Friday, October 14, 2016

Find the Table Lock and Unlock the Table


To check table has been locked or not:

select
   c.owner,
   c.object_name,
   c.object_type,
   b.sid,
   b.serial#,
   b.status,
   b.osuser,
   b.machine
from
   v$locked_object a ,
   v$session b,
   dba_objects c
where
   b.sid = a.session_id
and

   a.object_id = c.object_id;

select owner, table_name, stattype_locked
from dba_tab_statistics
where stattype_locked is not null;

Unlock the table:

Exec dbms_stats.unlock_table_stats('APPLSYS','FND_CP_GSM_IPC_AQTBL');

To check the Index status:

select INDEX_NAME,INDEX_TYPE,BLEVEL, STATUS, LAST_ANALYZED, OWNER from dba_indexes where
upper(index_name) like'%PA_PROJ_EVENTS%'

Rebuilding the particular Index:

ALTER INDEX PJI.PJI_PA_PROJ_EVENTS_LOG_N1 REBUILD ONLINE;

No comments:

Post a Comment