UTL_FILE_DIR 参数 和 directory 的作用是让Oracle通过Package(比如utl_file)来对OS上的文件进行操作(如创建,修改等)。
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.
Oracle9i R2后建议使用directory , 当然,现在11g R2了,其实UTL_FILE_DIR 还是用得很广泛,directory 仅仅用在了expdp/impdp上, 可能是因为UTL_FILE_DIR 不需要任何赋权就可以使用的原因, 而directory需要赋予用户读写权限 。directory 新增和修改不需要重启数据库,而utl_file_dir 需要。
使用 UTL_FILE_DIR(参数文件) :
alter system set UTL_FILE_DIR='/data/file_dir'
alter system set UTL_FILE_DIR='/data/file_dir','/u01/exp_dir'
使用 Directory :
create or replace directory UTF_DIR_01 as '/u01/exp_dir';
grant read,write on directory UTF_DIR_01 to wang ;
可以通过 查询dba_directories 查看所有directory, drop directory exp_dir; 删除。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/35489/viewspace-1351241/ ,如需转载,请注明出处,否则将追究法律责任。