Home » SQL & PL/SQL » SQL & PL/SQL » Getting OS info in PLSQL
Getting OS info in PLSQL [message #206749] Fri, 01 December 2006 06:08 Go to next message
Aju
Messages: 94
Registered: October 2004
Member

Hi

I have got a unique requirement. I will be provided with a directory name with the entire UNIX path. From the directory name I will have to collect all the subdirectory name. Within each subdirctory there will be only 1 file. I need to extract each of these filenames, its creation date and push all these information into a UNIX file.

Can anyone please help me on this.
I tried to use the prorgam as in the link below but it shows Java is not installed.
http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:439619916584

SQL> create or replace
2 and compile java source named "DirList"
3 as
4 import java.io.*;
5 import java.sql.*;
6
7 public class DirList
8 {
9 public static void getList(String directory)
10 throws SQLException
11 {
12 File path = new File( directory );
13 String[] list = path.list();
14 String element;
15
16 for(int i = 0; i < list.length; i++)
17 {
18 element = list[i];
19 #sql { INSERT INTO DIR_LIST (FILENAME)
20 VALUES (:element) };
21 }
22 }
23
24 }
25 /
create or replace
*
ERROR at line 1:
ORA-29538: Java not installed

Thanks


Here is the information on my database
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi
TNS for Solaris: Version 10.2.0.1.0 - Production

As per the solution from reisman...
In 10g it is possible to execute an operating system command using the DBMS_SCHEDULER package.

But I could not find any reference in the DBMS_SCHEDULER package where I can get the OS info into Oracle PLSQL.

Sorry that I missed the response of Relisman

Thanks
Re: Getting OS info in PLSQL [message #206756 is a reply to message #206749] Fri, 01 December 2006 06:38 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10672
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
>> But I could not find any reference in the DBMS_SCHEDULER package
Not sure where you searched, but it is documented allover web and oracle documentation.
http://www.oracle-base.com/articles/10g/Scheduler10g.php
Re: Getting OS info in PLSQL [message #207025 is a reply to message #206749] Sun, 03 December 2006 23:19 Go to previous messageGo to next message
Aju
Messages: 94
Registered: October 2004
Member
Thanks Mahesh/Relisman for your time.

Sorry that I mis-interpreted the statement. What I mean is as below.

I understand, DBMS_Scheduler package executes a job according to the schedule you need. But as per Relisman this can execute operating system command. Please correct me if if i am wrong and guide how to acheive this.

In fact my requirement is to get all UNIX files attrbutes in a directory(filename, Creation_Date, filsize) into oracle (and may be I need to insert these values into a table)

In fact my team has done this through AB initio and Unix script but I am just wondering how to have this in PLSQL and exclude the Unix scripting
Re: Getting OS info in PLSQL [message #207125 is a reply to message #207025] Mon, 04 December 2006 04:12 Go to previous message
Mahesh Rajendran
Messages: 10672
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
write a shell script and call it in dbms_scheduler.
That is it.
Or
Are you expecting us to write the shell script?
Previous Topic: SQLPLUS login problem URGENT !!!
Next Topic: Is this Possible
Goto Forum:
  


Current Time: Sat Dec 10 11:01:27 CST 2016

Total time taken to generate the page: 0.08581 seconds