当前位置:网站首页>Oracle段顾问、怎么处理行链接行迁移、降低高水位
Oracle段顾问、怎么处理行链接行迁移、降低高水位
2022-07-02 06:24:00 【贤时间】
Oracle 有3个定时运行的后台程序,段顾问建议、SQL语句诊断、收集 统计信息,其中段顾问建议是用来分析表数据在数据块中的分布是否合理,如是否产生行链接、行迁移、高水位情况是否合理。
查看段顾问建议是否启用
SELECT client_name ,status ,consumer_group
FROM dba_autotask_client
ORDER BY client_name;
查看 auto space advisor 这一行的状态
启用段顾问建议
--启用
BEGIN
DBMS_AUTO_TASK_ADMIN.ENABLE(
client_name => 'sql tuning advisor',
operation => NULL,
window_name => NULL);
END;
/
--查看
SELECT window_name,TO_CHAR(window_next_time,'YYYY-MM-DD HH24:MI:SS')
,sql_tune_advisor
FROM dba_autotask_window_clients;
查看段顾问建议内容
SELECT
'Segment Advice --------------------------'|| chr(10) ||
'TABLESPACE_NAME : ' || tablespace_name || chr(10) ||
'SEGMENT_OWNER : ' || segment_owner || chr(10) ||
'SEGMENT_NAME : ' || segment_name || chr(10) ||
'ALLOCATED_SPACE : ' || allocated_space || chr(10) ||
'RECLAIMABLE_SPACE: ' || reclaimable_space || chr(10) ||
'RECOMMENDATIONS : ' || recommendations || chr(10) ||
'SOLUTION 1 : ' || c1 || chr(10) ||
'SOLUTION 2 : ' || c2 || chr(10) ||
'SOLUTION 3 : ' || c3 Advice
FROM
TABLE(dbms_space.asa_recommendations('FALSE', 'FALSE', 'FALSE'));
select
'Task Name : ' || f.task_name || chr(10) ||
'Start Run Time : ' || TO_CHAR(execution_start, 'dd-mon-yy hh24:mi') || chr (10) ||
'Segment Name : ' || o.attr2 || chr(10) ||
'Segment Type : ' || o.type || chr(10) ||
'Partition Name : ' || o.attr3 || chr(10) ||
'Message : ' || f.message || chr(10) ||
'More Info : ' || f.more_info || chr(10) ||
'------------------------------------------------------' Advice
FROM dba_advisor_findings f
,dba_advisor_objects o
,dba_advisor_executions e
WHERE o.task_id = f.task_id
AND o.object_id = f.object_id
AND f.task_id = e.task_id
AND e. execution_start > sysdate - 1
AND e.advisor_name = 'Segment Advisor'
ORDER BY f.task_name;
什么是行链接
行链接是因为自身数据量大(初始或者后来更新的),导致一行数据需要跨多个数据块,这就是行链接。
什么是行迁移
一个行数据块初始比较小或者被更新后比较小,导致被放到有空间的别的数据块中,在原数据块只保留一个指针,指向存储数据的数据块,这就是行迁移。
行链接和行迁移有什么坏处
读取数据时会产生多余的I/O.
怎么处理行链接和行迁移
1.移动
- 移动表 alter table xxx move;
- 重建该表的所有索引
要注意,这个期间这个表不能有事务发生。
2.数据迁移
- 运行一个分析脚本分析产生链接的数据
- 将行链接和行迁移产生的数据插入到临时表
- 删除原表产生行链接和行迁移的数据
- 将临时表的数据再插入原表
3.利用数据泵导入导出重建表
什么是高水位
高水位是未使用数据块和已经使用数据块的分界线,查询数据的时候从高水位线开始往下找。
怎么降低高水位
有4中方法:
1.收缩表
- 启用行迁移 alter table emp enable row movement
- 执行收缩 alter table emp shrink space;
- 重建索引
2.truncate 表
3.移动表(需要重建索引)
4.使用数据泵将表导出,删除表,重新导入
边栏推荐
- Wechat applet Foundation
- In depth study of JVM bottom layer (V): class loading mechanism
- Date time API details
- Ceaspectuss shipping company shipping artificial intelligence products, anytime, anywhere container inspection and reporting to achieve cloud yard, shipping company intelligent digital container contr
- DeprecationWarning: . ix is deprecated. Please use. loc for label based indexing or. iloc for positi
- Latex error: the font size command \normalsize is not defined problem solved
- ORACLE 11G SYSAUX表空间满处理及move和shrink区别
- Improve user experience defensive programming
- Sqli labs customs clearance summary-page4
- Browser scrolling for more implementations
猜你喜欢
CTF three count
PHP Session原理简析
Sqli-labs customs clearance (less1)
Redis -- cache breakdown, penetration, avalanche
Take you to master the formatter of visual studio code
Queue (linear structure)
Sqli labs customs clearance summary-page4
[Zhang San learns C language] - deeply understand data storage
In depth study of JVM bottom layer (II): hotspot virtual machine object
Sqli labs customs clearance summary-page2
随机推荐
The win10 network icon disappears, and the network icon turns gray. Open the network and set the flash back to solve the problem
php中计算两个日期之前相差多少天、月、年
Recursion (maze problem, Queen 8 problem)
js判断数组中对象是否存在某个值
2021-07-17c /cad secondary development creation circle (5)
IDEA2020中测试PySpark的运行出错
Thinkphp5中一个字段对应多个模糊查询
Redis -- cache breakdown, penetration, avalanche
[Zhang San learns C language] - deeply understand data storage
php中删除指定文件夹下的内容
JS judge whether the object is empty
ARP攻击
[daily question] - Huawei machine test 01
Flask migrate cannot detect db String() equal length change
2021-07-05c /cad secondary development create arc (4)
Laravel8中的find_in_set、upsert的使用方法
php中的二维数组去重
Sqli Labs clearance summary - page 2
PgSQL learning notes
在php的开发环境中如何调取WebService?