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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Rename DB on 2005

Author  Topic 

mhbdba
Starting Member

8 Posts

Posted - 2007-09-21 : 13:12:45
i am having issue renaming database on sql 2005, it says it is published and is being used by distribution. I have already confirmed that no users are connected to it and there is no Replication setup on it at the moment. How can i rename the DB without bringing it offline. Thanks

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2007-09-21 : 13:18:40
I think you need to remove any publications first.

Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

Zoroaster
Aged Yak Warrior

702 Posts

Posted - 2007-09-21 : 13:19:37
You have to bring it into single user mode and then use SP_RenameDB



Future guru in the making.
Go to Top of Page

Zoroaster
Aged Yak Warrior

702 Posts

Posted - 2007-09-21 : 13:19:52
You have to bring it into single user mode and then use SP_RenameDB



Future guru in the making.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-09-21 : 13:51:53
For 2005, you use ALTER DATABASE command and not sp_renamedb. According to the scripts that I have, you don't need to be in single user mode. But I didn't verify with BOL just with the scripts that I've run in the past to rename a database in 2005.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

mhbdba
Starting Member

8 Posts

Posted - 2007-09-21 : 13:54:11
Even after bringing the Database on Single User Mode, when I try to rename the DB, i get this:
"Can not rename the database name because it is published or it is a distribution database used by replication."
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-09-22 : 22:22:56
You have to stop replication in this case.
Go to Top of Page
   

- Advertisement -