Solved

Creating Folders on OS from PLSQL

Posted on 2012-03-30
5
1,304 Views
Last Modified: 2012-04-04
Hello Experts,

Is it possible to create a folder from PLSQL.

My database version is 10g and OS version is Windows XP and Redhat Linux.

I want from examples for this.
0
Comment
Question by:Swadhin Ray
5 Comments
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 167 total points
ID: 37786733
There is no direct way.

There is a trick from the link below that uses dbms_scehduler to call MKDIR.

http://www.orafaq.com/forum/t/154053/2/

exec dbms_scheduler.create_job('mkdir','executable','/bin/mkdir',1,auto_drop=>false);
exec dbms_scheduler.set_job_argument_value('mkdir',1,'/tmp/newdir');
exec dbms_scheduler.run_job('mkdir');
0
 
LVL 16

Assisted Solution

by:Wasim Akram Shaik
Wasim Akram Shaik earned 167 total points
ID: 37786736
you can't create physical directories  in OS using plsql..

there is an alternative way, you have to use external routines possibly a Java or C++ program which can do this for you..

i don't have this sample piece code for this, but you can refer to docs on how to call a routine from oracle

http://docs.oracle.com/cd/B19306_01/appdev.102/b14251/adfns_extern_proc.htm#i1019726
0
 
LVL 73

Assisted Solution

by:sdstuber
sdstuber earned 166 total points
ID: 37786787
if the system you want to create the directories in has an ftp server you could try

http://www.experts-exchange.com/A_3043.html

note, you would be limited to only those file systems exposed by the ftp server, but you could do it on multiple servers, all with pl/sql
0
 
LVL 16

Author Comment

by:Swadhin Ray
ID: 37786870
Thanks experts for you comments. I will try all the possible method and update as soon as possible.
0
 
LVL 16

Author Closing Comment

by:Swadhin Ray
ID: 37809570
By getting all the inputs I have used the JAVA source to solve my problem.

here are the steps that I used to accomplish my problem :
1)      Created a JAVA SOURCE on Oracle database.
2)      Create a wrapper to make use of the JAVA Source and named it like runOScm.
3)      Login with SYS user and grant DBMS_JAVA read, write and execute to the users from where we want to run the export (Export is my main issue where I am having a table with file name and doc contain with Langraw column )
4)      Then i had run the runOScm from java granted users to create folder.
5) Finally wrote one program which exported the LangRaw column i.e. contains pdf's , .doc files to folders based on its file name using UTL File.
6) Finally used script to FTP all the folders to other remote DB.


This is really great :-)  Thanks a ton experts..
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
Via a live example, show how to take different types of Oracle backups using RMAN.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now