What is the best way to copy data....

Hello friends,
What could you think is the best way to copy this data ? :
- I have two identical databases (Oracle 9i)
- I want to migrate the data of 90 tables (all tables begin with the same string, i.e. 'TAB') from Database1 to database2.
- There are integrity constraints, referentials, etc.
I'd like to generate a script to automate/accelerate the process.
So, I'm thinking on the following:
- Disable all the constraints in Database2.
- Connect to Database 1 and generate a script with the 'inserts' using TOAD (or another similar application)
- In a Database 2 session, execute the script...
Of course if I use TOAD I can't generate an unique script to do this process in one step so...
Any better idea? (Using export/import, ... or some script you have...)
Thanks.
Jose.

Use exp and imp. It works... seriously! And you don't need to drop the user/schema. But don't take my word, run an example...
On Database 1
First let's create a couple of tables with referential integrity to each other to make sure exp/imp can handle it...
SQL> create table t1 (t1_id number constraint pk_t1 primary key, t2_id number);
Table created.
SQL> create table t2 (t2_id number constraint pk_t2 primary key, t1_id number);
Table created.
SQL> alter table t1 add constraint fk_t1_t2 foreign key (t2_id) references t2 (t2_id);
Table altered.
SQL> alter table t2 add constraint fk_t2_t1 foreign key (t1_id) references t1 (t1_id);
Table altered.
SQL> insert into t1 (t1_id, t2_id) values (1, null);
1 row created.
SQL> insert into t2 (t2_id, t1_id) values (2, 1);
1 row created.
SQL> update t1 set t2_id = 2 where t2_id is null;
1 row updated.
SQL> commit;
Commit complete.
SQL> select * from t1;
     T1_ID      T2_ID
         1          2
SQL> select * from t2;
     T2_ID      T1_ID
         2          1
SQL> select table_name, constraint_name, constraint_type, r_constraint_name from user_constraints
  2  where table_name in ('T1','T2');
