Oracle DBMS_HCS_LOG
Version 21c

General Information
Library Note Morgan's Library Page Header
Which has the higher priority in your organization: Deploying a new database or securing the ones you already have? Looking for a website, and resources, dedicated solely to securing Oracle databases? Check out DBSecWorx.
Purpose Utility functions for HCS Logging from PLSQL code
AUTHID DEFINER
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_AVTUNE_UTIL DBMS_STANDARD
DBMS_AVTUNE DBMS_HCS_LIB UTL_FILE
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 DB and AVTUNE_PKG_ROLE roles
Source {ORACLE_HOME}/rdbms/admin/dbmshcslog.sql
Subprograms
 
CLEAR_LOGS (new 21c)
Clear the instance's logs dbms_hcs_log.clear_logs;
PRAGMA supplemental_log_data(clear_logs, UNSUPPORTED_WITH_COMMIT);
exec dbms_hcs_log.clear_logs;

PL/SQL procedure successfully completed.
 
CREATE_VIEWS (new 21)
Creates objects and views used for logging dbms_hcs_log.create_views(
user IN VARCHAR2 DEFAULT SYS_CONTEXT('USERENV', 'CURRENT_SCHEMA'));
PRAGMA supplemental_log_data(create_views, UNSUPPORTED_WITH_COMMIT);
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 (new 21c)
Drops objects and views used for logging dbms_hcs_log.drop_views(
user IN VARCHAR2 DEFAULT SYS_CONTEXT('USERENV', 'CURRENT_SCHEMA'));
PRAGMA supplemental_log_data(drop_views, UNSUPPORTED_WITH_COMMIT);
exec dbms_hcs_log.drop_views;
 
HCS_CALL_CTX_BUILD_CLOB (new 21c)
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);
PRAGMA supplemental_log_data(hcs_call_ctx_build_clob, UNSUPPORTED_WITH_COMMIT);
exec dbms_hcs_log.hcs_call_ctx_build_clob('TEST');

PL/SQL procedure successfully completed.
 
HCS_CALL_CTX_CLEAR_CLOB (new 21c)
Clears the private CLOB dbms_hcs_log.hcs_call_ctx_clear_clob;
PRAGMA supplemental_log_data(hcs_call_ctx_clear_clob, UNSUPPORTED_WITH_COMMIT);
exec dbms_hcs_log.hcs_call_ctx_clear_clob;

PL/SQL procedure successfully completed.
 
HCS_CALL_CTX_GET_LOG_VRB (new 21c)
Returns the logging detail level (0 - 3) dbms_hcs_log.hcs_call_ctx_get_log_vrb RETURN NUMBER;
PRAGMA supplemental_log_data(hcs_call_ctx_get_log_vrb, READ_ONLY);
SELECT dbms_hcs_log.hcs_call_ctx_get_log_vrb
FROM dual;

HCS_CALL_CTX_GET_LOG_VRB
------------------------
                       1
 
HCS_CALL_CTX_LOG (new 21c)
Sets CALL context for subsequent call_ctx_log dbms_hcs_log.hcs_call_ctx_log(callStr IN VARCHAR2);
PRAGMA supplemental_log_data(hcs_call_ctx_log_start, UNSUPPORTED_WITH_COMMIT);
TBD
 
HCS_CALL_CTX_LOG_CLEAR_CLOB (new 21c)
writes the CLOB to the log and reinitializes it dbms_hcs_log.hcs_call_ctx_log_clear_clob(p_comp IN VARCHAR2);
PRAGMA supplemental_log_data(hcs_call_ctx_log_clear_clob, UNSUPPORTED_WITH_COMMIT);
exec dbms_hcs_log.hcs_call_ctx_log_clear_clob('TEST');
BEGIN dbms_hcs_log.hcs_call_ctx_log_clear_clob('TEST'); END;
*
ERROR at line 1:
ORA-20000: Log called before Log START
ORA-06512: at "SYS.DBMS_HCS_LOG", line 142
ORA-06512: at "SYS.DBMS_HCS_LOG", line 206
ORA-06512: at line 1

See HCS_CALL_CTX_LOG_START Demo Below
 
HCS_CALL_CTX_LOG_END (new 21c)
Logs END call and nulls out current call context dbms_hcs_log.hcs_call_ctx_log_end;
PRAGMA supplemental_log_data(hcs_call_ctx_log_end, UNSUPPORTED_WITH_COMMIT);
See HCS_CALL_CTX_LOG_START Demo Below
 
HCS_CALL_CTX_LOG_START (new 21c)
Sets the CALL context for subsequent call_ctx_log dbms_hcs_log.hcs_call_ctx_log_start(callStr IN VARCHAR2);
PRAGMA supplemental_log_data(hcs_call_ctx_log_start, UNSUPPORTED_WITH_COMMIT);
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 (new 21c)
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);
PRAGMA supplemental_log_data(purge, UNSUPPORTED_WITH_COMMIT);
exec dbms_hcs_log.purge(1, TRUE);

PL/SQL procedure successfully completed.

Related Topics
Built-in Functions
Built-in Packages
Database Security
DBMS_AVTUNE
DBMS_AVTUNE_UTIL
What's New In 19c
What's New In 20c-21c

Morgan's Library Page Footer
This site is maintained by Dan Morgan. Last Updated: This site is protected by copyright and trademark laws under U.S. and International law. © 1998-2019 Daniel A. Morgan All Rights Reserved
  DBSecWorx