Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
jogin malathi
Posting Yak Master
117 Posts |
Posted - 2007-06-05 : 03:27:22
|
hi How can i rename database name through commandHere i tried with the folloeing statementALTER DATABASE indraja1MODIFY NAME = indraja11 but i got error as Msg 5030, Level 16, State 2, Line 1The database could not be exclusively locked to perform the operation.Thanks in AdvanceMalathi Rao |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-06-05 : 03:43:41
|
Before renaming database, you need to set it to single-user mode. Have you done that?Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
|
|
jogin malathi
Posting Yak Master
117 Posts |
Posted - 2007-06-05 : 04:46:38
|
quote: Originally posted by harsh_athalye Before renaming database, you need to set it to single-user mode. Have you done that?Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED"
no iam trying to take database oflineand how to set database to single-user modeMalathi Rao |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-06-05 : 04:57:24
|
"how to set database to single-user mode"Use MasterGOAlter database <db-name>Set Single_UserGO Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
|
|
jogin malathi
Posting Yak Master
117 Posts |
Posted - 2007-06-05 : 05:54:52
|
quote: Originally posted by harsh_athalye "how to set database to single-user mode"Use MasterGOAlter database <db-name>Set Single_UserGO Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED"
i tried with the above statementbut its not executingcan u show me some exapmleMalathi Rao |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-06-05 : 06:25:08
|
Are you getting any error?Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2007-06-05 : 09:54:38
|
Add 'ROLLBACK IMMEDIATE' in 'alter database' statement if users are connecting to the db. |
|
|
homebrew
Posting Yak Master
114 Posts |
Posted - 2007-08-15 : 16:05:19
|
Right click <RENAME> |
|
|
ashley.sql
Constraint Violating Yak Guru
299 Posts |
Posted - 2007-08-15 : 16:23:21
|
alter database db_nameset single_user with rollback immediatesp_renamedb 'oldname' , 'newname'Ashley Rhodes |
|
|
|
|
|