Restoring SQL DB

  • Hi,

    I am trying to restore a backup to a new DB usign the following snippet.

    RESTORE DATABASE

    FROM DISK = 'BackupFilePath\backupFileName.bak'

    WITH MOVE 'DB_Template' TO ,

    MOVE 'DB_Template_log' TO

    The error msg i get is..

    ERROR:

    Logical file 'DB_Template' is not part of database 'DatabaseName'. Use RESTORE FILELISTONLY to list the logical file names.

    RESTORE DATABASE is terminating abnormally.

    Kindly help

  • From BOL:

    Copying a database using BACKUP and RESTORE

    The following example uses both the BACKUP and RESTORE statements to make a copy of the AdventureWorks database. The MOVE statement causes the data and log file to be restored to the specified locations. The RESTORE FILELISTONLY statement is used to determine the number and names of the files in the database being restored. The new copy of the database is named TestDB. For more information, see RESTORE FILELISTONLY (Transact-SQL).

    BACKUP DATABASE AdventureWorks

    TO AdventureWorksBackups ;

    RESTORE FILELISTONLY

    FROM AdventureWorksBackups ;

    RESTORE DATABASE TestDB

    FROM AdventureWorksBackups

    WITH MOVE 'AdventureWorks_Data' TO 'C:\MySQLServer\testdb.mdf',

    MOVE 'AdventureWorks_Log' TO 'C:\MySQLServer\testdb.ldf';

    GO

    So it sounds like the logical name of your database is not DB_Template or whatever you may have actually had in there.

  • Yup. That's the issue. Thanks for the reply

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

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