AttachDB helps to make simple administration tasks on SQL Server databases without SQL Server Enterprise Manager. It also checks that SQL Server 7/2000/2005 has latest service pack installed. Utility can be used with command line arguments in bat files and setup scripts. Supports browsing for file on remote server.
AttachDB require Visual Basic 6.0 runtime, ADO 2.1 or later and mscomctl.ocx ActiveX control (typically this is a part of VB6 runtime). If you are not sure that your PC has VB6 runtime or mscomctl.ocx installed - you can install using full setup AttachDBSetup.exe. Else it is enough just to copy AttachDB.exe to any folder on your local disk. ADO can be downloaded from Microsoft Data Access and Storage Developer Center
Working with AttachDB
At first start AttachDB tries to connect to your local Microsoft SQL Server 7/2000/2005 with sa login and empty password or using NT security, if it fails dialog to enter proper login and password will appear. After utility connects to SQL server it read its version and display service pack version installed. If SQL Server has non-recent service pack version installed - its version will appears in red. If SQL server is not running or connection is very slow connection procedure can tame some time. For local server timeout settings is 5 sec, for remove server 30 seconds.
After connection to SQL Server established you can either select existing database in combo box, or enter new database name to attach it or restore.
Attach/Detach. You can attach database with both database files mdf and ldf or providing only one mdf file, then textbox with path to ldf file should be empty. While detaching you can find where files are store if you click on a button with error. If database in use during detach process you can disconnect all users with corresponding button.
Backup/restore you can backup and restore database, database log and both. If database in use during backup or restore process you can disconnect all users with corresponding button.
Run script this function used to run T-SQL script from text file on selected database.
DB settings you can change database recovery model and shrink database.
In case you operate with big databases and this takes more then 30 seconds you have to set bigger command timeout in corresponding textbox.
Working from command line
AttachDB supports following command-line arguments:
- /StartSQL Start SQL server on local machine
- /Server MySQLServer specifies which SQL Server to use
- /Database MyDatabase - specifies database. This is required for any option besides
- /MDFPath "C:\File.MDF"
- /LDFPath "C:\File.LDF"
- /DatabaseExist - return 1 if Database exists on server
- /NoAutoUpdate disable auto update over internet
Typical scenario to use Attach DB in database installation script: first you run AttachDB with /StartSQL, that once more with /Database /MDFPath "C:\File.MDF" /LDFPath "C:\File.LDF" /Attach
AttachDB utility is free for non-commercial usage. However, if you have found AttachDB to be useful, please consider registering it. Maybe it lets you do something you could not easily do any other way. Whatever the reason, you can directly support the continued development of AttachDB, and your help will be greatly valued.
AttachDB have to be registered for commercial usage.
Registration fee is $25.
Register AttachDB Utility online:
Registered version update itself to newer version via internet, so registered users will get updated version as soon as it will be ready. Current version is 2.0.100.
If you would like to include AttachDB in your SQL Server database or application distribution please contact Point Limited with details and we will provide a quotation.
Download: AttachDB.exe (524 kb)