SelfRunner

SelfRunnerOdbc

TwoPanelQueryCollection

TwoPanelInlineQueries

TwoPanelTabIndSizeNumRows

TwoPanelTabIndLastAnalyzed

TwoPanelTableDataCompare

CreRunSchemaNumRows

CreRunNumRowsAllDbTab

MakeHtm

MakeHta

GetEnvVars

Click on the image for a bigger view

tptila.gif

Run this script
to create and view
the last-analyzed information
of
non-sys tables and indexes.

TwoPanelTabIndLastAnalyzed.bat
 
Run this script to create and view the last-analyzed information of non-sys tables and indexes.

Queries running too slow.
I go on a wild-goose-chase checking log files, trace files, and every tuning trick in the wide, wide world.
Hey, why did I not remember to check the last analyzed information of the tables and the indexes first?

Here is the script:

:: =================================================================
:: TwoPanelTabIndLastAnalyzed.bat
:: Compare last analyzed info for tables and indexes side-by-side.
::
:: =================================================================
:: Jerome Christopher [Jerome_christopher@yahoo.com
::
http://sqlhtm.blogspot.com
:: http://www.sqlhtm.com/sqlhtm
:: =================================================================

del c:\11.out c:\12.out

(
echo spool c:\1.out
echo set pages 1000 lines 200 echo off feedback off
echo prompt  ^<html^>^<head^>

echo set heading off feedback off
echo select ^'^<^'^|^|^'style type^=^'^|^|^'^'^'^'^|^|^'text^'^|^|^'^/^'^|^|^'css^'^|^|^'^'^'^'^|^|^'^>^'^|^| chr^(10^)^|^|
echo ^'body  ^{font^:6pt Arial^,Helvetica^,sans^-serif^; color^:black^; background^:^}^'^|^|chr^(10^)^|^|
echo ^'p     ^{font^:bold 6pt Arial^,Helvetica^,sans^-serif^; color^:black^; background^:white^}^'^|^|chr^(10^)^|^|
echo ^'table ^{font^:6pt Arial^,Helvetica^,sans^-serif^; color^:Black^; background^:^#f7f7e7^;^}^'^|^|chr^(10^)^|^|
echo ^'tr    ^{font^:6pt Arial^,Helvetica^,sans^-serif^; color^:Black^; background^:^#f7f7e7^;^}^'^|^|chr^(10^)^|^|
echo ^'td    ^{font^:bold bold 6pt Arial^,Helvetica^,sans^-serif^; color^:black^; background^:aqua^;^}^'^|^|chr^(10^)^|^|
echo ^'th    ^{font^:bold 6pt Arial^,Helvetica^,sans^-serif^; color^:white^; background^:olive^; ^}^'^|^|chr^(10^)^|^|
echo ^'a     ^{font^:6pt Arial^,Helvetica^,sans^-serif^; color^:^#663300^; background^:^#ffffff^; vertical^-align^:top^;^}^'^|^|chr^(10^)^|^|
echo ^'^<^'^|^|^'^/^'^|^|^'style^>^' from dual^;
echo prompt ^<^/head^>^<body^>

echo select ^'Two Panel Compare Tool - Tables and Indexes Last Analyzed ^' from dual;
echo prompt ^<h1^>Tables Last Analyzed^<^/h1^>
echo select name,to_char^(sysdate,^'dd-mon-yy hh:mi:ss pm Dy^'^) Today from v$database;
echo set heading on feedback on
echo set markup HTML ON table ^"^" entmap off

echo prompt ^<table^>^<tr^>^<td^>
echo break on owner skip 1
echo select owner,table_name,num_rows,to_char^(last_analyzed,^'DD-MON-YY HH24:MI:SS'^) lan from dba_tables
echo where upper^(owner^) not like ^'SYS^%%^'
echo order by owner,num_rows desc;


echo set heading off
echo set feedback off
echo prompt Two Panel Compare Tool - Tables and Indexes Last Analyzed.
echo prompt    For tiny dbs, start and go for coffee. 
echo prompt    For medium dbs, start and go for lunch.
echo prompt    For VLDBS, start and go take a vacation :^)


echo spool off
rem echo prompt =====================================================
rem echo prompt ^'^<^/pre^>^<^/td^>^<^/tr^>^<^/table^>^' ^;
echo prompt ^<^/td^>^<^/tr^>^<^/table^>^<^/body^>^<^/html^>
echo exit
)> c:\1.bat

