Use scripts to modify Database names and logical file names

Source: Internet
Author: User

I used to change the database name in the Enterprise Manager.
Because the Enterprise Manager cannot be directly modified, you can use a stupid method to back up the database and specify a new database name when restoring the database.
In addition, you cannot modify the logical file name when restoring data in the Enterprise Manager. Once the logical file name is modified, a prompt is displayed that you need to use restore filelistonly to RESTORE the data.

Therefore, the databases created later use the same logical file name.

After reading the online help today, you can use SQL scripts to get rid of it:
(Mk: @ MSITStore: C: \ Program % 20Files \ Microsoft % 20SQL % 20Server \ 80 \ Tools \ Books \ tsqlref. chm:/ts_aa-az_4e5h.htm)

-- Modify Database Name
Alter database shyq_data modify name = shyc_data

-- Modify the logical file name
Alter database shyc_data modify file (name = 'shyq _ data', newname = 'shyc _ data ')
Alter database shyc_data modify file (name = 'shyq _ log', newname = 'shyc _ log ')

It seems that you should take a closer look at the help in the future!

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.