昨天,数据库发生了异常情况,数据库时快时慢,慢的时侯,无法查询,无法连接,情况总结如下:
由于有人不慎修改了dslam割接代码块:
/* 该代码块性能严重有问题
update (
select \*+BYPASS_UJVC use_nl(ds, mp, e)*\
mp.rsc_status_cd r1,
mp.version v1
from t_cut_dslam ds,
managed_port mp,
rsc_facing_serv_exp rfse
where ds.old_port_id = mp.managed_port_id
and ds.old_serv_id is not null
and ds.new_serv_id is null
and ds.new_port_id is not null
and mp.managed_port_id !=rfse.managed_port_id
)
set r1 = 101,
v1 = sysdate;
commit;*/
现修改如下:
update (
select /*+BYPASS_UJVC use_nl(ds, mp, e)*/
mp.rsc_status_cd r1,
mp.version v1
from t_cut_dslam ds,
managed_port mp
where ds.old_port_id = mp.managed_port_id
and ds.old_serv_id is not null
and ds.new_serv_id is null
and ds.new_port_id is not null
and not exists( select 1 from
rsc_facing_serv_exp rfse
where mp.managed_port_id =rfse.managed_port_id)
)
set r1 = 101,
v1 = sysdate;
commit;
导致REDO写入太快,近5分钟切换一次REDO
Tue May 5 17:15:14 2009
Thread 1 advanced to log sequence 1810 (LGWR switch)
Current log# 1 seq# 1810 mem# 0: /oracle/raw/rlv_s_redo_01
Current log# 1 seq# 1810 mem# 1: /oracle/raw/rlv_s_redo_02
Tue May 5 17:20:37 2009
Thread 1 advanced to log sequence 1811 (LGWR switch)
Current log# 2 seq# 1811 mem# 0: /oracle/raw/rlv_s_redo_03
Current log# 2 seq# 1811 mem# 1: /oracle/raw/rlv_s_redo_04
Tue May 5 17:25:37 2009
Thread 1 advanced to log sequence 1812 (LGWR switch)
Current log# 3 seq# 1812 mem# 0: /oracle/raw/rlv_s_redo_05
Current log# 3 seq# 1812 mem# 1: /oracle/raw/rlv_s_redo_06
Tue May 5 17:27:31 2009
WARNING: inbound connection timed out (ORA-3136)
Tue May 5 17:30:36 2009
Thread 1 advanced to log sequence 1813 (LGWR switch)
Current log# 1 seq# 1813 mem# 0: /oracle/raw/rlv_s_redo_01
Current log# 1 seq# 1813 mem# 1: /oracle/raw/rlv_s_redo_02
Tue May 5 17:35:15 2009
Thread 1 advanced to log sequence 1814 (LGWR switch)
Current log# 2 seq# 1814 mem# 0: /oracle/raw/rlv_s_redo_03
Current log# 2 seq# 1814 mem# 1: /oracle/raw/rlv_s_redo_04
Tue May 5 17:39:38 2009
Thread 1 advanced to log sequence 1815 (LGWR switch)
Current log# 3 seq# 1815 mem# 0: /oracle/raw/rlv_s_redo_05
Current log# 3 seq# 1815 mem# 1: /oracle/raw/rlv_s_redo_06
Tue May 5 17:42:50 2009
Thread 1 advanced to log sequence 1816 (LGWR switch)
Current log# 1 seq# 1816 mem# 0: /oracle/raw/rlv_s_redo_01
Current log# 1 seq# 1816 mem# 1: /oracle/raw/rlv_s_redo_02
由于过快切换REDO,导致CPU在等待归档写完,造成CPU等待,而写完归档CPU恢复正常,
由于过快切换REDO,CPU在等待、正常,继续等待、正常的状态,
这是数据库时快时慢的原因。
经过杀掉操作系统进程,实例自动恢复后,现在恢复正常。
跟恢复有关的参数:
1.调整REDO时间
例程恢复的REDO操作是由SMON进程来完成的
通过配置初始化参数recovery_parallelism可以指定启动多个Slave进程的个数,来降低REDO时间
SQL> alter system set recovery_parallelism = 3 scope = spfile;
系统已更改。
SQL> shutdown immediate;
2.调整UNDO时间
例程恢复的UNDO操作是由后台进程SMON来完成的。为了降低例程恢复的UNDO时间,可以启动多个Slave进程
参数fast_start_parallel_rollback可以控制SLAE进程的个数
该参数为FALSE,则不会启用SLAVE进程,如果为LOW,则SLAVE进程个数为2倍的CPU个数,如果为HIGH,则Slave进程个数为4倍的CPU个数
SQL> show parameter fast_start_parallel_rollback
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
fast_start_parallel_rollback string LOW
当执行例程恢复时,通过查询v$fast_start_servers可以监视执行UNDO操作的进程信息。
select pid, state, undoblocksdone from v$fast_start_servers;
PID STATE UNDOBLOCKSDONE
---------- ----------- --------------
12 RECOVERING 4293
13 IDLE 0
14 IDLE 0
15 IDLE 0
PID用于惟一地标识恢复进程,STATE用于标识恢复进程的状态(IDLE:代闲状态,RECOVERING:正在恢复)
UNDOBLOCKSDONE用于标识已经回退的UNDO块个数。
当执行例程恢复时,通过查询v$fast_start_transactions,可以用于监视事务恢复的信息。
阅读(1287) | 评论(0) | 转发(0) |