Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2009
    Posts
    73

    Question Unanswered: Restore databse Problem

    I have Database with Name "ABC" on on server A
    with its mdf and ldf files on
    following location on server A

    D:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\SAMSWeb.mdf


    D:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Log\SAMSWeb.ldf


    on second server i.e Server B there is same databse "ABC"

    with both ldf and mdf in d drive of server B

    D:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\SAMSWeb.mdf


    D:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Log\SAMSWeb.ldf





    I have to create a restore job which restores database from server B to Server A everynight , and restored database has name "ABC_2"

    i dont want to overwrite mdf and ldf files of database named ABC on server

    so how to write a script which restores databse with diffrent names of mdf and ldf files??

  2. #2
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    Code:
    RESTORE DATABASE [ABC_2] 
       FROM  DISK = N'B:\DBBackups\abc_2.bak' 
       WITH  FILE = 1,  REPLACE,
       MOVE N'ABC_Data' TO N'D:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\ABC_2.MDF',  
       MOVE N'ABC_Log' TO N'D:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Log\ABC_2.LDF',  
       NOUNLOAD,  STATS = 10
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •