SQL Server detach and attach database

Source: Internet
Author: User
Tags management studio microsoft sql server management studio sql server management sql server management studio

Detaching a database means separating the database from the SQL Server instance, but not deleting the database's file and transaction log files, so that the database can be attached to other instances

Unable to detach the state of the database:

1. The database has been replicated and published

2. Database snapshots exist in the database

3. The database is in an unknown state

Attaching a database refers to attaching a database other than the current instance to the current instance. When you attach a database, both the. mdf and. ndf files for the database should be available. You need to specify the current database file location if the attached database file is different from the location where the database was created or when it was last attached. In the process of attaching a database, if there is no log file, a new log file is created

How it works (in Microsoft SQL Server Management Studio):

Detach: Select the database that needs to be detached, right-task-detach

Additional: Select ' Database ', right-attach, locate the. mdf file that needs to attach the database for additional operations

SQL Server detach and attach database

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.