您好,登錄后才能下訂單哦!
DECLARE
my_task_id number;
obj_id number;
my_task_name varchar2(100);
my_task_desc varchar2(500);
BEGIN
my_task_name := 'Table_Segment_Advice';
my_task_desc := 'Manual Segment Advisor Run';
---------
-- Step 1 創建一個任務
---------
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 為這個任務分配一個對象
---------
dbms_advisor.create_object (
task_name => my_task_name,
object_type => 'TABLE',
attr1 => 'user_name',
attr2 => 'table_name',
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 b.advisor_name,c.attr1,c.attr2,a.task_name,a.message,a.more_info
from DBA_ADVISOR_FINDINGS a,DBA_ADVISOR_TASKS b,dba_advisor_objects c
where a.task_id=b.task_id
and b.advisor_name='Segment Advisor'
and b.task_name='Table_Segment_Advice'
and a.object_id=c.object_id
and a.task_id=c.task_id
或
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('TRUE', 'FALSE', 'FALSE'));
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。