Tuesday, June 19, 2018

Move audit information away from SYSAUX

Check current tablespace location
SELECT table_name, tablespace_name FROM dba_tables
WHERE table_name IN ('AUD$', 'FGA_LOG$') ORDER BY table_name; 

Create tablespace for audit
create tablespace AUDIT_DATA datafile size 1G autoextend on; 

Move to the new AUDIT_DATA tablespace
BEGIN
  DBMS_AUDIT_MGMT.set_audit_trail_location(
  audit_trail_type => DBMS_AUDIT_MGMT.AUDIT_TRAIL_AUD_STD,--this moves table AUD$
  audit_trail_location_value => 'AUDIT_DATA');
  DBMS_AUDIT_MGMT.set_audit_trail_location(
  audit_trail_type => DBMS_AUDIT_MGMT.AUDIT_TRAIL_FGA_STD,--this moves table FGA_LOG$
  audit_trail_location_value => 'AUDIT_DATA');
END;
/

Friday, June 15, 2018

Friday, June 8, 2018

Extract entire database DDL script for SVN

The best program I found is scheme2dll. It can generate ddl script per schema/object type/object name in a tree structure. This is perfect for SVN.

You can download the binary here.

This is the command I use to extract the ddl, schema_export.cmd
@echo off
REM SVN Revision Information: DO NOT REMOVE
REM $Revision: 37 $
REM $Author: chiup $
REM $Date: 2018-06-08 11:56:08 -0400 (Fri, 08 Jun 2018) $
REM
setlocal
java -jar scheme2ddl.jar -url dba_account/xxxxxxxxxx@localhost:1521:paris -p 8 -s ^
ACTUARY_BBS,^
APS,^
B2B,^
BAM,^
BBS,^
BFS,^
CHATS,^
DATAMANAGER,^
DCS,^
DEATH_RECALC,^
DISCOVERER5,^
DSGATEWAY,^
ENROL,^
GENERIC_TRD,^
IP,^
LTIP,^
MAINT,^
MBK,^
OCA,^
ODS,^
OPTFIN,^
OPTIT,^
ORABPEL,^
ORAOCA_PUBLIC,^
PAY,^
PBC,^
PCONV,^
PENWEB,^
PIN,^
PPI,^
PPS_OPSEU,^
PRISM_DBA,^
RMS_OPSEU,^
RULES_TRD,^
SES,^
TRD,^
UDDISYS,^
UNCL,^
WCRSYS,^
XFS,^
XPSPA ^
-o F:\oracle_ddl
endlocal

Friday, June 1, 2018

Installing Oracle XE 11g r2 on Amazon EC2

Add a disk via EC2 console and setup it up in linux

mkfs -t ext4 /dev/xvdb
mkdir /u01

Find out the uuid of the disk
ls -al /dev/disk/by-uuid/

Add the following line to /etc/fstab to mount the disk at boot time
UUID=82497d4a-9507-47db-b19c-c4473827ead6 /u01   ext4    defaults,nofail        0       2

Mount the disk and verify fstab syntax
mount -a

Add Swap space

dd if=/dev/zero of=/swapfile bs=1024 count=3072000
mkswap /swapfile
swapon /swapfile

Add the following line to /etc/fstab to enable swap at boot time
/swapfile swap swap defaults 0 0

Mount the swap and verify fstab syntax
mount -a

Add oracle group and user

groupadd oinstall
groupadd dba
useradd -g oinstall -G dba,oinstall oracle
chown -R oracle:oinstall /u01
passwd oracle

Add the following lines to /etc/security/limits.conf
oracle              soft    nproc   2047
oracle              hard    nproc   16384
oracle              soft    nofile  1024
oracle              hard    nofile  65536
oracle              soft    stack   10240

Install Oracle

yum install glibc make binutils gcc libaio
rpm -i oracle-xe-11.2.0-0.5.x86_64.rpm
/etc/init.d/oracle-xe configure

Add the following lines to ~oracle/.bash_profile

export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
export ORACLE_SID=XE

PATH=$PATH:$ORACLE_HOME/bin:$HOME/.local/bin:$HOME/bin
export PATH