Wednesday 11 April 2012

How to restore a user database

  1. Right click on the Server, select Tasks and Restore
  2. In General pane, select From device and locate the .bak file to restore from.
  3. Select all but the final element from within the .bak file to restore
  4. Select database name from To database
  5. In Options select RESTORE WITH NORECOVERY
  6. Run through options 1-4 again, selecting the transaction log to restore.
  7. In Options select RESTORE WITH RECOVERY
  8. The database has now been restored, recovered and ready for use
In the options above, it is possible to select a restore to a point in time.

If a database is restored onto another server, the backup information is not restored with the database, as it is held in the msdb database of the original system.

There may be a time when a damaged page messes up your database. First of all, you need to determine which page is damaged. This can be done by looking in System databases > msdb > Tables > dbo.suspect_pages. Then restore the page like so:

RESTORE DATABASE AdventureWorks
PAGE = '1:160' -- '1'=File_ID, '610'=page_ID
FROM AWBackup -- this is your backup device
WITH NORECOVERY

No comments:

Post a Comment