Showing posts with label Step by step to enable Unified Audit in Oracle 12c R2 RAC Database. Show all posts
Showing posts with label Step by step to enable Unified Audit in Oracle 12c R2 RAC Database. Show all posts

Friday, 24 April 2020

Step by step to enable Unified Audit in Oracle 12c R2 RAC Database

----Check the Database Configuration---

-bash-4.4$ srvctl config database -d cdbpr
Database unique name: cdbpr
Database name: cdbpr
Oracle home: /d01/app/oracle/product/12.2.0.1/db_1
Oracle user: oracle
Spfile: +CDATA/CDBPR/PARAMETERFILE/spfile.269.1037317075
Password file: +CDATA/CDBPR/PASSWORD/pwdcdbpr.260.1037316549
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups: CDATA,ADATA
Mount point paths:
Services:
Type: RAC
Start concurrency:
Stop concurrency:
OSDBA group: dba
OSOPER group: oper
Database instances: cdbpr1,cdbpr2
Configured nodes: badc-cdbpr01,badc-cdbpr02
CSS critical: no
CPU count: 0
Memory target: 0
Maximum memory: 0
Default network number for database services:
Database is administrator managed
-bash-4.4$


-----------Node 1----------
SQL> show parameter db_name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_name                              string      cdbpr
SQL> show parameter instance

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
active_instance_count                integer
cluster_database_instances           integer     2
instance_abort_delay_time            integer     0
instance_groups                      string
instance_mode                        string      READ-WRITE
instance_name                        string      cdbpr1
instance_number                      integer     1
instance_type                        string      RDBMS
open_links_per_instance              integer     4
parallel_instance_group              string
SQL> SELECT VALUE FROM V$OPTION WHERE PARAMETER='Unified Auditing';

VALUE
----------------------------------------------------------------
FALSE

SQL>

-----------Node 2----------

SQL> show parameter instance

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
active_instance_count                integer
cluster_database_instances           integer     2
instance_abort_delay_time            integer     0
instance_groups                      string
instance_mode                        string      READ-WRITE
instance_name                        string      cdbpr2
instance_number                      integer     2
instance_type                        string      RDBMS
open_links_per_instance              integer     4
parallel_instance_group              string
SQL> SELECT VALUE FROM V$OPTION WHERE PARAMETER='Unified Auditing';

VALUE
----------------------------------------------------------------
FALSE

SQL>

-----------In Node 1 do the following activities----------  

1. Shutdown Database.
2. stop listener
3. enable unified audit
4. start Database
5. start listener.
6. check unified audit enabled or not

----shutdown database---

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>

----stop listener----

-bash-4.4$ srvctl status listener
Listener LISTENER is enabled
Listener LISTENER is running on node(s): badc-cdbpr01,badc-cdbpr02
Listener LISTENERMICR is enabled
Listener LISTENERMICR is running on node(s): badc-cdbpr01,badc-cdbpr02

-bash-4.4$ su - grid
Password:
Oracle Corporation      SunOS 5.11      11.3    February 2019
-bash-4.4$ lsnrctl stop

LSNRCTL for Solaris: Version 12.2.0.1.0 - Production on 24-APR-2020 09:59:00

Copyright (c) 1991, 2016, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
The command completed successfully
-bash-4.4$

-bash-4.4$ srvctl status listener
Listener LISTENER is enabled
Listener LISTENER is running on node(s): badc-cdbpr02
Listener LISTENERMICR is enabled
Listener LISTENERMICR is running on node(s): badc-cdbpr01,badc-cdbpr02
-bash-4.4$

----Relink the oracle binaries to turn pure Unified Auditing on---

-bash-4.4$ whoami
oracle
-bash-4.4$ cd $ORACLE_HOME/rdbms/lib
-bash-4.4$ make -f ins_rdbms.mk uniaud_on ioracle
/usr/ccs/bin/ar d /d01/app/oracle/product/12.2.0.1/db_1/rdbms/lib/libknlopt.a kzanang.o
/usr/ccs/bin/ar cr /d01/app/oracle/product/12.2.0.1/db_1/rdbms/lib/libknlopt.a /d01/app/oracle/product/12.2.0.1/db_1/rdbms/lib/kzaiang.o
chmod 755 /d01/app/oracle/product/12.2.0.1/db_1/bin

 - Linking Oracle
