Project Name
You must be an Administrator to perform these tasks.
You can attach (add) and detach (remove) a database from the SQL Server. The database can be detached and attached to a different server or to the same server, here the server is SQL server. Detaching a database removes the database from SQL Server but leaves the database intact within the data and transaction log files that compose the database. These data and transaction log files can then be used to attach the database to any instance of SQL Server, including the server from which the database was detached. This makes the database available in exactly the same state it was in when it was detached.
Detaching and attaching databases is useful if you want to move a database:
From one computer to another without having to re-create the database and then restore the database backup manually.
To a different physical disk, for example, when the disk containing the database file has run out of disk space and you want to expand the existing file rather than add a new file to the database on the other disk.
To move a database, or database file, to another server or disk:
Detach the database.
Move the database file(s) to the other server or disk.
Attach the database specifying the new location of the moved file(s).
To attach the database
On the File menu, click Data Utilities and then select Attach Data File
Enter the database name you want to attach it to the SQL Server
Enter the physical name, including path, of the database file
Enter the login name and password, the user must be an administrator
To detach the database
Note that Detaching database does not mean the database is removed from the operating system. Only the database is removed from the SQL Server, the physical location of the database file is intact.
On the File menu, click Data Utilities and then select Detach Data File
Enter the database name you want to detach it from the SQL Server
Enter the login name and password, the user must be an administrator