Re: su - oracle -c "script"

  • From: "Joe Smith" <joe_dba@xxxxxxxxxxx>
  • To: stephenbooth.uk@xxxxxxxxx
  • Date: Thu, 11 Aug 2005 16:24:59 -0500

This works:

ROOT@host# vi test.ksh
"test.ksh" 3 lines, 120 characters
#!/bin/ksh
su - oracle -c '/apps/oracle/product/9.2/bin/sqlplus "/ as sysdba"' < /apps/oracle/select_users.sql



USE OF THIS SYSTEM CONSTITUTES CONSENT TO MONITORING FOR THESE PURPOSES.

You have new mail.
stty: : Inappropriate ioctl for device
stty: : Inappropriate ioctl for device
stty: : Inappropriate ioctl for device

SQL*Plus: Release 9.2.0.6.0 - Production on Thu Aug 11 21:23:23 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> Connected.
SQL> SQL>   2
USERNAME                       DEFAULT_TABLESPACE
------------------------------ ------------------------------
SYS                            SYSTEM
SYSTEM                         SYSTEM

18 rows selected.

SQL> Disconnected from 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
ROOT@host# id
uid=0(root) gid=0(root)
ROOT@host#


When I direct the sql script in with < the sql script runs. What does "stty: : Inappropriate ioctl for device" mean? Do I need to worry about it?

thanks.



On 11/08/05, Joe Smith <joe_dba@xxxxxxxxxxx> 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.
--
//www.freelists.org/webpage/oracle-l

_________________________________________________________________
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: