码迷,mamicode.com
首页 > 数据库 > 详细

Use utl-file to operate file in Oracle

时间:2015-12-09 19:23:04      阅读:163      评论:0      收藏:0      [点我收藏+]

标签:

the below is about utl_file operation:

first, you should make a directory at the path that you wish:

[jeffreyxu@rat167 ~]$ mkdir test_dir

 

anyone has the privileges read, write and execute

[jeffreyxu@rat167 ~]$ chmod 777 test_dir 

 


use sys log in oracle:

[jeffreyxu@rat167 ~]$ rlwrap sqlplus sys/111111@localhost:1522/xe as sysdba;

SQL*Plus: Release 12.1.0.1.0 Production on Mon Dec 7 14:35:22 2015

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

 
make directory alias for you wish or found above

SQL> create or replace directory BLOBDIR as ‘/sandbox/test_dir‘;

Directory created.

 

 add read and write privileges to the directory above

 SQL> grant read,write on 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_report

SYS                   XMLDIR
/u01/app/oracle/product/11.2.0/xe/rdbms/xml

SYS                   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

标签:

原文地址:http://www.cnblogs.com/Jeffrey-xu/p/5033637.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!