Solved

How to automate index rebuilds online in Oracle 10.2.0.2

Posted on 2008-06-12
2
300 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
2 Comments
 
LVL 47

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 34

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
oracle global variables 4 53
Oracle regular expression 6 30
File generation using utl_file 4 31
PAYER_ID has both atributes 4 20
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…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now