Skip to content

Instantly share code, notes, and snippets.

@dincosman
Created July 28, 2024 13:59
Show Gist options
  • Save dincosman/3f6456966c0e01725948fbb9725b2271 to your computer and use it in GitHub Desktop.
Save dincosman/3f6456966c0e01725948fbb9725b2271 to your computer and use it in GitHub Desktop.
Database Audit Records spooler shell script
#!/bin/bash
# Set Oracle environment variables
source /home/oracle/.bashrc
export ORAENV_ASK=NO
export ORACLE_SID=bltdb1
. oraenv bltdb1
#export ORACLE_PDB_SID=testpdb
# Execute SQL query and spool output to file
$ORACLE_HOME/bin/sqlplus -s /nolog << EOF
conn / as sysdba
SET LONG 50000
SET LONGCHUNKSIZE 50000
SET LINESIZE 32767
SET PAGESIZE 0
SET FEEDBACK OFF
SET TRIMSPOOL ON
SET TAB OFF
SET SERVEROUTPUT OFF
SET VERIFY OFF
SET HEADING OFF
SET TERMOUT OFF
SET ECHO OFF
@audit_record_spooler.sql
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment