Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Automated Database Copy

Author  Topic 

RyanSmith
Starting Member

8 Posts

Posted - 2008-01-16 : 13:41:51
I have a database (actually several of them) on a production server. I want to be able to create an automatic process so every evening the production database is copied to a different server that runs staging sites.

I know that this is possible through database mirroring, but I don't want the database to be constantly mirrored. I would prefer to have a script that ran every night that just make an exact copy over to the staging server.

Is there any way to automate this, possibly through the copy database wizard? Does anyone have any good suggestions as to how I can make this work? If not, does anyone know of a good straight forward article on database mirroring that will get me started quick?

Thanks.


http://www.dynamicajax.com

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2008-01-16 : 13:54:37
The simplest way to do it is to use a SQL Agent job to restore it onto the other server from your database backup.

CODO ERGO SUM
Go to Top of Page

RyanSmith
Starting Member

8 Posts

Posted - 2008-01-16 : 14:07:16
Thanks for the reply Michael. Do you have any links that explain how to setup this process?

http://www.dynamicajax.com
Go to Top of Page

sqlsquirrel
Starting Member

21 Posts

Posted - 2008-01-16 : 17:01:31
Michael is correct... Have 2 steps in your SQL Agent backup job. The first step is backup the database. The second step does an RPC call to a restore job on the staging server. You will first need to setup the staging server as a linked server on the production server inorder to do the RPC call. Your RPC call will look like this: exec <server name>.msdb.dbo.sp_start_job 'name of restore job here'

I am using this method for full, differential and log restores.

Good Luck!

Brett Davis
Senior SQL Server DBA
For more helpful tips checkout my blog at: http://www.lockergnome.com/sqlsquirrel/
Go to Top of Page

hey001us
Posting Yak Master

185 Posts

Posted - 2008-01-16 : 17:49:23
here you go:
Backup / Restore / Replication / Jobs / Houskeeping
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=55210

hey
Go to Top of Page

montu
Yak Posting Veteran

60 Posts

Posted - 2008-01-16 : 18:17:42
or what i did is back up the database then schedule windows task to copy the backup file across the other server then restore database through SQL scheduled task. only thing u need to consider is time between copy and restore task.
Go to Top of Page
   

- Advertisement -