Automatically restore SQL Server database backup for testing

I use SQL Server 2012 and create a maintenance plan to create a full backup every day. I want to create a recovery backup for testing every week from the last full backup I created. if this recovery failed to notify me by email, and if the recovery is successful, delete the restored database.

EDIT:

1- I want to use a maintenance plan to restore the database

2- I want to find the last full backup

what should I do.

early

+4
source share
2 answers

I use "Red Gate Backup Pro 7" to create and restore a backup.

Red Gate Backup pro restore last there is a backup automatically by installing a full backup, Diff backups and Trn Backup files.

+2
source

First you must configure the mail of the database. Then you must create the Sql server agent job with the request, which you can get from the recovery page using the script as a new request window. then you must create an agent in the Sql Server Agent to send email to the desired mail database. in your task, you can indicate that if the task fails or the work is successful, or in both cases, the operator sends you an email. If you want to delete the restored table, you can create a table for the recovery result, and in your recovery code you can change the try / catch in the transaction state if the restore was successfully inserted into the table and complete the transaction, otherwise it will delete the table. You must create another task in the Agent and execute a query to search for a commit in this table, if true, and then delete the restored database, otherwise you can write a query for execution that will send you an email. You can read about this request here: http://technet.microsoft.com/enus/library/ms189505(v=sql.105).aspx

Hope that would be helpful

chakere hame iroonia;)

+1
source

Source: https://habr.com/ru/post/1501598/


All Articles