oracle文档中的介绍Server security for PL/SQL file I/O consists of a restriction on the directories that can be accessed. Accessible directories must be specified in the instance parameter initialization file (INIT.ORA). Specify the accessible directories for the UTL_FILE functions in the initialization file using the UTL_FILE_DIR parameter. For example: UTL_FILE_DIR = <directory name> -------------------------------------------------------------------------------- Note: The directory specification is different on different platforms. --------------------------------------------------------------------------------
If the initialization file for the instance contains the line UTL_FILE_DIR = /usr/jsmith/my_app, then the directory /usr/jsmith/my_app is accessible to the FOPEN function. Note that a directory named /usr/jsmith/My_App would not be accessible on case-sensitive operating systems. The parameter specification UTL_FILE_DIR = * has a special meaning. This entry turns off directory access checking, and it makes any directory accessible to the UTL_FILE functions.
可是我找不到init.ora这个文件啊?
搜过了,没有,我也觉得很奇怪.请问oracle版本不同,这个初始文件名也不同吗?我用的是8i 还有使用utl_file包的用户必须被授予这个包的execute权限,有例子是这样的:以sys身份登陆,执行:grant execute on utl_file to username.但总提示我'权限不够'的错误.
按init*.ora搜索试试 用internal用户呢
应为init<sid>.ora这样的文件名,不如你真的按init*.ora这样搜一下, 没有这样的文件,你是如何用的oracle呢,也或者你用的是oracle9i 如你用的是9i,用的是spfile 你可以用 alter system set utl_file_dir=/usr; 这样来设置
--------------------------------------------------------------------------------
Note:
The directory specification is different on different platforms. --------------------------------------------------------------------------------
If the initialization file for the instance contains the line UTL_FILE_DIR = /usr/jsmith/my_app, then the directory /usr/jsmith/my_app is accessible to the FOPEN function. Note that a directory named /usr/jsmith/My_App would not be accessible on case-sensitive operating systems. The parameter specification UTL_FILE_DIR = * has a special meaning. This entry turns off directory access checking, and it makes any directory accessible to the UTL_FILE functions.
还有使用utl_file包的用户必须被授予这个包的execute权限,有例子是这样的:以sys身份登陆,执行:grant execute on utl_file to username.但总提示我'权限不够'的错误.
用internal用户呢
没有这样的文件,你是如何用的oracle呢,也或者你用的是oracle9i
如你用的是9i,用的是spfile
你可以用
alter system set utl_file_dir=/usr;
这样来设置
我照两位老兄的办法做了,是有一个initorcl.ora(我创建的数据库sid:orcl),但里面没有utl_file_dir这个参数的设置,我自己加了进去,也还是不行!
我忘记internal用户的password,请相告!
加进去以后,重新启动数据库