(
echo spool c:\1.out
echo set pages 1000 lines 200 echo off feedback off
echo prompt  ^<html^>^<head^>

echo set heading off feedback off
echo select ^'^<^'^|^|^'style type^=^'^|^|^'^'^'^'^|^|^'text^'^|^|^'^/^'^|^|^'css^'^|^|^'^'^'^'^|^|^'^>^'^|^| chr^(10^)^|^|
echo ^'body  ^{font^:6pt Arial^,Helvetica^,sans^-serif^; color^:black^; background^:^}^'^|^|chr^(10^)^|^|
echo ^'p     ^{font^:bold 6pt Arial^,Helvetica^,sans^-serif^; color^:black^; background^:white^}^'^|^|chr^(10^)^|^|
echo ^'table ^{font^:6pt Arial^,Helvetica^,sans^-serif^; color^:Black^; background^:^#f7f7e7^;^}^'^|^|chr^(10^)^|^|
echo ^'tr    ^{font^:6pt Arial^,Helvetica^,sans^-serif^; color^:Black^; background^:^#f7f7e7^;^}^'^|^|chr^(10^)^|^|
echo ^'td    ^{font^:bold bold 6pt Arial^,Helvetica^,sans^-serif^; color^:black^; background^:aqua^;^}^'^|^|chr^(10^)^|^|
echo ^'th    ^{font^:bold 6pt Arial^,Helvetica^,sans^-serif^; color^:white^; background^:olive^; ^}^'^|^|chr^(10^)^|^|
echo ^'a     ^{font^:6pt Arial^,Helvetica^,sans^-serif^; color^:^#663300^; background^:^#ffffff^; vertical^-align^:top^;^}^'^|^|chr^(10^)^|^|
echo ^'^<^'^|^|^'^/^'^|^|^'style^>^' from dual^;
echo prompt ^<^/head^>^<body^>

echo select ^'Two Panel Compare Tool - Tables and Indexes Last Analyzed ^' from dual;
echo prompt ^<h1^>Indexes Last Analyzed^<^/h1^>
echo select name,to_char^(sysdate,^'dd-mon-yy hh:mi:ss pm Dy^'^) Today from v$database;
echo set heading on feedback on
echo set markup HTML ON table ^"^" entmap off

echo prompt ^<table^>^<tr^>^<td^>
echo break on owner skip 1
echo select owner,table_name,index_name,index_type,num_rows,status,to_char^(last_analyzed,^'DD-MON-YY HH24:MI:SS^'^) lan
echo from dba_indexes where upper^(owner^) not like ^'SYS%%^'
echo order by owner,num_rows desc;

echo set heading off
echo set feedback off
echo prompt Two Panel Compare Tool - Tables and Indexes Last Analyzed.
echo prompt    For tiny dbs, start and go for coffee. 
echo prompt    For medium dbs, start and go for lunch.
echo prompt    For VLDBS, start and go take a vacation :^)

echo spool off
rem echo prompt =====================================================
rem echo prompt ^'^<^/td^>^<^/tr^>^<^/table^>^' ^;
echo prompt ^<^/td^>^<^/tr^>^<^/table^>^<^/body^>^<^/html^>
echo exit
)> c:\2.bat

sqlplus -s " system/oracle@xe " <c:\1.bat >c:\11.htm
sqlplus -s "
system/oracle@xe " <c:\2.bat >c:\12.htm

(
echo ^<html^>
echo   ^<head^>
echo     ^<title^>
echo       Two Panel Compare Tool - Tables And Indexes - Last Analyzed Stats
echo    ^<^/title^>
echo   ^<^/head^>
echo   ^<FRAMESET COLS^=^"430^,570^" border^=1^>
echo   ^<FRAME NAME^=^"top^"    SRC^=^"c^:^\11.htm^" marginwidth^=^"10^" scrolling^=^"Auto^"^>
echo   ^<FRAME NAME^=^"bottom^" SRC^=^"c^:^\12.htm^" marginwidth^=^"10^" scrolling^=^"Auto^"^>
echo   ^<^/FRAMESET^>
echo ^<^/html^>
)>c:\tptila.hta
c:\tptila.hta

exit

   

Home

Scripts

Tips

Misc

Resume

Tamil

JobSearch

www.sqlhtm.com Copyright Jerome S. Christopher 2010