Restore a SQL Server 2000 Backup

OCPdba.Net

  • Assume that the backup file is sitting under: C:\Projects\aaa\20031209\db.BAK

  • To show the contents of the file execute the following command:
  • 
      RESTORE FILELISTONLY FROM DISK = 'C:\Projects\aaa\20031209\db.BAK';
    
      Output: 
    
      
    
             

  • Note that the files are in a directory that is non-existent on the recovery machine

  • To recover the files, the WITH MOVE option is needed.

  • Note that the Logical Name of the file is used here as the source.
  • 
      RESTORE DATABASE BOB FROM
      DISK = 'C:\Projects\aaa\20031209\db.BAK'
      WITH
      MOVE 'bob_Data' TO 'C:\SQL2K\data\BOB\bob_Data.MDF',
      MOVE 'bob_Log' TO  'C:\SQL2K\data\BOB\bob_Log.LDF';
    
    
      Output: 
    
      Processed 3672 pages for database 'BOB', file 'bob_Data' on file 1.
      Processed 1 pages for database 'BOB', file 'bob_Log' on file 1.
      RESTORE DATABASE successfully processed 3673 pages in 8.165 seconds (3.684 MB/sec).
    
    

  • MSDN - RESTORE FILELISTONLY documentation.
  • MSDN - RESTORE DATABASE documentation.

  • OCPdba.Net