views:

510

answers:

3

Hi Masters,

Good Day,

I am new and very naive to Oracle DB.

I am using Oracle 10G.

Let me explain to you. I have one source database named ( DB1) and Target Database named (DB2).

  • I have 2 schema's named dbs1 and dbs2 in the source database (DB1).

  • I have exported both the database schemas in Source Database (DB1) and imported it successfully into the Target Database (DB2).

  • Now I face a challenge in synchronizing these database schemas every time from Source DB (DB1) to Target DB (DB2).

Can anyone please help in letting me know how can achieve this synchronization?

It would a great help.

Thanks

Nash

A: 

You may use "Database Change Management" tools like LiquiBase

Sujee
Can you please explain a further I am very new to Oracle. Can we achieve the same through exp and imp commands with changing the options. Please help Sir/Madam
+7  A: 

Oracle has its own built-in function to handle this situation: it's called Streams. Find out more. There is also Replication, but that uses materialized views rather than tables in the target database. Find out more.

Do not look at third party products or attempt to handroll your own implementation until you have considered the functionality you already have. Oracle licenses are expensive: be sure to get your money's worth.

Setting up data integration between databases is a complex subject, and not one which I would choose to hand to a beginner. However, you will find it easier to get yourself started if you use Oracle's standard functionality. The same applies to asking for help, here or in other forums.

The three key issues you have to decide on are:

  1. synchronicity Do you want the Target DB to be completely up-to-date with the Source database? Or is it sufficient to apply updates asynchronously, perhaps even in batches? At the extreme case, synchronous updates result in distributed transactions, where two-phase commit means changes to data in Source DB must also be applied to Target DB as part of the same transaction.

  2. structural changes It's easy enough to propagate DML changes from one schema to another, but what about DDL - new columns, new tables, etc.

  3. directionality Will all the changes always go from Source DB to Target DB? Are there any prospects of data changes be propagated in the other direction? In a related question, can the data in Target DB be changed independently of changes in the Source DB? Or is the Target DB read only?

EDIT

The deprecated IMP/EXP utilities and the more modern DataPump functionality are intended for one-off operations. That is, importing structure and data into an empty schema, or importing data into empty objects. They are not suitable for use in a rolling synchronization operation, one where we have to be apply incremental changes. The appropriate tools for that task are the ones I have already listed: Streams or Replication.

EDIT 2

"Can you please give an example for the same. I would be very thanful to you."

Examples of both Replication and Streams? That would take a chunk of time, and to be quite frank I doubt you can afford my hourly rate. What I can do is point you to some handy resources on Das Interwebs. Martin Zahn has written a Replication Survival Guide which is pretty good. Tim Hall has an introduction to Streams on his Oracle-Base site; that's for 9i but it remains a decent primer. Neither of these is a substitute for the documentation, but they will help you get a handle on the different technologies.

You describe yourself as "new and very naive to Oracle DB". So you must understand that this is no trivial task. Unfortunately you can't just cut'n'paste some example code and expect it to work. You have a great deal of planning, designing and configuration ahead of you. Start by answering the questions I listed above. You need to know exactly where you are trying to reach before you make any decisions on how to get there.

APC
Hi Sir/Madam, I want full changes made to the schemas in Source Database to synchronized with Target Database. Can you please tell whether it can be achieved through emp/imp commands in oracle. Thanks Nash
+1 for getting your money's worth. I'd also add that as APC has mentioned that setting up even the Oracle supplied functionality is not a trival task. Along with the documentation APC mentions, if you have access to Oracle's support site (https://support.oracle.com) it is worth looking at the documents there on getting started with Streams.
carpenteri
Sir/Madam, Can you please give an example for the same. I would be very thanful to you.
Sir for example if suppose any table is added to ds1 in source database ( DB1). I want to just synchronize that creation of table in target database ( DB2) with same schemaname ds1 which i have earlier imported.
A: 

You can use a compare and synchronize db tool like db schema difftective or DB balance.