Solved

Creating Folders on OS from PLSQL

Posted on 2012-03-30
5
1,359 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

Suggested Solutions

Title # Comments Views Activity
Dataware house query tuning 9 78
grouping on time windows 6 51
Not able to add the URL for the   access control list - oracle plsql 10 96
How to free up undo space? 3 39
Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows how to recover a database from a user managed backup
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

776 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