Welcome Guest ( Log In | Register )


 
 
 
 
 
 

 
 
Oracle 

performance Tuning 10g reference poster
 
Oracle training in Linux 

commands
 
Oracle training 

Excel
 
Easy Oracle Jumpstart
 
Oracle training & performance tuning books
 
Burleson Consulting Remote DB Administration
 
 
 
Closed TopicStart new topic
> to execute UNIX shell script from Oracle Function
venkatesh03
post Apr 27 2012, 07:12 AM
Post #1


Advanced Member
***

Group: Members
Posts: 39
Joined: 17-July 10
Member No.: 43,498



Hi,
I have a requirement where i need to execute a unix shell script "a.sh" having permissions user1,group1 and no access to public. This should be executed from Oracle function.

So i wrote a routine in Java and it works fine when i execute a command like Date etc.

But when i execute "a.sh" from oracle client, its returning error that "could not be executed-permission denied". This is because once login happened through the "sqlplus" the shell takes user as "oracle" and group as "dba" but the script "a.sh" having only permissions user1,group1. Unfortunately we are not allowed to change the permission for "a.sh" to give execute permission to all(public).

After searching in internet, i understand that one way is to make the password (/etc/passwd) for the user "user1" as no password and can use "su" command so that it wont ask password while invoking it.

Is there any other way apart from this doing changes in password file at UNIX level when executing a script from oracle client?

Please let me know if further information is required.

Oracle: version: 11.2.0.1
UNIX : AIX -5.9

Thanks & Regards,
Venkatesh S
Go to the top of the page
 
+Quote Post
burleson
post Apr 27 2012, 08:02 AM
Post #2


Advanced Member
***

Group: Members
Posts: 11,090
Joined: 26-January 04
Member No.: 13



Hi Vencat,

See here:

http://www.dba-oracle.com/t_unix_linux_cpm...side_oracle.htm

http://www.dba-oracle.com/t_execute_shell_...l_procedure.htm

Jon Emmons has working examples in the code download with his book "Oracle shell scripting":

http://www.rampant-books.com/book_0701_shell_scripting.htm


--------------------
Hope this helps. . .

Donald K. Burleson
Oracle Press author
Author of Oracle Tuning: The Definitive Reference
Go to the top of the page
 
+Quote Post
venkatesh03
post Apr 30 2012, 07:57 AM
Post #3


Advanced Member
***

Group: Members
Posts: 39
Joined: 17-July 10
Member No.: 43,498



QUOTE (burleson @ Apr 27 2012, 09:02 AM) *



Hi Burleson,
Thanks for your reply.
I checked the link which you have given.

Please check the file permission below and the execution of statements.

-rwxr-s--- 1 user1 group1 62 Apr 30 08:24 a.sh
-rwsr-sr-x 1 user1 group1 68 Apr 30 08:28 call_a.sh


I executed 2 UNIX commands , one is "date" command ["date" can be executed by all users] and other is "call_a.sh" as below with output.

SQL> select OSexec('/usr/bin/date') as STDOUT from dual;

STDOUT
--------------------------------------------------------------------------------

Mon Apr 30 08:32:01 EDT 2012

SQL> select OSexec('/home/call_a.sh') as STDOUT from du
al;

STDOUT
--------------------------------------------------------------------------------

126


Here the first query return correct values while the second one gives error, return value as "126".

Kindly let me know if any changes required in file permission.

Thanks & Regards,
Venkatesh S
Go to the top of the page
 
+Quote Post
burleson
post Apr 30 2012, 08:11 AM
Post #4


Advanced Member
***

Group: Members
Posts: 11,090
Joined: 26-January 04
Member No.: 13



Hi Vencat,

Why the sticky bits?

>> Kindly let me know if any changes required in file permission.

Try using chmod and see!


--------------------
Hope this helps. . .

Donald K. Burleson
Oracle Press author
Author of Oracle Tuning: The Definitive Reference
Go to the top of the page
 
+Quote Post

Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 19th April 2014 - 07:51 PM