Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

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)

SQL DBAdmin toolbox - Part 2: Verify all databases in the enterprise

By Infostar,

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 verification
RestoreConfig: configuration table
_admsp_RestoreDatabase: restore procedure
_admsp_LogVerificationResult: logging procedure, writing to BackupVerificationResult
_admsp_InventoryBackupFiles: logging procedure, writing to BackupFiles
BackupVerificationResult: table for job result
BackupFiles: table containing information of all backup files
RestoreFileLisOnlytOutput: 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 exist
2. Run the script
3. 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

 

 

 

 

Total article views: 1832 | Views in the last 30 days: 5
 
Related Articles
FORUM

Backup/restore

Backup/restore

FORUM

Restore from Backup with Replicated Database

Restore from Backup with Replicated Database

FORUM

How to Restore model database from backup ?

How to RESTORE model database from backup(.bak) ?

FORUM

database backup and restore in sql server 2005

database backup and restore using java

ARTICLE

Automating Database Restores

This article describes a way to automatically restore multiple database backups from a directory.

 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones