2 Replies Latest reply: Feb 6, 2013 7:14 AM by 755430 RSS

    Help regarding issue connecting to DB through shell script

    755430
      Hi,

      I have a Oracle 8.1.7 Database running on a AIX box. I am trying to truncate one table from within the shell script using here documents.

      Code section of my script -

      succ=`sqlplus -s ${USR} << EOF
      whenever sqlerror exit sql.sqlcode
      set feedback on
      Truncate table abc.xyz;
      exit;
      EOF`

      USR has been set as /. We have ops$ users in the database. So when I run this script using my id it runs fine. The problem seems to be coming when this runs as part of the batch job which runs under a different osuser. The error is -

      + + sqlplus -s /
      + 0< /tmp/sh164108.8
      succ=ERROR:
      ORA-01017: invalid username/password; logon denied


      SP2-0306: Invalid option.
      Usage: CONN[ECT] [logon] [AS {SYSDBA|SYSOPER}] | [INTERNAL]
      where <logon> ::= <username>[<password>][@<connect_string>] | /
      SP2-0306: Invalid option.
      Usage: CONN[ECT] [logon] [AS {SYSDBA|SYSOPER}] | [INTERNAL]
      where <logon> ::= <username>[<password>][@<connect_string>] | /
      SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus

      I am not sure what is going wrong. I have tried and googled for the issue and it seems that the issue is coming because the osuser under which the job runs may not be setup to use "sqlplus -s /" ? Any help appreciated.

      Regards,
      Saurabh