Oracle online redo logs and standby logs Info ..
Oracle log file info ..logfiles.sql
standby logs ...
Syntax to add /drop group are as Below
SQL>Alter database add standby logfile Thread <thread no> group <group no> <PATH> size <>M;
SQL>Alter database add logfile Thread <thread no> group <group no> <PATH> size <>M;
set linesize 200 pagesize 200
column member format a50
column first_change# format 99999999999999999999
column next_change# format 99999999999999999999
select l.thread#,
lf.group#,
lf.member,
trunc(l.bytes/1024/1024) as size_mb,
l.status,
l.archived,
lf.type,
lf.is_recovery_dest_file as rdf,
l.sequence#,
l.first_change#,
l.next_change#
from v$logfile lf , v$log l
where l.group# = lf.group#
order by l.thread#,lf.group#, lf.member;
alter session set nls_date_format='dd-mm-yyyy hh24:mi:ss';
set linesize 300 pagesize 200
column member format a90
column first_change# format 99999999999999999999
column next_change# format 99999999999999999999
col group_size for a10
select l.thread#,
lf.group#,
lf.member,
CASE WHEN l.bytes < 1024 THEN l.bytes||''
WHEN l.bytes < POWER(1024,2) THEN ROUND(l.bytes/POWER(1024,1),1)||'K'
WHEN l.bytes < POWER(1024,3) THEN ROUND(l.bytes/POWER(1024,2),1)||'M'
WHEN l.bytes < POWER(1024,4) THEN ROUND(l.bytes/POWER(1024,3),1)||'G'
WHEN l.bytes < POWER(1024,5) THEN ROUND(l.bytes/POWER(1024,4),1)||'T'
END group_size ,
l.status,
l.archived,
lf.type,
lf.is_recovery_dest_file as rdf,
l.sequence#,
l.first_change#,
l.next_change# ,
FIRST_TIME,NEXT_TIME
from v$logfile lf , v$log l
where l.group# = lf.group#
order by l.thread#,lf.group#, lf.member;
====================
For standby logs ...
set linesize 200 pagesize 200
column member format a50
column first_change# format 99999999999999999999
column next_change# format 99999999999999999999
select l.thread#,
lf.group#,
lf.member,
trunc(l.bytes/1024/1024) as size_mb,
l.status,
l.archived,
lf.type,
lf.is_recovery_dest_file as rdf,
l.sequence#,
l.first_change#,
l.next_change#
from v$logfile lf , v$standby_log l
where l.group# = lf.group#
order by l.thread#,lf.group#, lf.member;
select * from v$logfile where type='STANDBY';
lf.group#,
lf.member,
trunc(l.bytes/1024/1024) as size_mb,
l.status,
l.archived,
lf.type,
lf.is_recovery_dest_file as rdf,
l.sequence#,
l.first_change#,
l.next_change#
from v$logfile lf , v$log l
where l.group# = lf.group#
union
select l.thread#,
lf.group#,
lf.member,
trunc(l.bytes/1024/1024) as size_mb,
l.status,
l.archived,
lf.type,
lf.is_recovery_dest_file as rdf,
l.sequence#,
l.first_change#,
l.next_change#
from v$logfile lf , v$standby_log l
where l.group# = lf.group#
order by 7;
======
to create redo for standby ..
select 'alter database add standby logfile '''||regexp_substr(MEMBER,'/.+/')||'stdby_'||regexp_replace(member,regexp_substr(MEMBER,'/.+/'),'')||''' size '||bytes||';' "Create Standby redo" from v$logfile lf , v$log l
where l.group# = lf.group#
union all
select 'alter database add standby logfile '''||regexp_substr(MEMBER,'/.+/')||'stdby_redo0'||(select max(group#)+1 from v$log)||'.rdo'||''' size '||bytes||';' "Create Standby redo" from v$logfile lf , v$log l
where l.group# = lf.group#
and rownum <=2
/
==============
set linesize 300 pagesize 300
COL GROUP# FORMAT 999999 HEAD 'Group'
COL THREAD# FORMAT 999999 HEAD 'Thread'
COL SEQUENCE# FORMAT 99999999 HEAD 'Sequence'
COL size FORMAT A6 HEAD 'Size|Mb'
COL STATUS FORMAT A10
COL MEMBER FORMAT A50
COL switch_dt FORMAT A20
COL ARCHIVED FORMAT A7
BREAK ON THREAD# NODUP ON GROUP# NODUP SKIP 1 ON sizeMb NODUP ON switch_dt NODUP
COMPUTE NUMBER LABEL 'MEMBER:' OF SEQUENCE# ON GROUP#
SELECT L.GROUP#, L.THREAD#, L.SEQUENCE#, LPAD(TRUNC(BYTES/1024/1024),5) sizeMb, L.STATUS, MEMBER, TO_CHAR(FIRST_TIME, 'dd-mm-yyyy HH24:MI:SS') switch_dt,
DECODE(ARCHIVED,'YES','Done..','Non') ARCHIVED
FROM V$LOG L, V$LOGFILE F
WHERE L.GROUP# = F.GROUP#
ORDER BY 1,3,6;
for log_cur in ( select group# group_no from v$log )
loop
execute immediate 'alter database clear logfile group '||log_cur.group_no;
end loop;
end;
/
redo size Recommendation
set linesize 300
select
b.recid,
to_char(b.first_time,'dd-mon-yy hh24:mi:ss') start_time,
a.recid,
to_char(a.first_time,'dd-mon-yy hh24:mi:ss') end_time,
round(((a.first_time-b.first_time)*25)*60,2) minutes
from
v$log_history a, v$log_history b
where a.recid = b.recid+1
and a.first_time between to_date('2024-05-29:08:00:00','yyyy-mm-dd:hh24:mi:ss')
and to_date('2024-05-29:17:00:00','yyyy-mm-dd:hh24:mi:ss')
order by a.first_time asc;
select time "Day" ,round(max(value/1024),2) "Max_Redo_KB/s",round(avg(value)/1024,2) "Avg_Redo(top30_mins)_KB/s",round(avg(value)*60*20/1024,0) "Recommended_ORL_size_KB"
from (
with agg as (
select to_char(BEGIN_TIME,'DD/MON/YYYY') time,value, dense_rank() over (partition by to_char(BEGIN_TIME,'DD/MON/YYYY') order by value desc) as rank
from dba_hist_sysmetric_history where metric_name = 'Redo Generated Per Sec'
and to_char(BEGIN_TIME,'DD/MON/YYYY') > sysdate -7)
select time,value from agg where agg.rank <31
) group by time order by 1 desc
6 comments:
ALTER DATABASE DROP LOGFILE MEMBER '/u01/app/oracle/fast_recovery_area/ORA12/onlinelog/o1_mf_1_dw9fqrwm_.log';
file path
select distinct substr(name, 1, instr(name, '/',-1)) PATH
from (select name from v$datafile
union all
select NAME from v$controlfile
union all
select MEMBER from v$logfile
union all
select name from v$tempfile) ;
http://anuj-singh.blogspot.co.uk/2011/10/oracle-redo-log-files-info.html
alter database add standby logfile group 10 '/u02/oradata/stdby_redo10a.log' size 52428800;
alter database add standby logfile group 11 '/u02/oradata/stdby_redo11a.log' size 52428800;
alter database add standby logfile group 12 '/u02/oradata/stdby_redo12a.log' size 52428800;
SQL> alter database rename file '+DATA/orclse/redo01.log' to '/u01/app/oradata/Orclsed/redo01.log';
Database altered.
SQL> alter database rename file '+DATA/orclse/redo02.log' to '/u01/app/oradata/Orclsed/redo02.log';
Database altered.
SQL> alter database rename file '+DATA/orclse/redo03.log' to '/u01/app/oradata/Orclsed/redo03.log';
Database altered.
Oracle 10g
set linesize 200 pagesize 200
column member format a50
column first_change# format 99999999999999999999
column next_change# format 99999999999999999999
select l.thread#,
lf.group#,
lf.member,
trunc(l.bytes/1024/1024) as size_mb,
l.status,
l.archived,
lf.type,
lf.is_recovery_dest_file as rdf,
l.sequence#,
l.first_change#
from v$logfile lf , v$log l
where l.group# = lf.group#
union
select l.thread#,
lf.group#,
lf.member,
trunc(l.bytes/1024/1024) as size_mb,
l.status,
l.archived,
lf.type,
lf.is_recovery_dest_file as rdf,
l.sequence#,
l.first_change#
from v$logfile lf , v$standby_log l
where l.group# = lf.group#
order by 6;
Post a Comment