博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
通过段调优顾问帮助解决行链接问题
阅读量:5235 次
发布时间:2019-06-14

本文共 5699 字,大约阅读时间需要 18 分钟。

--解决行链接问题SQL> create tablespace hzqtbs datafile '/u01/app/oracle/oradata/prod/hzqtbs.dbf' size 600m;Tablespace created.SQL> create user hzq identified by hzq default tablespace hzqtbs quota unlimited on hzqtbs account unlock;User created.SQL> grant create session to hzq;Grant succeeded.SQL> grant resource to hzq;Grant succeeded.SQL> conn hzq/hzqConnected.create table test (id number,name varchar2(100));beginfor i in  1..1000000 loopinsert into test values(i,'user'||i);commit;end loop;end;/--通过更新使字段边长生成行链接update test set name='userldsajflsadjfldsjfldsafdsahflsahfldsaflsajflkdajfjflajfldsakjflkdsajfldsajflsafjlasfadsafdsafsad';--删除,重新收集手动运行顾问DECLAREBEGINdbms_advisor.delete_task (task_name => 'MYTEST Advice');END;/DECLAREmy_task_id number;obj_id number;my_task_name varchar2(100);my_task_desc varchar2(500);BEGINmy_task_name := 'MYTEST Advice';my_task_desc := 'Manual Segment Advisor Run';----------- Step 1 create a task---------dbms_advisor.create_task (advisor_name => 'Segment Advisor',task_id => my_task_id,task_name => my_task_name,task_desc => my_task_desc);----------- Step 2 create a object---------dbms_advisor.create_object (task_name => my_task_name,object_type => 'TABLE',attr1 => 'HZQ',attr2 => 'TEST',attr3 => NULL,attr4 => NULL,attr5 => NULL,object_id => obj_id);----------- Step 3---------dbms_advisor.set_task_parameter(task_name => my_task_name,parameter => 'recommend_all',value => 'TRUE');----------- Step 4---------dbms_advisor.execute_task(my_task_name);END;/--查看看行链接问题SELECT'Task Name : ' || f.task_name || 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 TASK_ADVICEFROM dba_advisor_findings f,dba_advisor_objects oWHERE o.task_id = f.task_idAND o.object_id = f.object_idORDER BY f.task_name;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) ||'------------------------------------------------------' AdviceFROM dba_advisor_findings f,dba_advisor_objects o,dba_advisor_executions eWHERE o.task_id = f.task_idAND o.object_id = f.object_idAND f.task_id = e.task_idAND e. execution_start > sysdate - 1AND e.advisor_name = 'Segment Advisor'ORDER BY f.task_name;ADVICE----------------------------Task Name : MYTEST AdviceStart Run Time : 18-may-16 22:53Segment Name : TESTSegment Type : TABLEPartition Name :Message : The free space in the object is less than 10MB.More Info : Allocated Space:167772160: Used Space:165481507: Reclaimable Space :2290653:------------------------------------------------------Task Name : MYTEST AdviceStart Run Time : 18-may-16 22:53ADVICE-------------------------------------------------------Segment Name : TESTSegment Type : TABLEPartition Name :Message : The object has chained rows that can be removed by re-org.More Info : 46 percent chained rows can be removed by re-org.--有46%的行链接可以被remove,解决行链接的方法是通过move表来实现,但是表move后表的索引会失效,需要重建索引,行移动需要很多的表空间,建议表空间空余空间大于表的大小。SQL> create index idx_test on test(id);Index created.SQL> conn / as sysdbaConnected.SQL> select owner,index_name,status from dba_indexes where table_name='TEST';OWNER                   INDEX_NAME              STATUS------------------------------ ------------------------------ --------HZQ                   IDX_TEST               UNUSABLESQL> alter index hzq.IDX_TEST rebuild;Index altered.--删除,重新收集手动运行顾问DECLAREBEGINdbms_advisor.delete_task (task_name => 'MYTEST Advice');END;/DECLAREmy_task_id number;obj_id number;my_task_name varchar2(100);my_task_desc varchar2(500);BEGINmy_task_name := 'MYTEST Advice';my_task_desc := 'Manual Segment Advisor Run';----------- Step 1 create a task---------dbms_advisor.create_task (advisor_name => 'Segment Advisor',task_id => my_task_id,task_name => my_task_name,task_desc => my_task_desc);----------- Step 2 create a object---------dbms_advisor.create_object (task_name => my_task_name,object_type => 'TABLE',attr1 => 'HZQ',attr2 => 'TEST',attr3 => NULL,attr4 => NULL,attr5 => NULL,object_id => obj_id);----------- Step 3---------dbms_advisor.set_task_parameter(task_name => my_task_name,parameter => 'recommend_all',value => 'TRUE');----------- Step 4---------dbms_advisor.execute_task(my_task_name);END;/SQL> 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 || ch  2    3    4    5    6  r(10) ||'Message : ' || f.message || chr(10) ||'More Info : ' || f.more_info || chr(10) ||'------------------------------------------------------' AdviceFROM dba_advisor_findings f,dba_advisor_objects o,dba_advisor_executions eWHERE o.task_id = f.ta  7    8    9   10   11   12   13  sk_idAND o.object_id = f.object_idAND f.task_id = e.task_idAND e. execution_start > sysdate - 1AND e.advisor_name = 'Segment Advisor'ORDER BY f.task_name; 14   15   16   17   18  ADVICE----------------------------------------------------Task Name : MYTEST AdviceStart Run Time : 18-may-16 23:07Segment Name : TESTSegment Type : TABLEPartition Name :Message : The free space in the object is less than 10MB.More Info : Allocated Space:134217728: Used Space:126002153: Reclaimable Space :8215575:--------------------------------------------------------结果没有显示行链接问题

 

转载于:https://www.cnblogs.com/houzhiqing/p/5507076.html

你可能感兴趣的文章
Java Concurrentmodificationexception异常原因和解决方法
查看>>
客户端访问浏览器的流程
查看>>
codeforces水题100道 第二十二题 Codeforces Beta Round #89 (Div. 2) A. String Task (strings)
查看>>
c++||template
查看>>
[BZOJ 5323][Jxoi2018]游戏
查看>>
编程面试的10大算法概念汇总
查看>>
Vue
查看>>
python-三级菜单和购物车程序
查看>>
条件断点 符号断点
查看>>
VMware12 + Ubuntu16.04 虚拟磁盘扩容
查看>>
水平垂直居中
查看>>
MySQL简介
查看>>
设计模式之桥接模式(Bridge)
查看>>
jquery的$(document).ready()和onload的加载顺序
查看>>
Python Web框架Django (五)
查看>>
.net学习之继承、里氏替换原则LSP、虚方法、多态、抽象类、Equals方法、接口、装箱拆箱、字符串------(转)...
查看>>
【codevs1033】 蚯蚓的游戏问题
查看>>
【程序执行原理】
查看>>
python的多行注释
查看>>
连接Oracle需要jar包和javadoc文档的下载
查看>>