SQL Server modifies the database name (including the database. MDF name)

Source: Internet
Author: User

At the beginning, I learned SQL Server 2005 and got a morning to modify the database name. I needed to modify the name of DB. MDF and db_log.ldf, and finally solved the problem. Write it down here. Don't forget to modify it later.

Assume that the original database is dB, and the additional database is dB. MDF and db_log.ldf.

Change to DBT, DBT. MDF, and dbt_log.ldf.

Steps:

1. Back up the original database (select database> right-click> task> Backup) to back up the DB. Bak file.

2. Create a database DBT, right-click it, and choose task> restore> database. The "Restore database" window is displayed.

3. Select "Source Device" and browse. In the "specify backup" dialog box that appears, click "add" to find the DB. Bak file you just backed up, and click "OK.

4. In the "Restore database" window, select the backup set to be restored and check the backup set.

5. on the "options" Page, select "options" and "Restore options" to "Overwrite existing databases", and specify the path and name after restoration as DBT. MDF and dbt_log.ldf,

Click OK to modify the name and delete the original 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.