Solved

Mirror batch of sql databases in one go

Posted on 2013-06-26
7
258 Views
Last Modified: 2013-07-03
Guys

I am creating a new mirror sql server 2008 r2 instance the primary instance has over 100 databases running is there a way to create the mirror with out having to backup then copy the files then restore then create mirror individually for them all.

Any advice is welcome

Regards
0
Comment
Question by:DarrenJackson
7 Comments
 
LVL 21

Assisted Solution

by:Haresh Nikumbh
Haresh Nikumbh earned 50 total points
Comment Utility
0
 
LVL 23

Assisted Solution

by:Racim BOUDJAKDJI
Racim BOUDJAKDJI earned 400 total points
Comment Utility
You can automate the process but you will have to backup, copy (or put on a share drive) and restore each database you want to mirror.
0
 

Author Comment

by:DarrenJackson
Comment Utility
Thanks guys for the input.

takecoffe I will look at this it may be of help.

Racimo I was hoping that I could make use of some utility to speed up the process as it could take me a few days to compete this task

but if it cant be done it cant be done
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 23

Accepted Solution

by:
Racim BOUDJAKDJI earned 400 total points
Comment Utility
THe below should at least help you get automate the backup copy part

exec master..sp_msforeachdb 'if lower(''?'') not in (''master'', ''msdb'', ''model'', ''tempdb'')
begin
backup database [?] to disk =''C:\?.BAK''
exec xp_cmdshell ''xcopy C:\?.BAK D:\RESTORE_FOLDER''
end'

Open in new window


Not tested but that should help...
0
 

Author Comment

by:DarrenJackson
Comment Utility
Racimo thanks for this I will check this out as well

Regards
0
 
LVL 26

Assisted Solution

by:Zberteoc
Zberteoc earned 50 total points
Comment Utility
First, you HAVE to do the backup and restore in mirroring. That is the way how mirroring works, based on primary backups restored on the mirror so the first step has to be done in FULL with NO RECOVERY option on mirror. There is no other way.

To help the process you could create a shared backup location between the 2 server directly accessible from both of them so that at least you can skip the copy part. The shared location could be either on the primary, on secondary or on a "third party" network location.
0
 

Author Comment

by:DarrenJackson
Comment Utility
Right have tested the above script and with a few tweaks I have got a working model I can use

thanks guys for the help
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Join & Write a Comment

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now