Solved

How to automate index rebuilds online in Oracle 10.2.0.2

Posted on 2008-06-12
2
302 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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Oracle Pivot Question 8 61
Oracle SQL syntax check  without executing 6 53
PL SQL Search Across Columns 4 35
Select and Insert Query running slow 4 34
Subquery in Oracle: Sub queries are one of advance queries in oracle. Types of advance queries: •      Sub Queries •      Hierarchical Queries •      Set Operators Sub queries are know as the query called from another query or another subquery. It can …
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
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.
Via a live example, show how to take different types of Oracle backups using RMAN.

770 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