Use Utl-file to operate file in Oracle

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.