[This is a theoretical question, brought up from a real world scenario]
How would you structure a table (say, a Person table) with unique system- generated ID, so that two databases could be merged at a later date? Now
add dependent tables that have foreign key constraints to the first table, and repeat the question.
Real world scenario: DB server goes down. Last full backup from several hours before is restored on a second db server, and users go back to
entering data.
Original DB is brought back online, and the client wants to
merge the data from the Original DB (after the backup) into the new db without needing to re-enter the data manually.
Too late for the real world scenario, but how would you prevent this from being an issue going forward?
[This is a theoretical question, brought up from a real world scenario]
How would you structure a table (say, a Person table) with unique system- generated ID, so that two databases could be merged at a later date? Now
add dependent tables that have foreign key constraints to the first table, and repeat the question.
Real world scenario: DB server goes down. Last full backup from several hours before is restored on a second db server, and users go back to
entering data. Original DB is brought back online, and the client wants to merge the data from the Original DB (after the backup) into the new db without needing to re-enter the data manually.
Too late for the real world scenario, but how would you prevent this from being an issue going forward?
(I'm bringing this up on a MySQL newsgroup because the db servers are
MySQL.)
On 19/11/2019 22:54, Lyle H. Gray wrote:
How would you structure a table (say, a Person table) with unique
system- generated ID, so that two databases could be merged at a
later date? Now add dependent tables that have foreign key
constraints to the first table, and repeat the question.
I had this issue when taking orders offline on a laptop
Then needing to merge the orders.
You simply write code to insert the new orders one by one into the old database.
Too late for the real world scenario, but how would you prevent thisYou CAN store elsewhere the 'last id entered' and use this as your
from being an issue going forward?
starting value for a new table
On 19/11/2019 23.54, Lyle H. Gray wrote:
[This is a theoretical question, brought up from a real world
scenario]
How would you structure a table (say, a Person table) with unique
system- generated ID, so that two databases could be merged at a
later date? Now add dependent tables that have foreign key
constraints to the first table, and repeat the question.
I don't think this is so much about how your table really looks like,
for the following scenario would cause a disaster.
Real world scenario: DB server goes down. Last full backup from
several hours before is restored on a second db server, and users go
back to entering data.
Real time data replication from first server to the second one, if the
mysql own setup ain't good enough, then I would suggest Sybase
replicator and use ODBC to connect to the servers.
Original DB is brought back online, and the client wants to
merge the data from the Original DB (after the backup) into the new
db without needing to re-enter the data manually.
In theory GUID as id could solve this, but it's possible to get a GUID generated twice, best practice is to always check that the GUID don't
exist before using it, as the second machine lacks a number of GUIDs,
it would be theoretically possible that it could generate one that the
first server has generated (even if the risk is slim).
Too late for the real world scenario, but how would you prevent this
from being an issue going forward?
Maybe application that can take the missing data from server 2 and
generate new ID's for them when inserting into server 1, unless there
is external dependencies...
I would go for real time replication, where you have master/slave
relation. The setup needs to allow the master/slave relation to switch
to slave/master, this functionality is supported with the Sybase replication.
[This is a theoretical question, brought up from a real world scenario]
How would you structure a table (say, a Person table) with unique system- generated ID, so that two databases could be merged at a later date? Now
add dependent tables that have foreign key constraints to the first table, and repeat the question.
Real world scenario: DB server goes down. Last full backup from several hours before is restored on a second db server, and users go back to
entering data. Original DB is brought back online, and the client wants
to merge the data from the Original DB (after the backup) into the new db without needing to re-enter the data manually.
Too late for the real world scenario, but how would you prevent this from being an issue going forward?
(I'm bringing this up on a MySQL newsgroup because the db servers are--
MySQL.)
Real world scenario: DB server goes down. Last full backup from several hours before is restored on a second db server, and users go back to entering data. Original DB is brought back online, and the client wants to merge the data from the Original DB (after the backup) into the new db without needing to re-enter the data manually.
3. when you go live with a copy, go forth with it. Never look back at the data on the crashed server. You lost some changes. Live with it.
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 63 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 492977:01:51 |
| Calls: | 840 |
| Files: | 1,301 |
| D/L today: |
17 files (29,919K bytes) |
| Messages: | 265,073 |