Embed sqlplus inside a shell script and run with cygwin or mks on Windows
563244Feb 22 2007 — edited Apr 4 2007Hi folks,
I have a shell script which runs pretty well on Solaris/Linux, but get broken on Windows with both cygwin and MKS shell.
The sqlplus command embedded inside the script looks like:
sqlplus system/passwd <<EOF
CONNECT / as sysdba;
shutdown abort;
startup pfile=${ORACLE_HOME}/dbs/p_create_$DB.ora nomount;
create database $DB;
controlfile reuse
datafile '${SYS}' size 150M reuse
SYSAUX DATAFILE '${SYSAUX}' size 1G REUSE
UNDO TABLESPACE undotbs DATAFILE '${UNDO}' SIZE 100M REUSE
AUTOEXTEND ON NEXT 5120K MAXSIZE UNLIMITED
logfile '${LOG1}' size 400M reuse,
'${LOG2}' size 400M reuse
maxdatafiles 100;
exit;
The error looks like:
ERROR:
ORA-12560: TNS:protocol adapter error
Enter user-name: SP2-0306: Invalid option.
Usage: CONN[ECT] [logon] [AS {SYSDBA|SYSOPER}]
where <logon> ::= <username>[<password>][@<connect_identifier>] | /
Enter user-name: SP2-0306: Invalid option.
Usage: CONN[ECT] [logon] [AS {SYSDBA|SYSOPER}]
where <logon> ::= <username>[<password>][@<connect_identifier>] | /
SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
Would anyone shed some light on this?