Monday, December 17, 2012

AIX - a sample script to start/stop OBIEE

#!/bin/ksh
# Check passed parameters
if [ $# -ne 2 ]
then
  echo "Please provide parameters"
  echo "Parameter 1 - Domain"
  echo "Parameter 2 - start or stop"
  exit
fi

Wednesday, July 11, 2012


Upgrade - Oracle Database 10.2.0.4 to 11.2.0.3

Oracle Database software uses 2 files (1 and 2) of the 11.2.0.3 patchset.
SQL> select name from v$database;
NAME
---------

TEST11G
SQL> select * from v$version;
BANNER

----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 – Production
CORE    10.2.0.4.0    Production
TNS for Linux: Version 10.2.0.4.0 – Production
NLSRTL Version 10.2.0.4.0 – Production


Wednesday, July 4, 2012

11gR2 Rac install on Centos 6.2 without Oracle ASMLib


Oracle ASMlib is available for linux prior to OL6 or RedHat 6. However, starting from 6, you can only use asmlib for UEK kernel.
On Linux, the built in udev is definitely a better solution to handle persistent device naming and permissions.

Without ASMLib, you don't need to worry about the raw disks everytime when there's a kernel update.

Tuesday, June 19, 2012

What are cvutrace.log.* files

 I was looking to clear some space recently and ran across a 21G directory (<grid_infrastructure_home>/cv/log). Inside there were a lot of files like “cvutrace.log.0_20100720015347″. These files are log files related to a RAC installation. They can safely be deleted.

To stop the files from being generated is add the following at the top of the cluvfy script in the <grid_infrastructure_home>/bin directory.



Windows:
set SRVM_TRACE=false

AIX:
export  SRVM_TRACE=false

Monday, June 18, 2012

An example of logon trigger

By user and by Module:
CREATE OR REPLACE TRIGGER SET_OPTIMIZER_ONLOGIN AFTER LOGON ON DATABASE
DECLARE
uname VARCHAR2(30);
app VARCHAR2(30);
cmmd VARCHAR2(64);
BEGIN
cmmd:='ALTER SESSION SET optimizer_index_cost_adj=20';
uname:=SYS_CONTEXT('USERENV','SESSION_USER');
app := upper(SYS_CONTEXT('USERENV','MODULE'));
IF uname = '*****' and app like 'SQLPLUS.EXE' then
   EXECUTE IMMEDIATE cmmd;
END IF;
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
/

By module only:
CREATE OR REPLACE TRIGGER SET_OPTIMIZER_ONLOGIN AFTER LOGON ON DATABASE
DECLARE
app VARCHAR2(30);
cmmd VARCHAR2(64);
BEGIN
cmmd:='ALTER SESSION SET optimizer_index_cost_adj=20';
app := upper(SYS_CONTEXT('USERENV','MODULE'));
IF app like 'RUNBATCH.EXE' then
   EXECUTE IMMEDIATE cmmd;
END IF;
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
/

Wednesday, May 30, 2012

Regular Expression in Ultraedit to replace Non ASCII characters

Find Non ASCII characters:
[~^t^r^n -~]+

Find Non ASCII characters following with space and ASCII characters:
[~^t^r^n -~]+ [-,."^?0-9a-z]

To replace the space with CR/LF:
search ^([~^t^r^n -~]+^) ^([-,."^?0-9a-z]+^)
and replace to ^1^p^2

Here ^1 = ^([~^t^r^n -~]+^)
     ^2 = ^([-,."^?0-9a-z]+^)
     space is going to be replaced by ^p(CR/LF)

Thursday, May 17, 2012

How to Resume a Failed RMAN Duplicate Due to Missing Backups or ArchiveLogs

It is relatively easy to resume the rman restore and recovery process if it has failed due to missing backups or archivelogs.  You most often see the following error messages complaining that something is missing. RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 05/24/2010 12:52:44
RMAN-03015: error occurred in stored script Memory Script
RMAN-06053: unable to perform media recovery because of missing log
RMAN-06025: no backup of log thread 1 seq 6253 lowscn 1663211060 found to restore

You may have forgotten to copy them over to the same local disk location and/or  failed to restore due to tape issues. After you are sure that you have everything you need in the location RMAN expects them,  shutdown the database that is being duplicated (this is assumed that the controlfile has been restored and the database mounted), start it backup in nomount mode and just rerun the same commands.

RMAN automatically (tested using Oracle RDBMS Enterprise Edition 10.2.0.4) runs through the commands and continues the restore and recovery process from where it left off.

For example: There was a gap in the archive logs in the flash recovery area. I have an alternate archive destination that contains the missing log.
After the first duplicate command failed, I used RMAN to catalog the existence of the  missing log:
CATALOG ARCHIVELOG '/u01/arc/ORACLE_SID/1_6253_DBID.arc';
see MOS Document: How To Catalog Backups / Archivelogs / Datafile Copies / Controlfile Copies [ID 470463.1]  Then shutdown, startup nomount the database being duplicated. Reran the exact same duplicate command:
archive log thread 1 sequence 6251 is already on disk as file /backup/flash_recovery_area/ORACLE_SID/archivelog/2010_05_22/o1_mf_1_6251_5zk173bs_.arc
archive log thread 1 sequence 6252 is already on disk as file /backup/flash_recovery_area/ORACLE_SID/archivelog/2010_05_22/o1_mf_1_6252_5zkhfw99_.arc
archive log thread 1 sequence 6253 is already on disk as file /u01/arc/ORACLE_SID/1_6253_DBID.arc
archive log thread 1 sequence 6254 is already on disk as file /backup/flash_recovery_area/ORACLE_SID/archivelog/2010_05_23/o1_mf_1_6254_5zl68htc_.arc
As you can see from the above output…that it applies the archive logs including the single cataloged piece in the alternate location.  This may save someone else time and trouble when they have the same issue.