Wednesday, August 24, 2022

Invalid objects sys.dv$configuration_audit and sys.dv$enforcement_audit - After 19c upgrade

Hello ,

After the 19c DB upgrade we found 2 SYS objects showing invalid. The good thing about these objects is that we have Oracle DOC ID for the same. Below action plan that has been performed:

Execute the below steps:
SQL> select owner,object_name from dba_objects where status='INVALID';

OWNER
--------------------------------------------------------------------------------
OBJECT_NAME
--------------------------------------------------------------------------------
SYS
DV$CONFIGURATION_AUDIT
SYS
DV$ENFORCEMENT_AUDIT

SQL> drop view sys.dv$configuration_audit;
View dropped.
SQL> drop view sys.dv$enforcement_audit;
View dropped.
SQL> CREATE OR REPLACE FORCE NONEDITIONABLE VIEW "AUDSYS"."DV$CONFIGURATION_AUDIT" ("OS_USER", "USERID", "HOST_NAME", "TERMINAL", "EVENT_TIMESTAMP", "OBJ_OWNER", "OBJ_NAME", "DV_ACTION_CODE", "DV_ACTION_NAME", "DV_ACTION_OBJECT_NAME", "SQL_TEXT", "DV_RULE_SET_NAME", "DV_FACTOR_CONTEXT", "DV_COMMENT", "SESSIONID", "ENTRY_ID", "STATEMENT_ID", "DV_RETURN_CODE", "PROXY_USERID", "GLOBAL_USERID", "INSTANCE_ID", "OS_PROCESS", "DV_GRANTEE", "DV_OBJECT_STATUS") AS
  SELECT
  OS_USERNAME
  , DBUSERNAME
  , USERHOST
  , TERMINAL
  , EVENT_TIMESTAMP
  , OBJECT_SCHEMA
  , OBJECT_NAME
  , DV_ACTION_CODE
  , DV_ACTION_NAME
  , DV_ACTION_OBJECT_NAME
  , SQL_TEXT
  , DV_RULE_SET_NAME
  , DV_FACTOR_CONTEXT
  , DV_COMMENT
  , SESSIONID
  , ENTRY_ID
  , STATEMENT_ID
  , DV_RETURN_CODE
  , DBPROXY_USERNAME
  , GLOBAL_USERID
  , INSTANCE_ID
  , OS_PROCESS
  , DV_GRANTEE
  , DV_OBJECT_STATUS
FROM audsys.unified_audit_trail where audit_type = 'Database Vault' and DV_ACTION_CODE > 20000;  2    3    4    5    6    7    8    9   10   11   12   13   14   15   16   17   18   19   20   21   22   23   24   25   26   27
View created.
SQL> CREATE OR REPLACE FORCE NONEDITIONABLE VIEW "AUDSYS"."DV$ENFORCEMENT_AUDIT" ("OS_USER", "USERID", "HOST_NAME", "TERMINAL", "EVENT_TIMESTAMP", "OBJ_OWNER", "OBJ_NAME", "DV_ACTION_CODE", "DV_ACTION_NAME", "DV_ACTION_OBJECT_NAME", "SQL_TEXT", "DV_RULE_SET_NAME", "DV_FACTOR_CONTEXT", "DV_COMMENT", "SESSIONID", "ENTRY_ID", "STATEMENT_ID", "DV_RETURN_CODE", "PROXY_USERID", "GLOBAL_USERID", "INSTANCE_ID", "OS_PROCESS", "DV_GRANTEE", "DV_OBJECT_STATUS") AS
  SELECT
  OS_USERNAME
  , DBUSERNAME
  , USERHOST
  , TERMINAL
  , EVENT_TIMESTAMP
  , OBJECT_SCHEMA
  , OBJECT_NAME
  , DV_ACTION_CODE
  , DV_ACTION_NAME
  , DV_ACTION_OBJECT_NAME
  , SQL_TEXT
  , DV_RULE_SET_NAME
  , DV_FACTOR_CONTEXT
  , DV_COMMENT
  , SESSIONID
  , ENTRY_ID
  , STATEMENT_ID
  , DV_RETURN_CODE
  , DBPROXY_USERNAME
  , GLOBAL_USERID
  , INSTANCE_ID
  , OS_PROCESS
  , DV_GRANTEE
  , DV_OBJECT_STATUS
