473,385 Members | 1,531 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

SQL*Plus and Shell Programming

I run most of my SQL scripts via kornshell on AIX.

I use the "here-document" to run some of the smaller ones.

Example:
#!/bin/ksh

# Analyze the table.
sqlplus ${SCHEMA_NM}/${SCHEMA_PASSWD}@${DB_NM} <<-ANALYZE_TABLE
SET TERMOUT ON
SET FEEDBACK ON
SET SQLBLANKLINES ON
SET TIMING ON
SET SERVEROUTPUT ON SIZE 1000000
SET ECHO ON
BEGIN
HP.ANALYZE_TABLE ( TABLE_NM => 'ADGPMP' );
END;
/
ANALYZE_TABLE

As I look at it from my telnet window I don't see the feedback...

Here is what I see:

SQL> SET TERMOUT ON
SQL> SET FEEDBACK ON
SQL> SET SQLBLANKLINES ON
SQL> SET TIMING ON
SQL> SET SERVEROUTPUT ON SIZE 1000000
SQL> SQL> SQL> SQL> SQL> SQL> SQL> 2 3 4
PL/SQL procedure successfully completed.

Elapsed: 00:00:01.01

This sure makes log file reading a pain!
Does anyone know how I can see the SQL or (PL/SQL in this case) that
is being executed?

Thanks!
Jul 19 '05 #1
2 12630
ph***@eng.utah.edu (Peter) wrote in message news:<47**************************@posting.google. com>...
I run most of my SQL scripts via kornshell on AIX.

I use the "here-document" to run some of the smaller ones.

Example:
#!/bin/ksh

# Analyze the table.
sqlplus ${SCHEMA_NM}/${SCHEMA_PASSWD}@${DB_NM} <<-ANALYZE_TABLE
SET TERMOUT ON
SET FEEDBACK ON
SET SQLBLANKLINES ON
SET TIMING ON
SET SERVEROUTPUT ON SIZE 1000000
SET ECHO ON
BEGIN
HP.ANALYZE_TABLE ( TABLE_NM => 'ADGPMP' );
END;
/
ANALYZE_TABLE

As I look at it from my telnet window I don't see the feedback...

Here is what I see:

SQL> SET TERMOUT ON
SQL> SET FEEDBACK ON
SQL> SET SQLBLANKLINES ON
SQL> SET TIMING ON
SQL> SET SERVEROUTPUT ON SIZE 1000000
SQL> SQL> SQL> SQL> SQL> SQL> SQL> 2 3 4
PL/SQL procedure successfully completed.

Elapsed: 00:00:01.01

This sure makes log file reading a pain!
Does anyone know how I can see the SQL or (PL/SQL in this case) that
is being executed?

Thanks!


either redirect or tee the output or include a spool command
(preferred) in your script.

Sybrand Bakker
Senior Oracle DBA
Jul 19 '05 #2
sy******@yahoo.com wrote in message news:<a1**************************@posting.google. com>...
ph***@eng.utah.edu (Peter) wrote in message news:<47**************************@posting.google. com>...
I run most of my SQL scripts via kornshell on AIX.

I use the "here-document" to run some of the smaller ones.

Example:
#!/bin/ksh

# Analyze the table.
sqlplus ${SCHEMA_NM}/${SCHEMA_PASSWD}@${DB_NM} <<-ANALYZE_TABLE
SET TERMOUT ON
SET FEEDBACK ON
SET SQLBLANKLINES ON
SET TIMING ON
SET SERVEROUTPUT ON SIZE 1000000
SET ECHO ON
BEGIN
HP.ANALYZE_TABLE ( TABLE_NM => 'ADGPMP' );
END;
/
ANALYZE_TABLE

As I look at it from my telnet window I don't see the feedback...

Here is what I see:

SQL> SET TERMOUT ON
SQL> SET FEEDBACK ON
SQL> SET SQLBLANKLINES ON
SQL> SET TIMING ON
SQL> SET SERVEROUTPUT ON SIZE 1000000
SQL> SQL> SQL> SQL> SQL> SQL> SQL> 2 3 4
PL/SQL procedure successfully completed.

Elapsed: 00:00:01.01

This sure makes log file reading a pain!
Does anyone know how I can see the SQL or (PL/SQL in this case) that
is being executed?

Thanks!


either redirect or tee the output or include a spool command
(preferred) in your script.

Sybrand Bakker
Senior Oracle DBA


Thanks for the response!

I usually have a shell script that calls this and logs the whole thing
with either a redirect or a tee. The problem is that when I do that
still all I see is: SQL> SQL> SQL> SQL> SQL> SQL> SQL> 2 3 4
.. I don't want to spool because I am usually just calling one stored
procedure. If I wanted to spool I would probably just call a .sql
file via the command line.

How do I get the "here-document" to output the SQL commands to stdout?

Any ideas?

Thanks!
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ruben Schoenefeld | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi - after I got sql*plus to work on my Linux box and I recompiled PHP 5 to include the oracle instant client, I run into a weird problem: I...
2
by: Ethel Aardvark | last post by:
I have a query which runs fine in SQL*Plus but which will not compile into a packaged procedure (claiming that the table can not be found): SELECT DISTINCT Folder_ID INTO l_RootID -- remove...
3
by: khangu | last post by:
Hello! i am a newbie in oracle database. I have some question about SQL*PLUS Currently, i have some table in an oracle database. When i open SQL*PLUS and type my query: "select * from employee"....
3
by: valexena | last post by:
In order to set SQL*PLUS session so that NLS_DATE_FORMAT information is altered in a specific way every time I log into Oracle which method would be used? -- Posted via http://dbforums.com
0
by: GP | last post by:
Consider the following: (extracted from a .bat) sqlplus toto/titi ^ @%pdl%\islqz033 ^ '1 ' ^ 'aaa' ^ ' ' ^ 'zzz' ^ ....
3
by: Peter | last post by:
Has anyone seen this before? I start SQL*Plus, and login by typing sqlplus Quantum/Password@BPrd I type: select '&1' from dual; it responds
1
by: Miori | last post by:
Dear all, Server machine running Oracle Database Server on Linux and a Client machine running Oracle Client on WIndows XP. HOw it is possible to shut down/start up the Oracle database on the...
2
by: Ant | last post by:
Hi, I have an SQL assignment to do and at my school we use SQL *Plus there however I don't have Oracle at home, where I would like to do the work ,so I was wondering whats the easiest way to get...
9
by: skyloon | last post by:
I've did a program using vb6 to connect to oracle9i, i can establish the connection, the problem is when i execute the query in oracle sql*plus, it can execute successfully, but when run in vb...
9
by: ghssal | last post by:
HI I am using ORACLE forms and trying to insert a new order, by enter the customer_ID and i will get the latest order för this customer and save the new order with new order_date. I use this ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.