A good way of executing a sql script from a unix script
${SQLPLUS} -S / @stall.sql 2>&1 | tee $logs/stall_${DATE}.log
Or
sqlplus -s / <<EOF
whenever sqlerror exit sql.sqlcode
@create_tables.sql;
@sdv_tables.sql;
@pvv_funcs.sql;
EOF
Kalman
-----Original Message-----
From: Sikyala Raquel
[mailto:oracledba-ezmlmshield-x88313555.[Email address protected]
Sent: Tuesday, April 03, 2007 4:43 PM
To: LazyDBA Discussion
Subject: Executing sql command in unix script
I am trying to execute a sql command within a unix script.
Does anyone know how I would do this?
This is the line in the Unix script:
su - oracle -c "export ORACLE_SID=${db}; sqlplus '/as sysdba'
@${PWD}/audit_loc.sql" > ${PWD}/audit_loc.txt
The script is audit_loc.sql
I would like to execute the sql statement within Unix rather than using
this: @${PWD}/audit_loc.sql
The contents of the script is the following:
set heading off;
show parameter audit_file_dest;
exit;
Raquel Sikyala
---------------------------------------------------------------------
TO REPLY TO EVERYBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
To post a dba job: http://jobs.lazydba.com
To Subscribe : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html
------------------------------------------------------------------------------
Notice: This e-mail message, together with any attachments, contains
information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station,
New Jersey, USA 08889), and/or its affiliates (which may be known
outside the United States as Merck Frosst, Merck Sharp & Dohme or MSD
and in Japan, as Banyu - direct contact information for affiliates is
available at http://www.merck.com/contact/contacts.html) that may be
confidential, proprietary copyrighted and/or legally privileged. It is
intended solely for the use of the individual or entity named on this
message. If you are not the intended recipient, and have received this
message in error, please notify us immediately by reply e-mail and then
delete it from your system.
------------------------------------------------------------------------------
Oracle LazyDBA home page