
{"id":7608,"date":"2020-04-29T09:06:56","date_gmt":"2020-04-29T09:06:56","guid":{"rendered":"https:\/\/rax-stg-wp-aws.com\/blogs\/enable-oracle-audits-at-the-operating-system-level-in-rac-databases\/"},"modified":"2026-11-03T19:28:46","modified_gmt":"2026-11-03T19:28:46","slug":"enable-oracle-audits-at-the-operating-system-level-in-rac-databases","status":"publish","type":"blogs","link":"https:\/\/www.rackspace.com\/en-gb\/blogs\/enable-oracle-audits-at-the-operating-system-level-in-rac-databases\/","title":{"rendered":"Enable Oracle audits at the operating system level in RAC databases"},"content":{"rendered":"<p><strong>&nbsp;Introduction<\/strong><\/p>\n<p>When you set this parameter to `true`, the process generates files in the directory&nbsp;determined by the&nbsp; <em>`AUDIT_FILE_DEST` <\/em>parameter. These files contain a protocol of&nbsp;all the actions of the <em>`sys`<\/em> user. By default, the files contain the connections&nbsp;by <em>`sys` <\/em>but do not include the actions that occur after the connection.<\/p>\n<p>If you set `AUDIT_SYS_OPERATIONS=true`, the audit file containing all the actions&nbsp;of <em>`sys` <\/em>belongs to the operating system user that installed the&nbsp;database&#8211; usually, the Oracle user. A user with privileges to connect as<br \/>\n<em>`sys` <\/em>probably also has the privilege to connect as `Oracle` on the operating&nbsp;system (OS) level. This access makes using <em>`AUDIT_SYS_OPERATIONS<\/em>` somewhat&nbsp;useless from a security standpoint. So, Oracle permits `root` to own the audit file,&nbsp;which should make it harder for the database administrator to manipulate or delete<br \/>\nthe file.<\/p>\n<p><strong>Configure the audit file at the OS level<\/strong><\/p>\n<p>Use the following steps to configure the audit file at the OS level in an&nbsp;Oracle Real Application Clusters (RAC) environment:<\/p>\n<p><strong>Step 1: Set the database parameters<\/strong><\/p>\n<p>Use the following commands to set the database parameters:<\/p>\n<p><em>&nbsp; &nbsp; SQL&gt; alter system set audit_sys_operations=true scope=spfile;<br \/>\n&nbsp; &nbsp; System altered.<\/em><\/p>\n<p><em>&nbsp; &nbsp; SQL&gt; alter system set audit_syslog_level=&#8217;LOCAL1.WARNING&#8217; scope=spfile;<br \/>\n&nbsp; &nbsp; System altered.<\/em><\/p>\n<p><em>&nbsp; &nbsp; SQL&gt; alter system set audit_trail = OS<br \/>\n&nbsp; &nbsp; SCOPE=SPFILE;<br \/>\n&nbsp; &nbsp; System altered.<\/em><\/p>\n<p><strong>Step 2: Configure the RAC nodes<\/strong><\/p>\n<p>Use the following steps, as <strong>root<\/strong>, to configure the RAC1 and RAC2 nodes:<\/p>\n<p>a) Run the following command to back up <strong>\/etc\/rsyslog.conf<\/strong>:<\/p>\n<p><em>&nbsp; &nbsp; cp -p \/etc\/rsyslog.conf \/etc\/rsyslog.conf.&lt;ITK#&gt;<\/em><\/p>\n<p>b) Add the following lines to <strong>\/etc\/rsyslog.conf<\/strong>:<\/p>\n<p><em>&nbsp; &nbsp; # Oracle audit &lt;ITK#&gt;<br \/>\n&nbsp; &nbsp; local1.warning \/var\/log\/oracle\/db_name_audit.log<\/em><\/p>\n<p>#### Step 3: Restart the syslog logger<\/p>\n<p>Run the following commands to restart the `<em>syslog<\/em>` logger process:<\/p>\n<p><em>&nbsp; &nbsp; service rsyslog status<br \/>\n&nbsp; &nbsp; service rsyslog restart<br \/>\n&nbsp; &nbsp; service rsyslog status<\/em><\/p>\n<p><strong>&nbsp;Step 4: Restart the RAC database<\/strong><\/p>\n<p>Use the following steps to restart the RAC database on RAC1 and RAC2 in a rolling fashion:<\/p>\n<p>a) Run the following commands on RAC2:<\/p>\n<p>&nbsp;<em> &nbsp; srvctl stop instance -d DB_NAME -i DB_SID2<br \/>\n&nbsp; &nbsp; srvctl start instance -d DB_NAME -i DB_SID2<br \/>\n&nbsp; &nbsp; srvctl status database -d DB_NAME<\/em><\/p>\n<p>b) Wait for ten minutes.<\/p>\n<p>c) Run the following commands on RAC1:<\/p>\n<p><em>&nbsp; &nbsp; srvctl stop instance -d DB_NAME -i DB_SID1<br \/>\n&nbsp; &nbsp; srvctl start instance -d DB_NAME -i DB_SID1<br \/>\n&nbsp; &nbsp; srvctl status database -d DB_NAME<\/em><\/p>\n<p><strong>&nbsp;Step 5: Set up the logrotate file<\/strong><\/p>\n<p>To set up the <strong>logrotate<\/strong>&nbsp;file on RAC1 and RAC2, edit <strong>\/etc\/logrotate.d\/oracle_audit<\/strong>,<br \/>\nas <strong>root<\/strong>, to include the following lines:<\/p>\n<p>&nbsp; <em>&nbsp; \/var\/log\/oracle\/db_name_audit.log<br \/>\n&nbsp; &nbsp; {<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp;rotate 12<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp;compress<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp;weekly<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp;dateext<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp;notifempty<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp;missingok<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp;copytruncate<br \/>\n&nbsp; &nbsp; }<\/em><br \/>\n&nbsp;<\/p>\n<p><strong>Logrotate parameters<\/strong><\/p>\n<p>You can include the following options (collected from&nbsp;Manage your logs using <a href=\"https:\/\/techandfi.com\/manage-your-logs-using-logrotate\/\">Logrotate<\/a>]&nbsp;and the <a href=\"https:\/\/man7.org\/linux\/man-pages\/man8\/logrotate.8.html\">man file<\/a>&nbsp;in the&nbsp;<strong>logrotate<\/strong>&nbsp;configuration file:<\/p>\n<ul>\n<li><strong>Rotate<\/strong>: Keep the last N archives of the log. You can set this high, as long as the disk usage is reasonable. You can also set it to the last 10 days or&nbsp;2 weeks if the log gets bigger.<\/li>\n<li><strong>Compress<\/strong>: The archived logs are compressed using gzip (recommended). This&nbsp;compression keeps the file size much lower than the raw logs.<\/li>\n<li><strong>Weekly<\/strong>: The log files are rotated once every day, or if the date is advanced&nbsp;by at least 7 days, since the last rotation (while ignoring the exact time).&nbsp;The weekday interpretation is as follows: &nbsp;0 means Sunday, 1 means Monday, 6 means&nbsp;Saturday. The special value 7 means each 7 days, irrespective of the weekday.&nbsp;The default is 0 if the weekday argument is omitted.<\/li>\n<li><strong>Yearly<\/strong>: Log files are rotated if the current year is not the same as the last&nbsp;rotation.<\/li>\n<li><strong>dateext<\/strong>: The archived log files are appended with the date when it is processed. The default format is YYYYMMDD. This appendage makes the search for the archived logs easier.<\/li>\n<li><strong>notifempty<\/strong>: If the log file is empty, do not archive it. This is important because you only keep a certain number of archives, and this makes sure that you don\u2019t have archived empty files that push out older archived entries.<\/li>\n<li><strong>missingok<\/strong>: If any log file cannot be found, just search for the next log file in the configuration. This ensures that the logrotate program does not exit unexpectedly in case one log file is missing.<\/li>\n<li><strong>copytruncate<\/strong>: When a log is archived, logrotate copies the contents of the log file into another file (with a timestamp). This option then tells logrotate to remove or truncate the copied entries from the original log file. This option is needed when programs continuously write into the log file, and this option ensures that the same log file is being used by the program to prevent it from exiting unexpectedly (due to it being unable to access the log file).<\/li>\n<\/ul>\n<p><u>Pros and cons<\/u><\/p>\n<p>The pros and cons of writing the audit records to a file on the OS include the following considerations:<\/p>\n<ul>\n<li><strong>Pros:&nbsp;<\/strong>Logging the audit records to a <em>`root`<\/em>-owned filesystem restricts even the Oracle&nbsp;user who installed the database from reading the content and modifying it.<\/li>\n<li><strong>Cons:&nbsp;&nbsp;<\/strong>Storing audit files on the OS consumes space and can cause performance issues.<\/li>\n<li>For example, <em>`sys` <\/em>could now perform large actions, such as running <em>`catalog.sql`<\/em><\/li>\n<\/ul>\n<p>or<em> `catproc.sql`<\/em> operations.<\/p>\n<p><strong>Conclusion<\/strong><br \/>\nThe steps in this post direct all the audit records to an OS file in a RAC&nbsp;database. Oracle recommends that you use the OS settings, especially if you use&nbsp;an ultra-secure database configuration.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Enable Oracle audits at the operating system level in RAC databases<\/p>\n","protected":false},"author":2,"featured_media":7610,"menu_order":0,"comment_status":"open","ping_status":"open","template":"","format":"standard","meta":{"content-type":"","nid":"26450","content_type":"blog","created_by":"10130","authored_on":"2024-01-05T10:06:56+00:00","field_article_industries":"","tag_category":"Technical","field_blog_author_text":"by Anubhav Sharma, Oracle Database Administrator, Rackspace Technology","seo_description":"Learn to audit all actions of Oracle Database superuser. Gain insights into AUDIT_SYS_OPERATIONS parameter and its security implications.\r\n","field_featured_image":"","insights_image":"\/wp-content\/uploads\/2026\/blog_technical_images\/26450-insights_image-oracle-technical-blog-1-insights.jpg","field_partners":"","rxt_platforms":"Oracle","product":"","publisheddate":"2020-04-29T09:06:56","rxt_solutions":"Databases","opengraph_tag":"","x_tag":"","teaser_flag":"Technical Blog","seo_titile":"Oracle Audit Security OS Level in RAC Databases | Rackspace","field_topics":"","field_slug":"enable-oracle-audits-at-the-operating-system-level","footnotes":""},"categories":[178],"tags":[204],"class_list":["post-7608","blogs","type-blogs","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-technical"],"_links":{"self":[{"href":"https:\/\/www.rackspace.com\/en-gb\/wp-json\/wp\/v2\/blogs\/7608","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rackspace.com\/en-gb\/wp-json\/wp\/v2\/blogs"}],"about":[{"href":"https:\/\/www.rackspace.com\/en-gb\/wp-json\/wp\/v2\/types\/blogs"}],"author":[{"embeddable":true,"href":"https:\/\/www.rackspace.com\/en-gb\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rackspace.com\/en-gb\/wp-json\/wp\/v2\/comments?post=7608"}],"version-history":[{"count":1,"href":"https:\/\/www.rackspace.com\/en-gb\/wp-json\/wp\/v2\/blogs\/7608\/revisions"}],"predecessor-version":[{"id":7609,"href":"https:\/\/www.rackspace.com\/en-gb\/wp-json\/wp\/v2\/blogs\/7608\/revisions\/7609"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.rackspace.com\/en-gb\/wp-json\/wp\/v2\/media\/7610"}],"wp:attachment":[{"href":"https:\/\/www.rackspace.com\/en-gb\/wp-json\/wp\/v2\/media?parent=7608"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rackspace.com\/en-gb\/wp-json\/wp\/v2\/categories?post=7608"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rackspace.com\/en-gb\/wp-json\/wp\/v2\/tags?post=7608"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}