MINI MINI MANI MO
Rem
Rem $Header: rdbms/admin/dbmsaddm.sql /main/11 2014/02/20 12:45:48 surman Exp $
Rem
Rem dbmsaddm.sql
Rem
Rem Copyright (c) 2006, 2014, Oracle and/or its affiliates.
Rem All rights reserved.
Rem
Rem NAME
Rem dbmsaddm.sql - Declaration of the DBMS_ADDM package
Rem
Rem DESCRIPTION
Rem Utilities for using ADDM
Rem
Rem NOTES
Rem
Rem
Rem BEGIN SQL_FILE_METADATA
Rem SQL_SOURCE_FILE: rdbms/admin/dbmsaddm.sql
Rem SQL_SHIPPED_FILE: rdbms/admin/dbmsaddm.sql
Rem SQL_PHASE: DBMSADDM
Rem SQL_STARTUP_MODE: NORMAL
Rem SQL_IGNORABLE_ERRORS: NONE
Rem SQL_CALLING_FILE: rdbms/admin/catpdbms.sql
Rem END SQL_FILE_METADATA
Rem
Rem MODIFIED (MM/DD/YY)
Rem surman 12/29/13 - 13922626: Update SQL metadata
Rem surman 03/27/12 - 13615447: Add SQL patching tags
Rem arbalakr 02/16/12 - Add APIs to get compare period addm reports
Rem ushaft 02/16/12 - Add rt addm interface.
Rem ushaft 08/08/08 - ADd ASH query for ADDM findings
Rem ushaft 11/29/06 - moved describe_directive to prvt_hdm
Rem ushaft 08/07/06 - added SQL/Segment/Parameter directives
Rem ushaft 05/10/06 - Created
Rem
@@?/rdbms/admin/sqlsessstart.sql
CREATE OR REPLACE PACKAGE dbms_addm
authid current_user
IS
-- PROCEDURE DBMS_ADDM.analyze_db
-- PURPOSE: Create and execute an ADDM task to analyze all instances
-- of a database for a rango of snapshots.
-- PARAMETERS:
-- TASK_NAME
-- An optional task name. Task names must be unique to the user.
-- If not specified, a name will be generated by the system.
-- BEGIN_SNAPSHOT
-- The snapshot id for the beginning of the analysis period
-- END_SNAPSHOT
-- The snapshot id for the end of the analysis period
-- DB_ID
-- The databse to analyze, defaults to current database.
procedure analyze_db ( task_name in out varchar2,
begin_snapshot in number,
end_snapshot in number,
db_id in number := NULL);
-- PROCEDURE DBMS_ADDM.analyze_inst
-- PURPOSE: Create and execute an ADDM task to analyze a specific instance
-- of a database for a rango of snapshots.
-- PARAMETERS:
-- TASK_NAME
-- An optional task name. Task names must be unique to the user.
-- If not specified, a name will be generated by the system.
-- BEGIN_SNAPSHOT
-- The snapshot id for the beginning of the analysis period
-- END_SNAPSHOT
-- The snapshot id for the end of the analysis period
-- INSTANCE_NUMBER
-- The number of the instance to analyze, defaults to current
-- DB_ID
-- The databse to analyze, defaults to current database.
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);
-- PROCEDURE DBMS_ADDM.analyze_partial
-- PURPOSE: Create and execute an ADDM task to analyze a partial list
-- of instances for a rango of snapshots.
-- PARAMETERS:
-- TASK_NAME
-- An optional task name. Task names must be unique to the user.
-- If not specified, a name will be generated by the system.
-- INSTANCE_NUMBERS
-- A comma separated list of instance numbers that participate
-- in the analysis
-- BEGIN_SNAPSHOT
-- The snapshot id for the beginning of the analysis period
-- END_SNAPSHOT
-- The snapshot id for the end of the analysis period
-- DB_ID
-- The databse to analyze, defaults to current database.
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);
-- PROCEDURE DBMS_ADDM.insert_finding_directive
-- PURPOSE: insert a directive filtering a finding, either for a task or
-- system wide.
-- PARAMETERS:
-- TASK_NAME
-- An optional task name. If NULL, this is a system directive.
-- DIR_NAME
-- A unique name identifying the new directive
-- FINDING_NAME
-- A name for the finding, will appear in the "FINDING_NAME"
-- column of dba_advisor_findings.
-- MIN_ACTIVE_SESSIONS
-- Minimal value for active sessions. A finding is filtered out
-- if it has less active sessions than this value.
-- MIN_PERC_IMPACT
-- Minimal value for percentage of impact (0-100). A finding
-- is filtered out if its impact is less than this percentage of
-- the database time of the analysis period.
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);
-- PROCEDURE DBMS_ADDM.insert_finding_directive
-- PURPOSE: insert a directive filtering sql recommendations,
-- either for a task or system wide.
-- PARAMETERS:
-- TASK_NAME
-- An optional task name. If NULL, this is a system directive.
-- DIR_NAME
-- A unique name identifying the new directive
-- SQL_ID
-- A string identifying the SQL (13 characters).
-- MIN_ACTIVE_SESSIONS
-- Minimal value for active sessions. Ain action is filtered out
-- if the SQL's total db time is less than this value.
-- MIN_PERC_IMPACT
-- Minimal value for response time (microseconds).
-- A SQL action is filtered out if the response time is less than
-- this value.
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);
-- PROCEDURE DBMS_ADDM.insert_segment_directive
-- PURPOSE: insert a directive filtering recommendations to run segment
-- advisor.
-- PARAMETERS:
-- TASK_NAME
-- An optional task name. If NULL, this is a system directive.
-- DIR_NAME
-- A unique name identifying the new directive
-- OWNER_NAME
-- The owner of the segment.
-- OBJECT_NAME
-- The name of the main object. If NULL, then all objects for the
-- specified owner are filtered.
-- SUB_OBJECT_NAME
-- The name of a partition of the object. If null, than all
-- partitions of the object are filtered. Also, if the object is
-- not partitioned, leave the value as NULL.
--
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);
-- PROCEDURE DBMS_ADDM.insert_segment_directive
-- PURPOSE: insert a directive filtering recommendations to run segment
-- advisor.
-- PARAMETERS:
-- TASK_NAME
-- An optional task name. If NULL, this is a system directive.
-- DIR_NAME
-- A unique name identifying the new directive
-- OBJECT_NUMBER
-- The data object number (as appears in OBJ$)
--
procedure insert_segment_directive ( task_name in varchar2,
dir_name in varchar2,
object_number in number);
-- PROCEDURE DBMS_ADDM.insert_parameter_directive
-- PURPOSE: insert a directive filtering a recommendations to change
-- a system parameter.
-- PARAMETERS:
-- TASK_NAME
-- An optional task name. If NULL, this is a system directive.
-- DIR_NAME
-- A unique name identifying the new directive
-- PARAMETER_NAME
-- The name of the system parameter. All actions to change this
-- parameter are filtered out.
procedure insert_parameter_directive ( task_name in varchar2,
dir_name in varchar2,
parameter_name in varchar2);
-- PROCEDURE DBMS_ADDM.delete_finding_directive
-- PURPOSE: delete an addm directive
-- PARAMETERS:
-- TASK_NAME
-- An optional task name. If NULL, this is a system directive.
-- DIR_NAME
-- A unique name identifying the directive
procedure delete_finding_directive ( task_name in varchar2,
dir_name in varchar2);
-- PROCEDURE DBMS_ADDM.delete_sql_directive
-- PURPOSE: delete an addm directive
-- PARAMETERS:
-- TASK_NAME
-- An optional task name. If NULL, this is a system directive.
-- DIR_NAME
-- A unique name identifying the directive
procedure delete_sql_directive ( task_name in varchar2,
dir_name in varchar2);
-- PROCEDURE DBMS_ADDM.delete_segment_directive
-- PURPOSE: delete an addm directive
-- PARAMETERS:
-- TASK_NAME
-- An optional task name. If NULL, this is a system directive.
-- DIR_NAME
-- A unique name identifying the directive
procedure delete_segment_directive ( task_name in varchar2,
dir_name in varchar2);
-- PROCEDURE DBMS_ADDM.delete_parameter_directive
-- PURPOSE: delete an addm directive
-- PARAMETERS:
-- TASK_NAME
-- An optional task name. If NULL, this is a system directive.
-- DIR_NAME
-- A unique name identifying the directive
procedure delete_parameter_directive ( task_name in varchar2,
dir_name in varchar2);
-- PROCEDURE DBMS_ADDM.delete
-- PURPOSE: delete an ADDM task
-- PARAMETERS:
-- TASK_NAME
-- The name of the task to be deleted.
procedure delete ( task_name in varchar2);
-- FUNCTION DBMS_ADDM.get_report
-- RETURN: a CLOB containing the report.
-- PURPOSE: get the report of an ADDM task.
-- PARAMETERS:
-- TASK_NAME
-- The name of the task to report on.
function get_report ( task_name in varchar2)
return clob;
-- FUNCTION DBMS_ADDM.get_ash_query
-- RETURN: a varchar containing an ASH query identifying the rows
-- in ASH with impact for the finding.
-- PURPOSE: get a SQL text of an ASH query for a finding
-- PARAMETERS:
-- TASK_NAME
-- The name of the task.
-- FINDING_ID
-- The ID of the finding within the task
function get_ash_query ( task_name in varchar2, finding_id in number)
return varchar2;
-- FUNCTION DBMS_ADDM.real_time_addm_report
-- RETURN: a clob containing a real time addm report for the
-- past 5 minutes.
-- PURPOSE: Get Real-Time ADDM report of a system.
-- Get a full RAC report - assumes SQL over GV$ is possible.
function real_time_addm_report
return clob;
-- FUNCTION DBMS_ADDM.compare_databases_report
-- RETURN: a clob containing a compare period addm report comparing the
-- the performance of a database over two different time periods
-- or the performance of two different databases over two different
-- time periods
-- PURPOSE: Get a compare period addm report for the given two time periods
-- PARAMETERS:
-- BASE_DBID
-- dbid of the base period.Default is NULL in which case
-- we choose the current dbid.
-- BASE_BEGIN_SNAP_ID
-- snapshot id of the beginning of the base period
-- BASE_END_SNAP_ID
-- snapshot id of the end of the base period
-- COMP_DBID
-- dbid of the comparison period. Default is NULL in
-- which case we choose the current dbid
-- COMP_BEGIN_SNAP_ID
-- snapshot id of the beginning of the comparison period
-- COMP_END_SNAP_ID
-- snapshot id of the end of the comparison period
-- REPORT_TYPE
-- Output type for the report - XML or HTML.Default is HTML
function compare_databases ( base_dbid in number := NULL,
base_begin_snap_id in number,
base_end_snap_id in number,
comp_dbid in number := NULL,
comp_begin_snap_id in number,
comp_end_snap_id in number,
report_type in varchar2 := 'HTML')
return clob;
-- FUNCTION DBMS_ADDM.compare_instances
-- RETURN: a clob containing a compare period addm report comparing the
-- the performance of a single instance over two different
-- time periods or the performance of two different instances
-- over two different time periods
-- PURPOSE: Get a compare period addm report for the given two time periods
-- PARAMETERS:
-- BASE_DBID
-- dbid of the base period.Default is NULL in which case
-- we choose the current dbid.
-- BASE_INSTANCE_ID
-- instance id of the base period
-- BASE_BEGIN_SNAP_ID
-- snapshot id of the beginning of the base period
-- BASE_END_SNAP_ID
-- snapshot id of the end of the base period
-- COMP_DBID
-- dbid of the comparison period. Default is NULL in
-- which case we choose the current dbid
-- COMP_INSTANCE_ID
-- instance id of the comparison period
-- COMP_BEGIN_SNAP_ID
-- snapshot id of the beginning of the comparison period
-- COMP_END_SNAP_ID
-- snapshot id of the end of the comparison period
-- REPORT_TYPE
-- Output type for the report - XML or HTML.Default is HTML
function compare_instances ( base_dbid in number := NULL,
base_instance_id in number,
base_begin_snap_id in number,
base_end_snap_id in number,
comp_dbid in number := NULL,
comp_instance_id in number,
comp_begin_snap_id in number,
comp_end_snap_id in number,
report_type in varchar2 := 'HTML')
return clob;
-- FUNCTION DBMS_ADDM.compare_capture_replay_report
-- RETURN: a clob containing a compare period addm report comparing the
-- the performance of a capture to a replay
-- PURPOSE: Get a compare period addm report
-- PARAMETERS:
-- REPLAY_ID
-- id of the replay to be compared
-- REPORT_TYPE
-- Output type for the report - XML or HTML.Default is HTML
function compare_capture_replay_report(replay_id in number,
report_type in varchar2 := 'HTML')
return clob;
-- FUNCTION DBMS_ADDM.compare_replay_replay_report
-- RETURN: a clob containing a compare period addm report comparing the
-- the performance of a replay to another replay
-- PURPOSE: Get a compare period addm report
-- PARAMETERS:
-- REPLAY_ID1
-- id of the replay to be compared
-- REPLAY_ID2
-- id of the replay to be compared
-- REPORT_TYPE
-- Output type for the report - XML or HTML.Default is HTML
function compare_replay_replay_report(replay_id1 in number,
replay_id2 in number,
report_type in varchar2 := 'HTML')
return clob;
END dbms_addm;
/
GRANT EXECUTE ON dbms_addm TO PUBLIC;
CREATE OR REPLACE PUBLIC SYNONYM dbms_addm FOR dbms_addm;
@?/rdbms/admin/sqlsessend.sql
OHA YOOOO