Showing posts with label oracle 19c. Show all posts
Showing posts with label oracle 19c. Show all posts

Wednesday, June 28, 2023

Oracle 19c Mixed Mode Auditing - Oracle's Default auditing - do they work?

Dears,

Its a quick blog, I wanted to check weather oracle's default AUDITING works as it is written in the document?



I picked 11.2 guide Oracle 11.2 Audit Document & tested the results in 19c.
Interestingly with my tests..
1. SYS user drop command in a schema in PDB is properly captured in OS Audit Trail (as per audit_sys_operation param)
2. ALTER TABLE command from SYS and APPLICATION (the owner of the object) are trapped properly in unified_audit_trail view
3. DROP TABLE command from PDBADMIN (drop any table by default isnt granted to PDBADMIN) targeting the application object was trapped in unified_audit_trail

So all worked as expected. Please see below...


OS audit trail for the drop run by SYS:

Audit file: /u01/app/oracle/admin/ORA19C/adump/F8B08577DBE37CF5E05305C2A8C0FBD0/ORA19C_ora_11276_20230628073917822599918146.aud

which is <ADUMP>/<PDB GUID>/*ora* process id trace

Wed Jun 28 07:57:43 2023 +01:00
LENGTH : '295'
ACTION :[33] 'drop table opdb1_public_user.test'
DATABASE USER:[1] '/'
PRIVILEGE :[6] 'SYSDBA'
CLIENT USER:[6] 'oracle'
CLIENT TERMINAL:[5] 'pts/0'
STATUS:[1] '0'
DBID:[9] '793483480'
SESSIONID:[10] '4294967295'
USERHOST:[20] 'vcentos79-oracle-sa1'
CLIENT ADDRESS:[0] ''
ACTION NUMBER:[2] '12'

The commands ran were:
As SYS:

SQL> alter table opdb1_public_user.test add (tabcreate varchar2(20));

Table altered.

SQL> drop table opdb1_public_user.test;

Table dropped.


As Application user:

SQL> alter table opdb1_public_user.test add (tabcreate1 varchar2(10));

Table altered.

SQL> alter table test add (tabcreate2 varchar2(10));

Table altered.

SQL>

As PDBADMIN:
SQL> drop table opdb1_public_user.test purge;

Table dropped.

SQL>

The query to get information on above commands:

set lines 1000
set pages 20000
set colsep ,
col action_name for a12
col OS_USERNAME for a20
col USERHOST for a20
col dbusername for a20
col subclient_program_name for a30
col object_schema for a20
col object_name for a40
col subsql_text for a30
col system_privilege_used for a20
col audit_option for a20
col object_privileges for a20

select action_name
,return_code
,to_char(cast(EVENT_TIMESTAMP as date),'DD/MON/YYYY HH24:MI:SS') evnttime
,SESSIONID
,OS_USERNAME
,USERHOST
,dbusername
,substr(client_program_name,1,30) subclient_program_name
,object_schema
,object_name
,substr(sql_text,1,20) subsql_text
,system_privilege_used
,audit_option
,object_privileges
from unified_audit_trail
order by 1,3;

To filter on object name, use below..

select action_name
,return_code
,to_char(cast(EVENT_TIMESTAMP as date),'DD/MON/YYYY HH24:MI:SS') evnttime
,SESSIONID
,OS_USERNAME
,USERHOST
,dbusername
,substr(client_program_name,1,30) subclient_program_name
,object_schema
,object_name
,substr(sql_text,1,20) subsql_text
,system_privilege_used
,audit_option
,object_privileges
from unified_audit_trail
where object_name='TEST'
order by 1,3
/

Thanks



Thursday, April 6, 2023

Oracle 19c - Precheck Failure: [FATAL] PRVG-1901 : failed to setup CVU remote execution framework directory "/tmp/InstallActions2023-04-06_03-40-35PM/CVU_19.0.0.0.0_oracle/" on nodes "vcentos79-oracle-ha1"

 Dears,

I wrote a playbook to quickly spin up oracle 19c database. The playbook was working all fine for last 3 or 4 years. Suddenly it broke (after started using a new lab setup); I had some changes in the OS build routine (started using VGs).

Issue:

[oracle@vcentos79-oracle-ha1 ~]$ /u01/app/oracle/product/19.0.0/db_1/runInstaller -silent -executePrereqs
Launching Oracle Database Setup Wizard...
[FATAL] PRVG-1901 : failed to setup CVU remote execution framework directory "/tmp/InstallActions2023-04-06_03-40-35PM/CVU_19.0.0.0.0_oracle/" on nodes "vcentos79-oracle-ha1"
Please select a different work area for the framework
vcentos79-oracle-ha1 : /bin/sh: /tmp/InstallActions2023-04-06_03-40-35PM/CVU_19.0.0.0.0_oracle//exectask.sh: Permission denied
vcentos79-oracle-ha1 : /bin/sh: /tmp/InstallActions2023-04-06_03-40-35PM/CVU_19.0.0.0.0_oracle//exectask.sh: Permission denied
Version of exectask could not be retrieved from node "vcentos79-oracle-ha1"
[oracle@vcentos79-oracle-ha1 ~]$

On further diagnosis using strace and autonmous run of exectask.sh I found below as the error....

(I dont have MOS access at the moment :), so went on to troubleshoot for lab setup)

]0;oracle@vcentos79-oracle-ha1:~[oracle@vcentos79-oracle-ha1 ~]$ /tmp/InstallActions2023-04-06_02-47-44PM/CVU_19.0.0.0.0_oracle/exectask -getver
-bash: /tmp/InstallActions2023-04-06_02-47-44PM/CVU_19.0.0.0.0_oracle/exectask: Permission denied
]0;oracle@vcentos79-oracle-ha1:~[oracle@vcentos79-oracle-ha1 ~]$



Root Cause:

The recent vms I build are having /tmp mounted with noexec option. This caused the issue.

[oracle@vcentos79-oracle-ha1 ~]$ mount | grep -i /tmp
/dev/mapper/ostmpswp--vg-ostmp--lv on /tmp type xfs (rw,nosuid,nodev,noexec,relatime,seclabel,attr2,inode64,noquota)
[oracle@vcentos79-oracle-ha1 ~]$

Looks like the noexec option must be added to the /tmp partition (https://www.stigviewer.com/stig/red_hat_enterprise_linux_6/2016-12-16/finding/V-57569)

So the workaround is to export TMPDIR to an oracle user home path and run the install commands.

When I exported TMPDIR to a local homedirectory like below...
The command just worked fine!!!

[oracle@vcentos79-oracle-ha1 tmp]$ export TMPDIR=/home/oracle/dba/tmp
[oracle@vcentos79-oracle-ha1 tmp]$ cd
[oracle@vcentos79-oracle-ha1 ~]$ /u01/app/oracle/product/19.0.0/db_1/runInstaller -silent -executePrereqs
Launching Oracle Database Setup Wizard...

Prerequisite checks executed successfully.
[oracle@vcentos79-oracle-ha1 ~]$

Thank you!