October 15, 2004 at 2:10 pm
I am trying to rename a database by using sp_renamedb 'oldname', 'newname'
It keeps me giving me error messages .
1. The database could not be exclusively locked to perform the operation.
Please let me know how to get around it.
I tried changing setting to DBO use only in sp_dboption..
thats doesnt work either..
please help,,what to do?/
Taj
Tajammal Butt
October 15, 2004 at 2:39 pm
The database is in use which is why you can't rename it. The following statement will kill all users from the database (rolling back all transactions) and put the database into single user mode to prevent further access.
alter database yourdbname
set single_user
with rollback after 1 second
You should then be able to rename the database.
To put it back into multi user mode run this:
alter database yourdbname
set multi_user
October 16, 2004 at 11:51 am
You can also simply stop your SQL Server and then restart it (If you can afford that) !
Then execute your sp_renamedb from the MASTER database in query analyzer.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply