[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
- [20230305]AUDSYS.AUD$UNIFIED ORA-46385.txtNifi
- 【故障處理】ORA-1688: unable to extend table AUDSYS.AUD$UNIFIEDNifi
- Laravel——驗證碼認證學習記錄Laravel
- 實戰表單驗證學習
- octobercms 外掛學習 驗證碼
- swoft 學習筆記之驗證器筆記
- 學習 Java 之 位元組碼驗證Java
- jQuery 表單驗證 學習手記jQuery
- [20230306]學習UNIFIED audit--dg相關問題.txtNifi
- Laravel 學習之 XSRF-TOKEN 驗證問題Laravel
- 機器學習之清理資料機器學習
- node學習---jwt實現驗證使用者身份JWT
- Laravel 驗證碼類實現 (供學習、參考)Laravel
- SpringBoot + Spring Security 學習筆記(三)實現圖片驗證碼認證Spring Boot筆記
- Nginx配置和Linux核心引數的學習與驗證NginxLinux
- Python高效深度學習機器識別驗證碼教程分享Python深度學習
- Java SpringBoot 如何使用 IdentityServer4 作為驗證學習筆記JavaSpring BootIDEServer筆記
- 驗證碼原理及驗證
- 數學證明 學習筆記筆記
- 6、Ktor學習-證書;
- 【PWA學習與實踐】(4) 解決FireBase login驗證失敗問題
- 學習Python需要考證嗎?Python學習入門!Python
- 認證授權:學習OIDC
- JavaScript驗證碼生成和驗證效果JavaScript
- 強化學習-學習筆記10 | 經驗回放強化學習筆記
- 基於學習的快取一致性協議帶參驗證快取協議
- SpringBoot + Spring Security 學習筆記(五)實現簡訊驗證碼+登入功能Spring Boot筆記
- SSL證書是如何驗證的?驗證方式推薦
- 驗證碼---js重新整理驗證碼JS
- easy-captcha實現驗證碼驗證APT
- 深度學習--Tensorflow初體驗深度學習
- C# 學習經驗分享C#
- thinkphp驗證器獲取$data資料,自定義驗證,多條件唯一性驗證unique驗證PHP
- DIDCTF-2022暑假取證學習
- Shiro學習-認證思路分析(七)