How to rename an SQLServer Database

Source: Internet
Author: User

The Enterprise Manager does not have the function to change the database name. If you must use the Enterprise Manager, you can back up the database and restore it. You can specify another database name during restoration, then delete the old database.

Take SQLServer 20000 as an example. The old database name is Admin10000 and the new database name is jb51.net.

Step 1. Back up the database

Open Enterprise Manager
-- Right-click a database
-- All tasks
-- Backup database
-- Purpose -- select Add from backup
-- Enter a backup file name (Note: if there is a file name, delete it)
-- OK

Step 2: Restore the database, specify a new database name, and modify the physical file name.

Enterprise Manager -- Right-click "Database" -- all tasks -- Restore database
-- Enter the restored database name jb51.net in "Restore to Database"
-- Restore select "from device" -- select device -- add your backup file -- OK, and return to the database restoration page.
-- Backup number -- Select Content -- select the backup content you want to restore
-- Option -- change the physical file name in "move to physical file name" to the name of your Data file to be stored. Here, change it to jb51.net _ Data. MDF (database file) and jb51.net _ Log. LDF (Log File)
-- If the database to be restored already exists, select "Force restore on the existing database"
-- OK

Step 3: Modify the logical file name

If you want to modify the logical file name, you can enter

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 4: 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.