dedri
asked on
restore sql database-generate restore script from files in folder
Very often I have a request to restore sql server databases from production to out test environment for a couple of out DB servers. Every DB servers are having around 10-15 databases on it.
Format of the backups are : DB1_backup_201305151900.ba k.
When I have a request I restore this dbs from tape to one folder on the disk, and after that I have to manually restore them. It's really a hard work and I need to automate this somehow.
If it is possible to generate a restore script from the files in directory?
The problem that need to be solved also is that db file location in production are located in drive D: and E: and on test environment only on disk E:
Format of the backups are : DB1_backup_201305151900.ba
When I have a request I restore this dbs from tape to one folder on the disk, and after that I have to manually restore them. It's really a hard work and I need to automate this somehow.
If it is possible to generate a restore script from the files in directory?
The problem that need to be solved also is that db file location in production are located in drive D: and E: and on test environment only on disk E:
ASKER
hi, anything that does not involve powershell. My SQL servers are sql server 2005 and windows 2003
The following link uses a T-SQL solution:
http://www.mssqltips.com/sqlservertip/1584/auto-generate-sql-server-restore-script-from-backup-files-in-a-directory/
http://www.mssqltips.com/sqlservertip/1584/auto-generate-sql-server-restore-script-from-backup-files-in-a-directory/
ASKER
Hi Qlemo, 10x for your reply.
I've already checked this article. The problem with this script is that it is only for one database, and I am having 10-15 databases in the folder. Also it does not provide the option to move database( on my production server databases are located on the D:\- data files and E:\ - log files), and on test servers they are all on one drive D:\
I've already checked this article. The problem with this script is that it is only for one database, and I am having 10-15 databases in the folder. Also it does not provide the option to move database( on my production server databases are located on the D:\- data files and E:\ - log files), and on test servers they are all on one drive D:\
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
10x
http://powershellcommunity.org/Forums/tabid/54/aft/8460/Default.aspx
http://www.mssqltips.com/sqlservertip/2218/restoresqldb-automate-a-sql-server-database-restore-improved-with-powershell/