In addition to Weibo, there is also WeChat
Please pay attention

WeChat public account
Shulou
2025-11-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
The editor will share with you how to solve the problem of sql server:alter database name. I hope you will get something after reading this article. Let's discuss it together.
-- step 1: modify the database name USE masterGOALTER DATABASE GeovinDuCms SET SINGLE_USER WITH ROLLBACK IMMEDIATEGOEXEC master..sp_renamedb 'GeovinDuCms','DuCms'GOALTER DATABASE DB_SHANGHAI SET MULTI_USER GO--step 2: view the logical name and physical file name of the modified database USE masterGOSELECT name AS [Logical Name], physical_name AS [DB File Path], type_desc AS [File Type] State_desc AS [State] FROM sys.master_filesWHERE database_id = DB_ID (NumbDuCms') GO--step 3: modify database logic file name USE masterGOALTER DATABASE DuCms SET SINGLE_USER WITH ROLLBACK IMMEDIATEGOALTER DATABASE DuCms MODIFY FILE (NAME=N'GeovinDuCms', NEWNAME=N'DuCms') GOALTER DATABASE DuCms MODIFY FILE (NAME=N'GeovinDuCms_log') NEWNAME=N'DuCms_log') GOALTER DATABASE DuCms SET MULTI_USER GO--step 4: open xp_cmdshell before modifying the database physical file name to support USE masterGOsp_configure 'show advanced options',1GORECONFIGURE WITH OVERRIDEGOsp_configure' xp_cmdshell', 1GORECONFIGURE WITH OVERRIDEGO--step 5: rename the database physical file name USE [master] GOALTER DATABASE DuCMS SET OFFLINE WITH ROLLBACK IMMEDIATEGOEXEC xp_cmdshell' RENAME "E:\ 2005database\ GeovinDuCms.mdf" "DuCms.mdf" 'GOEXEC xp_cmdshell' RENAME "E:\ 2005database\ GeovinDuCms_log.ldf", "DuCms_log.ldf" 'GO--step 6: point the logical name of the database to the new physical file And the database onlineUSE [master] GOALTER DATABASE DuCMS MODIFY FILE (NAME = DuCms, FILENAME ='E:\ 2005database\ DuCms.mdf') GOALTER DATABASE DuCMS MODIFY FILE (NAME = DuCms_log, FILENAME ='E:\ 2005database\ DuCms_log.ldf') GOALTER DATABASE DuCMS SET ONLINE--step 7: view the database after all modifications USE masterGOSELECT name AS [Logical Name], physical_name AS [DB File Path], type_desc AS [File Type] State_desc AS [State] FROM sys.master_filesWHERE database_id = DB_ID (NumbDuCMS') GO--step 8: turn off xp_cmdshell support USE masterGOsp_configure 'xp_cmdshell', 0GORECONFIGURE WITH OVERRIDEGOsp_configure' show advanced options',0GORECONFIGURE WITH OVERRIDEGOUSE DuCMSGO finished reading this article I believe you have a certain understanding of "how to solve the sql server:alter database name problem". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for your reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope





About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.