Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> su - oracle -c "script"

su - oracle -c "script"

From: Joe Smith <joe_dba_at_hotmail.com>
Date: Thu, 11 Aug 2005 15:31:39 -0500
Message-ID: <BAY107-F26CC3868E2E968BD4081BF97BD0@phx.gbl>


I am trying to run this cmd as root from a shell script:

su - oracle -c /apps/oracle/product/9.2/bin/sqlplus /nolog @/apps/oracle/select_user.sql

output:

SQL*Plus: Release 9.2.0.6.0 - Production on Thu Aug 11 20:06:45 2005

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

Enter user-name:

As you can see it keeps asking my for a password. I have tried

sqlplus "/ as sysdba"

and all the other variations I can think of.

As oracle it works just fine:

[oracle_at_host] /apps/oracle$ sqlplus /nolog @select_users.sql

SQL*Plus: Release 9.2.0.6.0 - Production on Thu Aug 11 20:31:41 2005

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

Connected.
SQL> select username, default_tablespace from dba_users   2 /

USERNAME                       DEFAULT_TABLESPACE
------------------------------ ------------------------------
SYS                               SYSTEM
SYSTEM                         SYSTEM



How do I run this as root from a shell script, call my sql script owned by oracle and make it work?

thanks.



Don’t just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/
--
http://www.freelists.org/webpage/oracle-l
Received on Thu Aug 11 2005 - 15:33:49 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US