TABLE_NAME                     CONSTRAINT_NAME                C R_CONSTRAINT_NAME
T1                             PK_T1                          P
T1                             FK_T1_T2                       R PK_T2
T2                             PK_T2                          P
T2                             FK_T2_T1                       R PK_T1
SQL>
Now let's export those tables. You can build a parfile manually or even spool it from a sql script with the names of all tables you need to export...
$ cat parfile.txt
tables=(\
t1,\
t2
$ exp rc/pwd parfile=parfile.txt file=db1.dmp log=db1.log
Export: Release 10.1.0.3.0 - Production on Mon Jan 9 20:49:17 2006
Copyright (c) 1982, 2004, Oracle.  All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options
Export done in UTF8 character set and UTF8 NCHAR character set
About to export specified tables via Conventional Path ...
. . exporting table                             T1          1 rows exported
. . exporting table                             T2          1 rows exported
Export terminated successfully without warnings.
On Database 2
Copy your .dmp file to Database 2
Import
$ imp rc/pwd full=y file=db1.dmp log=db1_imp.log
Import: Release 10.1.0.3.0 - Production on Mon Jan 9 20:51:15 2006
Copyright (c) 1982, 2004, Oracle.  All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options
Export file created by EXPORT:V10.01.00 via conventional path
import done in UTF8 character set and UTF8 NCHAR character set
. importing RC's objects into RC
. . importing table                           "T1"          1 rows imported
. . importing table                           "T2"          1 rows imported
About to enable constraints...
Import terminated successfully without warnings.
All data is there...
SQL> select * from t1;
     T1_ID      T2_ID
         1          2
SQL> select * from t2;
     T2_ID      T1_ID
         2          1 All constraints are there...
SQL> select table_name, constraint_name, constraint_type, r_constraint_name from user_constraints
  2  where table_name in ('T1','T2');
TABLE_NAME                     CONSTRAINT_NAME                C R_CONSTRAINT_NAME
T1                             PK_T1                          P
T1                             FK_T1_T2                       R PK_T2
T2                             PK_T2                          P
T2                             FK_T2_T1                       R PK_T1It does work!

Similar Messages

  • What is the best way to copy aperture library on to external hard drive? I am getting a message that say's "There was an error opening the database. The library could not be opened because the file system of the library's volume is unsupported".

    What is the best way to copy aperture library on to external hard drive? I am getting a message that say's "There was an error opening the database. The library could not be opened because the file system of the library's volume is unsupported". What does that mean? I am trying to drag libraries (with metadata) to external HD...wondering what the best way to do that is?

    Kirby Krieger wrote:
    Hi Shane.  Not much in the way of thoughts - - but fwiw:
    How is the drive attached?
    Can you open large files on the drive with other programs?
    Are you running any drive compression or acceleration programs (some drives arrive with these installed)?
    Can you reformat the drive and try again?
    Hi Kirby,
    I attached the UltraMax Plus with a USB cable. The UltraMax powers the cable so power is not an issue. I can open other files. Also, there is 500GB of files on the drive so I cannot re-format it. Although, I noted I could import the entire Aperture Library. However, I do not want to create a duplicate on my machine because that would be defeating the purpose of the external drive.
    Thanks,
    Shane

  • I'm buying a new Macbook Pro this week and am wondering what is the best way to copy over the software I have from my existing Macbook Pro to the new one? eg. Photoshop and Office etc. I no longer have the CDs.

    I'm buying a new Macbook Pro this week and am wondering what is the best way to copy over the software I have from my existing Macbook Pro to the new one? eg. Photoshop and Office etc. I no longer have the CDs.

    Ya know what I'm on a brand new MBP just about 24 hours old and you know whats been working amazingly for me. I have a 27inch iMac as well and i've just connected it to my network and been dragging files and apps across the network onto my new MBP. Its really working fast and its flawless. You could always do that option, Just go into sharing options and turn them on for both Macs. Then just click and drag. Of course they have to both be on the same network for this to be possible.
    Look at my network.
    Shared is what your looking at.  I click on there see all my computers files and then drag the ones i want form its folder to my MBP folders.  Hope that helps if your looking for a very simple way on a wireless network.

  • What is the best way to transfer data from a PC to an iMac?

    What is the best way to transfer data from a PC to an iMac?

    If you know how to set up a computer-to-computer Ethernet network, then you can give that a try, but a hard drive will be faster than Ethernet unless you don't have a lot to transfer.
    Mac OS X 10.6 Help- Creating a computer-to-computer network

  • What is the best way to copy a DVD i made from iMovie?  It was HD720 and I don't want to lose any quality in the copies.

    What is the best way to copy a DVD I made from iMovie?  It was HD720 and I don't want to lose any quality in the copies.  I need to distribute it to about 20 people. It's 42 minutes long.

    You will need to save it as a video to the camera roll.
    Import it into windows as you would a photo.
    Then purchase DVD authoring software, and create a DVD.

  • What is the best way to copy 700 local folders full of email to a new computer?

    I am moving my wife from and old computer (Thunderbird, Win XP) to a new one (Thunderbird Win 7). She has about 700 local folders with thousands of email messages in them. What is the best way to copy them to the new computer?

    The easiest way is just copy the whole profile.
    Help menu > troubleshooting information
    Close Thunderbird
    In windows explorer select all and copy.
    paste everything onto a thumb or other read/write portable media (not CD or DVD)
    on the new Machine repeat the troubleshooting and close steps to get the current profile folder
    This time paste everything from the portable media into the profile replacing what is there
    Open Thunderbird, your done mail contacts add-ons everything

  • What are the diffrent ways to copy data from one application to another?

    Hi,
    Can you guys tell me what are the different ways to copy data from one application to another application??
    I know we can do it through script logic using DESTINATION_APP.
    Is there any other way to copy data from one application to another application?
    Please help me
    Thanks,
    Charly

    You can also call a custom DTSX package in SSIS via the datamanager.
    there are at least 5 ways of transfering data in BPC between apps.
    1. Through the front end (excel etc) via evdre/evsnds
    2. Through Script logic using *Dest App
    3. Using BPC's standard export dtsx package via DM
    4. Using SSIS using BPC's custom SSIS tasks
    5. Through Script logic using stored procs.
    i am sure people will come up with more.
    remember if you use ssis and move data into any table but the wb, you need to process the cube afterwards.

  • What is the Best way To Copy and paste data from 1 book to another

     I have 18 sheets in 5 different books that I want to extract data from specific cells.  What is the best way to do this?  Example:  1 sheet is called Numbers E-O1 data in 13:WXYZ. The data updates and moves up 1 row every time I enter
    a new number. So let's say I enter the number 12. Through a lot of calculations the output goes in 13:WXYZ. To what I call a counter which is a 4 digit number.  Anyways, how can I send that 4 digit number to a totally different sheet?  To bullet
    what I'm talking about
    data in cells Row 13:WXYZ in book called Numbers sheet E-O1
    send data to book called "Vortex Numbers" Sheet E-O row 2001:CDEF
    What formula or Macro can I use to make this work?
    thank you!

    Hello Larbec,
    Syntax:
    '[BookName]SheetName'!Range
    Enter in cell  2001:CDEF:
    ='[Numbers]E-O1'!13:WXYZ
    This assumes that the file is open in Excel. Otherwise you need to add the path:
    'ThePath[BookName]SheetName'!Range
    Best regards George

  • What is the best way to save data from GPIB Device in a file?

    HI!
    I have a Keithley SourceMeter and want to save readings in a File along with settings on the front panel and timestamps plus several other infos. What is the best way to do this? Which file type? Any recommendations or hints could help me?
    Thanks

    Hi Andy,
    There are 3 main file formats that you can consider writing your data out to in LabVIEW:
    ASCII
    Binary
    Datalog
    ASCII
    ASCII files are useful because every operating system and almost every application can read/write ASCII format files. Use ASCII files when:
    Other users or applications will need to access the data file.
    You will not need to perform random access file I/O
    File I/O speed is not crucial
    Disk space is not crucial
    Examples within LabVIEW Example Finder: Fundamentals >> File Input and Output >> Write to Text File.vi and Read from Text File.vi
    Binary
    Binary byte stream files are more specific to data storage and retrieval. Use b
    inary files when:
    File I/O will remain in LabVIEW only -- no other applications will be needing to write/read that file. There is no standard formatting for binary files and thus other applications or operating systems may be unable to read the file.
    Files are smaller than ASCII files
    Easier and faster random access to data
    Examples within LabVIEW Example Finder: Fundamentals >> File Input and Output >> Write Binary File.vi and Read Binary File.vi
    Datalog
    When to use datalog:
    If you need to record data with a mixture of types, it can be cumbersome to convert everything to ASCII or to keep track of the binary formatting.
    Datalog format is binary and internal to LabVIEW, so again only use this format if no other applications or operating systems will be needing to perform file I/O on the file.
    Examples within LabVIEW Example Finder: Fundamentals >> File Input and Output >> Write Datalog File
    Example.vi and Read Datalog File Example.vi
    Good luck!
    Kileen C.
    Applications Engineer
    National Instruments

  • What is the best way to get data to a user interface?

    Hi,
    I'm using labview 6i. I have an application with a handful of "core" vi's that actually run my application, doing the data acquisition, analysis, and control. I am currently using these same vi's for my user interface. I also have a number of vi's that contain menu's for configuring the "core" vi's. My questions is, what is the best way to seperate the "core" vi's from the user interface vi's. Global's, data socket, control references, others?
    Thanks for the help.

    Hi Sal,
    I have been a strong advocate of control refnums ever since LV 6i hit the streets. I recomend you look into using them to provide this conectivity.
    You could accomplish this by using a variation on the following.
    In your UI, create refnums for each of the controls or indicators that must be monitored or updated. Pass the appropriate refnums to each of the "core.i's" at program init time. Inside each of the core.vi's, use property nodes to read the control's values when appropriate and similarly for display purposes. (Note: Not all boolean mechanical actions are compatible with this technique. In those case you will have to explicitly write false values after find the control to be true or vise versa).
    By using this technique, you can keep the UI diagrams clea
    n. Depending on your app. the UI diagram could consist of the init's I mentioned above, and a while loop that watches if it's time to exit.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • What is the best way to retrive data from a Global Variable?

    Here is what I want to do,
    I have several PC's that run different types of tests. I want to use a global variable, running on a single PC, that acts like a sever that can be accessed by the other PC's in my lab. This Global variable will store the hostnames of the different PC's that are currently running each test, along with a description of the test.  Then, a user can access this Global variable to read the different values and select the PC and connect to it's desktop using Remote Desktop in Windows.
    Is it possible to write data to the Global variable that is running on the single PC?
    What is the best way to do this? Does anyone have a sample VI?
    What is the best way to then read the data from the Global variable?
    (I will probably use an array\cluster to store the hostnames.) 

    Another pre-LV8 idea...
    A functional global can be accessed using VI-Server and called using "call by reference".
    This approach harnesses the TCP functionality built into the VI-Server to manage the conncetion.
    This can be pretty quick and (if the functional global is written correctly) will support buffered- mixed data types. (Try to do that with the Shared Variable  ).
    Just another idea,
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • What's the best way to copy a big poster and print it out?

    I'm doing a big art project (around 5ft by 5ft), where I'm going to draw stuff out by hand, and would like to make a copy of that project by scanning it into the computer, or taking high-res photos of the project and compiling them together in the computer, and then printing the image out at that size, or bigger. So, I will have the original, 5x5ft, and a printed copy. 
    What's the best way of doing this?
    I hear that vector images are ideal for this, so is Illustrator recommended for this?
    I know it's a vector graphics program, but is there any way I can take a bitmap image from a scan or photo, and somehow turn it into a vector? If this is not possible, what recommendations would you have?
    I have Illustrator CS2.

    Take the photo in one shot by a camera with 24MP, e.g.
    http://www.kenrockwell.com/nikon/d3x.htm
    This should be sufficient for a poster reproduction 5ft square
    as a raster image.
    For vectorizing one doesn't need high resolution (it's often
    recommended to blur the source image).
    Perspective and lens corrections can be applied by Photoshop,
    but the lighting should be well balanced.
    Barrel distortion by wide angle lens is really no problem.
    Plenty examples:
    All photos here were taken without tripod by a 170 Euro camera.
    http://www.fho-emden.de/~hoffmann/andalusien13032010.pdf
    Especially see p.20, a photo (with flash) of an exhibition photo,
    viewing direction not orthogonal to the object, then perspectively
    and lens-distortion corrected.
    (The PDF shows the photos heavily downsampled).
    Best regards --Gernot Hoffmann

  • What is the best way to audit data

    What is the best way to audit actual changes in the data, that is, to be able to see each insert, update, delete on a given row, when it happened, who did it, and what the row looked like before and after the change?
    Currently, we have implemented our own auditing infrastructure where we generate standard triggers and an audit table to store OLD (values at the beginning of the Before Row timing point) and NEW (values at the beginning of the After Row timing point) values for every change.
    I'm questioning this strategy because of the performance impact it has (significant, to say the least) and because it's something that a developer (confession, I'm the developer) came up with, rather than something a database administrator came up with. I've looked into Oracle Auditing, but this doesn't seem like we'd be able to go back and see what a row looked like at a given point in time. I've also looked at Flashbacks, but this seems like it would require a monumental amount of storage just to be able to go back a week, much less the years we currently keep this data.
    Thanks,
    Matt Knowles
    Edited by: mattknowles on Jan 10, 2011 8:40 AM

    mattknowles wrote:
    What is the best way to audit actual changes in the data, that is, to be able to see each insert, update, delete on a given row, when it happened, who did it, and what the row looked like before and after the change?
    Currently, we have implemented our own auditing infrastructure where we generate standard triggers and an audit table to store OLD (values at the beginning of the Before Row timing point) and NEW (values at the beginning of the After Row timing point) values for every change.You can either:
    1. Implement your own custom auditing (as you currently do)
    2. Flashback Data Archive (11g). Requires license.
    3. Version enable your tables with Workspace Manager.
    >
    I'm questioning this strategy because of the performance impact it has (significant, to say the least) and because it's something that a developer (confession, I'm the developer) came up with, rather than something a database administrator came up with. I've looked into Oracle Auditing, but this doesn't seem like we'd be able to go back and see what a row looked like at a given point in time. I've also looked at Flashbacks, but this seems like it would require a monumental amount of storage just to be able to go back a week, much less the years we currently keep this data.
    Unfortunately, auditing data always takes lots of space. You must also consider performance, as custom triggers and Workspace Manager will perform much slower than FDA if there is heavy DML on the table.

  • Replacing MacBook Pro's optical drive with SSD. What is the best way to migrate data?

    I have a time machine backup on external drive.
    I would like to:
    1. clean install Lion on the new SSD (120 GB)
    2. restore apps from my backup on the SSD
    3. keep only data on the existing HDD
    My questions:
    What is the best way to make it?
    Can I just keep the existing system on my non-SSD HDD, and after having Lion on SSD keep just data and delete the system libraries? Or is it better to format the whole disk and restore data from time machine backup (so it is not fragmented...).
    Thanks for any tips in advance!
    Antonin

    OK, thanks a lot.
    And after reformatting the old HDD can I - can I tell Time Machine where to recover my folders (apps --> SSD, data --> old HDD)?
    I mean when Time Machine starts recovering my 450 GB of files onto 120 GB SSD will it ask me to decide what put where?

  • What is the best way to move data from one array to another

    I'm going to be moving data from one array to a larger array on the same RAID but different controller. (I have some extra extra drives I'm also going to be installing Retrospect so I can't just restore from a backup.)
    The RAID has 450GB of production files, fonts etc.
    What is the best way to move the data over?
    I saw that someone had suggested using ditto. Would that be better than MacMV?
    I also own Bru LE so I could use that.
    Any advice would be appreciated.
    Thanks,
    Paul

    Ditto is a great option -- probably the best.
    ditto -rsrc src_folder /Volumes/targetvolume/targetfolder

Maybe you are looking for