Oracle µÄÊý¾Ýµ¼Èëµ¼³ö¼° Sql Loader (sqlldr) µÄÓ÷¨
ÔÎÄ:http://www.blogjava.net/Unmi/archive/2009/01/05/249956.html
ÔÚ Oracle Êý¾Ý¿âÖУ¬ÎÒÃÇͨ³£ÔÚ²»Í¬Êý¾Ý¿âµÄ±í¼ä¼Ç¼½øÐи´ÖÆ»òǨÒÆʱ»áÓÃÒÔϼ¸ÖÖ·½·¨£º
1. A ±íµÄ¼Ç¼µ¼³öΪһÌõÌõ·ÖºÅ¸ô¿ªµÄ insert Óï¾ä£¬È»ºóÖ´ÐвåÈëµ½ B ±íÖÐ
2. ½¨Á¢Êý¾Ý¿â¼äµÄ dblink£¬È»ºóÓà create table B as select * from A@dblink where ...£¬»ò insert into B select * from A@dblink where ...
3. exp A ±í£¬ÔÙ imp µ½ B ±í£¬exp ʱ¿É¼Ó²éѯÌõ¼þ
4. ³ÌÐòʵÏÖ select from A ..£¬È»ºó insert into B ...£¬Ò²Òª·ÖÅúÌá½»
5. ÔÙ¾ÍÊDZ¾ÆªÒªËµµ½µÄ Sql Loader(sqlldr) À´µ¼ÈëÊý¾Ý£¬Ð§¹û±ÈÆðÖðÌõ insert À´ºÜÃ÷ÏÔ
µÚ 1 ÖÖ·½·¨ÔڼǼ¶àʱÊǸöجÃΣ¬ÐèÈýÎå°ÙÌõµÄ·ÖÅúÌá½»£¬·ñÔò¿Í»§¶Ë»áËÀµô£¬¶øÇÒµ¼Èë¹ý³ÌºÜÂý¡£Èç¹ûÒª²»²úÉú REDO À´Ìá¸ß insert into µÄÐÔÄÜ£¬¾ÍÒªÏÂÃæÄÇÑù×ö£º
view source
print?
1.alter table B nologging;
2.insert /* +APPEND */ into B(c1,c2) values(x,xx);
3.insert /* +APPEND */ into B select * from A@dblink where .....;
ºÃÀ²£¬Ç°Ãæ¼òÊöÁË Oracle ÖÐÊý¾Ýµ¼Èëµ¼³öµÄ¸÷ÖÖ·½·¨£¬ÎÒÏëÒ»¶¨»¹Óиü¸ßÃ÷µÄ¡£ÏÂÃæÖص㽲½² Oracle µÄ Sql Loader (sqlldr) µÄÓ÷¨¡£
ÔÚÃüÁîÐÐÏÂÖ´ÐÐ Oracle µÄ sqlldr ÃüÁ¿ÉÒÔ¿´µ½ËüµÄÏêϸ²ÎÊý˵Ã÷£¬Òª×ÅÖعØ×¢ÒÔϼ¸¸ö²ÎÊý£º
userid -- Oracle µÄ username/password[@servicename]
control -- ¿ØÖÆÎļþ£¬¿ÉÄÜ°üº¬±íµÄÊý¾Ý
-------------------------------------------------------------------------------------------------------
log -- ¼Ç¼µ¼ÈëʱµÄÈÕÖ¾Îļþ£¬Ä¬ÈÏΪ ¿ØÖÆÎļþ(È¥³ýÀ©Õ¹Ãû).log
bad -- »µÊý¾ÝÎļþ£¬Ä¬ÈÏΪ ¿ØÖÆÎļþ(È¥³ýÀ©Õ¹Ãû).bad
data -- Êý¾ÝÎļþ£¬Ò»°ãÔÚ¿ØÖÆÎļþÖÐÖ¸¶¨¡£ÓòÎÊý¿ØÖÆÎļþÖв»Ö¸¶¨Êý¾ÝÎļþ¸üÊÊÓÚ×Ô¶¯²Ù×÷
errors -- ÔÊÐíµÄ´íÎó¼Ç¼Êý£¬¿ÉÒÔÓÃËûÀ´¿ØÖÆÒ»Ìõ¼Ç¼¶¼²»ÄÜ´í
rows -- ¶àÉÙÌõ¼Ç¼Ìá½»Ò»´Î£¬Ä¬ÈÏΪ 64
skip -- Ìø¹ýµÄÐÐÊý£¬±ÈÈçµ¼³öµÄÊý¾ÝÎļþÇ°Ã漸ÐÐÊDZíÍ·»òÆäËûÃèÊö
»¹Óиü¶àµÄ sqlldr µÄ²ÎÊý˵Ã÷Çë²Î¿¼£ºsql loaderµÄÓ÷¨¡£
ÓÃÀý×ÓÀ´ÑÝʾ sqlldr µÄʹÓã¬ÓÐÁ½ÖÖʹÓ÷½·¨£º
1. ֻʹÓÃÒ»¸ö¿ØÖÆÎļþ£¬ÔÚÕâ¸ö¿ØÖÆÎļþÖаüº¬Êý¾Ý
2. ʹÓÃÒ»¸ö¿ØÖÆÎļþ(×÷Ϊģ°å) ºÍÒ»¸öÊý¾ÝÎļþ
Ò»°ãΪÁËÀûÓÚÄ£°åºÍÊý¾ÝµÄ·ÖÀ룬ÒÔ¼°³ÌÐòµÄ²»Í¬·Ö¹¤»áʹÓõڶþÖÖ·½Ê½£¬ËùÒÔÏÈÀ´¿´ÕâÖÖÓ÷¨¡£Êý¾ÝÎļþ¿ÉÒÔÊÇ CSV Îļþ
Ïà¹ØÎĵµ£º
ÏÂÃæÊÇSql Server ºÍ Access ²Ù×÷Êý¾Ý¿â½á¹¹µÄ³£ÓÃSql£¬Ï£Íû¶ÔÄãÓÐËù°ïÖú¡£
н¨±í£º
create table [±íÃû]
(
[×Ô¶¯±àºÅ×Ö¶Î] int IDENTITY (1,1) PRIMARY KEY ,
[×Ö¶Î1] nVarChar(50) default \'ĬÈÏÖµ\' null ,
[×Ö¶Î2] ntext null ,
[×Ö¶Î3] datetime,
[×Ö¶Î4] money null ,
[×Ö¶Î5] int default 0,
[×Ö¶Î6] De ......
ÔÚSQL Server2005ÖÐÑ¡ÖÐÒªµ¼ÈëÊý¾ÝµÄ¿â > ÓÒ¼ü > н¨²éѯ£º
Ö´ÐÐSQLÓï¾äÈçÏ£º
insert into
Ä¿±êÊý¾Ý¿â±íÃû (×Ö¶Î1,×Ö¶Î2,....) select
×Ö¶Î1,×Ö¶Î2... from
openrowset
('microsoft.jet.oledb.4.0',';database=Ô´Êý¾Ý¿â·¾¶£¨È磺d:\test.mdb£©','select * from Ô´±í where ²éѯÌõ¼þ')
SQL Óï¾äÆôÓÃ×é¼ ......
Ê×ÏÈ£¬ÎÒÃÇ¿´¿´existsºÍinµÄЧÂÊÎÊÌ⣬ÕâÀïÎÒֻ˵Ã÷Ò»ÖÖ²âÊÔÓï¾ä
set statistics io on
sqlstatement
set statistics io off¡¢
»òÕß
set statistics time on
sqlstatement
set statistics time off
´ÓstudioÀïÃæµÄÏûÏ¢¿ÉÒÔ¿´³öÎÊÌ⣬ÎÒÒýÓÃÍøÉϵÄһЩ׼Ôòhttp://www.cnblogs.com/diction/arch ......
left join(×óÁª½Ó) ·µ»Ø°üÀ¨×ó±íÖеÄËùÓмǼºÍÓÒ±íÖÐÁª½á×Ö¶ÎÏàµÈµÄ¼Ç¼
right join(ÓÒÁª½Ó) ·µ»Ø°üÀ¨ÓÒ±íÖеÄËùÓмǼºÍ×ó±íÖÐÁª½á×Ö¶ÎÏàµÈµÄ¼Ç¼
inner join(µÈÖµÁ¬½Ó) Ö»·µ»ØÁ½¸ö±íÖÐÁª½á×Ö¶ÎÏàµÈµÄÐÐ
¾ÙÀýÈçÏ£º
--------------------------------------------
±íA¼Ç¼ÈçÏ£º
aID¡¡¡¡¡¡¡¡¡¡aNum
1¡¡¡¡¡¡¡¡¡¡a ......
´ó¼Ò¶¼ÖªµÀ£¬ÓÃPL/SQLÁ¬½ÓOracle£¬ÊÇÐèÒª°²×°Oracle¿Í»§¶ËÈí¼þµÄ¡£ÓÐûҪÏë¹ý²»°²×°Oracle¿Í»§¶ËÖ±½ÓÁ¬½ÓOracleÄØ£¿
ÆäʵÎÒÒ»Ö±ÏëÕâÑù×ö£¬ÒòΪÕâ¸ö¿Í»§¶ËʵÔÚÌ«ÈÃÈËÌÖÑáÁË£¡£¡£¡²»µ«»á°²×°Ò»¸öJDK£¬¶øÇÒ»¹»á°Ñ×Ô¼º·ÅÔÚ»·¾³±äÁ¿µÄ×îÇ°Ã棬»áÔì³É²»Ð ......