Oracle sqlplus copyÃüÁîÓ÷¨
±¾ÎĽéÉÜÁËÈçºÎÀûÓÃsqlplus copy ÃüÁîÔÚÁ½¸öÊý¾Ý¿â¼äתÒÆÊý¾Ý
ÎÞÐèÓõ½dblink, Á½¸öÊý¾Ý¿â¼ä²»ÐèÖ±½ÓͨѶ£¬µ±È»£¬ÐèÒªÓÐÒ»¸öclient¶ÎÄÜͬʱÒÔsqlplusÁ¬½Óµ½Á½¸öÊý¾Ý¿â
ÎÊÌâµÄÌá³ö
ÂÛ̳ÉÏÓÐÈËÌá³öÕâÑùµÄÎÊÌ⣺
¼ÙÉèÓÐÁ½¸öÊý¾Ý¿â,·Ö±ð´¦ÓÚÁ½¸ö²»Í¬µÄÍøµ«ÓÐÒ»¸ö¿Í»§»ú°²ÁËÁ½¿éÍø¿¨¿ÉÒÔͬʱÁ¬µ½Á½¸öÊý¾Ý¿âÇëÎÊÈç¹û²»Í¨¹ýÔÚ¿Í»§»úÉϽ¨ÖÐת±í,ÓÐûÓа취ʵÏÖÕâÁ½¸öÊý¾Ý¿âÖдÓijһ¸öÍùÁíÒ»¸ö¿½±í.
ÎÊÌâµÄ½â´ð
¿ÉÒÔʹÓÃsqlplusµÄcopyÃüÁîÀ´´ïµ½¡£
copyµÄÃüÁîµÄÕâ¸öÑù×ӵģº
usage: COPY from <db> TO <db> <opt> <table> { (<cols>) } USING <sel>
<db> : database string
<opt> : ONE of the keywords: APPEND, CREATE, INSERT or REPLACE
<table>: name of the destination table
<cols> : a comma-separated list of destination column aliases
<sel> : any valid SQL SELECT statement
ʵ¼ÊÉÏдµÄÓ¦¸ÃºÜÇå³þÁË£¬°´ÕÕÄÇÑùµÄÓï·¨¾Í¿ÉÒÔÍê³ÉÁË¡£
ËüÏ൱ÓÚ´Ófrom DB¸ù¾Ý<sel>°ÑÊý¾ÝÈ¡µ½»º³åÇø£¬ÔÙ¸ù¾Ý<opt> ÔÚTO DBÖд´½¨table(create)»òÕß ÖØд´½¨table(replace)£¬È»ºó°ÑÊý¾Ýinsert»òÕßappend insert µ½TO DBµÄtableÖС£
Ø ÓÐÒ»µãÐèҪעÒâµÄ£¬Í¨³£»áÉèÖøßÒ»µãµÄarraysize£¬ÒÔ±ãʹsqlplusÓëDBµÄ½»»¥¼õÉÙ£¬ÒÔ´ïµ½¸üºÃµÄÐÔÄÜ¡£
Ø ÁíÍ⣬ÔÚдdatabase stringʱ£¬¿ÉÒÔ²»±Øд³öÃÜÂ룬sqlplus»áÉÔºó»áÌáʾÄãÊäÈëÃÜÂë¡£
Ò»¸öÍêÕûµÄÀý×Ó:
sqlplus /nolog
SQL> set arraysize 5000
SQL> copy from serol/luo@mescp to serol/luo@ractest create test_copy_table using select * from dba_objects;
Array fetch/bind size is 5000. (arraysize is 5000)
Will commit when done. (copycommit is 0)
Maximum long size is 5000. (long is 5000)
SQLRCN in cpytbl failed: -2120
Table TEST_COPY_TABLE created.
12579 rows selected from serol@mescp.
12579 rows inserted into TEST_COPY_TABLE.
12579 rows committed into TEST_COPY_TABLE at serol@ractest.
Ïà¹ØÎĵµ£º
oracle±í¿Õ¼ä²Ù×÷Ïê½â
1
2
3×÷Õߣº À´Ô´£º ¸üÐÂÈÕÆÚ£º2006-01-04
5
6
7½¨Á¢±í¿Õ¼ä
8
9CREATE TABLESPACE data01
10DATAFILE '/ora ......
* Èç¹ûij¸öÔ¼ÊøÖ»×÷ÓÃÓÚµ¥¶ÀµÄ×ֶΣ¬¼´¿ÉÒÔÔÚ×ֶ춶¨ÒåÔ¼Êø£¬Ò²¿ÉÒÔÔÚ±í¼¶¶¨ÒåÔ¼Êø£¬µ«Èç¹ûij¸öÔ¼Êø×÷ÓÃÓÚ¶à¸ö×ֶΣ¬
±ØÐëÔÚ±í¼¶¶¨ÒåÔ¼Êø
* ÔÚ¶¨ÒåÔ¼Êøʱ¿ÉÒÔͨ¹ýCONSTRAINT¹Ø¼ü×ÖΪԼÊøÃüÃû£¬Èç¹ûûÓÐÖ¸¶¨£¬ORACLE½«×Ô¶¯ÎªÔ¼Êø½¨Á¢Ä¬ÈϵÄÃû³Æ
¶¨Òåprimary keyÔ¼Êø(µ¥¸ö×ֶΣ©
create t ......
¿ª·¢Êý¾Ý¿âÓ¦Óã¬Ñ¡ÔñÒ»¸öºÃµÄÊý¾Ý¿âÊǷdz£ÖØÒªµÄ¡£±¾ÎÄ´ÓһЩ·½Ãæ±È½ÏÁËSQL ServerÓëOracle¡¢DB2ÈýÖÖÊý¾Ý¿â£¬ÎªÄãÑ¡ÔñÊý¾Ý¿âÌṩһЩ²Î¿¼¡£
¡¡¡¡
¡¡¡¡¿ª·ÅÐÔ
¡¡¡¡SQL Server
¡¡¡¡Ö»ÄÜÔÚWindows ÉÏÔËÐУ¬Ã»ÓÐË¿ºÁµÄ¿ª·ÅÐÔ£¬²Ù×÷ϵͳµÄϵͳµÄÎȶ¨¶ÔÊý¾Ý¿âÊÇÊ®·ÖÖØÒªµÄ¡£Windows9XϵÁвúÆ·ÊÇÆ«ÖØÓÚ×ÀÃæÓ¦Óã¬NT se ......
¹Ø¼ü×Ö: ºÊýrank, over partitionʹÓÃ
ÅÅÁУ¨rank()£©º¯Êý¡£ÕâЩÅÅÁк¯ÊýÌṩÁ˶¨ÒåÒ»¸ö¼¯ºÏ£¨Ê¹Óà PARTITION ×Ӿ䣩£¬È»ºó¸ù¾ÝijÖÖÅÅÐò·½Ê½¶ÔÕâ¸ö¼¯ºÏÄÚµÄÔªËؽøÐÐÅÅÁеÄÄÜÁ¦£¬ÏÂÃæÒÔscottÓû§µÄemp±íΪÀýÀ´ËµÃ÷rank over partitionÈçºÎʹÓÃ
1£©²éѯԱ¹¤Ð½Ë®²¢Á¬ÐøÇóºÍ
select deptno,ename,sal,
sum(sal)over ......
EXPºÍIMPÊÇOracleÌṩµÄÒ»ÖÖÂß¼±¸·Ý¹¤¾ß¡£Âß¼±¸·Ý´´½¨Êý¾Ý¿â¶ÔÏóµÄÂß¼¿½±´²¢´æÈëÒ»
¸ö¶þ½øÖÆת´¢Îļþ¡£ÕâÖÖÂß¼±¸·ÝÐèÒªÔÚÊý¾Ý¿âÆô¶¯µÄÇé¿öÏÂʹÓÃ,
Æäµ¼³öʵÖʾÍÊǶÁÈ¡Ò»¸öÊý¾Ý¿â¼Ç¼¼¯£¨ÉõÖÁ¿ÉÒÔ°üÀ¨Êý¾Ý×ֵ䣩²¢½«Õâ¸ö¼Ç¼¼¯Ð´ÈëÒ»¸öÎļþ,ÕâЩ¼Ç¼µÄµ¼³öÓëÆäÎïÀíλÖÃÎ޹أ¬µ¼ÈëʵÖʾÍÊǶÁȡת´¢Îļþ²¢
Ö´Ð ......