Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> su - oracle -c "script"
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.
-- http://www.freelists.org/webpage/oracle-lReceived on Thu Aug 11 2005 - 15:33:49 CDT
![]() |
![]() |