-
DBMS_STATS options
Howdy all you politically correct boys and girls;
Is there any way to run dbms_stats at the schema level and omit a few HUGE partitioned tables.
What we have now is a script that analyzes all of the tables for this schema, this works fine BUT.. we are adding another 40 or so tables to this schema and now have to keep updating this script.
Essentially we would like to avoid this and just have the flexability to analyze the monster tables at other times.
I do not see any options online, a simple WHERE clause would work if it existed.
HP/UX 11
Oracle 9.2.0.6
I remember when this place was cool.
-
i dont think there is an exceptions kinda thing, but you can do a little loop to select the table name from user_tables with a where clause then pass the table name to dbms_stats
-
Thanks dave,
I can generate it through SQL plus that way, but it is a bit tedious.
I remember when this place was cool.
-
ho rm analyze.tmp.sql
spool analyze.tmp.sql
set heading off
select 'prompt >processing: '
||table_name
||chr(13)
||'select to_char(sysdate,''MM/DD/YY HH24:MI:SS'') from dual;'
||chr(13)
||'execute dbms_stats.gather_table_stats(ownname => user, tabname => '''||table_name||''', degree => 4, cascade => true);'
||chr(13)
||'select to_char(sysdate,''MM/DD/YY HH24:MI:SS'') from dual;' from user_tables where table_name<>'BIG_TABLE';
spool off
@analyze.tmp.sql
ho rm analyze.tmp.sql
OCP DBA 8, 8i, 9i, 10g
-
Originally Posted by danromeo
ho rm analyze.tmp.sql
spool analyze.tmp.sql
set heading off
select 'prompt >processing: '
||table_name
||chr(13)
||'select to_char(sysdate,''MM/DD/YY HH24:MI:SS'') from dual;'
||chr(13)
||'execute dbms_stats.gather_table_stats(ownname => user, tabname => '''||table_name||''', degree => 4, cascade => true);'
||chr(13)
||'select to_char(sysdate,''MM/DD/YY HH24:MI:SS'') from dual;' from user_tables where table_name<>'BIG_TABLE';
spool off
@analyze.tmp.sql
ho rm analyze.tmp.sql
HUH?
SQL no worky
I remember when this place was cool.
-
are you running on windows?
if yes you need to change rm with del
you need to create a sql file with that content (an.sql)
then execute that script:
sqlplus user/pass@host @an.sql
Last edited by danromeo; 06-29-2005 at 04:24 PM.
OCP DBA 8, 8i, 9i, 10g
-
Originally Posted by danromeo
are you running on windows?
I tried it in both environments.
I also tried just the SQL in SQL plus.
Did you get it to run?
I remember when this place was cool.
-
I just rewrote my entire statistics gathering process. Basically what I do in this case is I have a table of owner/tablenames that want to exclude from analyzing. I use dbms_stats.gather_database_stats(options=>'LIST STALE') to get a list of objects to analyze. I then bounce those against my table that stores the objects I want to exclude to decide if I need to analyze the table.
You can read about my basic algorithm at http://marist89.blogspot.com/2005/06...sstats_14.html.
Jeff Hunter
-
Originally Posted by marist89
Mr. Genius, do you have any tables where you want to generate histograms, I didn't see it mentioned in your blog?
If so, what criteria are you using to determine the need for the histograms.
Thanks.
-
Originally Posted by dbtoo
Mr. Genius, do you have any tables where you want to generate histograms, I didn't see it mentioned in your blog?
If so, what criteria are you using to determine the need for the histograms.
Thanks.
Histograms are a special case. Most times, you know what tables need histograms and how many buckets. Same deal, if the table/index reports as stale, you bounce it off a table of know tables that need histograms.
Jeff Hunter
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|