Question

I use SQL Server 2012 and create maintenance plan to create full backup each day. I want to create restore test backup end of each week from last created full backup. if this restore failed alert me by email and if restore complete successfully delete restored database.

EDIT :

1- I want to use maintenance plan to restore database

2- I want to find last full backup

what shall I do.

thanks in advance

Was it helpful?

Solution

I use 'Red Gate Backup Pro 7` to create and restore backup.

Red Gate Backup pro restore last exists backup automatically by set full backup, Diff backup and Trn Backup folders.

OTHER TIPS

First you should set up your database mail Then you should create a Sql Server Agent job with a query , That you can get from restore page with script as new query window. then you should create an operator in Sql Server Agent to send e-mail by your desired database mail . in your job you can specify that on job failure or job success or both , the operator send to email you. If you want to delete the restored table , you can create a table for the result of the restore, and in your restore code , you can modify a try/catch within a transaction state, if the restore was successful insert into table and commit transaction , else it delete table. You should create other job in Agent and execute a query to look for commit in that table , if true then delete restored database, else you can write a query to execute, that would send you email. You can read about this query here: http://technet.microsoft.com/enus/library/ms189505(v=sql.105).aspx

i hope it would be helpful

chakere hame iroonia ;)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top