473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

synchronize the database

hi frdz
i'm doing web site
i have to use two databases
one is for web site (suppose call it as web db server-A) &
another is for some trasaction(call it as trans db server-B)
so i want to synchronize these databases.
means i want to do updation to these db [once in the day ]
[whtever changes made in B will be update db A from last updation point
at the end of day ]
so can u tell me how can i synchronize the databases.
thnks.........
Mar 26 '07 #1
4 1184
iburyak
1,017 Expert 512MB
You can write a stored proc to update all tables in a database and run it by a scheduled job nightly.



Thank you.
Mar 26 '07 #2
can u give me the procedure how to write the Syncronization of database
or any link that can refer to syncronise database...............

thanks for ur's reply.
Mar 28 '07 #3
iburyak
1,017 Expert 512MB
Do you update both databases independently or one is primary and another secondary?
If yes the easiest way besides replication just delete everything from tables and reload new data.

On server B

[PHP]BEGIN TRAN

DELETE FROM TABLE1

INSERT INTO TABLE1
SELECT * FROM ServerA.dabase_name.dbo.TABLE1

IF @@ERROR = 0
COMMIT TRAN
ELSE
ROLLBACK TRAN


BEGIN TRAN

DELETE FROM TABLE2

INSERT INTO TABLE2
SELECT * FROM ServerA.dabase_name.dbo.TABLE2

IF @@ERROR = 0
COMMIT TRAN
ELSE
ROLLBACK TRAN[/PHP]

If tables are big you have to reload them in a loop taking chunks of data depend on a size.
This way you will not overload transaction log at insert time but you will loose ability to roll back data to original in case of a problem.

[PHP]SET ROWCOUNT 2000
While @@ROWCOUNT > 0
BEGIN
BEGIN TRAN
DELETE FROM TABLE1
COMMIT TRAN
END
SET ROWCOUNT 0

While @@ROWCOUNT > 0
BEGIN
BEGIN TRAN
INSERT INTO TABLE1
SELECT TOP 2000 * FROM ServerA.dabase_name.dbo.TABLE1
WHERE primery_key_column not in(select primary_key_column From TABLE1)
COMMIT TRAN
END[/PHP]
Mar 28 '07 #4
thanks for ur suggetion.
ur idea is very good but i don't want to delete the tables.
will database mirroring solve this problem?
i'm trying this thing but i got errors
so plz can u tell me abt any other idea.
or how to use db mirroring concept?
thanks ....
Mar 28 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Roger Godefroy | last post by:
Hi, I have to develop a customer relation application. I would like to synchronize databases, so the user can work at the office and at home. Internet isn't available at home. What would be the...
4
by: gene.ellis | last post by:
Using a web interface, I am placing text into a SQL database. From time to time, I would like to synchronize one of my other tables in the database with the table that I am inserting content into....
1
by: Hewit | last post by:
DataTable Class documentation says. Thread Safety "This type is safe for multithreaded read operations. You must synchronize any write operations." In my web based application (ASP.Net)...
0
by: Radek Mrkvicka | last post by:
GeniusConnect for Microsoft Outlook® 2000/XP/2003 Synchronize Outlook® data with any DB2 database! You can synchronize Outlook data with any relational database that supports ODBC (DB2, MS...
1
by: taleran58 | last post by:
Hi all. I'm writting a multithreading program that will update a loacal Access database. I'm using OleDB connection to get access to the database from each thread and my question is: how do I...
1
by: taleran58 | last post by:
Hi all. I'm writting a multithreading program that will update a loacal Access database. I'm using OleDB connection to get access to the database from each thread and my question is: how do I...
3
by: Elioth | last post by:
Hi, I want to synchronize Access and SQL database schema. I have running a application and I want sync database because when I create a new Table in the database I need this table in all client...
1
by: John | last post by:
Hello, I need to synchronize one access database with other access database. Tables and fields are off course same. Can someone tell me how to achieve this? Regards
1
by: rbarber | last post by:
I have to synchronize 2 databases hourly but am having difficulty maintaining foreign key relations. These tables use auto-increment columns as primary keys, with child records in other tables...
1
by: vicky12 | last post by:
HI all can anyone help me with this. I have two databases, one at my local host and second one on a web server with same tables. I have to make some changes to my local database and I need to update...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.