Home Products Downloads Purchase Support News Members Company
SITE FEED
Support Forum
The fastest and most effective to get answers to your questions quickly. Click Here for more info.
FAQs
Quick answers to common questions. Click Here for more info.
Troubleshooting
Known issues and basic troubleshooting techniques for problems or unexpected behaviors. Click Here for more info.
Knowledgebase
Technical tips, How-to articles, and other tutorials about ApexSQL Tools. Click Here for more info.
Online Documentation
All of our help files for download or convenient viewing online. Click Here for more info.
Videos
Watch product demos, training videos, or tutorials of our products' main features.  We frequently upload new videos so check often for updates. Click Here for more info.

ApexSQL Knowledgebase

Tips and How-to Articles for Apex SQL Tools


How to Sychronize a Database on a Schedule

DESCRIPTION
There are times when you want to run ApexSQL Diff operations on a schedule. For example, you may want to sychronize your testing and production databases every night (during downtime). This KB article describes how to schedule a database sychronization in ApexSQL Diff. (Note: You can use the same approach in, for example, ApexSQL Log if you want to read the transaction log on a desired frequency and schedule).

SOLUTION
To schedule database sychronization, use the free command line interface that comes with ApexSQL Diff (and all other ApexSQL Tools) together with Windows'/SQL Server's scheduler.

To illustrate, let's use 2 databases: TestDB (testing database) & ProdDB (production database):

UID/PWD for TestDB: TestDBsa/password1
UID/PWD for ProdDB: ProdDBsa/password2

To sychronize TestDB with the ProdDB, the following command needs to be executed:

apexsqldiff.com /s1:server_name /d1:ProdDb /u1:ProdDBsa
   /p1:password2 /s2:server_name /d2:TestDB /u2:TestDBsa /p2:password1 /sync

To run this command every Sunday, 10 pm, schedule it using SQL Server or Windows' scheduler.

To schedule using SQL Server:

1. Open SQL Server and create a new job:



2. To run the job every Sunday, 10PM, create a new sched as shown below:



To do this using Windows' Scheduler:

1. Open Scheduled Tasks and double-click Add Scheduled Task.



2. In the Scheduled Task Wizard, click Browse and go to ApexSQL Diff's application folder and select apexsqldiff.com



3. Assign a name for the synchronization job and specify frequency.



4. Select the time and day you want the task to start.



5. Specify login credentials as necessary.



6. Check Open Advanced Properties before clicking Finish.



7. In the Run textbox of Advanced Properties, type in the following and click OK.

"C:\Program Files\ApexSQL\ApexSQLDiff\ApexSQLDiff.com"
   /s1:server_name /d1:ProdDb /u1:ProdDBsa /p1:password2
   /s2:server_name /d2:TestDB /u2:TestDBsa /p2:password1 /sync



You may use any of the above approaches to schedule your database synchronization.

AUTHOR
Janice Lee

LAST REVIEW DATE
21 August 2007

Labels:



© 2008 Apex SQL Tools All Rights Reserved | 1.919.968.8444 | Contact Us | Terms of Use | Privacy Policy