HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Automate DBs restore through TSQL by given folders

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
dbstsqlautomatefoldersthroughgivenrestore

Problem

I searched in the internet but cannot find clear and direct way. I have a folder which include 100 databases as full backup, another folder contains all logs for these 100 DBs.

I need a script to do the automate restore for these DBs?

The names for backup files are different, for example

Adventure_Work_06162015_220000.bak
Adventure_Work_06012015_150000.bak

and so on, appreciate your help and cooperation.

Solution

I would suggest to use Restore Gene written by Paul Brewer.

There is a T-SQL [sp_RestoreGene] and PowerShell version [ps_RestoreGene] of it and you can use it / customize it as per your needs.

SQLServerCentral.com has an excellent article by the author on how to configure and describes the working of it as well - Restore Gene : Automating SQL Server Database Restores.

Context

StackExchange Database Administrators Q#104189, answer score: 2

Revisions (0)

No revisions yet.