Why am I having so much trouble restoring?

  • What I'm trying to do is really just make a copy of a database on the same server for testing purposes. In previous versions of SQL Server, all I would do is restore the last backup I took of the source database and restore it with a new name. I would have to make sure to change the names of the files as well, but that always seemed to work and was so easy. But in 2012, this is much more difficult, it keeps wanting to use the timelines, and then doesn't let me change the file names.

    Is there a better way to create a copy on the same server from a live and active database with minimal impact to the users? Some way that won't confuse my maintenance plans, or anything else on the server?

  • RESTORE DATABASE <new database name> FROM DISK = <backup location>

    WITH MOVE ....

    Probably easier to do with T-SQL than the GUI.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Now the new db is stuck as Restoring. This is the query that I ran, and the message that it delivered after. Did I miss something? I've definitely waited long enough.

    RESTORE DATABASE TestDB

    FROM DISK = 'D:\Backup\backup.bak'

    WITH NORECOVERY,

    MOVE 'DateFile' TO 'D:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\TestDB.mdf',

    MOVE 'LogFile_Log' TO 'D:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\TestDB.ldf';

    GO

    [font="Courier New"]Processed 379192 pages for database 'TestDB', file 'DateFile' on file 1.

    Processed 5 pages for database 'TestDB', file LogFile_log' on file 1.

    RESTORE DATABASE successfully processed 379197 pages in 79.610 seconds (37.212 MB/sec).[/font]

  • RESTORE DATABASE TestDB

    FROM DISK = 'D:\Backup\backup.bak'

    WITH NORECOVERY,

    MOVE 'DateFile' TO 'D:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\TestDB.mdf',

    MOVE 'LogFile_Log' TO 'D:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\TestDB.ldf';

    GO

    In the RESTORE statement, you specified NORECOVERY, which leaves the database in a state where additional log files may be restored. If you are done restoring the database, then you need to recover the database:

    RESTORE DATABASE TestDB

    WITH RECOVERY

    Eddie Wuerch
    MCM: SQL

  • Ha! Wow, thanks for being patient with my me. That fixed it.

    Much appreciated everyone!

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

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