dbms-凯发app官方网站

凯发app官方网站-凯发k8官网下载客户端中心 | | 凯发app官方网站-凯发k8官网下载客户端中心
  • 博客访问: 3502786
  • 博文数量: 718
  • 博客积分: 1860
  • 博客等级: 上尉
  • 技术积分: 7790
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-07 08:51
个人简介

偶尔有空上来看看

文章分类

全部博文(718)

文章存档

2024年(4)

2023年(74)

2022年(134)

2021年(238)

2020年(115)

2019年(11)

2018年(9)

2017年(9)

2016年(17)

2015年(7)

2014年(4)

2013年(1)

2012年(11)

2011年(27)

2010年(35)

2009年(11)

2008年(11)

最近访客
相关博文
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·

分类: oracle

2010-09-20 20:45:03

一些dbms_xxxx包的内容打包

dbms_advisor.sql               dbms_alert.sql
dbms_auto_task.sql             dbms_backup_restore.sql
dbms_crypto.sql                dbms_datapump.sql
dbms_job.sql                   dbms_lob.sql
dbms_lock.sql                  dbms_logmnr.sql
dbms_logmnr_d.sql              dbms_metadata.sql
dbms_output.sql                dbms_rcvman.sql
dbms_redefinition.sql          dbms_refresh.sql
dbms_repair.sql                dbms_repcat.sql
dbms_result_cache.sql          dbms_rowid.sql
dbms_scheduler.sql             dbms_session.sql
dbms_shared_pool.sql           dbms_snapshot.sql
dbms_space .sql                dbms_spm.sql
dbms_spm_internal.sql          dbms_sql.sql
dbms_sqlpa.sql                 dbms_stats.sql
dbms_stats_internal.sql        dbms_streams.sql
dbms_system.sql                dbms_trace.sql
dbms_tts.sql                   dbms_workload_repository.sql

 

文件: dbms_x_11g.rar
大小: 398kb
下载:
oracle 11gr2 数据库 dbms_addm包内容

 

package body dbms_addm
is

procedure validate_task(task_name_in in out varchar2)
is
  tid number;
  status_t varchar2(11);

begin
  select max(status) into status_t
  from user_advisor_tasks
  where advisor_name = 'addm' and
         task_name = task_name_in;
        
  
  if status_t is null then
    dbms_advisor.create_task('addm', tid, task_name_in);
    return;
  
  elsif status_t = 'completed' or status_t = 'executing' then
    return;

  
  elsif status_t <> 'initial' then
    dbms_advisor.reset_task(task_name_in);
  end if;
end;



procedure analyze_db ( task_name in out varchar2,
                       begin_snapshot in number,
                       end_snapshot in number,
                       db_id in number := null)
is

begin
  dbms_management_packs.check_pack_enabled('diagnostic');
  validate_task(task_name);
  dbms_advisor.set_task_parameter(task_name, 'start_snapshot', begin_snapshot);
  dbms_advisor.set_task_parameter(task_name, 'end_snapshot', end_snapshot);
  if db_id is not null then
    dbms_advisor.set_task_parameter(task_name, 'db_id', db_id);
  end if;
  dbms_advisor.execute_task(task_name);
end;



procedure analyze_inst ( task_name in out varchar2,
                         begin_snapshot in number,
                         end_snapshot in number,
                         instance_number in number := null,
                         db_id in number := null)
is
  inst_id number;
  dbid number;

begin
  dbms_management_packs.check_pack_enabled('diagnostic');

  validate_task(task_name);
  dbms_advisor.set_task_parameter(task_name, 'start_snapshot', begin_snapshot);
  dbms_advisor.set_task_parameter(task_name, 'end_snapshot', end_snapshot);

  inst_id := instance_number;
  dbid := db_id;

  if db_id is not null then
    dbms_advisor.set_task_parameter(task_name, 'db_id', dbid);
  end if;

  if inst_id is null then
    select dbms_utility.current_instance into inst_id from dual;
  end if;
  dbms_advisor.set_task_parameter(task_name, 'instance', inst_id);

  dbms_advisor.execute_task(task_name);
end;




procedure analyze_partial ( task_name in out varchar2,
                            instance_numbers in varchar2,
                            begin_snapshot in number,
                            end_snapshot in number,
                            db_id in number := null)
is

begin
  dbms_management_packs.check_pack_enabled('diagnostic');

  validate_task(task_name);
  dbms_advisor.set_task_parameter(task_name, 'instances', instance_numbers);
  dbms_advisor.set_task_parameter(task_name, 'start_snapshot', begin_snapshot);
  dbms_advisor.set_task_parameter(task_name, 'end_snapshot', end_snapshot);
  if db_id is not null then
    dbms_advisor.set_task_parameter(task_name, 'db_id', db_id);
  end if;
  dbms_advisor.execute_task(task_name);
