RE: Executing sql command in unix script

RE: Executing sql command in unix script

 

  

What does this mean?
sqlplus '/as sysdba'"
sqlplus -S /

Sqlplus -s account/pw

Would run sqlplus in silent mode

Kalman

-----Original Message-----
From: Sikyala, Raquel [mailto:[Email address protected]
Sent: Tuesday, April 03, 2007 5:29 PM
To: Zilberman, Kalman; [Email address protected]
Subject: RE: Executing sql command in unix script

I tried the following:

su - oracle -c "export ORACLE_SID=${db}; sqlplus '/as sysdba'"
sqlplus -S / <<EOF
set heading off;
show parameter audit_file_dest;
exit;
> audit_loc.txt file
and it logged me into the database and showed a sql prompt. How do I
modify the above so that it executes the statements and prints the value
to the audit_loc.txt file?

-----Original Message-----
From: Zilberman Kalman [mailto:[Email address protected]
Sent: Tuesday, April 03, 2007 5:07 PM
To: Sikyala, Raquel
Subject: RE: Executing sql command in unix script

**A LazyDBA.com subscriber has responded to your lazydba.com post**
**LazyDBA.com mail shield has forwarded you this email, **and removed
any attachments, and kept your email address secret **from this person,
and any viruses/trojans.
**If you reply to this email, the person will see your email address as
normal **Anything below this line is the original email text


A good way of executing a sql script from a unix script

${SQLPLUS} -S / [Email address protected] 2>&1 | tee
$logs/stall_${DATE}.log

Or

sqlplus -s / <<EOF
whenever sqlerror exit sql.sqlcode
[Email address protected]
[Email address protected]
[Email address protected]
EOF


Kalman

-----Original Message-----
From: Sikyala Raquel
[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'
[Email address protected] > ${PWD}/audit_loc.txt

The script is audit_loc.sql

I would like to execute the sql statement within Unix rather than using
this: [Email address protected]

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.

------------------------------------------------------------------------
------




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