Transfer data from one database to another

Hello,
We have an application which uses an Oracle 9i server database. On this server we have two databases ( one for test and one for production ).
From time to time it's required to transfer data from production database to test database.
The steps followed by the ones which made the transfer are:
a) drop the user schema ( the one which contains all data)
b) recreate the user
c) import the data ( using import utility )
d) compile invalid object ( what this will mean I don't know)
It's not possible to delete only the content of the tables and then import data from a dump file? In this way the steps c) and d) will no longer be required. If this is possible can you tell me if is there a command which will delete all data from all table ( almost 2000 tables)?
Thank you fro your help!

I think ..following a,b,c,d is the best way to maintain consistency. you are just thinking about the data in the tables, but what about the changes in views,procedures,functions etc....
compile invalid object ( what this will mean I don't know)create a file xxx.sql with following code and execute it from sql*plus
set echo off
set head off
set feedback off
set timing off
spool compile_invalid_obj.sql
select 'ALTER '||DECODE(OBJECT_TYPE,'PACKAGE BODY','PACKAGE',OBJECT_TYPE)||' '||OBJECT_NAME||' '||DECODE(OBJECT_TYPE,'PACKAGE','COMPILE PACKAGE;','PACKAGE BODY','COMPILE PACKAGE;','COMPILE;')
from user_objects
where status = 'INVALID';
spool off
set feedback on
set echo on
set timing on
@compile_invalid_obj.sql
HTH
--Chaitanya                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • Transfer data from one database to another without identities but keep the relation b/w PK and Foreign key

    Hi,
    I need to transfer data from one database to another database (both are identical databases). 
    1. Not transferring identity columns (primary keys). the destination table might have the same key.
    2. keep the PK's and FK's relation b/w parent and child table
    3. I have 4 levels 
    Example: tableA (col1 int identity(1,1) , col2, col3)
    tableB (col1 int identity(1,1) ,
    col2 , col3) -- col2 has the foreign key relation with tableA.col1
    tableC (col1 int identity(1,1) ,
    col2, col3) -- col2  has the foreign key relation with tableB.col1
    tableD (col1 int identity(1,1) , col2, col3) -- col2  has the foreign key relation with tableC.col1
    please advise me.
    Thanks in advance

    Try the below:
    /********************************SAMPLE TARGET***************************************************************/
    Use MSDNSamples
    create table TableA(LevelValueId int identity(1,1) primary key, name varchar(100))
    Insert into TableA(name) Select 'R1'
    Insert into TableA(name) Select 'R2'
    create Table TableB(ChildId int identity(100,1),name varchar(100), LevelValueID int references TableA(LevelValueId))
    Insert into TableB(name,LevelValueID) Select 'Childname1',1
    /********************************SAMPLE TARGET***************************************************************/
    /********************************SAMPLE SOURCE***************************************************************/
    Use Sample
    create table TableA(LevelValueId int identity(1,1) primary key, name varchar(100))
    Insert into TableA(name) Select 'C1'
    Insert into TableA(name) Select 'C2'
    create Table TableB(ChildId int identity(100,1),name varchar(100), LevelValueID int references TableA(LevelValueId))
    Insert into TableB(name,LevelValueID) Select 'Kidname1',1
    /********************************SAMPLE SOURCE***************************************************************/
    USe MSDNSamples
    /********************************MIGRATION INTERMEDIATE TABLE***************************************************************/
    --Migration table
    Create table Mg_TableA(LevelValueId int, NewValueId int)
    /********************************MIGRATION INTERMEDIATE TABLE***************************************************************/
    /********************************ACTUAL MIGRATION FOR MASTER TABLE***************************************************************/
    MERGE INTO TableA
    USING sample.dbo.TableA AS tv
    ON 1 = 0
    WHEN NOT MATCHED THEN
    INSERT(name) Values(tv.name)
    Output tv.levelValueId ,inserted.LevelValueid INTO
    Mg_TableA;
    /********************************ACTUAL MIGRATION FOR MASTER TABLE***************************************************************/
    /********************************ACTUAL MIGRATION FOR CHILD TABLE***************************************************************/
    Insert into TableB (name,LevelValueID)
    Select A.name,B.NewValueId From sample.dbo.TableB A
    Inner join Mg_TableA B on A.LevelValueID = B.LevelValueId
    /********************************ACTUAL MIGRATION FOR CHILD TABLE***************************************************************/
    /********************************TEST THE VALUES***************************************************************/
    Select * From TableA
    Select * From Mg_TableA
    Select * From TableB
    /********************************TEST THE VALUES***************************************************************/
    Drop table TableB,Tablea,Mg_TableA
    Use Sample
    Drop Table TableB,Tablea

  • Different ways to Transfer data from one database to another database

    Hi all,
    What are the ways to transfer data from one database to another database. With the following options, i Can transfer data as far as i know. Please
    correct me if i am wrong or tell me if there is any other options are available.
    1) Create database link/connection string and using this string and COPY command, we can transfer data.
    2) By using Export and Import utilities.
    I told first one to my interviewer, he told, its strange, by using, COPY command also can we transfer data ? As far as i know, we can transfer data. Am i right ?
    Thanks in advance,
    Pal

    transfer data from one database to another database.You mean store the data of one to another?
    1) Create database link/connection string and using this string and COPY command, we can transfer data.every SELECT on a DB-link is transfering data. And you can have all kind of transfers and store on the e.g CTAS of materialized views or.... the SQL*PLUS COPY :
    The COPY command is not being enhanced to handle datatypes or features introduced with, or after Oracle8i. The COPY command is likely to be made obsolete in a future release.
    But there are many others. Check for ORACLE Streams, and the "COPY" your interviewer was mentioning is about the operating file system COPY right? That's transportable tablespaces.
    http://download.oracle.com/docs/cd/E11882_01/server.112/e17120/tspaces013.htm#ADMIN11403
    -- andy

  • Transfer of Data from one Database to Another

    Respected Guys
    Is there any way to transfer few fields from different tables located on a Database Server used by SAP to an other database used by an another application. The other database also have same fields and and Tables structure.
    Both databases are located on different servers and are oracle9i.
    Is there any way to transfer real time data from one database to another. If not then any way by which we can preiodically can transfer the data.
    Thnx

    Hi
    U can use a <a href="http://help.sap.com/saphelp_nw04s/helpdata/en/9c/d736b880c34f76b507bac7751a0474/frameset.htm">DBCON (Database Connection) tool</a>.
    Here you should call another database and write SQL native code in order to transfer/read the data.
    Max

  • How to transfer DATA from one machine to another using  DBlink

    I want to transfer data from one machine to another both having oracle 8.0.5 with AIX operating system using DB link. CAn any one help me in this task

    Step one - Create and test SQLNet connections between the databases.
    Step two - Create at least on database like from one database to the other:
    CREATE DATABASE LINK linkname
    CONNECT TO user identified by password
    USING 'tnsnamesentry';
    Step three - use the dblink linkname in dml statements eg:
    insert into emp@linkname
    (select * from emp);

  • How can you transfer data from one ipod to another ?

    How can you transfer data from one ipod to another ipod ?

    The geniusbar told me what to do, I understood but there is still a problem for me >:/ It's not showing up though. Like "device."  Nothing is happening, and I tried as soon as I got home. Then after half an hour, then an hour, then 3 hours. My problem is that it's not showing up! It's stuck in recovery mode! There's still like 25% battery. So I have no idea why.

  • How do I transfer data from one iPhone to another?

    How do I transfer data from one iPhone to another?

    If your old device is an Apple using iOS 5 or later, and you have an iCloud account, you can transfer all your saved messages, email accounts, photos, notes, and other personal settings to your new iPhone.
    Here's how...
    Connect your old Apple device to WiFi and to a power source.
    Back it up to iCloud by going to Settings > iCloud > Storage & Backup and toggling iCloud Backup on. The time it takes to ba ckup depends on how much data you have and on the speed of your internet connection.
    iCloud backs up your device once a day. If it needs backing up before you transfer to your new iPhone 5, tap Back Up Now in Settings > iCloud > Storage & Backup. Do not start transferring before the backup is finished.
    Turn on your new iPhone and complete the setup by selecting your language and country, and choose whether to enable Location Services. When prompted, choose your WiFi network.
    When prompted to set up, choose Restore from iCloud Backup, tap Next, and enter your Apple ID and password.
    Select the backup of your old device and tap Restore. Wait until the device has finished restoring from the backup.
    When the restore process is complete, your iPhone will restart and be ready to use.
    Connect your iPhone 5 to iTunes to sync data not contained in the backup (such as music, videos, apps, and so on). You can choose the data that are synced by clicking the syncing tabs in iTunes.

  • How to move only subset of data from one database to another?

    Both source & destination are Oracle11g databases.
    The requirement details are as below,
    1) The database contains static as well as transactional data for telecom domain.
    2) We have to move region-wise data from one database to another.
    3) There are around 10 regions.
    4) The region wise data extraction from source db is based on around 40 to 50 tables. Rest of the tables contains
    static data & it will not change.
    5) The volume is around 1 million subscribers per region.
    6) The migration is required because
    a) The client is upgrading its base product which uses this database
    b) There is a change in structure of static tables
    c) Hardware upgrade
    d) The client want to start with single region on new database & rest of the regions will be operated from old
    database.
    7) Keep execution time to very minimum.
    I am thinking to have solution as below,
    1) Create destination database with upgraded db structure (as mentioned in 6b)
    2) Create database links to access source db in destination db.
    3) Write SQL queries to fetch data from all the respective tables for a specific region
    4) Write separate PL/SQL blocks for each table to fetch data from source db & insert into respective table in
    destination db
    a) Use FOR ALL & bulk collect to improve the performance
    b) Divide table data into multiple chunks & execute parallel batches (around 10) to insert the data
    5) Validate pre & post counts to verify the success of migration
    Is there any other better way?
    Regards,
    Sandeep

    How to move only subset of data from a partiular table by using transportable tablespace?
    E.g. SUB table using SMP_SUB tablespace contains subscriber data in source database.
    The indexes defined on SUB table are under SMP_IDX_SUB tablespace
    The subscribers data can be categorized by different regions, say region_id column. Then how to move data & indexes of SUB table from source db to destination db?
    any specific example would be helpful.

  • How to transfer data from one macbookpro to another

    how to you transfer data from one macbookpro to another. the other one was stolen.

    If your computer was stolen and you don't have a data backup, you can't transfer data from the stolen computer to your new one. If you have a data backup, restore the data to the new computer.

  • How  to transfer data from one system to another by datamart please give de

    how  to transfer data from one system to another by datamart please give details

    Hi Deba,
    Find the below SAP help doc which may help u...
    http://help.sap.com/saphelp_nw70/helpdata/en/12/43074208ae2a38e10000000a1550b0/frameset.htm
    Also find the below threads...
    Loading data from one cube to another cube.
    data copy from infocube to infocube in two different BW systems
    Delta when loading from ODS to ODS
    reg datamart
    Data mart flag
    Regards,
    KK.

  • Can I use flash drives to transfer data from one MBP to another at a differ

    I've looked and cannot find any info on the use of flash drives. Can I use a flash drive to transfer data from one MBP to another one at a different location? (ie; school Apple and home MBP) Grade tests and papers at home, enter data into home computer, then put it on flash drive and carry flash drive to school, transferring data to school desk top? Are certain flash drives preferrable over others, name brands, size, etc?

    Yep, you sure can. Just about any drive will work as mentioned above. But I'm partial to SanDisk and PNY. I've used both and they work great! Currently I carry both a 2GB SanDisk Micro Cruzer and a retractable 2GB SanDisk Cruzer, both really nice. Replaced my oldie but goodie 256MB PNY drive that I've been using since they first came out.

  • How to copy the data from one database to another database without DB link

    Good Day,
    I want to copy the data from one database to another database with out DB link but the structure is same in both.
    Thanks
    Nihar

    You could use SQL*Plus' COPY command
    http://technology.amis.nl/blog/432/little-gold-nugget-sqlplus-copy-command
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14357/apb.htm#sthref3702
    Edited by: Alex Nuijten on Sep 16, 2009 8:13 AM

  • Transfer data from one DATASET to another DATASET

    Hi,
      Is there a way to transfer the data from one DATASET to another DATASET?
      I tried the following
      OPEN DATASET  DS1 FOR OUTPUT IN TEXT MODE ENCODING DEFAULT .
      OPEN DATASET  DS2 FOR INPUT IN TEXT MODE ENCODING DEFAULT .
      TRANSFER DS2 to DS1.
      CLOSE DATASET DS1.
      CLOSE DATASET DS2.
      But it does not work.
      Thanks in advance.

    Hi Jason,
    This logic transfers data from one dataset to another....Kindly check..
    DATA fname(60) VALUE 'myfile'.
    DATA fname2(60) VALUE 'myfile1'.
    TYPES: BEGIN OF line,
             col1 TYPE i,
             col2 TYPE i,
           END OF line.
    TYPES  itab TYPE line OCCURS 10.
    DATA: lin TYPE line,
          tab TYPE itab.
    DO 5 TIMES.
      lin-col1 = sy-index.
      lin-col2 = sy-index ** 2.
      APPEND lin TO tab.
    ENDDO.
    "writing data to file fname.
    OPEN DATASET fname FOR OUTPUT IN BINARY MODE.
    LOOP AT tab INTO lin.
      TRANSFER lin TO fname.
    ENDLOOP.
    CLOSE DATASET fname.
    "reading data from fname and writing to fname1.
    OPEN DATASET fname2 FOR OUTPUT IN BINARY MODE.
    OPEN DATASET fname FOR INPUT IN BINARY MODE.
    DO.
      READ DATASET fname INTO lin.
      IF sy-subrc <> 0.
        EXIT.
      ELSE.
        TRANSFER lin TO fname2.
      ENDIF.
    ENDDO.
    CLOSE DATASET fname.
    CLOSE DATASET fname2.
    "displaying data from fname2.
    OPEN DATASET fname2 FOR INPUT IN BINARY MODE.
    CLEAR lin.
    DO.
      READ DATASET fname2 INTO lin.
      IF sy-subrc NE 0.
        EXIT.
      ENDIF.
      WRITE:/ lin-col1, lin-col2.
    ENDDO.
    CLOSE DATASET fname2.
    Mdi.Deeba
    Edited by: Mdi.Deeba on Feb 17, 2009 8:11 AM

  • Is there any mechanism available to transfer data from one AQ to another AQ

    Hi All,
    Is there any way , any api's available or any other real time mechanism available to transfer/move the data from one AQ to another AQ..
    Is this possible..could someone please advise/help us regards this..
    Thanks
    sachin.

    I dont think there is a standard business content datasource to extract data from NAST table. If you are going to use this data in some other LO modules based on the requirement enhance the datasource and append fields and write code to populate the message types.
    If you are going to use this as stand alone data, then you can go ahead and create a generic datasource based on table.

  • Table Data From One DataBase to another

    Dear Fellows,
    There are two DataBases running in my NT Server. I want to pull data of a table from other database. Does any body know how can I do it if I dont want to export and then import.
    Thanks in advance
    Danish

    Please find the help for SQL*PLUS command COPY.
    It will be useful when you want to copy datas from one database from another database without using import & export.

