Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: su - oracle -c "script"
This is logging in now, but not running the sql script:
ROOT_at_host# more test.ksh
#!/bin/ksh
su - oracle -c '/apps/oracle/product/9.2/bin/sqlplus "/ as sysdba"'
@/apps/oracle/select_users.sql
ROOT_at_host# ./test.ksh
SQL*Plus: Release 9.2.0.6.0 - Production on Thu Aug 11 21:11:41 2005
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
With the Partitioning and OLAP options
JServer Release 9.2.0.6.0 - Production
SQL> I have used ' ' and " " around the script, but it is still not running the script, its logging in though!
thanks.
>On 11/08/05, Joe Smith <joe_dba_at_hotmail.com> wrote:
> > 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:
> >
>
>I do something similar but the call to SQL*Plus is in a script, i.e.
>
>su - oracle -c ./myscript.sh
>
>where, in this case, myscript.sh would be
>
>-------------------------------------------
>#!/usr/bin/ksh
>
>sqlplus /nolog <<EOF
>@/apps/oracle/select_user.sql
>EOF
>--------------------------------------------
>
>Have you tried doing that. I'd guess that what's happening is that
>the su command is interpreting the /nolog as a separate attribute. If
>you really don't want to encapsulate the call to SQL*Plus in a script
>then try putting it in quotes:
>
>su - oracle -c '/apps/oracle/product/9.2/bin/sqlplus /nolog'
>
>Stephen
>
>--
>It's better to ask a silly question than to make a silly assumption.
-- http://www.freelists.org/webpage/oracle-lReceived on Thu Aug 11 2005 - 16:15:25 CDT
![]() |
![]() |