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');


Wednesday, February 10, 2016

1-2-3 PSU

Shutdown all the database instances in the 11.2.0.4.0 home
as oracle
srvctl stop home -o /ora01/oracle/product/11.2.0.4/db -s dbstatefile

Rollback patch 18769590
as oracle
$ORACLE_HOME/OPatch/opatch rollback -id 18769590

Rollback the psu
as root
opatch auto -rollback -ocmrf ocm.rsp

Rollback just the db Home
as root
opatch auto -oh /ora01/oracle/product/11.2.0.4/db -rollback -ocmrf ocm.rsp

Apply the PSU with the -norestart option
as root
opatch auto -ocmrf ocm.rsp -norestart

Start all the databasesas oracle
as root
crsctl start resource -w "TYPE = ora.database.type"

Start has and ASM
as root
crsctl start has

Tuesday, February 09, 2016

Check for ORACLE Patches applied


as grid and 11g:
$ORACLE_HOME/OPatch/opatch lsinventory -bugs_fixed  | grep -i 'PSU'
 
for database:
$ORACLE_HOME/OPatch/opatch lsinventory -bugs_fixed | egrep 'PSU|PATCH SET UPDATE'
$ORACLE_HOME/OPatch/opatch lsinventory -bugs_fixed | grep -i 'DATABASE PSU'
 
for CRS:
$ORACLE_HOME/OPatch/opatch lsinventory -bugs_fixed | grep -i 'TRACKING BUG' | grep -i 'PSU'
 
For GI:
$ORACLE_HOME/OPatch/opatch lsinventory -bugs_fixed | grep -i 'GI PSU'
 
query the registry$history database object
select substr(action_time,1,30) action_time,
substr(id,1,10) id,
substr(action,1,10) action,
substr(version,1,8) version,
substr(BUNDLE_SERIES,1,6) bundle,
substr(comments,1,20) comments
from registry$history;