演習: 接続されたセッションでのアクションの監査

この演習では、統合監査ポリシーへの変更が現在のセッションおよび他のすべての実行中のアクティブ・セッションでどのように即時有効になるかについて説明します。

  1. 新しい演習を開始する前に、演習の環境の推奨事項を参照してください。
  2. 演習を開始する前に、/home/oracle/labs/M104781GC10/setup_audit.shシェル・スクリプトを実行します。
    $ cd /home/oracle/labs/M104781GC10
    $ /home/oracle/labs/M104781GC10/setup_audit.sh
    
    SQL*Plus: Release 20.0.0.0.0 - Production on Fri Mar 20 04:12:39 2020
    Version 20.2.0.0.0
    
    Copyright (c) 1982, 2020, Oracle.  All rights reserved.
    
    
    Connected to:
    Oracle Database 20c Enterprise Edition Release 20.0.0.0.0 - Production
    Version 20.2.0.0.0
    
    SQL> shutdown immediate
    Database closed.
    Database dismounted.
    ORACLE instance shut down.
    SQL> exit
    Disconnected from Oracle Database 20c Enterprise Edition Release 20.0.0.0.0 - Production
    Version 20.2.0.0.0
    
    LSNRCTL for Linux: Version 20.0.0.0.0 - Production on 20-MAR-2020 04:13:03
    
    Copyright (c) 1991, 2019, Oracle.  All rights reserved.
    
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.150.76.66)(PORT=1521)))
    The command completed successfully
    /usr/bin/ar cr /u01/app/oracle/product/20.2.0/dbhome_1/rdbms/lib/libknlopt.a /u01/app/oracle/product/20.2.0/dbhome_1/rdbms/lib/kzaiang.o
    chmod 755 /u01/app/oracle/product/20.2.0/dbhome_1/bin
    
     - Linking Oracle
    rm -f /u01/app/oracle/product/20.2.0/dbhome_1/rdbms/lib/oracle
    ...
    LSNRCTL for Linux: Version 20.0.0.0.0 - Production on 20-MAR-2020 04:13:52
    
    Copyright (c) 1991, 2019, Oracle.  All rights reserved.
    
    Starting /u01/app/oracle/product/20.2.0/dbhome_1/bin/tnslsnr: please wait...
    
    TNSLSNR for Linux: Version 20.0.0.0.0 - Production
    System parameter file is /u01/app/oracle/homes/OraDB20Home1/network/admin/listener.ora
    Log messages written to /u01/app/oracle/diag/tnslsnr/edcdr8p1/listener/alert/log.xml
    Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.150.76.66)(PORT=1521)))
    Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
    
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.150.76.66)(PORT=1521)))
    STATUS of the LISTENER
    ------------------------
    Alias                     LISTENER
    Version                   TNSLSNR for Linux: Version 20.0.0.0.0 - Production
    Start Date                20-MAR-2020 04:13:52
    Uptime                    0 days 0 hr. 0 min. 0 sec
    Trace Level               off
    Security                  ON: Local OS Authentication
    SNMP                      OFF
    Listener Parameter File   /u01/app/oracle/homes/OraDB20Home1/network/admin/listener.ora
    Listener Log File         /u01/app/oracle/diag/tnslsnr/edcdr8p1/listener/alert/log.xml
    Listening Endpoints Summary...
      (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.150.76.66)(PORT=1521)))
      (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
    The listener supports no services
    The command completed successfully
    
    SQL*Plus: Release 20.0.0.0.0 - Production on Fri Mar 20 04:13:52 2020
    Version 20.2.0.0.0
    
    Copyright (c) 1982, 2020, Oracle.  All rights reserved.
    
    Connected to an idle instance.
    
    SQL> STARTUP
    ...
    SQL*Plus: Release 20.0.0.0.0 - Production on Mon Mar 9 05:09:56 2020
    Version 20.2.0.0.0
    
    Copyright (c) 1982, 2019, Oracle.  All rights reserved.
    
    Connected to:
    Oracle Database 19c Enterprise Edition Release 20.0.0.0.0 - Production
    Version 20.2.0.0.0
    
    specify password for HR as parameter 1:
    
    specify default tablespeace for HR as parameter 2:
    
    specify temporary tablespace for HR as parameter 3:
    
    specify log path as parameter 4:
    ...
    SQL> BEGIN
      2  DBMS_AUDIT_MGMT.clean_audit_trail(
      3  audit_trail_type => DBMS_AUDIT_MGMT.AUDIT_TRAIL_ALL,
      4  use_last_arch_timestamp => false);
      5  END;
      6  /
    
    PL/SQL procedure successfully completed.
    
    SQL>
    SQL> EXIT
    Disconnected from Oracle Database 20c Enterprise Edition Release 20.0.0.0.0 - Production
    Version 20.2.0.0.0
    
    SQL*Plus: Release 20.0.0.0.0 - Production on Mon Mar 9 05:09:55 2020
    Version 20.2.0.0.0
    
    Copyright (c) 1982, 2020, Oracle.  All rights reserved.
    
    Last Successful login time: Mon Mar 09 2020 04:57:43 +00:00
    
    Connected to:
    Oracle Database 20c Enterprise Edition Release 20.0.0.0.0 - Production
    Version 20.2.0.0.0
    
    SQL>
    SQL> DROP USER u1 CASCADE;
    
    User dropped.
    
    SQL> DROP USER u2 CASCADE;
    
    User dropped.
    
    SQL> CREATE USER u1 identified by password;
    
    User created.
    
    SQL> GRANT create session TO u1;
    
    Grant succeeded.
    
    SQL> GRANT select ON hr.locations TO u1;
    
    Grant succeeded.
    
    SQL> exit
    Disconnected from Oracle Database 20c Enterprise Edition Release 20.0.0.0.0 - Poduction
    Version 20.2.0.0.0
    $
  3. U1としてPDB20に接続します。
    $ sqlplus u1@PDB20
    
    SQL*Plus: Release 20.0.0.0.0 - Production on Fri Mar 20 04:31:44 2020
    Version 20.2.0.0.0
    
    Copyright (c) 1982, 2020, Oracle.  All rights reserved.
    
    Enter password: password
    
    Connected to:
    Oracle Database 20c Enterprise Edition Release 20.0.0.0.0 - Production
    Version 20.2.0.0.0
    
    SQL>
  4. 別のターミナル・セッションで、SYSTEMとしてPDB20に接続し、HR.LOCATIONS表での選択を監査するために、監査ポリシーを作成して有効にします。
    1. 統合監査が有効になっていることを確認します。
      $ sqlplus system@PDB20
      
      SQL*Plus: Release 20.0.0.0.0 - Production on Fri Mar 20 04:32:22 2020
      Version 20.2.0.0.0
      
      Copyright (c) 1982, 2020, Oracle.  All rights reserved.
      
      Enter password: password
      Last Successful login time: Fri Mar 20 2020 04:21:35 +00:00
      
      Connected to:
      Oracle Database 20c Enterprise Edition Release 20.0.0.0.0 - Production
      Version 20.2.0.0.0
      
      SQL> SELECT value FROM v$option WHERE parameter='Unified Auditing';
      
      VALUE
      ----------------------------------------------------------------
      TRUE
      
      SQL>
    2. HR.LOCATIONS表での選択を監査するために、監査ポリシーを作成して有効にします。
      SQL> CREATE AUDIT POLICY pol1 ACTIONS SELECT ON hr.locations;
      
      Audit policy created.
      
      SQL> AUDIT POLICY pol1;
      
      Audit succeeded.
      
      SQL> SELECT dbusername, action_name FROM unified_audit_trail
      WHERE  unified_audit_policies='POL1';
      
      no rows selected.
      
      SQL>
  5. U1セッションに戻り、HR.LOCATIONS表から行を選択します。
    SQL> SELECT street_address FROM hr.locations;
    
    STREET_ADDRESS
    ----------------------------------------
    1297 Via Cola di Rie
    93091 Calle della Testa
    2017 Shinjuku-ku
    ...
    
    23  rows selected.
    
    SQL> EXIT
    $
  6. U1が実行した問合せは、再接続されないが監査されますか。SYSTEMセッションに戻ります。
    SQL> SELECT dbusername, action_name FROM unified_audit_trail
    WHERE  unified_audit_policies='POL1';
    
    DBUSERNAME
    --------------------------------------------------------------------------------
    ACTION_NAME
    ----------------------------------------------------------------
    U1
    SELECT
    
    SQL>

    Oracle Database 19cとOracle Database 20cの動作の違いに注目します。Oracle Database 20cの有効になっている監査ポリシーでは、アクションを監査するためにすでに接続されているセッションを再接続する必要はありません。

  7. 監査ポリシーを削除します。
    SQL> NOAUDIT POLICY pol1;
    
    Noaudit succeeded.
    
    SQL> DROP AUDIT POLICY pol1;
    
    Audit Policy dropped.
    
    SQL> EXIT
    $