How to copy an Entity and Related Objects? [message #285112] |
Mon, 03 December 2007 09:59 |
MikeSanders
Messages: 6 Registered: December 2007
|
Junior Member |
|
|
Hi.
I'm a DBA in a medium software billing company.
The testing team people ask me replicate a customer (and all its data) from the System-Test DB to a DB of a certain tester.
Problem is the CUSTOMER table has releations to several other tables (ACCOUNTS, BILLS, etc) which in turn has relations to other tables.
As I see it I have two options:
1. Copy the entire System Tests DB to the oother DB. This is bad - this DB is very large and we don't have enough disk space.
2. Work out manually all the relations of the CUSTOMER and write a script to copy just the relevant tables/records for the specific customer. This seems too much work...
Anybody familiar with a script/tool to perform this?
|
|
|
|
Re: How to copy an Entity and Related Objects? [message #285138 is a reply to message #285113] |
Mon, 03 December 2007 12:42 |
MikeSanders
Messages: 6 Registered: December 2007
|
Junior Member |
|
|
Yes, I use DB-Link.
My problem is the part where I need to locate the records that are related.
For example:
I need to copy CUSTOMER whose CUSTOMER_ID is 30.
In ACCOUNT table, there's a FK to the CUSTOMER table. So I need to copy the ACCOUBT records where CUSTOMER_ID = 30.
And so it goes, for BILLS, and other tables.
The CUSTOMER is related to 6 tables! And these tables are releated as well..
|
|
|
|
|
Re: How to copy an Entity and Related Objects? [message #285294 is a reply to message #285210] |
Tue, 04 December 2007 03:47 |
MikeSanders
Messages: 6 Registered: December 2007
|
Junior Member |
|
|
Guys, thank you for your help.
However, this doesn't answer my question.
It's easy to copy records from one DB to another.
The problem is that you need to work out all the specific IDs of the relations, for a specific customer. This may be 20 different IDs!
And when people come and ask me to copy another customer - then I have to repeat the procees all over again - for THIS new customer.
This is a LOT of work..
Any ideas will be appreciated.
|
|
|
|
|