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;

Similar Messages

  • 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

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

  • How to Copy (or) Transfer data in a BLOB Table From one database to another

    Dear Members,
    I want to Copy or Tranfer the data in a Table having BLOB Column from one database to another database.
    The Problem is that I am using COPY Command.
    COPY from scott/[email protected] to k5esk_ldb2/k5esk_ldb2@k5_ist.world CREATE BLOB_TABLE using select * from BLOB_TABLE;
    This is working only if the table is not having BLOB Column or CLOB columns.
    Is there any other way to do the same.
    Appreciate any Help.
    Regards
    Madhu K

    You could try using export/import utilities, but may run into tablespace issues if the tablespaces are not the same between the two databases. You can also try Data Pump using the REMAP_TABLESPACE variable if you tablespaces are different. You could also write your own export and import code...there are plenty of examples of that to copy.

  • Simple: How to copy a Table from one Database to another?

    I already know how to do it by creating an identical table and then inserting the Data.
    Like so:
    SET IDENTITY_INSERT dByDtMinusC5 ON
    INSERT INTO [DB1]..T1 ([Id], [HbyD] , [K] )
    SELECT [Id], [[HbyD]]] ,[K] FROM [DB2]..T2
    As you can see I need to have T1 in order to copy T2 into DB1. Is there any way that I could auto create T1 and copy T2?
    There are so many forums in sql server Category, I hope I posted in the right one :0 . We need tag system for forums.   

    Hi Bhupinder,
    According to your description, you want to copy a table with Primary keys from one database to another database.
    As per my understanding, I think the best method is use Transfer SQL Server Objects Task in SQL Server Integration Services. The Transfer SQL Server Objects task transfers one or more types of objects in a SQL Server database between instances of SQL Server.
    Server roles, roles, and users from the specified database can be copied, as well as the permissions for the transferred objects. Indexes, Triggers, Full-text indexes, Primary keys, Foreign keys can also be copied.
    To use the Transfer SQL Server Objects Task, we should create a SQL Server Integration Services Project in SQL Server Data Tools, then drag a Transfer SQL Server Objects Task to Control Flow pane. Specify SourceConnection, SourceDatabase, DestinationConnection
    and DestinationDatabase for the Connection, select the table in the ObjectsToCopy category, then change CopyPrimaryKeys to True and the other corresponding properties in the task.
    References:
    Transfer SQL Server Objects Task
    Transfer SQL Server Objects Task in SSIS 2008 R2 With Example
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • In PL-SQL copy a table from one database to another

    I am currently working on a VB app where I need a way to archive tables from the running database to an archive database. I was hoping to do this with a stored procedure. Thanks for any suggestions in advance.

    AFAIAA there is no equivalent of the SQL*Plus copy command, but it is realtively simple to build such a thing in PL/SQL using DBMS_SQL or EXECUTE IMMEDIATE to issue the necesssary INSERT INTO table@archive_db select * from table;It's simple to create the table in the archive db , you just test for it's exist using %SQLFOUND.
    If you want it fancier, eg. changing the tablename dynamically that's also easy.
    rgds, APC

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

  • How to mirroring/replicating a table from one database to another database?

    I am having a table in 10g Database.
    I want to mirror this table in 9i Database.
    How to do this?

    1) Just to clarify, it is quite possible to use Streams between a 9i and 10g database (note for future reference that specifying actual database versions, i.e. 9.2.0.4 or 10.2.0.4 rather than marketing labels is generally helpful because there may be differences between different 9i and 10g releases)
    2) Are you setting up one-way replication? Or will changes be made on both databases, implying the need for multi-master replication?
    3) Why doesn't the table have a primary key? Could you declare a primary key? If not, you'd have to use the ROWID (i.e. specify WITH ROWID when creating the materialized view log and the materialized view) which tends to cause maintenance issues down the line. It really doesn't make sense to replicate a table without a primary key-- it really doesn't make sense to design a table without a primary key the vast majority of the time.
    Justin

  • 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 could I copy contraints from one database to another?

    Hi,
    I have a specific problem.
    I have taken a datadump and executed in another database. Some how the contraints were not copied.
    So I created following script to genrated alter statement and then run the script in target database:
    declare
    cursor get_cons is
    select distinct dc.table_name table_name, decode ( substr(dc.constraint_name,1,3), 'SYS', ' ', 'CONSTRAINT ' dc.constraint_name ) contraint, wmsys.wm_concat(ucc.column_name) over ( partition by dc.constraint_name order by dc.constraint_name ) cols
    from user_constraints dc,
    user_cons_columns ucc
    where dc.table_name like '%'
    and dc.constraint_type = 'P'
    and dc.table_name = ucc.table_name
    and dc.constraint_name = ucc.constraint_name;
    lv_sql varchar2(2000);
    begin
    for i in get_cons
    loop
    lv_sql := 'ALTER TABLE '
    I.TABLE_NAME
    +' ADD ('+
    i.contraint
    +' PRIMARY KEY ( '+
    I.COLS
    +' )); ';+
    dbms_output.put_line( lv_sql );
    end loop;
    end;
    Is there a better way to do it?
    Thank You,
    Ranjeeth

    Hi,
    do u have idea about move data from development environment to production environment.
    what is the simpleast way. suppose if we refer DATAPUMP or EXP/IMP. How to do it.
    through EXP command i am exporting full database or specified tables. but problem is i am not able import which i exported tables.
    can u give me the steps to how to import .DMP files through command prompt.
    Thanks
    Venkat.

  • 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

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

  • What is te best way to copy a table from a database to another?

    Hello friends:
    I have two databases: an Access database and an Oracle database. I must copy the data from al tables from the Access database to the oracle database. The tables in the both databases are equal (number of columns, type, etc).
    I read an resultset from acces (select * from table1) and I insert every row in the Oracle database with an while loop (while (r.next)...). It works fine when there are a few rows, but I have a table with over 200000 rows, and when I'm copying the row number 30.000, the system goes very slow...
    How can I copy tables from a database to another more quickly?
    Thanks!

    CASE #1
    The most efficient method would be to copy all the rows from Microsoft Access and write them to a text file using Access's native interface (not JDBC), then use Oracle's SQL Loader utility (not JDBC) to insert the data.
    You can insert 200,000 rows of 80 bytes each in 30 seconds or less even on a modest Oracle system using SQL Loader. The extract from Access is very dependent on the size of the CPU and the available memory.
    Hint 1: Avoid explicit or implict network traffic.
    Hint 2: Extract and load from local drives rather than networked or shared drives on other services
    Please note that this is done for efficiency of load, but has issues related to error checking, and operational scripting.
    Anything else you do or use will be slower than the method (above).
    CASE #2
    If you want to integrate this into a single JDBC program which will provide better operational management of the process, then you can simply connect to both databases in your Java program, then read the rows one at a time from Access, insert them using the Batch mechanism of JDBC to Oracle. You will also want to set the FetchSize in Oracle to a larger value then the default (i.e set it to 100 vs 10).
    Hint #3 You may want to look into alternative JDBC drivers for accessing MS Access, rather than the JDBC-ODBC bridge which is not optimized for MS Access. You may also want to consider using the OCI8 driver from Oracle rather than the thin driver. Both provide Type 4 functionality but I have heard (not experienced) that the OCI8 driver is better for managing batch style of processing like yours
    Good luck!
    Joel

  • 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

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

Maybe you are looking for

  • How to reset username and password

    I Have a WRT 320 N router and we need to access but it refuses to accept  default username and password (admin) what do we do now???

  • Invisble child window pane

    Hi,         I'm currently doing a project which has parent and child vi concept. When i was searching for few examples related to the concept, i came across this example. In this example i'm not able to drag if the window pane is invisble, meaning th

  • Where the XML file is generated

    Hi, Im trying to upgrade our R3 4/7 to ERP6 ehp4. We have solution_manager Ehp1 witch is intalled. My Instance is known in the solution manager ( SMSY ) I have lauch a maintenance task ( i have select the coponant ) but i haven't see nowhere this XML

  • Weird SQUARE BOXES in updated fields

    I updates few hundreds of records by multiple updte statements where i copied and inserted values. I think I left some blank spaces .. i donno but ... When i SELECT everything from what i updated I see some weird boxes (ONE SQUARE SHAPE BOX) next to

  • Save for web & devices has stopped working in (CS5) ?

    In save for web & devices, you alter the size, and select size, but it doesn't change it. It used to work okay. The only option I have is to change the image size under usual image size.