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.

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

  • 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.

  • 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

  • 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

  • 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

  • How to transfer table data from one client to another client?

    How to transfer table data from one client to another client?

    Hi,
    Look at the Blog
    /people/community.user/blog/2007/01/07/transport-table-entries
    Regards
    Sudheer

  • Move tables data from One DB to another using DB-Link ?

    Dear friends ,
    I want to move a table data (for a particular schema) from one database to another database's table (for a particular schema) . Can I do it using DB_Link ?
    If yes , then plz tell me the way , how can I do it ?

    >
    I want to move a table data (for a particular schema) from one database to another database's table (for a particular schema) . Can I do it using DB_Link ?>
    Yes you can use db link.Refer to the example in the link:-
    [http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_5005.htm#sthref6315]
    Anand

  • Copying Table Info From One Database to Another

    I am trying to copy data from a database instance on one server to an identical database instance on another server. I have a BC4J application module that I would like to use on both servers. I am relatively new in the BC4J area and would appreciate help from those of you who have done this type of thing before. How do I set up the connections in my client code to accomplish copying the data?

    Table may be copied with the
    expdp and impdp utilities.
    http://www.oracle.com/technology/products/database/utilities/index.html

  • 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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • EXPORT/IMPORT TABLE DATA FROM ONE SCHEMA TO ANOTHER ONE (S.O.S)

    Hi,
    I urgently need your help:(, I have two different instances, in each of them there are two schemas, A and B; which tables are the same, but I need to transfer JUST the table data from A's tables to B's tables, how can I do so??
    Thanks in advance,
    Isabel

    The total number of tables is 989:(And how many do you want ? If 988, and if you're on a 10g db, you can use exclude parameter from expdp/impdp?
    Nicolas.

  • How to move data from one database to another one?

    I 'd like to build up a new database, some of the data would come from an old database, then I have to make two connection objects to both databases, (two statement objects...) retrieving the data from the old one and inserting them to the new one.... sounds reasonable, huh? but it could not work this way... "........it would have caused the duplicated value , blah, blah..." even though I made two tables in two databases completely different, that errors are still there. seemed I cannot clone that table.
    could you guys have any better ideas? and why couldn't I go this way?
    the database: cloudscape3.01
    two databases are all on my local PC (WinNT4.0)
    thanks

    If you are getting dupicate record errors, then look at your recordset objects and make sure they are both pointing at seperate databases, and check the one you are using to output and make sure it isn't just writing NULL, if it is then trace up the line: your input (read) recordset may be reading NULL too.

  • Bring data from one database to another using a DBASE link

    I usually bring data using a database link
    something like
    Insert in table
    colon 1
    colon 1
    colon 3
    select
    colon 1
    colon 2
    colon 2
    from table@nameLINK.
    I
    The tables have the same structure the tables in the database where I am runing the script are empty
    I wonder if it is a way to do it faster (not a dba) without wriiting a script with the insert, some of the tables have a lot columns
    thank you

    Use NOLOGGING for the table and the APPEND hint for the query. This will eliminate the generation of redo and be faster.
    ALTER TABLE myTable NOLOGGING;
    Insert /*+ APPEND */ into myTable
    colon 1
    colon 1
    colon 3
    select
    colon 1
    colon 2
    colon 2
    from table@nameLINK;
    ALTER TABLE myTable LOGGING; -- if you want to turn logging back onIf this is a table you will truncate and load each day just leave the table as NOLOGGING.

  • How to move data from one database to another oracle database

    Hi
    All,
    AIX 5.3
    Oracle 10.2.0.3
    I want to move data between one oracle database to another oracle database.
    I know two method those are
    export/import
    dblink
    is there any other way I can move data?
    Thanks,
    Vishal

    I know below methods. However, using a perticular method is based on volume and type of data.
    1. imp/exp
    2. impdp/expdp
    3. SQL COPY command
    4. Transportable tablespace mathod
    5. dblink
    6. Export to flatfile and then use SQL Loader
    7. Oracle Migration Workbench
    Cheers
    Sameer

  • Best method for transferring data from one database to another?

    There is an 8i database I have to deal with on a regular basis. Besides being completely outdated and unsupported, in my opinion the database has not been well-maintained--for a table with 25 million records, should ‘select count(*) from table;’ take 5 minutes to run? I don’t really know, but that seems long to me. Many complex queries (most including only tables with less than a million records) take a ridiculously long time to run, to the point that I can’t even run some of them.
    I am not the DBA; I don't have the authority to fiddle with the database (nor would I feel comfortable doing that), and the powers that be will not put effort into improving functionality of this database due to an alleged plan to update/replace it within the next year. However, in the mean time, I still have to get data out of this database on a regular basis.
    I have XE 10g installed on my local machine, and I have set up a database link in it to the 8i database. I have found that I can pull in basic data (simple queries) from the 8i database into tables in my XE database (e.g. create table tbl1 as select data from tbl1@8idb) and then query those tables to get the information I need much, much faster (including creation of the tables). While this option does not allow me to create queries/reports that other people can run, it makes work I’m doing only for myself much faster.
    What I’m wondering is, what is the best way to bring the information I need over to my database? I usually don’t need entire tables, and I can probably identify a number of key tables (or parts of tables) I need. What I’ve been doing up until now is writing CREATE TABLE statements on the fly, but then I end up forgetting what all I’ve done, and each time I want up-to-date data, I have to drop the tables and re-create them. It seems to me that there should be an easier way to do this than to copy and paste from a text document into SQL*Plus.
    Does anyone have any suggestions for me on how best to do this?

    Sorry, I guess I posted this in the wrong forum. I re-posted in the database-general forum.

Maybe you are looking for

  • Down Payment clearing - after budget  2009

    Dear All, As per the changes in Budget 2009 (India),the new Tax procedure donu2019t have Surcharge and Cess, so when we book Invoice in Oct-09 its only Only Basic. The down payment which we have made/received  before Oct 09 has Surcharge & Cess. Now

  • Please help me understand this program's limit of use?

    If I have an adobe connect account, is a form on a formscentral url able to be edited in adobe connect? If the program designed to facilitate online conferences doesn't interface with a conferecne registration template program ran by the same company

  • ACE: Significance of mask in nat-pools configured for Source NAT

    Hi guys If I am using source nat in ACE (One IP address 10.10.10.200) used for all client address translations. What would be the difference between the nat-pools configured with different netmask. What is the recommended netmask for pat, 255.255.255

  • Why is Fox Soccer Plus not in HD?

    Verizon charges $14.99/mo for Fox Soccer Plus and even with a subscription, the channel is SD. Will this change? How is it decided whether a channel is HD or SD?

  • Cannot eject disk

    I burned a music CD. I ejected that disk and inserted a 2nd disk to make a 2nd copy. It does not show on the desktop. I have searched the forums and tried all the suggestions and still cannot eject the disk. I have Toast and a couple of disk ejector