General Information
Library Note
Morgan's Library Page Header
Purpose
Utility functions for HCS Logging from PL/SQL code
AUTHID
CURRENT_USER
Constants
Name
Data Type
Value
Logging
HCSLOG_VRB_NONE
INT
0
HCSLOG_VRB_SUMMARY
INT
1
HCSLOG_VRB_DETAIL_ALLOCS
INT
2
HCSLOG_VRB_DETAIL
INt
3
Dependencies
DBMS_ASSERT
DBMS_HIERARCHY
PLITBLM
DBMS_AVTUNE_UTIL
DBMS_MX_ODBO
UTL_FILE
DBMS_HCS_LIB
DBMS_STANDARD
Documented
No
Exceptions
Error Code
Reason
ORA-20000
Log called before Log START
ORA-44003
INVALID_SQL_NAME
First Available
21c
Security Model
Owned by SYS with EXECUTE granted to the DBA, PDB_DBA and AVTUNE_PKG_ROLE roles
Source
{ORACLE_HOME}/rdbms/admin/dbmshcslog.sql
Subprograms
CLEAR_LOGS
Clear the instance's logs
dbms_hcs_log.clear_logs;
exec dbms_hcs_log.clear_logs ;
PL/SQL procedure successfully completed.
CREATE_VIEWS
Creates objects and views used for logging
dbms_hcs_log.create_views(
user IN VARCHAR2 DEFAULT SYS_CONTEXT('USERENV', 'CURRENT_SCHEMA'));
exec dbms_hcs_log.create_views ;
PL/SQL procedure successfully completed.
SELECT object_name
FROM dba_objects
WHERE object_type = 'VIEW'
and owner = USER
AND last_ddl_time > SYSDATE-1/24
ORDER BY 1;
OBJECT_NAME
--------------------------------
TKHCS_LOG_BASE_VIEW
TKHCS_LOG_CALLS
TKHCS_LOG_CURRSESS_LASTLOG_VIEW
TKHCS_LOG_CURRSESS_VIEW
TKHCS_LOG_LASTSESS_VIEW
TKHCS_LOG_VIEW
DROP_VIEWS
Drops objects and views used for logging
dbms_hcs_log.drop_views(
user IN VARCHAR2 DEFAULT SYS_CONTEXT('USERENV', 'CURRENT_SCHEMA'));
exec dbms_hcs_log.drop_views ;
HCS_CALL_CTX_BUILD_CLOB
Builds a package private clob over numerous functions used for building a CLOB to log in one call
dbms_hcs_log.hcs_call_ctx_build_clob(line IN VARCHAR2);
exec dbms_hcs_log.hcs_call_ctx_build_clob ('TEST');
PL/SQL procedure successfully completed.
HCS_CALL_CTX_CLEAR_CLOB
Clears the private CLOB
dbms_hcs_log.hcs_call_ctx_clear_clob;
exec dbms_hcs_log.hcs_call_ctx_clear_clob ;
PL/SQL procedure successfully completed.
HCS_CALL_CTX_GET_LOG_VRB
Returns the logging detail level (0 - 3)
dbms_hcs_log.hcs_call_ctx_get_log_vrb RETURN NUMBER;
SELECT dbms_hcs_log.hcs_call_ctx_get_log_vrb ;
HCS_CALL_CTX_GET_LOG_VRB
------------------------
1
HCS_CALL_CTX_LOG
Sets CALL context for subsequent call_ctx_log
dbms_hcs_log.hcs_call_ctx_log(callStr IN VARCHAR2);
TBD
HCS_CALL_CTX_LOG_CLEAR_CLOB
writes the CLOB to the log and reinitializes it
dbms_hcs_log.hcs_call_ctx_log_clear_clob(p_comp IN VARCHAR2);
exec dbms_hcs_log.hcs_call_ctx_log_clear_clob ('TEST');
*
ORA-20000: Log called before Log START
See HCS_CALL_CTX_LOG_START Demo Below
HCS_CALL_CTX_LOG_END
Logs END call and nulls out current call context
dbms_hcs_log.hcs_call_ctx_log_end;
See HCS_CALL_CTX_LOG_START Demo Below
HCS_CALL_CTX_LOG_START
Sets the CALL context for subsequent call_ctx_log
dbms_hcs_log.hcs_call_ctx_log_start(callStr IN VARCHAR2);
exec dbms_hcs_log.hcs_call_ctx_log_start ('TEST');
PL/SQL procedure successfully completed.
exec dbms_hcs_log.hcs_call_ctx_log_clear_clob ('TEST');
PL/SQL procedure successfully completed.
exec dbms_hcs_log.hcs_call_ctx_log_end ;
PL/SQL procedure successfully completed.
PURGE
Purges HCS logs to the given max_segments. If call_only is TRUE (default) then the value for max_segments is not used for subsequent logging.
If call_only is FALSE, the value is used for subsequent logging.
dbms_hcs_log.purge(
max_segments IN NUMBER,
call_only IN BOOLEAN DEFAULT TRUE);
exec dbms_hcs_log.purge (1, TRUE);
PL/SQL procedure successfully completed.
SET_LOGGING_LEVEL (new 23ai)
Sets the analytic view log verbosity detail level
dbms_hcs_log.set_logging_level(
logging_level IN INT DEFAULT NULL,
alter_session IN BOOLEAN DEFAULT TRUE);
exec dbms_hcs_log.set_logging_level (1, TRUE);
PL/SQL procedure successfully completed.