looking for best practice of sync sql database on 2 different server

Posted on 2010-01-05
Last Modified: 2012-05-08
here is my requirement.
1. both server run 2003 R2 XP.  p-server runs 2005 SQL work group, backup server using SQL express.
2. we have up to 30 minutes to start the backup server if prod. srv failed, and it is ok to use bcp utility to reload the data.

looks for best practices or examples.

Question by:mshox1
    LVL 60

    Assisted Solution

    You're better off just Restoring a full backup to your express instance  
    LVL 29

    Assisted Solution

    I agree.
    We take a backup of our production database (obviously) nightly and copy this backup file to the test server where it is used to restore the test database. We do this for testing/development purposes but there is nothing stopping you from doing the same for DR purposes. Having the backups copied and restored overnight will save time should stuff hit the fan.

    The script below is used to find the most recent .bak file and perform the restore. Obviously you need to change the paths/names/files to suit.

    Don't forget to have your windows and/or SQL users already resident on the backup database server to again save time in getting back up online.
    declare @address varchar(200)
    select top 1  @address =  '\\servername\SQLBkup\dbname\' + right(M.physical_device_name,28)
    FROM [servername].msdb.dbo.backupset S 
    	INNER JOIN [servername].msdb.dbo.backupmediafamily M
     		ON M.media_set_id = S.media_set_id
    WHERE S.database_name = 'dbname'
    	 AND DATEDIFF(DAY,S.backup_start_date,GETDATE()) < 2
    	 and right(physical_device_name,3) = 'bak'
    order by S.backup_start_date desc
    Restore Database dbname
    	From Disk = @address 
    		with  move 'dbname_Data' to 'D:\Microsoft SQL Server\Databases\MSSQL\Data\dbname_Data.MDF'
    		, move 'dbname_Log' to 'D:\Microsoft SQL Server\Databases\MSSQL\Data\dbname_Log.LDF'
    	, REPLACE

    Open in new window

    LVL 29

    Assisted Solution

    I should add that the entire above process is automated... nobody sits there at night doing this :)
    LVL 5

    Accepted Solution

    You don't say what your requirement is for allowable data loss. To minimize data loss in the event of the failure of the primary instance, I recommend that you do full backups nightly plus differential backups every hour or two. Also do transaction log backups on a frequent interval. Perhaps as frequent as every five minutes. All of these backups should be written to a disk NOT located on the primary database server to avoid losing them if the server becomes unavailable. It is most convenient to map a drive and write them directly to a folder on the backup server. When the primary fails, on the backup instance you then restore the most recent full backup, followed by the most recent differential backup, followed by the transaction log backups taken since the restored differential. Your data will then be within five minutes of what is was when the primary failed. You should have restore scripts prepared in advance of the failure. (Look up restore with norecovery.) If you care make a little larger investment in coding, you can implement manual log shipping (express doesn't support automated log shipping), or implement replication to keep your backup instance up to date and quick to bring on-line.
    LVL 3

    Assisted Solution


    If this is a high availability situation then I suggest that you upgrade your MSDE edition and implement transaction log shipping.  This will enable both servers to be pretty much identical depending on the shipping schedule.  It will also provide a higher degree of protection and reduce your exposure to server failure.


    Author Comment

    1st thank you much for useful input and comments.  I have 1 questions,  I think that is I did not know where to find the sql admin step-by-step manual, so I can turn this wonderful ideal into practices.

    is this part of sql 2005 studio management tools?   please advice.  thanks

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Creating and Managing Databases with phpMyAdmin in cPanel.
    In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
    Video by: Steve
    Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    732 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

    17 Experts available now in Live!

    Get 1:1 Help Now