OracleDatabase Audit概述

來源:互聯網
上載者:User

針對SYSDBA的審計,Oracle提供了三種技術:

1、Database Audit使用者的使用的特權,執行的命令和訪問的表,以及登入狀態

2、使用資料庫觸發器對發起基於值的審計;

3、細粒度審計可以追蹤到對錶中哪些行進行了訪問;

當初始化參數檔案AUDIT_SYS_OPERATIONS被設定為true時,SYSDBA和SYSOPER執行的語句將被記錄到作業系統的審計檔案中;

標準審計

在進行Database Audit前 AUDIT_TRAIL初始化參數檔案需要被設定:

  • NONE:不執行審計
  • OS:審計檔案被寫入到作業系統中——the Application Log on windws, or the AUDIT_FILE_DEST directory on Uinx
  • DB:審計檔案被寫入到資料庫的資料字典表中:SYS.AUD$
  • DB_EXTENDED
  • XML
  • XML_EXXTENDED

例:

audit create any trigger; --審計所有建立觸發器的操作

auditselect any table by session;

audit insert on scott.emp whenever successful;--還有一個選項是WHENEVER NOT SUCCESSFUL;

audit allon scott.emp;

audit session whenever not successful;--對使用者登入進行審計; 

--查看系統產生的審計資訊

select * fromdba_audit_trail;

其他產生的審計資訊的視圖還包括:

DBA_AUDIT_OBJECT,DBA_AUDIT_STATEMENT, DBA_AUDIT_SESSION

 

使用觸發器來對值進行審計

A database trigger is a block of PL/SQL code that wil runautomaitcally whenever in INSERT, UPDATE, OR DELETE is executed against a table.

例:

CREATE ORREPLACE TRIGGER system.creditrating_audit

AFTERUPDAT OF creditrating

ON scott.customers

REFERENCINGNEW AS NEW OLD AS OLD

FOR EACHROW

BEGIN

IF :old.creditrationg!= :new.creditrating THEN

INSERT INTO system.creditrating_audit

VALUES(sys_context('userenv','os_user'),

sys_context('userenv','ip_address'),

:new.customer_id || 'credit rating changed from' || :old.creditrating ||' to ' || :new.creditrating);

END IF;

END;

/

 

細粒度審計Fine-Grained Auditing(FGA)

FGA isconfigured with the package DBMS_FGA

sql>execute dbms_fga.add_policy(-

object_schema=>'HR',-

object_name=>'EMPLOYEES',-

policy_name=>'POL1',-

audit_condition=>'department_id=80',-

audit_column=>'SALARY');

 

DBA_AUDIT_TRIALis used for standard database auditing;

DBA_FGA_AUDIT_TRAIL:is used for fine-grained auditing;

DBA_COMMON_AUDIT_TRAIL:is used for both;

To seethe results of auditing with triggers, you must create your own views thataddress your own tables;

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.