Wednesday, May 24, 2017

Resource busy; not able to modify the table

step 1 // identify object id
 select OBJECT_ID from dba_objects where OBJECT_NAME='EMP

step 2 // identify who is locking
select
   c.owner,
   c.object_name,
   c.object_type,
   b.sid,
   b.serial#,
   b.status,
   b.osuser,
   b.machine
from
   gv$locked_object a ,
   gv$session b,
   dba_objects c
where
   b.sid = a.session_id
and
   a.object_id = c.object_id
   and c.object_id=1101;
 
 
solution
steps 3  //  modify ddl table lock time for 10 seconds
alter session set ddl_lock_timeout = 10;

step 4 // modify table
alter table // full modify table command

Deleting tons of files in Linux (Argument list too long)

option 1
find /oramisc01/oracle/demo/adump -name "*aud"  -type f -mtime +1 -exec rm {} \;

option 2
find  /oramisc01/oracle/demo/adump  -name "aud*" -type f  -delete

option 3
find  /oramisc01/oracle/demo/adump  -name "aud*" -type f -mtime +1 |xargs rm -rf

option 4
mkdir empty_dir
rsync -a -delete empty_dir/ yourdirectory/


option 5
perl -e 'for(<*aud>){((stat)[9]<(unlink))}'




Friday, May 19, 2017

data guard - Check redo transport lag and apply lag in standby database

-- Check redo transport lag and apply lag in standby database


# standby
  
  archive log list
  
  col name for a13
  col value for a20
  col unit for a30
  set lines 122
  select name, value, unit, time_computed from v$dataguard_stats where name in ('transport lag','apply lag');