bertieuk
IS-IT--Management
- Jun 1, 2004
- 175
I have both SQL 7 and 2000.
I use maintenance plans for both servers. All databases fine.
I have tested disaster recovery and have restored fine using the microsoft info.....This takes each database backup file and RESTORES. I have currently stored the commands in a text file and paste them into Query Analyser.
An example of this file is below:
RESTORE DATABASE master FROM disk='d:\backup\master\master_db_200406242300.bak'
WITH MOVE 'master' to 'd:\mssql7\data\master.mdf',
MOVE 'mastlog' to 'd:\mssql7\data\mastlog.ldf',
REPLACE
go
-------------------------------------------
USE master
go
UPDATE sysdatabases SET filename='d:\mssql7\data\tempdb.mdf' WHERE name='tempdb'
go
ALTER DATABASE tempdb MODIFY FILE (name = tempdev, filename = 'd:\mssql7\data\tempdb.mdf')
ALTER DATABASE tempdb MODIFY FILE (name = templog, filename = 'd:\mssql7\data\templog.ldf')
go
------------------------------------------------
exec sp_detach_db N'model'
go
The procedure also requires stopping and starting the server in single user mode.
I would like to automate the whole process including the restore of the system databases and the stopping/starting the server in different modes. Ideally I would like to have all backup .bak databases in a directory and a script to cycle through all and restore. Where do I start? I am experienced with vb if it helps with the scripting.
Thanks
Si
I use maintenance plans for both servers. All databases fine.
I have tested disaster recovery and have restored fine using the microsoft info.....This takes each database backup file and RESTORES. I have currently stored the commands in a text file and paste them into Query Analyser.
An example of this file is below:
RESTORE DATABASE master FROM disk='d:\backup\master\master_db_200406242300.bak'
WITH MOVE 'master' to 'd:\mssql7\data\master.mdf',
MOVE 'mastlog' to 'd:\mssql7\data\mastlog.ldf',
REPLACE
go
-------------------------------------------
USE master
go
UPDATE sysdatabases SET filename='d:\mssql7\data\tempdb.mdf' WHERE name='tempdb'
go
ALTER DATABASE tempdb MODIFY FILE (name = tempdev, filename = 'd:\mssql7\data\tempdb.mdf')
ALTER DATABASE tempdb MODIFY FILE (name = templog, filename = 'd:\mssql7\data\templog.ldf')
go
------------------------------------------------
exec sp_detach_db N'model'
go
The procedure also requires stopping and starting the server in single user mode.
I would like to automate the whole process including the restore of the system databases and the stopping/starting the server in different modes. Ideally I would like to have all backup .bak databases in a directory and a script to cycle through all and restore. Where do I start? I am experienced with vb if it helps with the scripting.
Thanks
Si