【问题分类】功能使用
【关键字】UNIFIED_AUDIT_TRAIL,YAS-00220
【问题描述】当审计对象的SQL语句包含非标准中文字符时,出现YAS-00220 utf8 sequence is wrong,影响审计记录。
--第一步:打开审计开关SQL> ALTER SYSTEM SET UNIFIED_AUDITING = true;Succeed.--创建审计策略CREATE AUDIT POLICY up2ACTIONS DROP TABLE,DELETE ON sales.area,INSERT ON sales.area,UPDATE ON sales.area,ALL ON sales.sales_info;AUDIT POLICY up2;--第二步:执行操作被正常记录SQL> conn sales/salesConnected to:YashanDB Server Enterprise Edition Release 23.2.7.100 x86_64 - LinuxSQL> UPDATE area SET DHQ='guangzhou' WHERE area_no='01';1 row affected.SQL> commit;Succeed.SQL> SELECT dbusername,event_timestamp,sql_text,object_schemaFROM UNIFIED_AUDIT_TRAILWHERE dbusername='SALES'; 2 3DBUSERNAME EVENT_TIMESTAMP SQL_TEXT OBJECT_SCHEMA---------------------------------------------------------------- ---------------------------------------------------------------- ---------------------------------------------------------------- ----------------------------------------------------------------SALES 2024-12-11 09:52:27.602837 UPDATE area SET DHQ='guangzhou' WHERE area_no='01' SALES1 row fetched.--第三步:其中 '广.' 为非正常中文字段,查看审计表出现报错SQL> UPDATE area SET DHQ='广.' WHERE area_no='01';1 row affected.SQL> commit;Succeed.SQL> SELECT dbusername,event_timestamp,sql_text,object_schemaFROM UNIFIED_AUDIT_TRAILWHERE dbusername='SALES'; 2 3DBUSERNAME EVENT_TIMESTAMP SQL_TEXT OBJECT_SCHEMA---------------------------------------------------------------- ---------------------------------------------------------------- ---------------------------------------------------------------- ----------------------------------------------------------------SALES 2024-12-11 09:52:27.602837 UPDATE area SET DHQ='guangzhou' WHERE area_no='01' SALESYAS-00220 utf8 sequence is wrong--第四步:执行操作无法被正常记录SQL> UPDATE area SET DHQ='guangzhou' WHERE area_no='01';1 row affected.SQL> commit;Succeed.SQL> SELECT dbusername,event_timestamp,sql_text,object_schema FROM UNIFIED_AUDIT_TRAIL WHERE dbusername='SALES';DBUSERNAME EVENT_TIMESTAMP SQL_TEXT OBJECT_SCHEMA---------------------------------------------------------------- ---------------------------------------------------------------- ---------------------------------------------------------------- ----------------------------------------------------------------SALES 2024-12-11 09:52:27.602837 UPDATE area SET DHQ='guangzhou' WHERE area_no='01' SALESYAS-00220 utf8 sequence is wrong
【问题原因分析】数据库BUG
【解决/规避方法】避免包含非正常中文字符,重新清理审计表。
BEGINDBMS_AUDIT_MGMT.CLEAN_AUDIT_TRAIL (DBMS_AUDIT_MGMT.AUDIT_TRAIL_UNIFIED,true);END;/
【影响范围】23.2.9.xxx前的所有版本
【修复版本】-