ORACLE故障排除--注意事项
来源:互联网 发布:手机网站制作软件 编辑:程序博客网 时间:2024/04/29 17:58
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移动硬盘故障排除
- 自动关机故障排除方法
- windows正版验证问题。。。
- Word文档加密器(V4.0)
- 数据结构-二叉树算法
- 用VC++获取系统时间几种方法
- 我的生活:由聪明的猴子转变为沉默羔羊.....
- ORACLE故障排除--注意事项
- RSI症及正确的打字方式
- 属性访问的JSP,Webwokr Tag和Velocity模板表达方式比较
- udev的实现原理
- 好书《无毒一身轻—21天改变体质》- 总结
- 从西直门走到五道口
- 转载:盘点开放源码软件
- new和override的区别?
- SQL实验四 连接查询和嵌套查询