{"id":6286,"date":"2019-03-08T07:20:19","date_gmt":"2019-03-08T07:20:19","guid":{"rendered":"https:\/\/ittutorial.org\/?p=6286"},"modified":"2019-11-28T07:05:28","modified_gmt":"2019-11-28T07:05:28","slug":"sql-server-change-database-name","status":"publish","type":"post","link":"https:\/\/ittutorial.org\/sql-server-change-database-name\/","title":{"rendered":"SQL Server Change Database Name"},"content":{"rendered":"<p>Hi,<\/p>\n<p>Especially during the creation of Test environment, you may need changing database name as SQL Server DBA.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6287\" src=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/03\/sql-server-database.png\" alt=\"\" width=\"298\" height=\"240\" \/><\/p>\n<p><!--more--><\/p>\n\n<p>&nbsp;<\/p>\n<p>You don&#8217;t want to delete old database after creation of Test environment , perhaps you may need to see old database data. So you can change old database name to new name.<\/p>\n<p>You can change database name using following query.<\/p>\n<p>&nbsp;<\/p>\n<p>Take database to single_user mode.<\/p>\n<p>&nbsp;<\/p>\n<pre>alter database MehmetSalih set single_user with rollback immediate;<\/pre>\n<p>&nbsp;<\/p>\n<pre>Change database name like following\r\n\r\nexec sp_renamedb 'MehmetSalih', 'Deveci';<\/pre>\n<p>&nbsp;<\/p>\n<pre>then take database to multi_user mode.\r\n\r\nalter database Deveci set multi_user with rollback immediate;\r\n\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h4><span style=\"color: #ff0000;\">Do you want to learn Microsoft SQL Server DBA Tutorials for Beginners, then read the following articles.<\/span><\/h4>\n<p><a href=\"https:\/\/ittutorial.org\/sql-server-tutorials-microsoft-database-for-beginners\/\">https:\/\/ittutorial.org\/sql-server-tutorials-microsoft-database-for-beginners\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi, Especially during the creation of Test environment, you may need changing database name as SQL Server DBA.<\/p>\n","protected":false},"author":1,"featured_media":6287,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[2227],"tags":[2292,2291,2293,1028,1031,1600,1610,2231,2290,2286,2289,2288,2232,2273,2278,2267,2287,2294,2270,2269,2277,2230,2229,2274,2265,2266],"class_list":["post-6286","post","type-post","status-publish","format-standard","has-post-thumbnail","","category-sql-server-2","tag-alter-database-set-multi_user-with-rollback-immediate","tag-alter-database-set-single_user-with-rollback-immediate","tag-exec-sp_renamedb","tag-mehmet-deveci","tag-mehmet-salih-deveci","tag-sql-server-2012","tag-sql-server-2014","tag-sql-server-2019","tag-sql-server-change-database-name","tag-sql-server-change-recovery-model","tag-sql-server-full-backup","tag-sql-server-full-recovery-model","tag-sql-server-inventory-script","tag-sql-server-optimizer","tag-sql-server-performance-tempdb","tag-sql-server-sessions","tag-sql-server-simple-recovery-model","tag-sql-server-sp_renamedb","tag-sql-server-statistics","tag-sql-server-stats","tag-sql-server-tempdb","tag-sql-server-useful-query","tag-sql-server-useful-script","tag-sql-server-wait-events","tag-sql-server-whoisactive","tag-whoisactive"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/03\/sql-server-database.png","jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/6286","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/comments?post=6286"}],"version-history":[{"count":3,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/6286\/revisions"}],"predecessor-version":[{"id":12969,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/6286\/revisions\/12969"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/media\/6287"}],"wp:attachment":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/media?parent=6286"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/categories?post=6286"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/tags?post=6286"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}