Solved

How to automate index rebuilds online in Oracle 10.2.0.2

Posted on 2008-06-12
2
305 Views
Last Modified: 2013-12-19
Is there a way to set up monitoring of index pct used and kick off an online rebuild of the index when the 20% threshold is met.

what happens is a session spawns multiple inserts, deletes and updates on tables to set up a "data scenario" that the application uses.  When the application has completed the java framework on the app side spawns an additional sqlid that deletes all the data for the scenario and replaces it with the original data before the session.  Each time (hundreds of times a day) after the session closes the indexes on these tables (some are 3mm + rows) are not usable due to the massive dml changes.  The next user runs another session and everything is going full table scan and the performance is terrible.

Any ideas how to deal with this?

thanks
0
Comment
Question by:mjimison1956
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 48

Accepted Solution

by:
schwertner earned 500 total points
ID: 21769736
Yes it is possible. You have to define where it is the value you use to trigger.



PROCEDURE rebuild_ind IS
   v_sql VARCHAR2(890);
FOR i IN (SELECT * FROM dba_indexes) LOOP

    IF  pct_free < 20 THEN
     v_sql :=  'ALTER INDEX ' || i.owner ||'.'||i.index_name || ' rebuild';
     execute immediate v_sql;

    END IF;

END LOOP;

EXCEPTION
WHEN OTHERS
    .....

END;

Some clarification should be done.
This procedure cold be run every 20 minutes (DBMS_JOB, DBMS_SCHEDULE packages) or
when application finishes.
0
 
LVL 35

Expert Comment

by:johnsone
ID: 21769817
After loading large amounts of data are the tables being analyzed?  That could account for your performance issues.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that useā€¦
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question