end;







procedure insert_finding_directive ( task_name in varchar2,
                                     dir_name in varchar2,
                                     finding_name in varchar2,
                                     min_active_sessions in number := 0,
                                     min_perc_impact in number := 0)
is
  dir_id number;
  dir_text varchar2(2000);
  cnt number;

  task_name_cpy varchar2(100) := task_name;

begin
  dbms_management_packs.check_pack_enabled('diagnostic');
  if min_active_sessions is null or min_active_sessions < 0 then
    dbms_sys_error.raise_system_error(-13704,
                                      nvl(to_char(min_active_sessions),'null'),
                                      'min_active_session');
  end if;
  if min_perc_impact is null or min_perc_impact < 0 or min_perc_impact >100 then
    dbms_sys_error.raise_system_error(-13704,
                                      nvl(to_char(min_perc_impact),'null'),
                                      'min_perc_impact');
  end if;

  
  if not prvt_advisor.finding_name_exists('addm',finding_name) then
    dbms_sys_error.raise_system_error(-13713, finding_name);
  end if;

  
  if task_name is not null then
    validate_task(task_name_cpy);
  end if;

  dir_id := prvt_advisor.get_directive_id('addm', 'finding filter');

  dir_text :=
    ' ' ||
    ' ' ||
    ' ' || finding_name || ' ' ||
    ' ' ||
    ' ' ||
    ' ' || min_active_sessions || ' ' ||
    ' ' ||
    ' ' ||
    ' ' || min_perc_impact || ' ' ||
    ' ' ||
    '';

  dbms_advisor.insert_directive(dir_id, dir_name, task_name, dir_text);
end;







procedure insert_sql_directive ( task_name in varchar2,
                                 dir_name in varchar2,
                                 sql_id in varchar2,
                                 min_active_sessions in number := 0,
                                 min_response_time in number := 0)
is
  dir_id number;
  dir_text varchar2(2000);
  i number;
  c varchar2(1);

  task_name_cpy varchar2(100) := task_name;
begin
  dbms_management_packs.check_pack_enabled('diagnostic');

  if sql_id is null then
    dbms_sys_error.raise_system_error(-13704, 'null',
                                      'sql_id');
  end if;
  if min_active_sessions is null or min_active_sessions < 0 then
    dbms_sys_error.raise_system_error(-13704,
                                      nvl(to_char(min_active_sessions),'null'),
                                      'min_active_session');
  end if;
  if min_response_time is null or min_response_time < 0 then
    dbms_sys_error.raise_system_error(-13704,
                                      nvl(to_char(min_response_time),'null'),
                                      'min_response_time');
  end if;

  if length(sql_id) <> 13 then
    dbms_sys_error.raise_system_error(-13714, sql_id);
  end if;
  for i in 1..13 loop
    c := substr(sql_id, i, 1);
    if not ((c >= '0' and c <= '9') or (c >= 'a' and c <= 'z')) then
      dbms_sys_error.raise_system_error(-13714, sql_id);
    end if;
  end loop;

  
  if task_name is not null then
    validate_task(task_name_cpy);
  end if;

  dir_id := prvt_advisor.get_directive_id('addm', 'sql filter');

  dir_text :=
    ' ' ||
    ' ' ||
    ' ' || sql_id || ' ' ||
    ' ' ||
    ' ' ||
    ' ' || min_active_sessions || ' ' ||
    ' ' ||
    ' ' ||
    ' ' || min_response_time || ' ' ||
    ' ' ||
    '';

  dbms_advisor.insert_directive(dir_id, dir_name, task_name, dir_text);
end;









procedure insert_segment_directive ( task_name in varchar2,
                                     dir_name in varchar2,
                                     owner_name in varchar2,
                                     object_name in varchar2 := null,
                                     sub_object_name in varchar2 := null)
is
  dir_id number;
  dir_text varchar2(2000);
  name1 varchar2(100);
  name2 varchar2(100);
  name3 varchar2(100);

  task_name_cpy varchar2(100) := task_name;
begin
  dbms_management_packs.check_pack_enabled('diagnostic');
  if owner_name is null then
    name1 := '%';
  else
    name1 := lower(owner_name);
  end if;
  if object_name is null then
    name2 := '%';
  else
    name2 := lower(object_name);
  end if;
  if sub_object_name is null then
    name3 := '%';
  else
    name3 := lower(sub_object_name);
  end if;

  
  if task_name is not null then
    validate_task(task_name_cpy);
  end if;

  dir_id := prvt_advisor.get_directive_id('addm', 'segment filter');

  dir_text :=
    ' ' ||
    ' ' ||
    ' ' || name1 || ' ' ||
    ' ' ||
    ' ' ||
    ' ' || name2 || ' ' ||
    ' ' ||
    ' ' ||
    ' ' || name3 || ' ' ||
    ' ' ||
    ' ' ||
    ' 0 ' ||
    ' ' ||
    '';

  dbms_advisor.insert_directive(dir_id, dir_name, task_name, dir_text);
