Domanda

I am trying to create a automated way of copying data from a production oracle database to our test system. We only want to get specific data and so can't just do a full DB copy. I have all the SQL to get the data and can do it in toad by running the SQL and exporting as insert statements and then running those in the test system but this is time consuming as about 25 tables are involved.

I want to do it using python and cx_oracle. Can I have 2 connections to different databases open at the same time? So I can run a select in one and with the results build an insert and run that in the other or do I need to connect, run the select, disconnect and connect to the the other, run the insert and repeat for each statement? Would the multiple connects and disconnects cause issues for the databases? Taking down a production database will not make me popular....

I can't link the databases in any way and the copying needs to be repeatable for different data and simple enough for non technical users to use.

È stato utile?

Soluzione

Yes, you can have multiple connections open at the same time. Take care of each connection and cursor, of course.

You can find useful CX-OracleTools, a collection of scripts based on cx_oracle for working with Oracle databases. There is a CopyData script very interesting.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top