Maybe you are looking for

  • Slow running report in 6i

    I have a very complex and large report that runs extremely slow. I have always just put the sql in the data model and run it there. Does using a refcursor or some other method run faster as a general rule? It is taking 5+ minutes for a couple of line

  • Ctios login error 10162 Join Across Line on telephone 8961

    Cisco CTIOS client is giving the error message  "10162 Join Across Line is Enabled" when logging on telephone type 8961. Login is successful in telephone type 7942 & 7945. In the UCCE 8.0(1) SRND, it is mentioned that Join Across Line is permanently

  • IPod Shuffle Not Recognised by Mac

    Hi, My 1st Gen iPod shuffle appears to have stopped working. When it is not connected to a machine and I press play I get the flashing orange and green lights (I believe this means there is no song on the shuffle?). The battery level shows as full so

  • Cannot authorize my new macbook pro on iTunes.  I de-authorized my previous computers.  What is going on?

    I cannot authorize my new macbook pro on itunes.  I de-authorized all my previous accounts.  I tried following the directions given for authorizing a computer, but I do not see this option when I open itunes.  Any help is much appreciated.

  • CRM FAQ Signup Thread

    Hello Everyone, I moving the signup for building CRM Technical FAQ into this thread.  We will keep the list here until we get something more formal.  I will update thread based on your posts below. I will try to "bump" this up every week. More than o