Database renamed accidently

  • My SQL Server 2000 database was renamed without me consciously doing it and of course things failed big time (backups, DTS's in particular) so I'm wondering how it happened. I've managed to rename it back again, but it wasn't a simple matter of running sp_renamedb. I had to set the database to single user mode first, but even that wasn't a simple matter of running sp_dboption with the parameters given in BOL. Thanks to SQL Server Central (again) I found this post http://www.sqlservercentral.com/scripts/30490/ by Gregory Larsen in 2002 which saved my day. The point I'm trying to make is: a database can't renamed "accidently" unless you're on drugs.

    So, how did my database get renamed?

    Supporting facts (they may or may not be relevant):

    1. the new name was the old name with "1" appended

    2. I installed SQL Server 2005 (named instance) 2 days previous

    3. I migrated my data to 2005 by restoring from the latest backup of 2000 on the day the renaming occurred. The name of the restored 2005 database is totally different to the 2000 database.

    4. I am the only user on this server and have full rights to everything.

    The question is academic now, although I will sleep better if I can work out what happened even if (especially if) it proves me to be a dummy. Any ideas would be appreciated.

    Alister

  • Open Management Studio, click on a database name. Then click on it again. Then hit the 1 key on your keyboard. It'll try to rename the database. If there aren't any users connected at the time, it might even succeed.

    Yes, I think this is a really bad feature. Yes, it works for tables, procs, etc., too. Yes, it's a really bad feature for them too.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • Thanks for your response.

    I understand what you're saying but on my system I can't rename a database this way. Tables, stored procs, views - yes, but not a database.

    Cheers

    Alister

  • I just tried it on my dev box, and it worked. If you can't, then I guess it's impossible to accidentally rename a database for you, and someone must have renamed it intentionally.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply