Put your tips and tricks online - Share your knowledge! Login | Register
 
 
  Search     Advanced search
 

Home | Ask Question | Add tip | My tips | Recent tips & tricks | Suggest a category | FAQ | Forums

 
 
 
 Category : Home > Databases > Oracle > Performance Tuning     

Generate an analyze script for all tables in schema


-- Replace USERNAME with the schema owner who's tables are to be analyzed.

set head off pagesize 0 echo off verify off feedback off linesize 200

spool analyze.sql

select 'set head on echo on verify on feedback on'
from dual
/

select 'spool analyze.log'
from dual
/

select	'exec DBMS_STATS.GATHER_TABLE_STATS(ownname=>' || '''' || owner || 
	'''' || ', ' || 'tabname=>' || '''' || table_name || '''' || ', ' || 
	'cascade=>true, degree=>4, estimate_percent=>99);'
from dba_tables
where owner = 'USERNAME'
/

select 'spool off'
from dual
/

select 'exit;'
from dual
/

spool off

exit;


  Options
 
   del.icio.us  |  newsvine  |  digg  |  furl  |  google  |  yahoo  |  Ma.gnolia  |  vigillar  |  reddit  |  technorati  |  icerocket  |  pubsub

       Rate this tip:    

Start discussion or add comment to this tip

  Details
Tip reference : #21
views : 1058
Added on : 10/03/05
Submited by : h8dk97
 
Send a message Send a message Printer friendly output Printer friendly output
Display this member's tips Display this member's tips (156)
 
 
<< Previous Next >>
 Most viewed tips 
  Databases > Oracle > Security : How to unlock Oracle user account  
  Databases > Oracle > Performance Tuning : How to enable trace in Oracle  
  Databases > Oracle : Kill user session  
  Operating Systems > Unix : How to kill Unix user session  
   
  All categories
Databases | Programming | Hardware | Operating Systems | Networking | Internet | ERP / CRM | Games & Multimedia | Graphics & Design | Miscellaneous | Office Software | TipLib FAQ
 
 

Home |  FAQ |  Terms of Use |  Privacy Policy

© 2005 tiplib.com