Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Administration - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 6525

Rename a Live database

$
0
0
Hi I want to Replace The Big Log database with A new one ( A database with same structure).But current DB has many connection . This is my plan : 1- Create a new database with same structure.2- Rename current database to olddb with this code :USE masterGO EXEC sp_dboption CurDataBase, 'Single User', TrueEXEC sp_renamedb 'CurDataBase', 'OldDataBase'GO 3- Rename Newdb to current DB. USE master GO EXEC sp_renamedb 'NewDataBase', 'CurDataBase'is it true ? and Tsql code is ok ? (Please dont forget many of connection to curdatabase (that Is a log db) and loss some seconds data is not problems)Thank you

Viewing all articles
Browse latest Browse all 6525

Trending Articles