Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8986493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:33:49+00:00 2026-06-15T21:33:49+00:00

I need to update existing data or insert new data from client database say

  • 0

I need to update existing data or insert new data from client database say DB1 into central database say DB2 both holding same schema and both databases reside in same machine.
The updates are not biderectional. I just want changes to be reflected from client(DB1) to server(DB2).
The client database(DB1) is nothing but the backup database(Full database backup consisting of mdf and ldf files) of DB2.The backup database(DB1) already has the modified data when synchronize.

So how do i do programatically using C# .NET?Can you give any example code?
I googled about it and saw Microsoft Syn Framework but I don’t know how to use it programmatically in C#.
Can you help me with sample code,please?
Sorry for my English.
Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T21:33:50+00:00Added an answer on June 15, 2026 at 9:33 pm

    Use database mirror concept below i mentioned steps to acheive mirroring below are the steps

    Step 1: Create encryption key, certificate and end-points on Principal Instance
    
    /* Execute this against the Principal Instance */
    USE MASTER
    GO
    CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'Password!'
    GO
    CREATE CERTIFICATE HOST_PRIN_cert
        WITH SUBJECT = 'HOST_PRIN certificate',
        START_DATE = '01/07/2009'
    GO
    CREATE ENDPOINT End_Mirroring
        STATE = STARTED
        AS TCP (LISTENER_PORT = 5022, LISTENER_IP = ALL)
        FOR DATABASE_MIRRORING
        (
            AUTHENTICATION = CERTIFICATE HOST_PRIN_cert,
            ENCRYPTION = REQUIRED ALGORITHM RC4,
            ROLE = ALL
        )
    GO
    BACKUP CERTIFICATE HOST_PRIN_cert
        TO FILE = 'D:\certificate\HOST_PRIN_cert.cer'
    GO
    
    Step 2: Create encryption key, certificate and end-points on Mirror Instance
    
    /* Execute this against the Mirror Instance */
    USE master
    GO
    CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'Password!'
    GO
    CREATE CERTIFICATE HOST_MIRR_cert
        WITH SUBJECT = 'HOST_MIRR certificate',
        START_DATE = '01/07/2009'
    GO
    CREATE ENDPOINT End_Mirroring
        STATE = STARTED
        AS TCP (LISTENER_PORT = 5023, LISTENER_IP = ALL)
        FOR DATABASE_MIRRORING
        (
            AUTHENTICATION = CERTIFICATE HOST_MIRR_cert,
            ENCRYPTION = REQUIRED ALGORITHM RC4,
            ROLE = ALL
        )
    GO
    BACKUP CERTIFICATE HOST_MIRR_cert 
        TO FILE = 'D:\certificate\HOST_MIRR_cert.cer';
    GO
    
    Step 3: Create login, user and associate certificate with user on Principal Instance
    
    /* 
    *  Execute this against the Principal Instance. The HOST_MIRR_cert.cer
    *  needs to be copied on the Principal Server.
    */
    USE MASTER
    GO
    /*
    *  We are creating a SQL Login here. For Windows logins,
    *  use the Grant Login instead of Create Login
    */
    CREATE LOGIN HOST_MIRR_login WITH PASSWORD = 'Password!'
    GO
    CREATE USER HOST_MIRR_user FOR LOGIN HOST_MIRR_login
    GO
    CREATE CERTIFICATE HOST_MIRR_cert
        AUTHORIZATION HOST_MIRR_user
        FROM FILE = 'D:\certificate\HOST_MIRR_cert.cer'
    GO
    GRANT CONNECT ON ENDPOINT::End_Mirroring TO [HOST_MIRR_login]
    GO
    
    
    Step 4: Create login, user and associate certificate with user on Mirror Instance
    
    /* 
    *  Execute this against the Mirror Instance. The HOST_PRIN_cert.cer
    *  needs to be copied on the Mirror Server.
    */
    USE MASTER
    GO
    /*
    *  We are creating a SQL Login here. For Windows logins, 
    *  use the Grant Login instead of Create Login
    */
    CREATE LOGIN HOST_PRIN_login WITH PASSWORD = 'Password!'
    GO
    CREATE USER HOST_PRIN_user FOR LOGIN HOST_PRIN_login
    GO
    CREATE CERTIFICATE HOST_PRIN_cert
        AUTHORIZATION HOST_PRIN_user
        FROM FILE = 'D:\certificate\HOST_PRIN_cert.cer'
        GO
    GRANT CONNECT ON ENDPOINT::End_Mirroring TO [HOST_PRIN_login]
    GO
    
    Step 5: Create encryption key, certificate and end-points on Witness Instance
    
    /* Execute this against the Witness Instance */
    USE MASTER
    GO
    CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'Password!'
    GO
    CREATE CERTIFICATE HOST_WITT_cert
        WITH SUBJECT = 'HOST_WITT certificate',
        START_DATE = '01/07/2009'
    GO
    CREATE ENDPOINT End_Mirroring
        STATE = STARTED
        AS TCP (LISTENER_PORT = 5024, LISTENER_IP = ALL)
        FOR DATABASE_MIRRORING
        (
            AUTHENTICATION = CERTIFICATE HOST_WITT_cert,
            ENCRYPTION = REQUIRED ALGORITHM RC4,
            ROLE = Witness
        )
    GO
    BACKUP CERTIFICATE HOST_WITT_cert
        TO FILE = 'D:\certificate\HOST_WITT_cert.cer'
    GO
    
    Step 6: Create login, user and associate certificate with user on Principal Instance
    
    /*
    *  Execute this against the Principal Instance. The HOST_WITT_cert.cer
    *  needs to be copied on the Principal Server.
    */
    USE MASTER
    GO
    /*
    *  We are creating a SQL Login here. For Windows logins,
    *  use the Grant Login instead of Create Login
    */
    CREATE LOGIN HOST_WITT_login WITH PASSWORD = 'Password!'
    GO
    CREATE USER HOST_WITT_user FOR LOGIN HOST_WITT_login
    GO
    CREATE CERTIFICATE HOST_WITT_cert
        AUTHORIZATION HOST_WITT_user
        FROM FILE = 'D:\certificate\HOST_WITT_cert.cer'
    GO
    GRANT CONNECT ON ENDPOINT::End_Mirroring TO [HOST_WITT_login]
    GO
    
    Step 7: Create login, user and associate certificate with user on Mirror Instance
    
    /*
    *  Execute this against the Mirror Instance. The HOST_WITT_cert.cer
    *  needs to be copied on the Mirror Server.
    */
    USE MASTER
    GO
    /*
    *  We are creating a SQL Login here. For Windows logins,
    *  use the Grant Login instead of Create Login
    */
    CREATE LOGIN HOST_WITT_login WITH PASSWORD = 'Password!'
    GO
    CREATE USER HOST_WITT_user FOR LOGIN HOST_WITT_login
    GO
    CREATE CERTIFICATE HOST_WITT_cert
        AUTHORIZATION HOST_WITT_user
        FROM FILE = 'D:\certificate\HOST_WITT_cert.cer'
    GO
    GRANT CONNECT ON ENDPOINT::End_Mirroring TO [HOST_WITT_login]
    GO
    
    Step 8: Create login, user and associate certificate with user on Witness Instance
    
    /*
    *  Execute this against the Witness Instance. The HOST_PRIN_cert.cer
    *  and HOST_MIRR_cert.cer needs to be copied on the Witness Server.
    */
    USE MASTER
    GO
    /*
    *  We are creating a SQL Login here. For Windows logins,
    *  use the Grant Login instead of Create Login
    */
    CREATE LOGIN HOST_PRIN_login WITH PASSWORD = 'Password!'
    GO
    CREATE USER HOST_PRIN_user FOR LOGIN HOST_PRIN_login
    GO
    CREATE CERTIFICATE HOST_PRIN_cert
        AUTHORIZATION HOST_PRIN_user
        FROM FILE = 'D:\certificate\HOST_PRIN_cert.cer'
    GO
    GRANT CONNECT ON ENDPOINT::End_Mirroring TO [HOST_PRIN_login]
    GO
    /*
    *  We are creating a SQL Login here. For Windows logins,
    *  use the Grant Login instead of Create Login
    */
    CREATE LOGIN HOST_MIRR_login WITH PASSWORD = 'Password!'
    GO
    CREATE USER HOST_MIRR_user FOR LOGIN HOST_MIRR_login
    GO
    CREATE CERTIFICATE HOST_MIRR_cert
    AUTHORIZATION HOST_MIRR_user
    FROM FILE = 'D:\certificate\HOST_MIRR_cert.cer'
    GO
    GRANT CONNECT ON ENDPOINT::End_Mirroring TO [HOST_MIRR_login]
    GO
    
    Step 9: Create the Mirrored Database on the Mirror Server using backups from the Principal Server
    
    /*
    *  Execute this against the Principal Instance.
    */
    USE MASTER
    GO
    BACKUP DATABASE MirrorDB
        TO DISK = 'D:\Backups\MirrorDB_FullBackup.bak'
    GO
    BACKUP LOG MirrorDB
        TO DISK = 'D:\Backups\MirrorDB_LogBackup.trn'
    GO
    /*
    *  Copy MirrorDB_FullBackup.bak and MirrorDB_LogBackup.trn to the
    *  Mirror Server.
    *  Execute this against the Mirror Instance.
    */
    USE MASTER
    GO
    RESTORE DATABASE MirrorDB
        FROM DISK = 'D:\Backups\MirrorDB_FullBackup.bak'
        WITH NORECOVERY
    GO
    RESTORE LOG MirrorDB
        FROM DISK = 'D:\Backups\MirrorDB_LogBackup.trn'
        WITH NORECOVERY
    GO
    
    Step 10: Setup Mirroring
    
    /*
    *  Execute this against the Mirror Instance.
    */
    ALTER DATABASE MirrorDB
        SET PARTNER = 'TCP://<<your principal server name here>>:5022'
    GO
    /*
    *  Execute this against the Principal Instance.
    */
    ALTER DATABASE MirrorDB
        SET PARTNER = 'TCP://<<your mirror server name here>>:5023'
    GO
    ALTER DATABASE MirrorDB
        SET WITNESS = 'TCP://<<your witness server name here>>:5024'
    GO
    
    At this point your Database Mirroring should be up and running. You can use the Database Mirroring Monitor to verify the setup as well as to monitor the Synchronization status.
    

    use below link understand clearly
    http://blogs.msdn.com/b/suhde/archive/2009/07/13/step-by-step-guide-to-configure-database-mirroring-between-sql-server-instances-in-a-workgroup.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I'm getting new data from my server I need to: update existing data
I need to import data from a file into a Microsoft SQL Server database.
I need to update an existing SharePoint content type by adding a new field
I have few values existing in data base,i need to update them but,i am
I have a MySQL insert statement that inserts data from an existing Despgoods table
I need to update my .htaccess file to redirect permanently all URLs from http://example.com/pages/5604/article/something/?page=299
I need to update a json list of object via url post data. For
We're designing data import from an external source like MAS200 into our production SQL
A common operation is to insert a new row if none exists, or update
I am making changes to an existing database while developing new software. There is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.