专著oracle 技术 记录维护生产数据库的点点滴滴....

The SQL*Plus copy Utility

上一篇 / 下一篇  2006-06-21 09:12:47 / 个人分类:ITPUB

查看( 131 ) / 评论( 3 )
The SQL*Plus COPY command can copy data between two databases via SQL*Net. The preferred method of doing this is to use SQL*Plus on the host where the database resides. If performing the copy command from a client SQL*Net connection, the data is transferred through the client machine.




The SQL*Plus COPY command can copy data between two databases via SQL*Net. The preferred method of doing this is to use SQL*Plus on the host where the database resides. If performing the copy command from a client SQL*Net connection, the data is transferred through the client machine.

The copy command copies data from one Oracle instance to another. The data is simply copied directly from a source to a target. The format of the copy command is:

COPY FROM database TO database action -

destination_table (column_name, column_name...) USING query


The action can include:

· create – If the destination table already exists, copy will report an error, otherwise the table is created and the data is copied.

· replace – If the destination table exists, copy will drop and recreate the table with the newly copied data. Otherwise, it will create the table and populate it with the data.

· insert – If the destination table exists, copy inserts the new rows into the table. Otherwise, copy reports an error and aborts.

· append– Inserts the data into the table if it exists, otherwise it will create the table and then insert the data.

eg:
SQL> help copy

COPY
----

COPY copies data from a query to a table in a local or remote
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


SQL> copy from USER/PASS@DB to USER/PASS@DB2 -
> insert table_name using select * from table_name;

Array fetch/bind size is 15. (arraysize is 15)
Will commit when done. (copycommit is 0)
Maximum long size is 5000. (long is 5000)
10 rows selected from USER@DB
10 rows inserted into table_name .
10 rows committed into table_name  at USER@DB2

TAG:

HuiYi_love发布于2006-06-21 10:24:00

dba_mx发布于2006-06-21 10:46:13
嗯?楼主难道只是想贴个文档出来??

疑似灌水
oradbHome oradbHome 发布于2006-06-21 12:10:00

QUOTE:

最初由 dba_mx 发布
[B]嗯?楼主难道只是想贴个文档出来??

疑似灌水 [/B]
呵呵,主要是原来不知道还有copy命令,看到后就做了个测试。
我来说两句

(可选)

日历

« 2008-09-07  
 123456
78910111213
14151617181920
21222324252627
282930    

数据统计

  • 访问量: 7130
  • 日志数: 667
  • 建立时间: 2007-12-21
  • 更新时间: 2008-09-05

RSS订阅

Open Toolbar