Home » RDBMS Server » Server Administration » Stale Stats (Oracle 11G,Linux 5)
Stale Stats [message #556895] Thu, 07 June 2012 03:52 Go to next message
saagar
Messages: 79
Registered: December 2007
Member
Hello ..


Is there any script that give us output of all Stale Statistics in Oracle Database
please let me know


Regards
Re: Stale Stats [message #556901 is a reply to message #556895] Thu, 07 June 2012 04:17 Go to previous messageGo to next message
Michel Cadot
Messages: 68641
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
For your own user:
set serveroutput on size 10000 format wrapped
declare
  l_objList dbms_stats.objectTab;
begin
  dbms_stats.gather_schema_stats
    ( ownname        => user,
      options        => 'LIST STALE',
      objlist        => l_objList );
  for i in 1..l_objList.count loop
    dbms_output.put_line (l_objList(i).objName||' - '||l_objList(i).objType);
  end loop;
end;
/

If you want for all users then you can loop on all_users views.

Regards
Michel
Re: Stale Stats [message #556906 is a reply to message #556901] Thu, 07 June 2012 04:25 Go to previous messageGo to next message
saagar
Messages: 79
Registered: December 2007
Member
How can i get it for a particualar schema name
can you please let me know

Regards
Re: Stale Stats [message #556909 is a reply to message #556906] Thu, 07 June 2012 04:39 Go to previous messageGo to next message
Michel Cadot
Messages: 68641
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Maybe changing the "ownname" parameter?

Regards
Michel
Re: Stale Stats [message #556912 is a reply to message #556909] Thu, 07 June 2012 04:46 Go to previous messageGo to next message
saagar
Messages: 79
Registered: December 2007
Member
NO i am very sorry
it gives me error

( ownname => apps,
*
ERROR at line 5:
ORA-06550: line 5, column 25:
PLS-00201: identifier 'APPS' must be declared
ORA-06550: line 4, column 3:
PL/SQL: Statement ignored

Sorry once again for code ..
Re: Stale Stats [message #556921 is a reply to message #556912] Thu, 07 June 2012 05:35 Go to previous messageGo to next message
Michel Cadot
Messages: 68641
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Maybe if it is a string you have to enclose it between '?

Regards
Michel
Re: Stale Stats [message #556926 is a reply to message #556921] Thu, 07 June 2012 05:49 Go to previous messageGo to next message
saagar
Messages: 79
Registered: December 2007
Member
thanks michel
got it... very much
but one question does it give all views,MVs,tables,indexes which are stale???

Regards
Re: Stale Stats [message #556928 is a reply to message #556926] Thu, 07 June 2012 06:01 Go to previous messageGo to next message
Michel Cadot
Messages: 68641
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Views have no statistics.
Does it answer the question if I say "does dbms_stats.gather_schema_stats gather the statistics for all objects that have statistics?".

Regards
Michel
Re: Stale Stats [message #556931 is a reply to message #556928] Thu, 07 June 2012 06:30 Go to previous message
saagar
Messages: 79
Registered: December 2007
Member
Yes ... it gives ...
i am very thankful to you ... for giving me this

Regards
Previous Topic: Lock output
Next Topic: Change current redo log size in oracle mount stage
Goto Forum:
  


Current Time: Fri Apr 19 05:46:34 CDT 2024