The below is about Utl_file operation:
First, you should make a directory at the path so you wish:
[Email protected] ~]$ mkdir Test_dir
Anyone has the privileges read, write and execute
Use SYS log in Oracle:
[Email protected] ~]$ rlwrap sqlplus sys/[email protected]:1522/xe as SYSDBA; Sql*plus:release 12.1.0.1.0 Production on Mon Dec 7 14:35:22 2015Copyright (c) 1982, Oracle. All rights reserved. Connected to:oracle Database 11g Express Edition Release 11.2.0.2.0-64bit Production
Make directory alias for wish or found above
sql> Create or replace directory Blobdir as '/sandbox/test_dir ';D irectory created.
Add read and write privileges to the directory above
Sql> Grant Read,write on the directory Blobdir to GDB; Grant succeeded.
Check is there the directory:
Sql> SELECT * from All_directories;owner directory_name---------------------------------------------------- --------Directory_path--------------------------------------------------------------------------------SYS Test_dir/sandbox/project/modified03-cci-09abby/match_acct_reportsys xmldir/u01/app/oracle/product/11.2.0/ Xe/rdbms/xmlsys Data_pump_dir/u01/app/oracle/admin/xe/dpdump/owner Directory_ NAME------------------------------------------------------------Directory_ PATH--------------------------------------------------------------------------------SYS blobdir/sandbox/ Test_dir
Add execute privilege on UserAccount
Sql> Grant execute on utl_file to GDB; Grant succeeded.
Use Utl-file to operate file in Oracle