FROM audsys.unified_audit_trail where audit_type = 'Database Vault' and DV_ACTION_CODE < 20000;  2    3    4    5    6    7    8    9   10   11   12   13   14   15   16   17   18   19   20   21   22   23   24   25   26   27
View created.
SQL> GRANT READ ON AUDSYS.DV$CONFIGURATION_AUDIT TO AUDIT_ADMIN;
GRANT READ ON AUDSYS.DV$CONFIGURATION_AUDIT TO AUDIT_VIEWER;
GRANT READ ON AUDSYS.DV$CONFIGURATION_AUDIT TO DV_MONITOR;
GRANT READ ON AUDSYS.DV$CONFIGURATION_AUDIT TO DV_SECANALYST;
GRANT READ ON AUDSYS.DV$ENFORCEMENT_AUDIT TO AUDIT_ADMIN;
GRANT READ ON AUDSYS.DV$ENFORCEMENT_AUDIT TO AUDIT_VIEWER;
GRANT READ ON AUDSYS.DV$ENFORCEMENT_AUDIT TO DV_MONITOR;
GRANT READ ON AUDSYS.DV$ENFORCEMENT_AUDIT TO DV_SECANALYST;
Grant succeeded.
SQL>
Grant succeeded.
SQL> GRANT READ ON AUDSYS.DV$CONFIGURATION_AUDIT TO DV_MONITOR
                                               *
ERROR at line 1:
ORA-01917: user or role 'DV_MONITOR' does not exist
SQL> GRANT READ ON AUDSYS.DV$CONFIGURATION_AUDIT TO DV_SECANALYST
                                               *
ERROR at line 1:
ORA-01917: user or role 'DV_SECANALYST' does not exist
SQL>
Grant succeeded.
SQL>
Grant succeeded.
SQL> GRANT READ ON AUDSYS.DV$ENFORCEMENT_AUDIT TO DV_MONITOR
                                             *
ERROR at line 1:
ORA-01917: user or role 'DV_MONITOR' does not exist
SQL>
GRANT READ ON AUDSYS.DV$ENFORCEMENT_AUDIT TO DV_SECANALYST
                                             *
ERROR at line 1:
ORA-01917: user or role 'DV_SECANALYST' does not exist
SQL>
SQL>
SQL>
SQL> alter view audsys.dv$configuration_audit compile;
alter view audsys.dv$enforcement_audit compile;
View altered.
SQL>
View altered.
SQL>
SQL> select owner,object_name,object_type from dba_objects where status='INVALID' and object_type not like '%JAVA%' and owner='SYS';
OWNER
--------------------------------------------------------------------------------
OBJECT_NAME
--------------------------------------------------------------------------------
OBJECT_TYPE
-----------------------
SYS
DRIPARSE
PACKAGE BODY
SYS
DRIXMD
PACKAGE BODY
OWNER
--------------------------------------------------------------------------------
OBJECT_NAME
--------------------------------------------------------------------------------
OBJECT_TYPE
-----------------------
SYS
DRVDDL
PACKAGE BODY
SYS
DRVXTAB
OWNER
--------------------------------------------------------------------------------
OBJECT_NAME
--------------------------------------------------------------------------------
OBJECT_TYPE
-----------------------
PACKAGE BODY
SYS
LBAC_EXP
PACKAGE BODY
SYS
OWNER
--------------------------------------------------------------------------------
OBJECT_NAME
--------------------------------------------------------------------------------
OBJECT_TYPE
-----------------------
OLS_ENFORCEMENT
PACKAGE BODY
6 rows selected.
SQL> set linesize 150
column owner format a20
column object_name format a30
select owner, object_name, object_type, status from dba_objects
where object_name like ('%CONFIGURATION_AUDIT%') or object_name like ('%ENFORCEMENT_AUDIT%')
order by 1,2;SQL> SQL> SQL>   2    3
OWNER                OBJECT_NAME                    OBJECT_TYPE             STATUS
-------------------- ------------------------------ ----------------------- -------
AUDSYS               DV$CONFIGURATION_AUDIT         VIEW                    VALID
AUDSYS               DV$ENFORCEMENT_AUDIT           VIEW                    VALID



Thanks

No comments:

Post a Comment