How to rename a SQL Server database _mssql

Source: Internet
Author: User
Enterprise Manager does not change the database name function, if you must use Enterprise Manager to achieve, you can back up the database, and then restore, in the restore time can be specified another library name, and then delete the old library on the line.

In SQL Server 20000, for example, the old database name is Admin10000 and the new database name is jb51.net.

The first step, backing up the database

Open Enterprise Manager
--Right key to a database
--All Tasks
--Backing up the database
--The purpose--to back up to the Select Add
--Enter a backup file name (note that if you have a file name, delete it)
-Determine

Step two, restore the database, specify a new library name, and modify the physical file name.

Enterprise Manager--right--"database"--All tasks--Restoring a database
--"Revert to Database Library" to enter the restored database name Jb51.net
--Restore Select "From Device"--Select device--add--Add your backup file--OK, back to database restore interface
--Backup number--Select Content--Select the content you want to restore that backup
--option--modifies the physical file name in "Move to physical file name" to the name of the file to be stored in your data file, modified to Jb51.net_Data.MDF (database file) and Jb51.net_Log.LDF (log file)
--If the database you want to restore already exists, select Force Restore on existing database
-Determine

step three, modify the logical file name

If you want to modify the logical file name, you can query the analyzer input

ALTER DATABASE [Jb51.net]
Modify file (name= ' Admin10000_data ', newname= ' Jb51.net_data ')

ALTER DATABASE [Jb51.net]
Modify file (name= ' Admin10000_log ', newname= ' Jb51.net_log ')

step fourth, and finally delete the old database jb51
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.