# 5.检查审核策略是否存在。 col user_name format A10 col policy_name format A20 SELECT*FROM AUDIT_UNIFIED_ENABLED_POLICIES where POLICY_NAME like'%TABLESPACE%';
# 6.在pdb_orcl中创建一个新表空间,并验证该操作已被审核。一个。创建一个新表空间TBS_ORCL。 CREATETABLESPACE tbs_orcl DATAFILE '/u01/app/oracle/oradata/cdb2/pdb_orcl/tbs_orcl01.dbf' SIZE 100M; COL dbusername FORMAT a12 COL action_name FORMAT a20 COL object_name FORMAT a20 SELECT dbusername, action_name, object_name FROM unified_audit_trail WHERE action_name like'%TABLESPACE%'; CONNECT/as sysdba CREATETABLESPACE tbs_root DATAFILE '/u01/app/oracle/oradata/cdb2/ tbs_root01.dbf' SIZE 10M; COL dbusername FORMAT a12 COL action_name FORMAT a20 COL object_name FORMAT a20 SELECT dbusername, action_name, object_name FROM unified_audit_trail WHERE action_name like'%TABLESPACE%'; DROP TABLESPACE tbs_root INCLUDING CONTENTS AND DATAFILES; CONNECT sys/oracle_4U@pdb_orcl AS SYSDBA DROP TABLESPACE tbs_orcl INCLUDING CONTENTS AND DATAFILES;
# 7.为中的任何CREATEUSER或DROPUSER操作创建审核策略AUDIT_USER。 CONNECTsystem/oracle_4U@pdb2 SELECT policy_name, user_name FROM audit_unified_enabled_policies; set pages 100 COL audit_option FORMAT A40 SELECT audit_option FROM audit_unified_policies WHERE policy_name ='ORA_SECURECONFIG'ORDERBY1;
# 8.在pdb2中以 lu_pdb2身份连接,并创建一个新用户并将其删除。 CREATEUSER lu_pdb2 IDENTIFIED BY oracle_4U; GRANT dba TO lu_pdb2; CONNECT lu_pdb2/oracle_4U@pdb2 CREATEUSER test IDENTIFIED BY test; DROPUSER test;
# 9.验证审核策略已审核这两项操作。使用UNIFIED_AUDIT_TRAIL视图。如果内存中的审计记录审计信息尚未刷新到表,请执行DBMS_AUDIT_MGMT.FLUSH_UNIFIED_AUDIT_TRAIL过程。 CONNECTsystem/oracle_4U@pdb2 COL dbusername FORMAT a12 COL action_name FORMAT a20 COL object_name FORMAT a20 SELECT dbusername, action_name, object_name FROM unified_audit_trail WHERE dbusername='LU_PDB2';
# 10.请注意,如果您连接到root用户并尝试读取为pdb2收集的审核记录,则不会找到任何信息。根目录下的UNIFIED_AUDIT_TRAIL视图仅显示根目录的审核记录(如果有)。从CDB_UNIFIED_AUDIT_TRAIL视图读取,即所有PDB的合并视图。 CONNECT/AS SYSDBA COL action_name FORMAT a20 COL object_name FORMAT a20 SELECT dbusername, action_name, object_name FROM unified_audit_trail WHERE dbusername='LU_PDB2';
SELECT dbusername, action_name, object_name FROM cdb_unified_audit_trail WHERE dbusername='LU_PDB2';
# d.检查cdb2中有两个不同的HR本地用户,一个在pdb_orcl中,另一个在pdb2中。 sqlplus sys/oracle_4U@cdb2as sysdba COL username FORMAT A20 SELECT username, con_id, common FROM cdb_users WHERE username='HR'; EXIT