Home » Infrastructure » Linux » How to hide terminal output in Linux
How to hide terminal output in Linux [message #260527] Mon, 20 August 2007 04:21 Go to next message
shilpa.rajput
Messages: 31
Registered: May 2006
Location: Pune
Member

Hello All,
Here is another query regarding the database health check shell script I'm writing.
Actually, in the script I'm redirecting the output to a file(temp) as :

sqlplus -s $usnm/$passw@$ORACLE_SID >> temp << EOF


The script works fine unless I turn to get the chained rows count.
In this shell script,I've spooled a sqlscript so as to analyze the tables to list the chained rows
& then have make it run immediately as -

set feedb off
spool anlz.sql

select 'analyze table '||owner ||'.'||table_name||' list chained rows;'
from all_tables;
spool off;

@/home/test/anlz.sql

Now the problem is, the output of the spooled sql file appears as a terminal output giving the feedback of the analyze commands executed.
Do anyone has idea how can I hide the output from terminal?
(It redirects all the output in the 'temp' file as well)

Thanks in advance.
Re: How to hide terminal output in Linux [message #260534 is a reply to message #260527] Mon, 20 August 2007 04:35 Go to previous messageGo to next message
Michel Cadot
Messages: 59291
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
set termout off


Regards
Michel
Re: How to hide terminal output in Linux [message #260549 is a reply to message #260534] Mon, 20 August 2007 05:08 Go to previous messageGo to next message
shilpa.rajput
Messages: 31
Registered: May 2006
Location: Pune
Member

Thanks Sir,
Actually, forgot to mention I had tried doing that but still I'm getting the whole command statement as :-

analyze table SYS.LOGMNRG_CCOL$ list chained rows;

as well as,the feedback

table analyzed;

Re: How to hide terminal output in Linux [message #260556 is a reply to message #260527] Mon, 20 August 2007 05:20 Go to previous messageGo to next message
shilpa.rajput
Messages: 31
Registered: May 2006
Location: Pune
Member

Note : Well, by mistake the sys object analyze statement is posted. Actually I have ommitted the sys and other default user tables from analyzing
Re: How to hide terminal output in Linux [message #260565 is a reply to message #260556] Mon, 20 August 2007 05:30 Go to previous messageGo to next message
Littlefoot
Messages: 19650
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Using such a file you'll get file full of ANALYZE TABLE statements which will also get executed at once:
REM analyze_prep.sql

set heading off
set feedback off
set termout off
spool analyze.sql

select 'analyze table ' || tname || ' estimate statistics;'
from tab
where tabtype = 'TABLE';

spool off;

@analyze.sql
This is how 'analyze.sql' looks like:
REM analyze.sql

analyze table PLAN_TABLE estimate statistics;                            
analyze table TOAD_PLAN_TABLE estimate statistics;                              
analyze table DEPT estimate statistics;                                         
analyze table EMP estimate statistics;                                          
analyze table BONUS estimate statistics;                                        
analyze table DUMMY estimate statistics; 
And this is how execution looks like; as you can see, there's nothing there, actually:
SQL> @analyze_prep
SQL>
Re: How to hide terminal output in Linux [message #260569 is a reply to message #260565] Mon, 20 August 2007 05:46 Go to previous messageGo to next message
shilpa.rajput
Messages: 31
Registered: May 2006
Location: Pune
Member

Thats how exactly the things are ( check out my problem statement )

set feedb off
spool anlz.sql

select 'analyze table '||owner ||'.'||table_name||' list chained rows;'
from all_tables;
spool off;

@/home/test/anlz.sql


This is whats I'm doing. But thing is that, I'm writing all this in Linux shell script & all the matter which should reflect only in the spooled file (anlz.sql) i. e.

analyze table user.PLAN_TABLE list chained rows;

is reflecting on the linux terminal as well as in the file.
As if this isn't enough, even the feedback for it

i.e. table analyzed;
is out on the terminal even after setting the feedb off.
Just wonder what can be done!
Re: How to hide terminal output in Linux [message #260570 is a reply to message #260569] Mon, 20 August 2007 05:50 Go to previous messageGo to next message
Littlefoot
Messages: 19650
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
You have this           I have this
-------------           -----------------
set feedb off           set heading off
                        set feedback off
                        set termout off

I guess you see the difference. Now, I don't say that it is the solution, but - did you, at least, try it?
Re: How to hide terminal output in Linux [message #260577 is a reply to message #260570] Mon, 20 August 2007 06:21 Go to previous messageGo to next message
shilpa.rajput
Messages: 31
Registered: May 2006
Location: Pune
Member

Yeah, I have tried it out. Actually, its just was part which I posted. But still, I'm getting the expected output.
Is there any possibility to hind this by using Linux command? or by setting any Linux parameter?
I do agree, it's the SQL output, but to control it's display on OS terminal might be somewhere an OS issue! It's just a guess. what do u think?
Re: How to hide terminal output in Linux [message #260580 is a reply to message #260569] Mon, 20 August 2007 06:29 Go to previous messageGo to next message
Michel Cadot
Messages: 59291
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
I think the following:
Quote:
set feedb off
spool anlz.sql

select 'analyze table '||owner ||'.'||table_name||' list chained rows;'
from all_tables;
spool off;

@/home/test/anlz.sql

Is in your shell script.
You have to put it in a SQL script to don't see it in your output.

Regards
Michel
Re: How to hide terminal output in Linux [message #260593 is a reply to message #260580] Mon, 20 August 2007 07:07 Go to previous messageGo to next message
shilpa.rajput
Messages: 31
Registered: May 2006
Location: Pune
Member

U caught it, right!
I was doing the same.. n now THANKS.. It worked.
It's taking a few more seconds probably as it has to go through some more scripts and then execute, but surely has solved the purpose.
Thanks again!
Re: How to hide terminal output in Linux [message #260603 is a reply to message #260593] Mon, 20 August 2007 07:44 Go to previous messageGo to next message
Littlefoot
Messages: 19650
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Well, if you had carefully reviewed my post with sample scripts, you'd see REMarks containing every script name - those were SQL's, not shell scripts.
Re: How to hide terminal output in Linux [message #260614 is a reply to message #260603] Mon, 20 August 2007 08:10 Go to previous message
shilpa.rajput
Messages: 31
Registered: May 2006
Location: Pune
Member

Well,I respect the solution posted by u.
Let me clarify :

Have a look at part of my shell script :


sqlplus -s $usnm/$passw@$ORACLE_SID >> temp << EOF
SET heading off;
SET termout off;
SET feedback off;
SET linesize 90;


spool anlz.sql

select 'analyze table '||owner ||'.'||table_name||' list chained rows;'
from all_tables;
spool off;

@/home/test/anlz.sql

SELECT ' Database Health Check Report ' from dual;
SELECT 'Instance Name :', instance_name FROM v\$instance;

SELECT 'Version :',banner
FROM v\$version
WHERE banner LIKE '%Oracle%';
.
.
.
.
.
.
..
.

likewise.

Actually I was writing the SQL script only, but in the shell script.
Now see what I've done with the same script.


I took,


Toggle Spoiler


this code into a SQL script as anlzsrpt.sql

and then called that in my original script as follows:



Toggle Spoiler


Actually the whole procedure is taking lot of time but at least purpose is solved.





[Updated on: Mon, 20 August 2007 08:15]

Report message to a moderator

Previous Topic: Enterprise Linux Installation error
Next Topic: How to trim variable
Goto Forum:
  


Current Time: Wed Oct 01 14:23:12 CDT 2014

Total time taken to generate the page: 0.24007 seconds