rm -f /d01/app/oracle/product/12.2.0.1/db_1/rdbms/lib/oracle
.
.
.
.
   mv -f /d01/app/oracle/product/12.2.0.1/db_1/bin/oracle /d01/app/oracle/product/12.2.0.1/db_1/bin/oracleO &&\
   chmod 600 /d01/app/oracle/product/12.2.0.1/db_1/bin/oracleO )
mv /d01/app/oracle/product/12.2.0.1/db_1/rdbms/lib/oracle /d01/app/oracle/product/12.2.0.1/db_1/bin/oracle
chmod 6751 /d01/app/oracle/product/12.2.0.1/db_1/bin/oracle
-bash-4.4$

---Start Database-----

SQL> startup
ORACLE instance started.

Total System Global Area 5.3687E+11 bytes
Fixed Size                 30051944 bytes
Variable Size            4.6439E+11 bytes
Database Buffers         7.1404E+10 bytes
Redo Buffers             1043685376 bytes
Database mounted.
Database opened.
SQL>

SQL> SELECT VALUE FROM V$OPTION WHERE PARAMETER='Unified Auditing';

VALUE
----------------------------------------------------------------
TRUE

SQL> SELECT VALUE FROM GV$OPTION WHERE PARAMETER='Unified Auditing';

VALUE
----------------------------------------------------------------
TRUE
FALSE

SQL>


-----------In Node 2 do the following activities----------   

1. Shutdown Database.
2. stop listener
3. enable unified audit
4. start Database
5. start listener.
6. check unified audit enabled or not

----shutdown database---

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>

----stop listener---

-bash-4.4$ su - grid
Password:
Oracle Corporation      SunOS 5.11      11.3    February 2019
-bash-4.4$ lsnrctl stop

LSNRCTL for Solaris: Version 12.2.0.1.0 - Production on 24-APR-2020 13:42:54

Copyright (c) 1991, 2016, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
The command completed successfully
-bash-4.4$

----Relink the oracle binaries to turn pure Unified Auditing on---

-bash-4.4$ whoami
oracle
-bash-4.4$ cd $ORACLE_HOME/rdbms/lib
-bash-4.4$ make -f ins_rdbms.mk uniaud_on ioracle
/usr/ccs/bin/ar d /d01/app/oracle/product/12.2.0.1/db_1/rdbms/lib/libknlopt.a kzanang.o
/usr/ccs/bin/ar cr /d01/app/oracle/product/12.2.0.1/db_1/rdbms/lib/libknlopt.a /d01/app/oracle/product/12.2.0.1/db_1/rdbms/lib/kzaiang.o
chmod 755 /d01/app/oracle/product/12.2.0.1/db_1/bin

 - Linking Oracle
rm -f /d01/app/oracle/product/12.2.0.1/db_1/rdbms/lib/oracle
.
.
.
.
.

   mv -f /d01/app/oracle/product/12.2.0.1/db_1/bin/oracle /d01/app/oracle/product/12.2.0.1/db_1/bin/oracleO &&\
   chmod 600 /d01/app/oracle/product/12.2.0.1/db_1/bin/oracleO )
mv /d01/app/oracle/product/12.2.0.1/db_1/rdbms/lib/oracle /d01/app/oracle/product/12.2.0.1/db_1/bin/oracle
chmod 6751 /d01/app/oracle/product/12.2.0.1/db_1/bin/oracle
-bash-4.4$

---Start Database and listener-----

SQL> startup
ORACLE instance started.

Total System Global Area 5.3687E+11 bytes
Fixed Size                 30051944 bytes
Variable Size            4.6439E+11 bytes
Database Buffers         7.1404E+10 bytes
Redo Buffers             1043685376 bytes
Database mounted.
Database opened.
SQL>

Finally Check that Unified Audit Enabled in both RAC Node

SQL> SELECT VALUE FROM GV$OPTION WHERE PARAMETER='Unified Auditing';

VALUE
----------------------------------------------------------------
TRUE
TRUE

SQL>