Learning opatch

For most of you, this is probably trivial.

Needed to get a list of patches for 4-nodes Exadata.

I saw co-worker ssh to each node, source ASM, database environment, run opatch command.

Thinking out loud, there’s has to be an easier way to do this; hence, I started digging into opatch commands.

It’s possible to list patches without having to source the environment.

$ORACLE_HOME/opatch lspatches -oh $ORACLE_HOME, where $ORACLE_HOME is the location for database and (more...)

Using dynamic variables for shell scripting

So you may ask, why go through all the trouble?

Have you ever had to move scripts from one directories to another to find out the script is now broken?

This is due to the hard coding of the location for SQL script in the shell script.

When possible, I would like to separate shell / SQL scripts so they can be run individually and easier for debugging.

Don’t you hate it when copy/paste SQL (more...)

Using sed to format controlfile trace

Do you find it cumbersome having to format controlfile trace?

For the most part, it’s a manual and tedious process.

Using sed, it may be possible to automate task.

RESUSE overwrites existing controlfile trace.

alter database backup controlfile to trace as ‘/tmp/cf.sql’ REUSE RESETLOGS;

ARROW:(SYS@hawklas):PRIMARY> alter database backup controlfile to trace as '/tmp/cf.sql' RESETLOGS;
alter database backup controlfile to trace as '/tmp/cf.sql' RESETLOGS
ERROR at line 1:
ORA-01277: file '/tmp/cf.sql'  (more...)

SQL Profile and Plan Baseline Notes

Optimizer with Oracle Database 12c
Oracle White Paper – June 2013

What is the difference between SQL Profiles and SQL Plan Baselines?
By Maria Colgan-Oracle on May 08, 2012

Plan Stability using Sql Profiles and SQL Plan Management
Amit Bansal / 20 December, 2011

3 OCT/10

Comments from Kerry Osborne September 9th, 2011 – 18:31
You didn’t mention the two biggest differences (in (more...)

Scaling Export and Import Tables Residing in Different Schemas 10gR2

Our team was tasked to unpartion all partition tables.

Import: Release has PARTITION_OPTIONS=DEPARTITION but we are on Release

The first step was to find all schemas with partition tables.

select owner, table_name, partitioning_type, subpartitioning_type, partition_count, status 
from dba_part_tables where owner not in ('SYS','SYSTEM') 
and (owner,table_name) not in (
 select owner,mview_name table_name 
 from dba_mviews 
 where owner not in ('SYS','SYSTEM') 
order by 1,2

NOTE: SQL (more...)

Monitoring RMAN Operations

Just a reference to source and my version of the script.

This is for restore since there are OUTPUTS.

Script to monitor RMAN Backup and Restore Operations (Doc ID 1487262.1)

$ sqlplus / as sysdba @mon_rman_restore.sql

SQL*Plus: Release - Production on Sun Aug 23 01:14:31 2015

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release -  (more...)

X-Window Fun

When ssh -X to another host, I am able to use X-Windows.

[dinh@ca01ts~]$ ssh -X dinh@
dinh@'s password:
Last login: Fri Aug 21 11:55:47 2015 from
/usr/bin/xauth: creating new authority file /home/dinh/.Xauthority
[dinh@arrow ~]$ xclock
Warning: Missing charsets in String to FontSet conversion

However, sudo to another user and X-Windows breaks.

[dinh@arrow ~]$ sudo su - oracle
[sudo] password for dinh:
[oracle@arrow ~]$  (more...)

Linux Locking using flock

I am faced with a situation on how to creating locking mechanism for RMAN backup.

Script dbf.sh backups database and can be run simutaneously if it’s not for the same database.

Hence dbf.sh sh running for PROD1 & PROD2 at the same time is VALID and running for PROD1 & PROD1 at the same time is NOT VALID.

While dbf.sh is running, arc.sh (backup archivelog) should not be running.

This was instigated (more...)

Not Another dbms_redefinition Post

If you follow me on twitter at all, then you will realize I often rant about how demos are too simplify and does not represent real world issues.

Please allow me to demonstrate how to partitioning an existing table using DBMS_REDEFINITION.

In the real world, how tables are there without foreign keys?

What happens if there are transactions underlying the table during redef?

What happened to the NOT NULL constraints?

I really like how Oracle (more...)

Warning: standby redo logs not configured for thread – BUG

Surprise to find the following error for single instance Data Guard environment:

    Warning: standby redo logs not configured for thread 3 on boston


This will be fixed with an upcoming patch for the existing issue in Oracle Database – good reason to stay up to date on patching?

Also, the number of Standby Redo Log Groups do not match since thread = 1 is being used.

Not *ALL* SRL have thread (more...)