Sunday, July 4, 2010

Find current SCN number in Database

select current_scn from v$database;
select dbms_flashback.get_system_change_number() from dual;

-- find where current SCN lives in SGA:

SQL> select ksmfsadr from x$ksmfsv where ksmfsnam = 'kcsgscn_';

KSMFSADR
--------
20009104

-- on 32bit environments this is the most significant half word of 8 byte SCN. To get the other, least significant half, you have to add 4 to the address and combine the results:

SQL> l
 1  select dbms_flashback.get_system_change_number flashback_scn,
 2         current_scn,
 3         (select to_number(ksmmmval,'XXXXXXXX')
 4         from x$ksmmem where addr = hextoraw('20009104')) * power(2,32) +
 5         (select to_number(ksmmmval,'XXXXXXXX')
 6         from x$ksmmem where addr = hextoraw('20009108')) direct_scn
 7* from v$database
SQL> /

FLASHBACK_SCN CURRENT_SCN DIRECT_SCN
------------- ----------- ----------
     2633692     2633692    2633692


The SCN lives in fixed part of SGA, thus its location doesn't change over instance bounces or SGA size changes. It might change only if you relink Oracle binary or change SGA mapped base address.



source:freelists.org 
Regards
Manoj 

Oracle E-business suite logs clean up

 Oracle E-business suite logs clean up #!/bin/bash cd $EBS_DOMAIN_HOME find $EBS_DOMAIN_HOME -type f -path "*/logs/*.log?*" -mtime...