[20230403]學習UNIFIED audit--驗證清理AUDSYS.AUD$UNIFIED.txt
[20230403]學習UNIFIED audit--驗證清理AUDSYS.AUD$UNIFIED.txt
--//前一陣子寫了定期清理AUDSYS.AUD$UNIFIED的schedule.連結
--//http://blog.itpub.net/267265/viewspace-2937975/=>[20230303]學習UNIFIED audit--定期清理AUDSYS.AUD$UNIFIED.txt
BEGIN
SYS.DBMS_SCHEDULER.CREATE_JOB
(
job_name => 'SYS.JOB_PURGE_AUDIT_RECORDS'
,start_date => TO_TIMESTAMP_TZ('2023/03/03 09:07:24.000000 +08:00','yyyy/mm/dd hh24:mi:ss.ff tzr')
,repeat_interval => 'freq=monthly;bydate=0101,0201,0301,0401,0501,0601,0701,0801,0901,1001,1101,1201;byhour=8; byminute=50; bysecond=0;'
,end_date => NULL
,job_class => 'DEFAULT_JOB_CLASS'
,job_type => 'PLSQL_BLOCK'
,job_action => 'BEGIN
DBMS_AUDIT_MGMT.SET_LAST_ARCHIVE_TIMESTAMP(DBMS_AUDIT_MGMT.AUDIT_TRAIL_UNIFIED,add_months(trunc(sysdate,''mm''),-2));
DBMS_AUDIT_MGMT.CLEAN_AUDIT_TRAIL(AUDIT_TRAIL_TYPE=>DBMS_AUDIT_MGMT.AUDIT_TRAIL_UNIFIED,USE_LAST_ARCH_TIMESTAMP=>TRUE);
END;'
,comments => 'Update last_archive_timestamp and clean unified audit trail'
);
END;
/
--//今天看看效果:
SYS@192.168.100.141:1521/dyhis> @ pr
==============================
PORT_STRING : x86_64/Linux 2.4.xx
VERSION : 19.0.0.0.0
BANNER : Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
BANNER_FULL : Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.9.0.0.0
BANNER_LEGACY : Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
CON_ID : 0
PL/SQL procedure successfully completed.
SYS@192.168.100.141:1521/dyhis> select * from DBA_AUDIT_MGMT_LAST_ARCH_TS;
AUDIT_TRAIL RAC_INSTANCE LAST_ARCHIVE_TS DATABASE_ID CONTAINER_GUID
-------------------- ------------ --------------------------------------------------------------------------- ----------- ---------------------------------
UNIFIED AUDIT TRAIL 0 2023-02-01 00:00:00.000000 +00:00 4090373436 B60D258AC2D9EF54E0532A63A8C09F1F
SYS@192.168.100.141:1521/dyhis> select add_months(trunc(sysdate,'mm'),1),add_months(trunc(sysdate,'mm'),-2) from dual ;
ADD_MONTHS(TRUNC(SY ADD_MONTHS(TRUNC(SY
------------------- -------------------
2023-05-01 00:00:00 2023-02-01 00:00:00
--//設定LAST_ARCHIVE_TS已經是2023-02-01 00:00:00.
SYS@192.168.100.141:1521/dyhis> select * from DBA_SCHEDULER_JOB_log where JOB_NAME='JOB_PURGE_AUDIT_RECORDS'
2 @ pr
==============================
LOG_ID : 249070
LOG_DATE : 2023-04-01 08:50:07.083490 +08:00
OWNER : SYS
JOB_NAME : JOB_PURGE_AUDIT_RECORDS
JOB_SUBNAME :
JOB_CLASS : DEFAULT_JOB_CLASS
OPERATION : RUN
STATUS : SUCCEEDED
USER_NAME :
CLIENT_ID :
GLOBAL_UID :
CREDENTIAL_OWNER :
CREDENTIAL_NAME :
DESTINATION_OWNER :
DESTINATION :
ADDITIONAL_INFO :
PL/SQL procedure successfully completed.
SYS@192.168.100.141:1521/dyhis> @ o2 AUDSYS.AUD$UNIFIED
owner object_name object_type SEG_PART_NAME status OID D_OID CREATED LAST_DDL_TIME
------ ----------- -------------------- -------------------- --------- ---------- ---------- ------------------- -------------------
AUDSYS AUD$UNIFIED TABLE VALID 18580 2020-10-20 10:28:13 2023-03-01 11:21:46
AUDSYS AUD$UNIFIED TABLE PARTITION SYS_P19622 VALID 171804 171804 2023-01-01 08:00:04 2023-01-01 08:00:04
AUDSYS AUD$UNIFIED TABLE PARTITION SYS_P20283 VALID 174234 174234 2023-02-01 08:00:00 2023-02-01 08:00:00
AUDSYS AUD$UNIFIED TABLE PARTITION SYS_P20923 VALID 176513 176513 2023-03-01 08:00:05 2023-03-01 08:00:05
AUDSYS AUD$UNIFIED TABLE PARTITION SYS_P21663 VALID 179544 179544 2023-04-01 08:00:01 2023-04-01 08:00:01
SYS@192.168.100.141:1521/dyhis> @ seg2 AUDSYS.AUD$UNIFIED
SEG_MB OWNER SEGMENT_NAME SEG_PART_NAME SEGMENT_TYPE SEG_TABLESPACE_NAME BLOCKS HDRFIL HDRBLK
------ ------ ------------ ------------- -------------------- ------------------- ---------- ---------- ----------
175 AUDSYS AUD$UNIFIED SYS_P20923 TABLE PARTITION SYSAUX 22400 3 145690
16 AUDSYS AUD$UNIFIED SYS_P21663 TABLE PARTITION USERS 2048 2 48657
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
144 AUDSYS AUD$UNIFIED SYS_P19622 TABLE PARTITION SYSAUX 18432 3 656234
88 AUDSYS AUD$UNIFIED SYS_P20283 TABLE PARTITION SYSAUX 11264 3 550906
--//新建立的分割槽已經在users表空間.
SYS@192.168.100.141:1521/dyhis> select trunc(EVENT_TIMESTAMP,'mm'),count(*) from audsys.AUD$UNIFIED group by trunc(EVENT_TIMESTAMP,'mm');
TRUNC(EVENT_TIMESTA COUNT(*)
------------------- ----------
2023-04-01 00:00:00 29666
2023-03-01 00:00:00 473349
2023-02-01 00:00:00 261572
--//可以發現2023-02-01 00:00:00日期之前的記錄已經刪除.
--//驗證了前面寫的SCHEDULER JOB沒有問題.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2943985/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [20230303]學習UNIFIED audit--定期清理AUDSYS.AUD$UNIFIED.txtNifi
- [20230301]學習UNIFIED audit-整理AUDSYS.AUD$UNIFIED.txtNifi
- [20230301]學習UNIFIED audit-移動AUDSYS.AUD$UNIFIED到別的表空間.txtNifi
- 【故障處理】ORA-1688: unable to extend table AUDSYS.AUD$UNIFIEDNifi
- [20230305]AUDSYS.AUD$UNIFIED ORA-46385.txtNifi
- Laravel——驗證碼認證學習記錄Laravel
- octobercms 外掛學習 驗證碼
- Django學習筆記—驗證碼Django筆記
- 實戰表單驗證學習
- swoft 學習筆記之驗證器筆記
- jQuery 表單驗證 學習手記jQuery
- 學習 Java 之 位元組碼驗證Java
- validator 驗證框架(學習筆記)框架筆記
- 演算法學習之路|檢驗身份證演算法
- angular學習筆記(二十)-表單驗證Angular筆記
- ASP.NET MVC學習之模型驗證篇ASP.NETMVC模型
- 我通過OCP認證的學習經驗
- 跟著百度學PHP[16]-驗證碼的學習PHP
- Laravel 驗證碼類實現 (供學習、參考)Laravel
- Laravel 學習之 XSRF-TOKEN 驗證問題Laravel
- node學習---jwt實現驗證使用者身份JWT
- [譯] 學習 Spring Security(五):重發驗證郵件Spring
- MVC學習筆記之:ASP.NET MVC的客戶端驗證-jQuery.validate驗證結合Model驗證中的實現MVC筆記ASP.NET客戶端jQuery
- Linux登入驗證機制、SSH Bruteforce Login學習Linux
- Nginx配置和Linux核心引數的學習與驗證NginxLinux
- Python高效深度學習機器識別驗證碼教程分享Python深度學習
- [20230306]學習UNIFIED audit--dg相關問題.txtNifi
- SpringBoot + Spring Security 學習筆記(三)實現圖片驗證碼認證Spring Boot筆記
- 數學證明 學習筆記筆記
- 全面學習MySQL中的檢視(1) 檢視安全驗證的方式MySql
- 驗證碼原理及驗證
- 專案學習經驗
- Oracle 學習經驗談Oracle
- SAP學習經驗談
- 20151221jquery學習筆記--驗證外掛jQuery筆記
- 20160322 javaweb 學習筆記--response驗證碼實現JavaWeb筆記
- 資料庫學習:查詢新身份證(18位)的校驗位(轉)資料庫
- ASP.NET學習手記:驗證使用者表單輸入 (轉)ASP.NET