使用copy命令拷贝数据表

实现同一个数据库不同用户间的表的拷贝 

首先看下copy命令的解释

SQL> help copy;


 COPY
 ----


 Copies data from a query to a table in the same or another
 database. COPY supports CHAR, DATE, LONG, NUMBER and VARCHAR2.


 COPY {FROM database | TO database | FROM database TO database}
            {APPEND|CREATE|INSERT|REPLACE} destination_table
            [(column, column, column, ...)] USING query


 where database has the following syntax:
     username[/password]@connect_identifier


首先给两个不同的用户授予表空间无限制操作权限

grant ulimited tablespace to test1;

grant ulimited tablespace to test;


SQL> copy from test1/test1@orcl1 to test/test@orcl1 create goods using select * from goods;


Array fetch/bind size is 15. (arraysize is 15)
Will commit when done. (copycommit is 0)
Maximum long size is 80. (long is 80)
Table GOODS created.


   16 rows selected from test1@orcl1.
   16 rows inserted into GOODS.
   16 rows committed into GOODS at test@orcl1.

posted @ 2015-09-02 10:26  饺子吃遍天  阅读(352)  评论(0编辑  收藏  举报