ORACLE故障排除--注意事项
来源:互联网 发布:海南大学网络教育平台 编辑:程序博客网 时间:2024/04/28 06:05
1. 在系统良好运作时, 进行一次Statspack! 并将结果文件保存作为以后的判断标准.
2. ORACLE中建立一张存放有执行计划的表
脚本如下:
--建立一张计划表
create table plan_hashes
( sql_text varchar2(1000),
hash_value number,
plan_hash_value number,
constraint plan_hashes_pk
primary key(hash_value,sql_text,plan_hash_value)
)
organization index;
--将shared_pool中的语句插入计划表
insert into plan_hashes( sql_text, hash_value, plan_hash_value )
select distinct sql_text,
hash_value,
plan_hash_value
from v$sql
where command_type in (
/* DELETE */ 7, /* INSERT */ 2,
/* MERGE */ 189, /* SELECT */ 3,
/* UPDATE */ 6 )
and parsing_user_id <> 0
and parsing_schema_id <> 0;
--查看当前shared pool中的执行计划与计划表的差异
select distinct sql_text,
hash_value,
plan_hash_value,
decode( (select 1
from plan_hashes
where plan_hashes.hash_value = v$sql.hash_value
and plan_hashes.sql_text = v$sql.sql_text
and rownum = 1), 1, 'Changed', 'New' ) status
from v$sql
where (sql_text, hash_value, plan_hash_value)
not in (select sql_text, hash_value, plan_hash_value
from plan_hashes)
and command_type in (
/* DELETE */ 7, /* INSERT */ 2,
/* MERGE */ 189, /* SELECT */ 3,
/* UPDATE */ 6 )
and parsing_user_id <> 0
and parsing_schema_id <> 0
/
--shared_pool中新的执行计划存入计划表
insert into plan_hashes( sql_text, hash_value, plan_hash_value )
select distinct sql_text,
hash_value,
plan_hash_value
from v$sql
where (sql_text, hash_value, plan_hash_value)
not in (select sql_text, hash_value, plan_hash_value
from plan_hashes)
and command_type in (
/* DELETE */ 7, /* INSERT */ 2,
/* MERGE */ 189, /* SELECT */ 3,
/* UPDATE */ 6 )
and parsing_user_id <> 0
and parsing_schema_id <> 0
/
3. 找出差异
收集了之前的历史资料,我们就能通过比对找出两者之间的差别
4. 每次只更改一个问题
不要多个人同时更改多个问题,也不要一个人更改多个问题,这样就无法确定到底是哪个变动解决了问题所在
5. 确认是否需要修改这个问题
改动一个问题之前要先确定目标,并且经过验证(小规模的基准测试是必要的)之后才能动手
6. 做好备份
任何改动之前都需要进行备份,使系统能够回退到改动前的状态时必须的
7. 建立小型的测试用例
由于系统可能会很庞大,运行起来相当复杂耗时,所以需要尽可能多的剥离不需要的代码,使用简单,明了的测试用例重现错误!
- ORACLE故障排除--注意事项
- ORACLE故障排除--注意事项
- ORACLE故障排除--注意事项
- ORACLE故障排除--注意事项
- 故障排除
- 故障排除
- 服务器故障排除方法
- 网卡故障排除详解
- 排除路由器崩溃故障
- TCP/IP 故障排除
- 孤立用户故障排除
- 计算机故障排除手册
- 磁盘空间满故障排除
- WinXP启动故障排除
- aiCache故障排除101
- 常见IIS故障排除
- USB移动硬盘故障排除
- 自动关机故障排除方法
- 生命周期事件
- 管道流
- MVC 3 Web Mail
- 用delphi操作mapinfo
- Delphi利用MSCOMM控件进行GPS数据采集
- ORACLE故障排除--注意事项
- memcached java 应用
- NO-SQL相关技术信息汇总
- Linux字符设备驱动
- Google C++ Style
- 自定义的弹出窗口/无菜单栏最大化窗口代码/
- 自增列为11位,从KT000000001开始每次增长1
- HDU-3734 逆序对数
- Eclipse快捷键