Renaming a Database

  • Marcin Zawadzki

    Mr or Mrs. 500

    Points: 510

    And what about cross-database Service Broker architecture?

    MZ

  • Charles Kincaid

    SSChampion

    Points: 13593

    Some good points raised here. I have one more opinion on this though. If you need to rename database often enough to have to automate that process, it's probably time for a full system review.

    If I rename my ProductionArchive database to be Archive2008 and create a new empty ProductionArchive. I will encounter no problems. My archive application creates any missing tables or columns, adjusts column parameters, and fills in infrastructure (domain) data on the next pass. But then I designed it this way with renaming considerations in mind.

    Somebody said something about "preachy". I guess the drugs from surgery yesterday have no fully worn off. Sorry.

    ATBCharles Kincaid

  • mmordecki

    Grasshopper

    Points: 13

    I can't seem to see the screens on the article. they just show up as 'x' so I will have to explain what problem we seem to be having.

    We are trying to rename the physical files of our database to move to a new SQL server box. We already detached it once, copied it and then reattached it to the new box. Now we need the original, renamed to lets say old.mdf also attached. What I am running into is that even if I detach it, and rename the physical files, it is still looking for the old database name when I reattach it, no matter what name I assign it when reattaching.

    The .mdf and .ldf show up as red 'x' when I try to reattach it as old.mdf and it is trying to look for the original database name.

    So is there something I am doing wrong, or how do I go about changing the physical filenames and having sql still find the files it needs to attach it as a new database name also? I have read some on ALTER Database, but I am unsure of the entire sequence of commands or syntax needed to make it work in the query window.

    Our current old database is called fh_farmington.mdf we need it renamed to fh_pre2009.mdf so that we can attach it to the new server if that helps at all.

    Btw our old box was SQL 2000 and the new box is SQL 2008, so I could either rename it on the old box and then move it, or else move it and then rename it on the new box if there are easier commands to use. Thanks - Mark

Viewing 3 posts - 16 through 18 (of 18 total)

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