Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin.
Search for scripts directly from SSMS, and instantly access any saved scripts in your
SSC briefcase from the favorites tab.
Download now (direct download link)
Thank this author by sharing:
It is a DBA responsibility to verify that database backups can be successfully restored but many DBAs (the majority ?) fail to do that. It is understandable that in a enterprise environment with hundreds of databases, manually restoring every one every day or week is impossible. But from now on - the moment that you get this set of scripts, there is no excuse any more for not regularly restoring and dbcc checking your database backup files. You can of course just ignore it at your own risk.
It is easy to set up and configure the verification station. For this you need a dedicated SQL server with highest SQL version in the enterprise. This version of script are for SQL Server 2008R2. The server should have enough disk space to restore the largest database. The service account of the database engine must have read access to all the backup files. I hope you have all the backups in a central network share, not in every SQL servers.
Objects used:admsp_VerifyBackups: main procedure for restore and verificationRestoreConfig: configuration table _admsp_RestoreDatabase: restore procedure_admsp_LogVerificationResult: logging procedure, writing to BackupVerificationResult _admsp_InventoryBackupFiles: logging procedure, writing to BackupFilesBackupVerificationResult: table for job result BackupFiles: table containing information of all backup filesRestoreFileLisOnlytOutput: User defined table type RestoreHeaderOnlyOutput: User defined table type BackupInfo: User defined table type
( The DBAdmin name convention: all the stored procedures, except one which is "Help", are prefixed with admsp_ or _admsp_. SPs prefixed with _admsp_ are internal and should be called only by other SPs. )
Deployment and configuration: 1. Create DBAdmin database if it does not exist2. Run the script3. Configure default restore setting (default setting has level 0: lvl=0)
Sample:INSERT INTO [RestoreConfig] ([Dist_Datafile_Dir], [Dist_LogFile_Dir], [Dist_FullText_Dir],[Enable],[lvl]) VALUES ('D:\SQLData', 'L:\SQLLog', 'D:\SQLData', 1, 0)
4. Configure each database instance (instance setting has level 1: lvl=1)
Sample:INSERT INTO [RestoreConfig] ([InstanceName], [SourceRoot], [Enable], [lvl]) VALUES ('SQLServer1', \\filesahre\sqlbackup$\SQLServer1', 1, 1)
The solution restore all databases under SourceRoot or one level below it.
5. Schedule the agent job executing admsp_VerifyBackups.
The results of job is logged in two tables: BackupVerificationResult and BackupFiles. Right now yo have to check the tables manually to find anything wrong with the backups. The analysis and alert part will be added later. However it will not be the next one. In the next part we will look at backup.
I do not provide much documentation here, if you need any help please write in the forum for this, I will be glad to help.
Next: Part 3 Adaptive backup
Restore from Backup with Replicated Database
How to RESTORE model database from backup(.bak) ?
database backup and restore using java
This article describes a way to automatically restore multiple database backups from a directory.