Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I check index building status on Oracle 11?

I made terrible mistake in SQL index creation:

create index IDX_DATA_TABLE_CUSECO on DATA_TABLE (CUSTOMER_ID, SESSION_ID, CONTACT_ID)
  tablespace IDX_TABLESPACE LOCAL ;

As You can see I missed keyword "ONLINE" to create index without blocking PRODUCTION table with high usage with 600m+ records. Corrected SQL is:

create index IDX_DATA_TABLE_CUSECO on DATA_TABLE (CUSTOMER_ID, SESSION_ID, CONTACT_ID)
  tablespace IDX_TABLESPACE LOCAL ONLINE;

I was done it under PL/SQL Developer. When I was trying to stop it program stop responding and crashed.

Production system not working for 9 hours now and my boss wanna explode. :D

Is there any chance to see how many seconds/minutes/hours Oracle 11g left to process this index creation ? Or maybe is there any chance to see does Oracle still working on this request? (PL/SQL Developer crashed).

For haters: I know I should do this like mentioned here: (source)

CREATE INDEX cust_idx on customer(id) UNUSABLE LOCAL;
ALTER INDEX cust_idx REBUILD parallel 6 NOLOGGING ONLINE;

like image 863
WBAR Avatar asked Sep 11 '12 16:09

WBAR


People also ask

How do I check my index status?

You can begin using our Google Index Checker Tool by accessing it from the Website Tracking section of the free tools. After opening the tool, you need to enter the URL of which you want to check the Google Indexation status and click on 'Check Site Index'.

Does Oracle automatically rebuild indexes?

Oracle reports that the new Oracle10g Automatic Maintenance Tasks (AMT) will automatically detect indexes that are in need of re-building.


1 Answers

You should be able to view the progress of the operation in V$SESSION_LONGOPS

SELECT sid, 
       serial#, 
       target, 
       target_desc, 
       sofar, 
       totalwork, 
       start_time, 
       time_remaining, 
       elapsed_seconds
  FROM v$session_longops
 WHERE time_remaining > 0

Of course, in a production system, I probably would have killed the session hours ago rather than letting the DDL operation continue to prevent users from accessing the application.

like image 122
Justin Cave Avatar answered Sep 20 '22 07:09

Justin Cave