Archive

Posts Tagged ‘copy’

Using SQL*Plus copy command in Oracle 11gR2

March 20, 2014 Leave a comment

There’s a unusual command in SQL*Plus that may be useful under certain circumstances: the COPY command (http://docs.oracle.com/cd/E11882_01/server.112/e16604/apb.htm).

Although this command will be obsoleted in future releases of SQL*Plus, Oracle has been saying the same since (at least) Oracle 9, and it’s still available in Oracle 11gR2.

I need to copy a table from one database to another database, and I don’t want to do an export/import of the table.

A simple copy of the table is enough for me:


miquel@db_2> copy from otheruser@db_1 create my_table using select * from other_table;
Enter FROM password:

Array fetch/bind size is 1000. (arraysize is 1000)
Will commit when done. (copycommit is 0)
Maximum long size is 2000000000. (long is 2000000000)
Table MY_TABLE created.

55481 rows selected from otheruser@db_1.
 55481 rows inserted into MY_TABLE.
 55481 rows committed into MY TABLE at DEFAULT HOST connection.

It’s that simple!

Feel free to comment below.

Categories: 11gR2, oracle, SQL*Plus Tags: