utl_file包的應用

tolywang發表於2007-07-25
需要指定utl_file包可以操作的目錄。在oracle 10g以前,可以用以下方法:
1、alter system set utl_file_dir='e:utl' scope=spfile;

2、在init.ora檔案中,配置如下:
UTL_FILE=E:utl或者UTL_FILE_DIR=E:utl
在oracle 10g中建議用以下方法配置:CREATE DIRECTORY utl AS 'E:utl';
參見oracle online:
In the past, accessible directories for the UTL_FILE functions were specified in the initialization file using the UTL_FILE_DIR parameter. However, UTL_FILE_DIR access is not recommended. It is recommended that you use the CREATE DIRECTORY feature, which replaces UTL_FILE_DIR. Directory objects offer more flexibility and granular control to the UTL_FILE application administrator, can be maintained dynamically (that is, without shutting down the database), and are consistent with other Oracle tools. CREATE DIRECTORY privilege is granted only to SYS and SYSTEM by default.

第三步:授權給指定使用者,以便執行utl_file
GRANT EXECUTE ON utl_file TO scott;

第四步:conn scott/tiger
就可以正常使用utl_file了。

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

相關文章