Question on restoring a backup

  • itmasterw 60042

    SSCrazy

    Points: 2759

    Hi,

    I am not that knowledgable on backups and the files that they create, so please forgive me if say something wrong here.

    My manager restored from a backup a database.  So, let's say we had a database named ABC when he restored it, from a backup he named the restored one as Meng; so far no problem. He wants to now restore the ABC database again from the ABC back up again, and call it ABC_Dev. He thinks he cannot do this because of the ABC database and the Meng Shae the same datafile names and in them the (mdf, ndf, and ldf) files.

    Questions:

    1. Is it true that for those reasons he/ I could not do this?
    2. If so what can we do?
    3. thank you
  • Michael L John

    One Orange Chip

    Points: 25887

    wrote:

    1. Is it true that for those reasons he/ I could not do this?

    No.  Look up the WITH MOVE Option

    wrote:

    2. If so what can we do?

    This syntax should get you started

    USE [master]
    RESTORE DATABASE [ABC_Dev] FROM DISK = N'YourBackupFile' WITH FILE = 1,
    MOVE N'ABC Logical Data File' TO N'D:\Data\ABC_Dev.mdf',
    MOVE N'ABC Logical Log File' TO N'L:\Logs\ABC_Dev_log.ldf',
    NOUNLOAD, REPLACE, STATS = 5

    GO
    wrote:

    thank you

    You're welcome.

    Do yourself a favor, and invest in yourself.  There is so much information about backups and restores available from a simple Google search.   You can learn 1000 times more in an a hour of reading than  you can by posting on a forum.

    Good Luck!

     

    Michael L John
    If you assassinate a DBA, would you pull a trigger?
    To properly post on a forum:
    http://www.sqlservercentral.com/articles/61537/

  • pietlinden

    SSC Guru

    Points: 62715

    Grant Fritchey has a bunch of videos on YouTube where he shows you how to do a bunch of database backup & restore things. Definitely worth watching.

  • ScottPletcher

    SSC Guru

    Points: 98398

    <Is it true that for those reasons he/ I could not do this?>

    No, SQL Server would never allow one file to be used by two different dbs at the same time.

    SQL DBA,SQL Server MVP(07, 08, 09) Prosecutor James Blackburn, in closing argument in the Fatal Vision murders trial: "If in the future, you should cry a tear, cry one for them [the murder victims]. If in the future, you should say a prayer, say one for them. And if in the future, you should light a candle, light one for them."

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

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