Copy table from one database to another database

Hi,
I am new to SQL and I have a question on copying a table.
QUE: copy one table with huge data(around 60millions of rows) from one database to another database(have to create a new table) in the same server. 

Hi ,
By mistake ,I understood you want to copy on different server .
I have rectify above.On same server we can copy Table in many way ;
As I mentioned Above you can use ;
select * into [Destination Database].[dbo].[NewTableName] from [SourceDatabase].[dbo].[Category]
Second;
select * into [Destination Database].[dbo].[NewTableName] from [SourceDatabase].[dbo].[Category] Where 1=2
Insert into [Destination Database].[dbo].[NewTableName]
select * from [SourceDatabase].[dbo].[Category]
Thanks

Similar Messages

  • To copy table from one database to another

    hai,
    I will be really pleased if someone can me tell me that how can i copy table from one database to another. I am having two databases.
    Gursimran

    You can Also do
    ++ Create a database link on the TARGET to SOURCE
    CREATE PUBLIC DATABASE LINK <<DBLNK_NAME>> CONNECT TO <<USER>> IDENTIFIED BY <<PASSOWORD>> USING '<<TNS_NAME>>';
    ++ And copy as below
    CREATE TABLE EMP AS SELECT * FROM EMP@DBLNK_NAME;

  • Best way to copy table from one database to any other database

    I need to write an application to perform database table copy from one kind of database to another kind of database.
    I just wrote a simple JDBC program which essentially does the something like below:
    PreparedStatement statement = null;
    ResultSet rs = null;
    try
    System.out.println("insertSQL:" + insertSQL.toString());      
    statement = target.prepareStatement(insertSQL.toString());
    System.out.println("selectSQL:" + selectSQL.toString());
    rs = source.executeQuery(selectSQL.toString());
    int rows = 0;
    while (rs.next())
    rows++;
    for (int i = 1; i <= columns.size(); i++)
    statement.setString(i, rs.getString(i));
    statement.execute();
    System.out.println("Copied " + rows + " rows.");
    But problem with this one is that it takes lot of time( more than 60 mins) for 100k records transfer. Would there be any faster way to do this?
    TIA...

    Thanks...
    I am using now batch update mechanism and set the fetchsize of resultSet cursor.
    Now I need to copy a table with almost 10 million records to the target database. My program works fine but it takes more than 3 hours.
    I am copying from Postgres table to MS SQL server table.
    Is there any other way or more better appraoch to make this more faster?
    TIA..

  • Copying  tables from one schema to another

    hi all,
    i have two schema where a has master tables.
    b schema is empty.. i want to copy all the tables from a schema to b with indexes and constraints
    I dont have import facility since i am using a client.
    thanks
    Hariharan M K

    Hi,
    Try this
    insert into table_name (select * from schema_name.table_name);if you have not permission to call by other schema then
    COPY FROM schema1/schema1@host_string -
    TO schema1/schema1@host_string-
    CREATE|INSERT|REPLACE  table_name [(column, column, column, ...)]
    USING select col1,col2,... from table_namehb venki

  • How to copy table from one sheet to another making formulas relative to current sheet

    I'm truly sorry if this has been answered within this forum but I've been reading these posts for the last hour and nothing. Ok so here's my issue:
    I'm trying to do a budget spreadsheet. My ss contains sheets with each one representing a month. So sheet 1 is called January, 2 February etc.
    I have two table in each sheet, one with a list of expenses and the other is a subtable with that references the first table for special expenses. The second table is identical in functionality in each sheet so I do a copy from January into February. However, when I copy into Feburary, all my formulas still point to 'January::' and I have to go and remove the 'January::' from each cell.
    Is there any way to copy the second table and make it relative to the sheet that it's in? It seems simple and maybe I'm doing something fundamentally wrong but I can't find the answer anywhere.

    I made a simple version of what I think you are describing:
    I gave each table a name "Tabl" and "SubTable"
    SubTable cell A1 is assigned as follows:
    A1=Table :: A1
    Then I duplicated the January Sheet by highlighting the sheet and typing the key command <COMMAND>+d (or selceting the menu item "Edit > Duplicate"):
    Then I change the name of the new shee from "January -1" to "February"
    The relative reference should already exist.
    You can confim this by changing the contants of the informaiton in cell A1 of Table in the "February sheet

  • How do I copy recordsets from one database table to another?

    I am using the Database Connectivity Toolset, and would like to copy either one recordset or multiple recordsets from one Access table to a table in a different database. I would like to do it directly with the data in variant form, but I can't get it to work. I can get it to work(on a small test table) if I first convert my source variant data to a cluster, then insert that into the other database table. My real database has many items with a variety of date types. Can I copy directly variant to variant?

    Is it necessary to read all the data back into LabVIEW first? The reason I'm asking is that it is much more efficient to just use SQL statements to get the data you need and write that directly to the second database. I did a quick Google search on it and came up with lots of responses on what the correct syntax is for setting that up. Using an SQL command to copy the data back and forth is analogous to copying data from one file to another using the Copy file function rather than reading the entire contents of the file, converting the file string to the data arrays, converting back to a string, and then writing it back to another file.
    Chapter 5 of the Database Connectivity Toolset User Manual describes how to execute SQL queries.
    If you do need to actually
    see the data in LabVIEW first, then the only way to get it back into the other database is to convert those variants to LV datatypes and then cluster those values again and write them back out to the second database.

  • How to Move or Copy the Tables from One Database to Another Database ?

    HI,
          Can any one help me on this, How i can move or copy the tables from one database to another database in SQL server 2005 by using SQL query. Hope can anyone provide me the useful and valuable response.
    Thanks
    Gopi

    Hello,
    Maybe these links help you out
    http://www.microsoft.com/downloads/en/details.aspx?familyid=56E5B1C5-BF17-42E0-A410-371A838E570A&displaylang=en
    http://www.suite101.com/content/how-to-copy-a-sql-database-a193532
    Also, you can just detach the database make a copy and move it to the new server.

  • Copying a table from one databse to another

    Hi,
    I used the following code to copy a table from one database to another.
    set copycommit 1
    set arraysize 1000
    copy from username/passwd@tnsname -
    create <tablename> -
    using -
    select * from <tablename>
    But I get the following error:
    set copycommit 1
    ERROR at line 1:
    ORA-00922: missing or invalid option
    Could you please let me know how this can be done.
    Thanks,
    Narasimhan

    Thanks for your suggestions.I created a database link.I had no problems.
    Then when i issue the command
    copy from uname/password@db
    create <tablename>
    using
    select * from <tablename>
    <Here db is database link to source database identified by uname and password>.
    I still get the error
    copy from uname/password@db
    ERROR at line 1:
    ORA-00900: invalid SQL statement
    Does it mean that the command is wrong?Or I'm doing something different.
    Thanks!

  • 10g express, scheduled copy of table from one db to another

    Hi,
    I don't know much about Oracle and was hoping if someone could shed some light on how we could implement our solution.
    Our scenario is as follows:
    For a new customer we are going to have 35million records per month coming into the database.
    What we had normally been doing in MSSQL, is creating a new table every month and writing the records in here (although we never had 35 million records before).
    The problem is, I want to archive these old monthly tables in order to save space. I don't know enough about the Oracle suite to see if there is already a program that we can schedule every month to move this table from one database to another. I was initially doing it by code, but this ends up taking 3 hours to copy... something we cannot afford.
    Is 35 million records too much to hold in a table? Should we be partitioning this down even more? I don't know where the threshold is before Oracle craps out.
    Or, maybe a better idea is to create a new database and just store new entries in a new database every month... this way we won't need to copy anything. To me, this sounds stupid though as i don't want to have 60 databases kicking around in five years.
    I'm a developer and no DBA, no one here is a DBA. We're trying to evaluate if our application is going to work on a Oracle platform all without knowing anything about it. Please help!
    Thanks,
    Kevin
    Message was edited by:
    user518940

    Kevin, you definately have the right database for 35M records/mth.
    From your post, it sounds like you need to retain the records in a database for 5 years (yes?). I don't know of any size limitation for Oracle outside of the OS. I don't think your solution should be multiple databases unless you have vastly different needs for the database that can not be satisfied with one instance - ie. OLTP vs. BATCH/OLAP...
    I don't fully understand what you are shooting for because it doesn't sound like you are going to save on any space just by moving the data from one database to another, the records will still require a similar amount of space unless compressed on another database. In either case, unless you can't, I would recommend a single database design. If you need high performance querying the data, and you query it by a specified period of time - ie month, I would recommend using enterprise edition with partitioning (seperately licensed). This would allow you to create a partitioned table where you could partition the table by month. As long as you don't create unnecessary global indexes, the performance should be quite similar to querying/inserting/appending into a table just containing 1 months records. Each partition can be placed in its own tablespace/datafile(s).
    If you absolutely must 'transport' the data to another instance (which I would strongly suggest that you should load it there in the first place unless business rules, performance limitations or something else simply don't allow it), you can use 'transportable tablespaces' and simply ftp the entire datafile to another Oracle database and attach it thus avoiding having to reload it. If it's truly historical you can just leave it ReadOnly. If you want to be tricky about it, you could try to make it part of a partitoned table on the new host.
    I hope I've helped just a little bit. If you need additional help, email me directly at LenLopez AT Yahoo DOT com

  • Getting error while creating table from one database to other.

    Hi,
    We are getting below error while creating the table from one database to other.
    SQL> create table fnd_lobs parallel compress as select * from [email protected];
    create table fnd_lobs parallel compress as select * from [email protected]
    ERROR at line 1:
    ORA-01555: snapshot too old: rollback segment number 28 with name "_SYSSMU28$"
    too small
    ORA-02063: preceding line from EEXIT2TEST
    ORA-01555: snapshot too old: rollback segment number 28 with name "_SYSSMU28$"
    too small
    ORA-02063: preceding line from EEXIT2TEST
    ORA-01555: snapshot too old: rollback segment number 28 with name "_SYSSMU28$"
    too small
    ORA-02063: preceding line from EEXIT2TEST
    ORA-01555: snapshot too old: rollback segment number 28 with name "_SYSSMU28$"
    too small
    Regards,
    Bhatia

    hi
    what are the apps version local and remote database???
    Snapshot too old errors occur because Oracle can 't reconstruct a consistent
    image of a block for the purposes of a consistent read.
    I feel at remote database, you are using UNDO, it will be rather easy to iincrease the undo retention time or increase the undo tablespace size.. if you are dealing with roll back segments, you may have rollback segments whose optimal values are too small...
    increase roll back segments size and select again then
    the following metalink notes might be helpful
    ORA-01555 "Snapshot too old" - Detailed Explanation Doc ID: 40689.1
    How To Avoid ORA-01555: Snapshot Too Old When Running PAAPIMP Doc ID: 603259.1
    OERR: ORA 1555 "snapshot too old (rollback segment too small)" Doc ID: 18954.1

  • How to copy a physical Alias table from one rpd to another

    Hi
    I am copy pasting the physical tables from one rpd to another. I first copied the physical table and then tried to copy the alias table i get the message ' Unknown Error' when i click ok it says
    'Failed to copy from clip board"

    Identify the "class=MyStyle" string in the MTML code, and use the Multi-File Find and Replace feature to step through each topic and change the specific instances to "class=MyOtherStyle." (I doubt that you'll want to "Replace All".)
    Sorry, there's no silver bullet!
    Good luck,
    Leon

  • How to copy a table from one system to another system

    Hi all,
            can any one say how to copy table from one system(sys1) to another system(sys2).
    regards,
    nagaraj

    There are many ways.
    1. Use the already existing transaport request number for that table to do the transaport (Active)
    2. Create mannual transport request from SE01 and in the object list enter following
    R3TR -- TABI -- <Table Name>
    And do the transaport.
    3. Ask your basis consultant to do the transaport from oracle layer.
    Thanks,

  • Copying value from one cursor to another

    Hi,
    I have a problem while copying values from one cursor to another cursor.
    The code looks like below.
    PROCEDURE XYZ
                TransactionResultSet OUT NOCOPY types.ref_cursor,
    IS
                temp_cursor types.ref_cursor;
                wip_rec types.ref_cursor;
    BEGIN
    DECLARE
                    CURSOR temp_cursor IS
                SELECT ...........
    END;
    BEGIN     
        FOR wip_rec IN temp_cursor
        LOOP
        update tinsagr set something
        where {the condition}
            IF SQL%ROWCOUNT = 0 THEN
      dbms_output.put_line('this is test ');
            Fetch wip_rec into TransactionResultSet;
         END IF;
       END LOOP;so basically i want to iterate the "temp_cursor" and depending on the values i get it from here i shall update a table. Actually i want to exclude few records from "temp_cursor" and add it/copy rest of the records to "TransactionResultSet"
    That means say initially " temp_cursor" has 100 records and i updated 5 records in a table and same number of records should be excluded and rest should be added to the output cursor TransactionResultSet.
    How do i achieve it?
    while saving i am getting
    (1): PLS-00456: item 'WIP_REC' is not a cursor.
    Do any one has any idea what to do in such scenario?

    There are options like....
    SQL> CREATE OR REPLACE TYPE emp_obj AS OBJECT (ename VARCHAR2(50), dept NUMBER);
      2  /
    Type created.
    SQL> CREATE OR REPLACE TYPE emp_tbl IS TABLE OF emp_obj;
      2  /
    Type created.
    SQL> set serverou on
    SP2-0158: unknown SET option "serverou"
    SQL> set serverout on
    SQL> DECLARE
      2    rc      sys_refcursor;
      3    v_ename emp.ename%TYPE;
      4    v_dept  emp.deptno%TYPE;
      5    ---End Of Local Varriable Declaration
      6    --Procedire declaration !
      7    PROCEDURE TEST_CUR(pi_out_ref_cur IN OUT sys_refcursor) IS
      8      emp_rec emp_tbl;
      9    BEGIN
    10      /* This BULK COLLECT can be done with explicit cursor,Ref Cursor
    11      with some simple modification, Here I have used implicit cursor! */
    12      SELECT emp_obj(ename, deptno) --Casting as the object
    13      BULK COLLECT
    14        INTO emp_rec
    15        FROM emp
    16       WHERE deptno = 10;
    17   
    18      dbms_output.put_line('Records selected are:');
    19      FOR i in 1 .. emp_rec.COUNT LOOP
    20        dbms_output.put_line(emp_rec(i).ename || '--' || emp_rec(i).dept);
    21      END LOOP;
    22      --Now we are filtering the record and may be doing some operation with each record.
    23      FOR i in 1 .. emp_rec.COUNT LOOP
    24        IF emp_rec(i).ename = 'KING' THEN
    25          --You can change this IF according to your need.
    26          emp_rec.DELETE(i);
    27        END IF;
    28      END LOOP;
    29      OPEN pi_out_ref_cur FOR
    30        SELECT * FROM TABLE(emp_rec); --Using the TYPE AS table.
    31    END TEST_CUR;
    32    /* Main execution or procedure calling section*/
    33  BEGIN
    34    --Actual calling
    35    TEST_CUR(rc);
    36    dbms_output.new_line;
    37    dbms_output.put_line('Now in Ref Cursor');
    38    dbms_output.put_line('****************');
    39    LOOP
    40      FETCH rc
    41        INTO v_ename, v_dept;
    42      dbms_output.put_line(v_ename || '--' || v_dept);
    43      EXIT WHEN rc%NOTFOUND;
    44    END LOOP;
    45 
    46  END;
    47  /
    Records selected are:
    CLARK--10
    KING--10
    MILLER--10
    Now in Ref Cursor
    CLARK--10
    MILLER--10
    MILLER--10
    PL/SQL procedure successfully completed.
    SQL>

  • Cutting and pasting tables from one project to another

    When cutting and pasting existing tables from one project to
    another, the line weights for the cell borders seem to vary at
    random - some are the original line weight and some are heavier
    when pasted.
    I've tried sorting things out with the table properties
    dialogue, but to no effect.
    Is there a quick fix, or am I better importing in whole
    topics and then editing the imported topic?

    Hi Colum/Peter,
    It's not a custom table, I just need to copy an existing
    table from one project to another.
    My blasted developers (may the fleas of a thousand camels,
    etc), just decided to change the toolbars in one of our
    applications. As this toolbar appears in slightly different guises
    in about 6 tabs, I was trying to update the table that shows what
    icon does what and cut and paste that table into all the sub
    projects I have. Each table then only needs a minor edit for a few
    icons specific to that sub-project.
    Peter's on the right track. When I cut and pasted the table
    it also pasted in a number of lines of HTML associated with the
    styles in the other project. If I delete those lines, the table
    then appears as it should.
    Thanks for prompt response

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

Maybe you are looking for

  • [solved] wicd do not work with wep or wpa/2...

    Hi! I have configured wicd using the wiki, and checked the steps several times... but only works when the wifi router is set to no encryption... If I use wep or wpa wpa2 it just keeps handshaking and never connects... any idea? Last edited by luuucia

  • ANY UPDATE ON PDF READER FOR CURVE 2 AND MORE ON BB PROTECT

    Please, I need an update if free pdf reader is now available for curve 2, OS V5. Please, how strong is Blackberry protect application on device installed  when intruders try to wide/format device and can I still have access to the device if number is

  • Can we get a "Add to Browser Favorites" URL from ABAP-side?

    Hi, via "Add to Browser Favorites", you can get a URL for opening exactly the portal page you are currently on. Is there any possibility to get (or create/generate) the URL for such a page from ABAP-side? We have the requirement to send e-mails from

  • ITunes comes up saying the iTunes library files cannot be saved. an unknown error occured

    iTunes comes up saying the iTunes library files cannot be saved. an unknown error occured what should i do

  • Windows Rfcexec rfc's

    Hi All, We have some RFC's running in our server manually, everyday we execute those rfc's at OS level. Can anyone please suggest us is there any procedure to run those rfc's without executing daily at OS level. How to register Program Id in SM59 lik