end;








procedure insert_segment_directive ( task_name in varchar2,
                                     dir_name in varchar2,
                                     object_number in number)

is
  dir_id number;
  dir_text varchar2(2000);

  task_name_cpy varchar2(100) := task_name;
begin
  dbms_management_packs.check_pack_enabled('diagnostic');

  
  if task_name is not null then
    validate_task(task_name_cpy);
  end if;

  dir_id := prvt_advisor.get_directive_id('addm', 'segment filter');

  dir_text :=
    ' ' ||
    ' ' ||
    ' 0 ' ||
    ' ' ||
    ' ' ||
    ' 0 ' ||
    ' ' ||
    ' ' ||
    ' 0 ' ||
    ' ' ||
    ' ' ||
    ' ' || object_number || ' ' ||
    ' ' ||
    '';

  dbms_advisor.insert_directive(dir_id, dir_name, task_name, dir_text);
end;








procedure insert_parameter_directive ( task_name in varchar2,
                                       dir_name in varchar2,
                                       parameter_name in varchar2)

is
  dir_id number;
  dir_text varchar2(2000);
  cnt number;
  pn varchar2(300) := lower(parameter_name);

  task_name_cpy varchar2(100) := task_name;
begin
  dbms_management_packs.check_pack_enabled('diagnostic');

  
  if task_name is not null then
    validate_task(task_name_cpy);
  end if;

  dir_id := prvt_advisor.get_directive_id('addm', 'parameter filter');

  if not prvt_hdm.parameter_exists(pn) then
    dbms_sys_error.raise_system_error(-13715, nvl(parameter_name, 'null'));
  end if;

  dir_text :=
    ' ' ||
    ' ' ||
    ' ' || pn || ' ' ||
    ' ' ||
    '';

  dbms_advisor.insert_directive(dir_id, dir_name, task_name, dir_text);
end;






procedure delete_finding_directive ( task_name in varchar2,
                                     dir_name in varchar2)
is
  dir_id number;
begin
  dbms_management_packs.check_pack_enabled('diagnostic');

  dir_id := prvt_advisor.get_directive_id('addm', 'finding filter');
 
  dbms_advisor.delete_directive(dir_id, dir_name, task_name);
end;






procedure delete_sql_directive ( task_name in varchar2,
                                 dir_name in varchar2)
is
  dir_id number;
begin
  dbms_management_packs.check_pack_enabled('diagnostic');

  dir_id := prvt_advisor.get_directive_id('addm', 'sql filter');

  dbms_advisor.delete_directive(dir_id, dir_name, task_name);
end;





procedure delete_segment_directive ( task_name in varchar2,
                                     dir_name in varchar2)
is
  dir_id number;
begin
  dbms_management_packs.check_pack_enabled('diagnostic');

  dir_id := prvt_advisor.get_directive_id('addm', 'segment filter');
 
  dbms_advisor.delete_directive(dir_id, dir_name, task_name);
end;






procedure delete_parameter_directive ( task_name in varchar2,
                                       dir_name in varchar2)
is
  dir_id number;
begin
  dbms_management_packs.check_pack_enabled('diagnostic');

  dir_id := prvt_advisor.get_directive_id('addm', 'parameter filter');
 
  dbms_advisor.delete_directive(dir_id, dir_name, task_name);
end;






procedure delete ( task_name in varchar2)
is
  cursor tnames(tn varchar2) is
  select task_name
  from user_advisor_tasks
  where task_name = tn
    and advisor_name = 'addm';
begin
  dbms_management_packs.check_pack_enabled('diagnostic');
  for t in tnames(task_name) loop
    dbms_advisor.delete_task(t.task_name);
  end loop;
end;







function get_report ( task_name in varchar2)
return clob
is
begin
  dbms_management_packs.check_pack_enabled('diagnostic');
  return dbms_advisor.get_task_report(task_name);
end;









function get_ash_query ( task_name in varchar2, finding_id in number)
return varchar2
is
begin
  dbms_management_packs.check_pack_enabled('diagnostic');
  dbms_advisor.check_privs;
  prvt_advisor.check_task_enabled(task_name,
                                  dbms_advisor.adv_name_addm,
                                  false);
  return prvt_hdm.get_ash_query(task_name, finding_id);
end;



end dbms_addm;


阅读(3227) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2010-09-23 19:00:51

很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com

|
")); function link(t){ var href= $(t).attr('href'); href ="?url=" encodeuricomponent(location.href); $(t).attr('href',href); //setcookie("returnouturl", location.href, 60, "/"); }
网站地图