su - oracle -c "script"

  • From: "Joe Smith" <joe_dba@xxxxxxxxxxx>
  • To: oracle-l@xxxxxxxxxxxxx
  • Date: Thu, 11 Aug 2005 15:31:39 -0500

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@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/


--
//www.freelists.org/webpage/oracle-l

Other related posts: