sqlplus copy在不同庫db遷移資料

wisdomone1發表於2013-05-20

--sqlplus copy可以自一個庫到另一個庫遷移資料庫表物件
SQL> copy
usage: COPY FROM TO

{ () } USING
     : database string, e.g.,
    : ONE of the keywords: APPEND, CREATE, INSERT or REPLACE --建立,新增,插入,替換表或表的資料
 
: name of the destination table --建立的目標表
  : a comma-separated list of destination column aliases --目標表的重新命名列
    : any valid SQL SELECT statement --源庫的select子句用於產生目標表或資料所用

---如不指定目標庫,則為當前庫,同理如僅指定to則源庫為當前庫,to指定目標庫
SQL> copy from create t_test_copy using select object_id o
bjectid from user_objects;

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 T_TEST_COPY created.

   28 rows selected from .
   28 rows inserted into T_TEST_COPY.
   28 rows committed into T_TEST_COPY at DEFAULT HOST connection.

SQL> desc t_test_copy;
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------

 OBJECTID                                           NUMBER(38)
 
--與copy效能相關的引數為arraysize,copycommit,long
 SQL> copy from create t_test_copy_2 using select object_id
 objectid from user_objects;

Array fetch/bind size is 5000. (arraysize is 5000)
Will commit after every 10 array binds. (copycommit is 10)
Maximum long size is 80. (long is 80)
Table T_TEST_COPY_2 created.

   30 rows selected from .
   30 rows inserted into T_TEST_COPY_2.
   30 rows committed into T_TEST_COPY_2 at DEFAULT HOST connection.

SQL>

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9240380/viewspace-761501/,如需轉載,請註明出處,否則將追究法律責任。

sqlplus copy在不同庫db遷移資料
請登入後發表評論 登入
全部評論

相關文章