[Oracle] SQL*Loader 详细使用教程(2)- 命令行参数

sqlldr工具

 

SQL*Loader的客户端工具是sqlldr,在操作系统的命令行下输入sqlldr,后面不接任何参数,将显示帮助信息如下所示(所有命令行参数的简单描述及其默认值),所以你并不需要对下面的参数死记硬背,当你忘记它们时,可以通过这个方式快速查询。

 

[plain] view plain copy
 
 print?
  1. Valid Keywords:  
  2.   
  3.     userid -- ORACLE username/password             
  4.    control -- control file name                    
  5.        log -- log file name                        
  6.        bad -- bad file name                        
  7.       data -- data file name                       
  8.    discard -- discard file name                    
  9. discardmax -- number of discards to allow          (Default all)  
  10.       skip -- number of logical records to skip    (Default 0)  
  11.       load -- number of logical records to load    (Default all)  
  12.     errors -- number of errors to allow            (Default 50)  
  13.       rows -- number of rows in conventional path bind array or between direct path data saves  
  14.                (Default: Conventional path 64, Direct path all)  
  15.   bindsize -- size of conventional path bind array in bytes  (Default 256000)  
  16.     silent -- suppress messages during run (header,feedback,errors,discards,partitions)  
  17.     direct -- use direct path                      (Default FALSE)  
  18.    parfile -- parameter file: name of file that contains parameter specifications  
  19.   parallel -- do parallel load                     (Default FALSE)  
  20.       file -- file to allocate extents from        
  21. skip_unusable_indexes -- disallow/allow unusable indexes or index partitions  (Default FALSE)  
  22. skip_index_maintenance -- do not maintain indexes, mark affected indexes as unusable  (Default FALSE)  
  23. commit_discontinued -- commit loaded rows when load is discontinued  (Default FALSE)  
  24.   readsize -- size of read buffer                  (Default 1048576)  
  25. external_table -- use external table for load; NOT_USED, GENERATE_ONLY, EXECUTE  (Default NOT_USED)  
  26. columnarrayrows -- number of rows for direct path column array  (Default 5000)  
  27. streamsize -- size of direct path stream buffer in bytes  (Default 256000)  
  28. multithreading -- use multithreading in direct path    
  29.  resumable -- enable or disable resumable for current session  (Default FALSE)  
  30. resumable_name -- text string to help identify resumable statement  
  31. resumable_timeout -- wait time (in seconds) for RESUMABLE  (Default 7200)  
  32. date_cache -- size (in entries) of date conversion cache  (Default 1000)  
  33. no_index_errors -- abort load on any index errors  (Default FALSE)  

 

另外两种配置命令行参数的方法

 

如果每次都必须在sqlldr中输入参数,一定烦不胜烦,因此Oracle提供了两种方式用来存储通用的参数,方便重用。

第一种方法是使用参数文件,把通用的参数写在参数文件中,然后在sqlldr中用parfile指定该参数文件。

第二种方法是把通用参数写在控制文件的OPTIONS字句中,并在sqlldr中用control指定控制文件。

我通常采用第二种方法,因为这样可以省了参数文件,比较方便。

那如果上面三个地方都配置了同一个参数,谁的优先级大呢?sqlldr命令行 > 参数文件 > 控制文件。

 

导入数据到远程数据库

 

SQL*Loader默认是导入到本地数据库,但也支持导入到远程数据库,只要在username后面“@远程数据库连接字符串”即可,如下所示:

 

> sqlldr CONTROL=ulcase1.ctl
Username: scott@inst1
Password: password

 

命令行参数详细说明

 

1. 指定文件名:control, bad, log, data, discard, parfile

2. 传统路径加载:direct=false(默认);直接路径加载:direct=true

3. 最大允许错误的记录数:errors;最大允许丢弃的记录数:discardmax;最大允许加载的记录数:load

4. 只有在直接路径加载下才能用的参数:no_index_errors(默认为false,如果为true表示在加载过程中不会把index设为unusable);parallel(默认为false,如果为true表示启用并行加载);skip_index_maintenance(默认为false,如果为true表示在加载过程中停止索引的维护)

5. rows:表示达到多少行将提交,默认(传统路径加载64,直接路径加载all)

6. skip:省略最前面的记录数

 

 
 

[Oracle] SQL*Loader 详细使用教程(4)- 字段列表

posted @ 2016-07-30 10:31  zfswff  阅读(1426)  评论(0编辑  收藏  举报