579
Chapter 21: Backup and Recovery Planning
21
Continuing:
RESTORE LOG Plan2Recover
FROM DISK = 'e:\P2R.bak'
With FILE = 3, RECOVERY;
Result:
Processed 0 pages for database 'Plan2Recover', file 'Plan2Recover' on
file 3.
Processed 1 pages for database 'Plan2Recover', file 'Plan2Recover_
log' on file 3.
RESTORE LOG successfully processed 1 pages in 0.004 seconds (0.122
MB/sec).
To test the recovery operation:
USE Plan2Recover;
Select * from T1;
Result:
PK Name
----------- ---------------
1 Full
2 Log 1
3 Log 2
(3 row(s) affected)
As this script shows, you can recover using T-SQL, but in this case Management Studio
beats code as the best way to accomplish the task.
System Databases Recovery
So far, this chapter has dealt only with user databases, but the system databases are impor-
tant to the recovery operation as well. The master database contains key database and
security information, and the msdb database holds the schedules and jobs for SQL Server,
as well as the backup history. A complete recovery plan must include the system databases.
Master Database
The master database, by default, uses the simple recovery model. Using only full backups
for the master database is OK; it’s not a transactional database.
Backing Up the Master Database
You back up the master database in the same manner as user databases.
c21.indd 579c21.indd 579 7/31/2012 9:22:54 AM7/31/2012 9:22:54 AM
http://www.it-ebooks.info