Останавливаем накат логов на стендбае.
1.) Alter database recover managed standby database cancel;
Определяем номер последнего изменения на стендбае.
Select surrent_scn from v$database;
Бэкапим продакшен начиная с номера из пункта 2.
3). backup incremental from scn NN database;
Бэкапим контролфайл на продакшене.
4). Backup current controlfile for standby;
Копируем всё что забэкапили на хост со стендбаем и начинаем восстановление.
5). RMAN -> Restore standby controlfile from '';
RMAN -> recover database noredo;
Запускаем накат логов на стендбае.
6). SQL -> alter database recover managed standby database disconnect from session;
Готово.
четверг, 23 сентября 2010 г.
Чем занят RMAN и как долго он будет этим заниматься.
set line 100
SELECT dense_rank() over (order by to_char(lo.start_time, 'dd.mm.yyyyy hh24:mi:ss')) NN,
to_char( lo.start_time, 'dd.mm.yyyyy hh24:mi:ss' ) "Start Time", lo.sid,decode(lo.totalwork,0,0,round(100*lo.sofar/lo.totalwork,2))"%",
replace(to_char(floor(lo.time_remaining/60/60),'00')||':'|| to_char(floor(lo.time_remaining/60)-floor(lo.time_remaining/60/60)*60,'00')||':'||
to_char( lo.time_remaining - floor( lo.time_remaining / 60 ) * 60, '00' ),' ') "remaining(hour)",
replace(to_char(floor(lo.elapsed_seconds/60/60),'00')||':'|| to_char( floor(lo.elapsed_seconds/60)-floor(lo.elapsed_seconds/60/60)*60,'00')||':'||
to_char(lo.elapsed_seconds- floor( lo.elapsed_seconds / 60 ) * 60, '00' ),' ') elapsed,round( lo.sofar/decode(lo.elapsed_seconds,0,1,lo.elapsed_seconds),4) "V,b/s"
FROM gv$session_longops lowhere lo.time_remaining!=0 and opname like 'RMAN%' and opname not like '%aggregate%' ORDER BY lo.start_time DESC;
SELECT dense_rank() over (order by to_char(lo.start_time, 'dd.mm.yyyyy hh24:mi:ss')) NN,
to_char( lo.start_time, 'dd.mm.yyyyy hh24:mi:ss' ) "Start Time", lo.sid,decode(lo.totalwork,0,0,round(100*lo.sofar/lo.totalwork,2))"%",
replace(to_char(floor(lo.time_remaining/60/60),'00')||':'|| to_char(floor(lo.time_remaining/60)-floor(lo.time_remaining/60/60)*60,'00')||':'||
to_char( lo.time_remaining - floor( lo.time_remaining / 60 ) * 60, '00' ),' ') "remaining(hour)",
replace(to_char(floor(lo.elapsed_seconds/60/60),'00')||':'|| to_char( floor(lo.elapsed_seconds/60)-floor(lo.elapsed_seconds/60/60)*60,'00')||':'||
to_char(lo.elapsed_seconds- floor( lo.elapsed_seconds / 60 ) * 60, '00' ),' ') elapsed,round( lo.sofar/decode(lo.elapsed_seconds,0,1,lo.elapsed_seconds),4) "V,b/s"
FROM gv$session_longops lowhere lo.time_remaining!=0 and opname like 'RMAN%' and opname not like '%aggregate%' ORDER BY lo.start_time DESC;
Хороший скриптик для "снятия нагрузки " с винтов.
set lines 400 pages 50000
alter session set nls_date_format='dd-mm-yyyy hh24:mi';
col Phys_Read_Total_Bps for 999999999999
col Phys_Write_Total_Bps for 999999999999
col Redo_Bytes_per_sec for 999999999999
col Phys_Read_IOPS for 999999999999
col Phys_write_IOPS for 999999999999
col Phys_redo_IOPS for 999999999999
col OS_LOad for 999999999999
col DB_CPU_Usage_per_sec for 999999999999
col Host_CPU_util for 999999999999
col Network_bytes_per_sec for 999999999999
col Phys_IO_Tot_MBps for 999999999999
col Phys_IOPS_Tot for 999999999999
spool io_max_checkup.log
select min(begin_time), max(end_time),
sum(case metric_name when 'Physical Read Total Bytes Per Sec' then maxval end) Phys_Read_Tot_Bps,
sum(case metric_name when 'Physical Write Total Bytes Per Sec' then maxval end) Phys_Write_Tot_Bps,
sum(case metric_name when 'Redo Generated Per Sec' then maxval end) Redo_Bytes_per_sec,
sum(case metric_name when 'Physical Read Total IO Requests Per Sec' then maxval end) Phys_Read_IOPS,
sum(case metric_name when 'Physical Write Total IO Requests Per Sec' then maxval end) Phys_write_IOPS,
sum(case metric_name when 'Redo Writes Per Sec' then maxval end) Phys_redo_IOPS,
sum(case metric_name when 'Current OS Load' then maxval end) OS_LOad,
sum(case metric_name when 'CPU Usage Per Sec' then maxval end) DB_CPU_Usage_per_sec,
sum(case metric_name when 'Host CPU Utilization (%)' then maxval end) Host_CPU_util, --NOTE 100% = 1 loaded RAC node
sum(case metric_name when 'Network Traffic Volume Per Sec' then maxval end) Network_bytes_per_sec,
snap_id
from dba_hist_sysmetric_summary
group by snap_id
order by snap_id;
spool off
spool io_maxtot_summary.log
select min(begin_time), max(end_time),
sum(case metric_name when 'Physical Read Total Bytes Per Sec' then maxval end)/1024/1024 +
sum(case metric_name when 'Physical Write Total Bytes Per Sec' then maxval end)/1024/1024 +
sum(case metric_name when 'Redo Generated Per Sec' then maxval end)/1024/1024 Phys_IO_Tot_MBps,
sum(case metric_name when 'Physical Read Total IO Requests Per Sec' then maxval end) +
sum(case metric_name when 'Physical Write Total IO Requests Per Sec' then maxval end) +
sum(case metric_name when 'Redo Writes Per Sec' then maxval end) Phys_IOPS_Tot,
sum(case metric_name when 'Current OS Load' then maxval end) OS_LOad,
sum(case metric_name when 'CPU Usage Per Sec' then maxval end) DB_CPU_Usage_per_sec,
sum(case metric_name when 'Host CPU Utilization (%)' then maxval end) Host_CPU_util, --NOTE 100% = 1 loaded RAC node
sum(case metric_name when 'Network Traffic Volume Per Sec' then maxval end) Network_bytes_per_sec,
snap_id
from dba_hist_sysmetric_summary
group by snap_id
order by snap_id;
spool off
alter session set nls_date_format='dd-mm-yyyy hh24:mi';
col Phys_Read_Total_Bps for 999999999999
col Phys_Write_Total_Bps for 999999999999
col Redo_Bytes_per_sec for 999999999999
col Phys_Read_IOPS for 999999999999
col Phys_write_IOPS for 999999999999
col Phys_redo_IOPS for 999999999999
col OS_LOad for 999999999999
col DB_CPU_Usage_per_sec for 999999999999
col Host_CPU_util for 999999999999
col Network_bytes_per_sec for 999999999999
col Phys_IO_Tot_MBps for 999999999999
col Phys_IOPS_Tot for 999999999999
spool io_max_checkup.log
select min(begin_time), max(end_time),
sum(case metric_name when 'Physical Read Total Bytes Per Sec' then maxval end) Phys_Read_Tot_Bps,
sum(case metric_name when 'Physical Write Total Bytes Per Sec' then maxval end) Phys_Write_Tot_Bps,
sum(case metric_name when 'Redo Generated Per Sec' then maxval end) Redo_Bytes_per_sec,
sum(case metric_name when 'Physical Read Total IO Requests Per Sec' then maxval end) Phys_Read_IOPS,
sum(case metric_name when 'Physical Write Total IO Requests Per Sec' then maxval end) Phys_write_IOPS,
sum(case metric_name when 'Redo Writes Per Sec' then maxval end) Phys_redo_IOPS,
sum(case metric_name when 'Current OS Load' then maxval end) OS_LOad,
sum(case metric_name when 'CPU Usage Per Sec' then maxval end) DB_CPU_Usage_per_sec,
sum(case metric_name when 'Host CPU Utilization (%)' then maxval end) Host_CPU_util, --NOTE 100% = 1 loaded RAC node
sum(case metric_name when 'Network Traffic Volume Per Sec' then maxval end) Network_bytes_per_sec,
snap_id
from dba_hist_sysmetric_summary
group by snap_id
order by snap_id;
spool off
spool io_maxtot_summary.log
select min(begin_time), max(end_time),
sum(case metric_name when 'Physical Read Total Bytes Per Sec' then maxval end)/1024/1024 +
sum(case metric_name when 'Physical Write Total Bytes Per Sec' then maxval end)/1024/1024 +
sum(case metric_name when 'Redo Generated Per Sec' then maxval end)/1024/1024 Phys_IO_Tot_MBps,
sum(case metric_name when 'Physical Read Total IO Requests Per Sec' then maxval end) +
sum(case metric_name when 'Physical Write Total IO Requests Per Sec' then maxval end) +
sum(case metric_name when 'Redo Writes Per Sec' then maxval end) Phys_IOPS_Tot,
sum(case metric_name when 'Current OS Load' then maxval end) OS_LOad,
sum(case metric_name when 'CPU Usage Per Sec' then maxval end) DB_CPU_Usage_per_sec,
sum(case metric_name when 'Host CPU Utilization (%)' then maxval end) Host_CPU_util, --NOTE 100% = 1 loaded RAC node
sum(case metric_name when 'Network Traffic Volume Per Sec' then maxval end) Network_bytes_per_sec,
snap_id
from dba_hist_sysmetric_summary
group by snap_id
order by snap_id;
spool off
Подписаться на:
Комментарии (Atom)