Windows Task Scheduler CMD

Don’t get me wrong. GUI can be terrific but it does have its place.

When the connection between you and the the target host are multiple servers across the continent, the latency will drive me crazy mad.

Hence, my exploration to learn more command line.

Enough of my rant, let’s demo.

Tested on Windows 7


Microsoft Windows [Version 6.1.7601]


List by Folders:

C:Usersdinh>schtasks /query /fo table /nh

DropboxUpdateTaskUserS-1-5-21-992222644- 18-Nov-2015  (more...)

Extent Allocation

Some references on extents dealing with extent trimming, initial extent for parallel load, tablespace fragmentation, etc…


Parallel Load: Uniform or AutoAllocate extents?

Tom Kyte covers this problem in great details in his post Loading and Extents

Initial Extent Size of a Partition Changed to 8MB from 64KB After Upgrade to or Later (Doc ID (more...)

Using emctl to Create Blackout

When it comes to using EM12c, I do not like using GUI, especially in the environment I am working with.

Aside from the rant, it’s more difficult to document steps using GUI and to reproduce or automate the steps.

If you are interested in using command line, then read on.

The blackout was created at the target (monitored) server.

Determine location of Agent installation.

[oracle@arrow ~]$ ps -ef|grep agent_inst

oracle    36878  36125  0 12:56 pts/1     (more...)

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...)