Stored Proc to write to database alert logs

Here’s a simple stored procedure that I’ve been using for about a decade.  From the application or from database triggers, if I want to record anything to the alert log, I can simply invoke this stored procedure and write error messages to the alert log.

Most of the DBAs have implemented alert log scanners and will send alert notifications if new ORA- error messages pop up in the alert log file.

create or replace procedure edba_write_alert

( p_message varchar2,
  p_oranum NUMBER default 20001)
is
begin
dbms_system.ksdddt;
dbms_system.ksdwrt(2, ‘ORA-’||to_char(p_oranum)||’: ‘||p_message);
end;
/
 
grant execute on edba_write_alert to public; 
 

oracle-rdbms-server-11gR2-preinstall

Starting from Oracle Database 11g Release 2, we no longer use the oracle-validated install.  Instead, we are supposed to leverage the new oracle-rdbms-server-11gR2-preinstall instead.

[root@ovmanager yum.repos.d]# yum install oracle-rdbms-server-11gR2-preinstall
Loaded plugins: security
ol6_UEK_base | 3.7 kB 00:00 …
ol6_UEK_latest | 3.7 kB 00:00 …
ol6_latest | 3.7 kB 00:00 …
ol6_u4_base | 3.7 kB 00:00 …
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package oracle-rdbms-server-11gR2-preinstall.x86_64 0:1.0-7.el6 will be installed
–> Processing Dependency: glibc-devel for package: oracle-rdbms-server-11gR2-preinstall-1.0-7.el6.x86_64
–> Processing Dependency: compat-libstdc++-33 for package: oracle-rdbms-server-11gR2-preinstall-1.0-7.el6.x86_64
–> Processing Dependency: libstdc++-devel for package: oracle-rdbms-server-11gR2-preinstall-1.0-7.el6.x86_64
–> Processing Dependency: libaio-devel for package: oracle-rdbms-server-11gR2-preinstall-1.0-7.el6.x86_64
–> Processing Dependency: xorg-x11-xauth for package: oracle-rdbms-server-11gR2-preinstall-1.0-7.el6.x86_64
–> Processing Dependency: gcc for package: oracle-rdbms-server-11gR2-preinstall-1.0-7.el6.x86_64
–> Processing Dependency: xorg-x11-utils for package: oracle-rdbms-server-11gR2-preinstall-1.0-7.el6.x86_64
–> Processing Dependency: gcc-c++ for package: oracle-rdbms-server-11gR2-preinstall-1.0-7.el6.x86_64
–> Processing Dependency: compat-libcap1 for package: oracle-rdbms-server-11gR2-preinstall-1.0-7.el6.x86_64
–> Processing Dependency: ksh for package: oracle-rdbms-server-11gR2-preinstall-1.0-7.el6.x86_64
–> Running transaction check
—> Package compat-libcap1.x86_64 0:1.10-1 will be installed
—> Package compat-libstdc++-33.x86_64 0:3.2.3-69.el6 will be installed
—> Package gcc.x86_64 0:4.4.7-3.el6 will be installed
–> Processing Dependency: cpp = 4.4.7-3.el6 for package: gcc-4.4.7-3.el6.x86_64
–> Processing Dependency: cloog-ppl >= 0.15 for package: gcc-4.4.7-3.el6.x86_64
—> Package gcc-c++.x86_64 0:4.4.7-3.el6 will be installed
–> Processing Dependency: libmpfr.so.1()(64bit) for package: gcc-c++-4.4.7-3.el6.x86_64
—> Package glibc-devel.x86_64 0:2.12-1.107.el6 will be installed
–> Processing Dependency: glibc-headers = 2.12-1.107.el6 for package: glibc-devel-2.12-1.107.el6.x86_64
–> Processing Dependency: glibc-headers for package: glibc-devel-2.12-1.107.el6.x86_64
—> Package ksh.x86_64 0:20100621-19.el6 will be installed
—> Package libaio-devel.x86_64 0:0.3.107-10.el6 will be installed
—> Package libstdc++-devel.x86_64 0:4.4.7-3.el6 will be installed
—> Package xorg-x11-utils.x86_64 0:7.5-6.el6 will be installed
–> Processing Dependency: libdmx.so.1()(64bit) for package: xorg-x11-utils-7.5-6.el6.x86_64
–> Processing Dependency: libXxf86dga.so.1()(64bit) for package: xorg-x11-utils-7.5-6.el6.x86_64
–> Processing Dependency: libXxf86misc.so.1()(64bit) for package: xorg-x11-utils-7.5-6.el6.x86_64
—> Package xorg-x11-xauth.x86_64 1:1.0.2-7.1.el6 will be installed
–> Processing Dependency: libXmuu.so.1()(64bit) for package: 1:xorg-x11-xauth-1.0.2-7.1.el6.x86_64
–> Running transaction check
—> Package cloog-ppl.x86_64 0:0.15.7-1.2.el6 will be installed
–> Processing Dependency: libppl.so.7()(64bit) for package: cloog-ppl-0.15.7-1.2.el6.x86_64
–> Processing Dependency: libppl_c.so.2()(64bit) for package: cloog-ppl-0.15.7-1.2.el6.x86_64
—> Package cpp.x86_64 0:4.4.7-3.el6 will be installed
—> Package glibc-headers.x86_64 0:2.12-1.107.el6 will be installed
–> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers-2.12-1.107.el6.x86_64
–> Processing Dependency: kernel-headers for package: glibc-headers-2.12-1.107.el6.x86_64
—> Package libXmu.x86_64 0:1.1.1-2.el6 will be installed
—> Package libXxf86dga.x86_64 0:1.1.3-2.el6 will be installed
—> Package libXxf86misc.x86_64 0:1.0.3-4.el6 will be installed
—> Package libdmx.x86_64 0:1.1.2-2.el6 will be installed
—> Package mpfr.x86_64 0:2.4.1-6.el6 will be installed
–> Running transaction check
—> Package kernel-headers.x86_64 0:2.6.32-358.el6 will be installed
—> Package ppl.x86_64 0:0.10.2-11.el6 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================
Package Arch Version Repository Size
========================================================================================================================
Installing:
oracle-rdbms-server-11gR2-preinstall x86_64 1.0-7.el6 ol6_UEK_base 15 k
Installing for dependencies:
cloog-ppl x86_64 0.15.7-1.2.el6 ol6_UEK_base 93 k
compat-libcap1 x86_64 1.10-1 ol6_UEK_base 17 k
compat-libstdc++-33 x86_64 3.2.3-69.el6 ol6_UEK_base 183 k
cpp x86_64 4.4.7-3.el6 ol6_UEK_base 3.7 M
gcc x86_64 4.4.7-3.el6 ol6_UEK_base 10 M
gcc-c++ x86_64 4.4.7-3.el6 ol6_UEK_base 4.7 M
glibc-devel x86_64 2.12-1.107.el6 ol6_UEK_base 973 k
glibc-headers x86_64 2.12-1.107.el6 ol6_UEK_base 604 k
kernel-headers x86_64 2.6.32-358.el6 ol6_UEK_base 2.3 M
ksh x86_64 20100621-19.el6 ol6_UEK_base 686 k
libXmu x86_64 1.1.1-2.el6 ol6_UEK_base 65 k
libXxf86dga x86_64 1.1.3-2.el6 ol6_UEK_base 24 k
libXxf86misc x86_64 1.0.3-4.el6 ol6_UEK_base 17 k
libaio-devel x86_64 0.3.107-10.el6 ol6_UEK_base 13 k
libdmx x86_64 1.1.2-2.el6 ol6_UEK_base 20 k
libstdc++-devel x86_64 4.4.7-3.el6 ol6_UEK_base 1.6 M
mpfr x86_64 2.4.1-6.el6 ol6_UEK_base 156 k
ppl x86_64 0.10.2-11.el6 ol6_UEK_base 1.3 M
xorg-x11-utils x86_64 7.5-6.el6 ol6_UEK_base 94 k
xorg-x11-xauth x86_64 1:1.0.2-7.1.el6 ol6_UEK_base 34 k

Transaction Summary
========================================================================================================================
Install 21 Package(s)

Total download size: 27 M
Installed size: 62 M
Is this ok [y/N]: y
Downloading Packages:
————————————————————————————————————————
Total 119 MB/s | 27 MB 00:00
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Retrieving key from file:///etc/yum.repos.d/RPM-GPG-KEY-oracle-ol6
Importing GPG key 0xEC551F03:
Userid: “Oracle OSS group (Open Source Software group) <build@oss.oracle.com>”
From : /etc/yum.repos.d/RPM-GPG-KEY-oracle-ol6
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : libstdc++-devel-4.4.7-3.el6.x86_64 1/21
Installing : mpfr-2.4.1-6.el6.x86_64 2/21
Installing : cpp-4.4.7-3.el6.x86_64 3/21
Installing : libXmu-1.1.1-2.el6.x86_64 4/21
Installing : 1:xorg-x11-xauth-1.0.2-7.1.el6.x86_64 5/21
Installing : libdmx-1.1.2-2.el6.x86_64 6/21
Installing : ksh-20100621-19.el6.x86_64 7/21
Installing : libXxf86dga-1.1.3-2.el6.x86_64 8/21
Installing : compat-libstdc++-33-3.2.3-69.el6.x86_64 9/21
Installing : libXxf86misc-1.0.3-4.el6.x86_64 10/21
Installing : xorg-x11-utils-7.5-6.el6.x86_64 11/21
Installing : libaio-devel-0.3.107-10.el6.x86_64 12/21
Installing : ppl-0.10.2-11.el6.x86_64 13/21
Installing : cloog-ppl-0.15.7-1.2.el6.x86_64 14/21
Installing : kernel-headers-2.6.32-358.el6.x86_64 15/21
Installing : glibc-headers-2.12-1.107.el6.x86_64 16/21
Installing : glibc-devel-2.12-1.107.el6.x86_64 17/21
Installing : gcc-4.4.7-3.el6.x86_64 18/21
Installing : gcc-c++-4.4.7-3.el6.x86_64 19/21
Installing : compat-libcap1-1.10-1.x86_64 20/21
Installing : oracle-rdbms-server-11gR2-preinstall-1.0-7.el6.x86_64 21/21
Verifying : compat-libcap1-1.10-1.x86_64 1/21
Verifying : cpp-4.4.7-3.el6.x86_64 2/21
Verifying : kernel-headers-2.6.32-358.el6.x86_64 3/21
Verifying : xorg-x11-utils-7.5-6.el6.x86_64 4/21
Verifying : glibc-devel-2.12-1.107.el6.x86_64 5/21
Verifying : ppl-0.10.2-11.el6.x86_64 6/21
Verifying : gcc-4.4.7-3.el6.x86_64 7/21
Verifying : libaio-devel-0.3.107-10.el6.x86_64 8/21
Verifying : libXxf86misc-1.0.3-4.el6.x86_64 9/21
Verifying : mpfr-2.4.1-6.el6.x86_64 10/21
Verifying : oracle-rdbms-server-11gR2-preinstall-1.0-7.el6.x86_64 11/21
Verifying : gcc-c++-4.4.7-3.el6.x86_64 12/21
Verifying : compat-libstdc++-33-3.2.3-69.el6.x86_64 13/21
Verifying : libXxf86dga-1.1.3-2.el6.x86_64 14/21
Verifying : 1:xorg-x11-xauth-1.0.2-7.1.el6.x86_64 15/21
Verifying : libstdc++-devel-4.4.7-3.el6.x86_64 16/21
Verifying : ksh-20100621-19.el6.x86_64 17/21
Verifying : libdmx-1.1.2-2.el6.x86_64 18/21
Verifying : libXmu-1.1.1-2.el6.x86_64 19/21
Verifying : cloog-ppl-0.15.7-1.2.el6.x86_64 20/21
Verifying : glibc-headers-2.12-1.107.el6.x86_64 21/21

Installed:
oracle-rdbms-server-11gR2-preinstall.x86_64 0:1.0-7.el6

Dependency Installed:
cloog-ppl.x86_64 0:0.15.7-1.2.el6 compat-libcap1.x86_64 0:1.10-1 compat-libstdc++-33.x86_64 0:3.2.3-69.el6
cpp.x86_64 0:4.4.7-3.el6 gcc.x86_64 0:4.4.7-3.el6 gcc-c++.x86_64 0:4.4.7-3.el6
glibc-devel.x86_64 0:2.12-1.107.el6 glibc-headers.x86_64 0:2.12-1.107.el6 kernel-headers.x86_64 0:2.6.32-358.el6
ksh.x86_64 0:20100621-19.el6 libXmu.x86_64 0:1.1.1-2.el6 libXxf86dga.x86_64 0:1.1.3-2.el6
libXxf86misc.x86_64 0:1.0.3-4.el6 libaio-devel.x86_64 0:0.3.107-10.el6 libdmx.x86_64 0:1.1.2-2.el6
libstdc++-devel.x86_64 0:4.4.7-3.el6 mpfr.x86_64 0:2.4.1-6.el6 ppl.x86_64 0:0.10.2-11.el6
xorg-x11-utils.x86_64 0:7.5-6.el6 xorg-x11-xauth.x86_64 1:1.0.2-7.1.el6

Complete!

By Charles Kim, Oracle ACE Director and Nitin Vengurlekar

tar with exclude

cat dg_tar.ksh

tar cpfX – dg.exclude dgmenu > dg.tar

 

$ cat dg.exclude

dgmenu/old

dgmenu/conf

dgmenu/log

afiedt.buf

*.old

*.bkup

 

Notes:

1.  dgmenu is the directory that we are creating a tar-ball for

Reduce Transportable Tablespace Downtime using Cross Platform Incremental Backups

Reduce Transportable Tablespace Downtime using Cross Platform Incremental Backups [ID 1389592.1]

What does this mean?  It means we can perform migrations from AIX/Solaris/HP-UX to Linux with significantly reduced downtime.  I can perform incremental backups across endianness.

This was originally tested for the Exadata and now it is available for everyone.


Posted by Charles Kim, Oracle ACE Director

clonedb with Direct NFS

For those interested in the clonedb feature of Oracle Direct NFS, check out MOS:  Clone your dNFS Production Database for Testing [ID 1210656.1]

On the ZFSSA, we have the ability to create snapshots and offer clones of our snapshots.  From a ZFSSA perspective, it is extremely simple to create snapshots and clones of snapshots via the BUI or CLI.    For customers with Exadata and ZFSSA, we obviously have options.  We can experiment with clonedb or leverage the storage appliance technology.

As a DBA, you may want to have the control yourself, especially, if you do not have control over the filer.  Check out this post by Kevin Closson.  He does a great job introducing the concept and showing you how to do it.   If you read to the end of his post, he provides links to couple of great videos on youtube.

ASM Pocket Reference Guide

Download the latest ASM Pocket Reference Guide prepared by Charles Kim, Oracle ACE Director, and Nitin Vengurlekar

dbca Leverage Golden Image Template Clones

Earlier in my blog post, I demonstrated how to create golden image templates using dbca GUI.  Now, my goal is to show you how to perform the same tasks but all through the dbca command-line-interface.  You will notice the  command line interface is significantly easier to use and has no dependency on X-windows.

In our example, we are leveraging /bkups file system for our backups.  The whole idea is to leverage NFS and place all of our golden images of databases to be shared across all the servers.

As we deploy our golden image template to all the target database servers, we just need to copy over the db_gold_01.dbc file (see below) and copy the file to the $ORACLE_HOME.  This dbc file should be part of our /u01 tar that we copy to every node.  

1. Create a Golden Image Database Templates from an Existing Database on Source

# cd db home on the source
$ > cat create_clone_template.ksh 
export BKUP_DIR=/bkups/templates
dbca -silent -createCloneTemplate \
-sourceSID RACDB \
-templateName db_gold_01 \
-sysDBAUserName sys \
-sysDBAPassword oracle123 \
-maintainFileLocations false \
-datafileJarLocation $BKUP_DIR

–output……

$ > ./create_clone_template.ksh 
Gathering information from the source database
4% complete
8% complete
13% complete
17% complete
22% complete
Backup datafiles 
28% complete
88% complete
Creating template file
100% complete
Look at the log file “/u01/app/oracle/cfgtoollogs/dbca/silent.log_2013-05-08_08-36-32-AM” for further details.

2. Locate the the tempate xml file in the format of .dbc 
dtccrac > find . -name ‘*.dbc’
./assistants/dbca/templates/General_Purpose.dbc
./assistants/dbca/templates/Data_Warehouse.dbc
./assistants/dbca/templates/db_gold_01.dbc

3. Copy to the target

– to /bkups/templates
$ > ls -l /bkups/templates
total 282784
-rw-r—– 1 oracle oinstall 18497536 May 8 08:37 gb_gold_01.ctl
-rw-r—– 1 oracle oinstall 270778368 May 8 08:37 gb_gold_01.dfb

– to $ORACLE_HOME/assistants/dbca/templates
db_gold_01.dbc

4. Create the database from template

dbca -silent \
-createDatabase \
-templateName db_gold_01.dbc \
-gdbName dbatools \
-sid dbatools \
-SysPassword oracle123 \
-SystemPassword oracle123 \
-emConfiguration NONE \
-redoLogFileSize 200 \
-recoveryAreaDestination FRA \
-storageType ASM \
-asmSysPassword oracle123 \
-diskGroupName DATA \
-listeners LISTENER_RRAC \
-characterSet WE8MSWIN1252 \
-nationalCharacterSet AL16UTF16 \
-databaseType MULTIPURPOSE \
-nodelist rac01,rac02,rac03,rac04 \
-initparams audit_file_dest=’/bkups//dbatools/adump’ \
-initparams compatible=’11.2.0.3′ \
-initparams db_create_file_dest=’+DATA’ \
-initparams db_create_online_log_dest_1=’+DATA’ \
-initparams db_create_online_log_dest_2=’+FRA’ \
-initparams diagnostic_dest=’/bkups’ \
-initparams parallel_max_servers=64 \
-initparams pga_aggregate_target=1824522240 \
-initparams processes=600 \
-initparams sga_target=4294967296 \
-initparams db_recovery_file_dest=’+FRA’ \

-initparams db_recovery_file_dest_size=4322230272

Complete DBCA

dbca with the silent option is the best way to create a database.  If you issue the find command from $ORACLE_HOME, you will see that oracle ships with two generic templates:

rhel59dra:/u01/app/oracle/product/11.2.0/db

> find . -name ‘*.dbc’
./assistants/dbca/templates/General_Purpose.dbc
./assistants/dbca/templates/Data_Warehouse.dbc

Leveraging the General Purpose template, I can create my custom database.  Notice all the init.ora options that is specified with my dbca command.

dbca -silent                             \

       -createDatabase                   \
       -templateName General_Purpose.dbc \
       -gdbName dbatools                   \
       -sid dbatools                       \
       -SysPassword oracle123 \
       -SystemPassword oracle123 \
       -emConfiguration NONE             \
       -redoLogFileSize 1000 \
       -recoveryAreaDestination FRA \
       -storageType ASM                  \
         -asmSysPassword oracle123 \
         -diskGroupName DATA     \
           -listeners  LISTENER_RAC \
       -characterSet AL32UTF8 \
       -nationalCharacterSet AL16UTF16 \
       -databaseType MULTIPURPOSE \
       -nodelist rhel59dra, rhel59drb \
       -initparams audit_file_dest=’/bkup/dbatools/adump’ \
           -initparams compatible=’11.2.0.3′ \
           -initparams db_create_file_dest=’+DATA’ \
           -initparams db_create_online_log_dest_1=’+DATA’ \
           -initparams db_create_online_log_dest_2=’+FRA’ \
           -initparams diagnostic_dest=’/bkup’ \
           -initparams parallel_max_servers=64 \
           -initparams pga_aggregate_target=1824522240 \
           -initparams processes=600 \
           -initparams sga_target=4294967296 \
           -initparams db_recovery_file_dest=’+FRA’ \
       -initparams db_recovery_file_dest_size=4322230272

Attach Home to rebuild the oraInventory

cd /apps
mv oraInventory oraInventory.OLD
mkdir oraInventory
 

$ /apps/oracle/product/11.2.0/grid/oui/bin

+ASM – oracle: ./attachHome.sh
Starting Oracle Universal Installer…
 
Checking swap space: must be greater than 500 MB.   Actual 32767 MB    Passed
The inventory pointer is located at /etc/oraInst.loc
The inventory is located at /apps/oraInventory
‘AttachHome’ was successful.
 
 
$ /apps/oracle/product/11.2.0/DB/oui/bin

DBATOOLS – oracle: ./attachHome.sh
Starting Oracle Universal Installer…
 
Checking swap space: must be greater than 500 MB.   Actual 32767 MB    Passed
The inventory pointer is located at /etc/oraInst.loc
The inventory is located at /apps/oraInventory
‘AttachHome’ was successful.
 
 
DBATOOLS – oracle: cd /apps/oraInventory
$ /apps/oraInventory
DBATOOLS – oracle: cd ContentsXML/
 
$ /apps/oraInventory/ContentsXML
DBATOOLS – oracle: cat inventory.xml
<?xml version=”1.0″ standalone=”yes” ?>
<!– Copyright (c) 1999, 2010, Oracle. All rights reserved. –>
<!– Do not modify the contents of this file by hand. –>
<INVENTORY>
<VERSION_INFO>
   <SAVED_WITH>11.2.0.2.0</SAVED_WITH>
   <MINIMUM_VER>2.1.0.6.0</MINIMUM_VER>
</VERSION_INFO>
<HOME_LIST>
<HOME NAME=”Ora11g_gridinfrahome1″ LOC=”/apps/oracle/product/11.2.0/grid” TYPE=”O” IDX=”1″ CRS=”true”/>
<HOME NAME=”OraDb11g_home1″ LOC=”/apps/oracle/product/11.2.0/DB” TYPE=”O” IDX=”2″/>
</HOME_LIST>
</INVENTORY>
 
+ASM – oracle: ./opatch lsinv |grep ^Patch
Patch history file: /apps/oracle/product/11.2.0/grid/cfgtoollogs/opatch/opatch_history.txt
Patch  12431716     : applied on Thu Jun 09 16:49:01 CDT 2011
Patch  11724916     : applied on Thu Jun 09 16:29:52 CDT 2011
Patch  12311357     : applied on Thu Jun 09 16:29:24 CDT 2011
 
+ASM – oracle: db DBATOOLS
The Oracle base remains unchanged with value /apps/oracle
 
$ /apps/oracle/product/11.2.0/grid/OPatch
DBATOOLS – oracle: cd $ORACLE_HOME/OPatch
$ /apps/oracle/product/11.2.0/DB/OPatch
DBATOOLS – oracle: ./opatch lsinv |grep ^Patch
Patch history file: /apps/oracle/product/11.2.0/DB/cfgtoollogs/opatch/opatch_history.txt
Patch  12431716     : applied on Thu Jun 09 16:53:03 CDT 2011
Patch  11724916     : applied on Thu Jun 09 16:38:21 CDT 2011
Patch  12311357     : applied on Thu Jun 09 16:37:54 CDT 2011 

Clone non-rac Grid Infrastructure

[oracle@my562b bin]$ ./detachHome.sh

Starting Oracle Universal Installer…

Checking swap space: must be greater than 500 MB.   Actual 4094 MB    Passed
The inventory pointer is located at /etc/oraInst.loc
The inventory is located at /apps/oraInventory
‘DetachHome’ was successful.

The contents of the inventory XML file looks like this:
[root@my562b ContentsXML]# cat inventory.xml
<?xml version=”1.0″ standalone=”yes” ?>
<!– Copyright (c) 1999, 2010, Oracle. All rights reserved. –>
<!– Do not modify the contents of this file by hand. –>
<INVENTORY>
<VERSION_INFO>
   <SAVED_WITH>11.2.0.2.0</SAVED_WITH>
   <MINIMUM_VER>2.1.0.6.0</MINIMUM_VER>
</VERSION_INFO>
<HOME_LIST>
<HOME NAME=”OraDb11g_home1″ LOC=”/apps/oracle/product/11.2.0/db” TYPE=”O” IDX=”2″/>
<HOME NAME=”Ora11g_gridinfrahome1″ LOC=”/apps/11.2.0/grid” TYPE=”O” IDX=”1″ REMOVED=”T”/>
</HOME_LIST>
</INVENTORY>
 

[oracle@my562b bin]$ perl clone.pl -silent ORACLE_BASE=/apps/oracle ORACLE_HOME=/apps/11.2.0/grid ORACLE_HOME_NAME=Ora11g_gridinfrahome1 INVENTORY_LOCATION=/apps/oraInventory

./runInstaller -clone -waitForCompletion  “ORACLE_BASE=/apps/oracle” “ORACLE_HOME=/apps/11.2.0/grid” “ORACLE_HOME_NAME=Ora11g_gridinfrahome1″ “INVENTORY_LOCATION=/apps/oraInventory” -silent -noConfig -nowait
Starting Oracle Universal Installer…

Checking swap space: must be greater than 500 MB.   Actual 4094 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2011-05-09_11-33-45AM. Please wait …
 
Copyright (C) 1999, 2010, Oracle. All rights reserved.


You can find the log of this install session at:
 /apps/oraInventory/logs/cloneActions2011-05-09_11-35-10AM.log
………………………………………………………………………………………. 100% Done.


Could not backup file /apps/11.2.0/grid/rootupgrade.sh to /apps/11.2.0/grid/rootupgrade.sh.ouibak
Could not backup file /apps/11.2.0/grid/root.sh to /apps/11.2.0/grid/root.sh.ouibak

Installation in progress (Monday, May 9, 2011 11:35:29 AM CDT)
………………………………………………………………                                                        72% Done.
Install successful

Linking in progress (Monday, May 9, 2011 11:35:38 AM CDT)

Link successful

Setup in progress (Monday, May 9, 2011 11:36:57 AM CDT)
…………….                                                100% Done.
Setup successful

End of install phases.(Monday, May 9, 2011 11:37:05 AM CDT)
WARNING:
The following configuration scripts need to be executed as the “root” user.
/apps/11.2.0/grid/root.sh
To execute the configuration scripts:
    1. Open a terminal window
    2. Log in as “root”
    3. Run the scripts
   
Run the script on the local node.
The cloning of Ora11g_gridinfrahome1 was successful.
Please check ‘/apps/oraInventory/logs/cloneActions2011-05-09_11-35-10AM.log’ for more details.

Contents of inventory XML after the clone:
[root@my562b ContentsXML]# cat inventory.xml
<?xml version=”1.0″ standalone=”yes” ?>
<!– Copyright (c) 1999, 2010, Oracle. All rights reserved. –>
<!– Do not modify the contents of this file by hand. –>
<INVENTORY>
<VERSION_INFO>
   <SAVED_WITH>11.2.0.2.0</SAVED_WITH>
   <MINIMUM_VER>2.1.0.6.0</MINIMUM_VER>
</VERSION_INFO>
<HOME_LIST>
<HOME NAME=”OraDb11g_home1″ LOC=”/apps/oracle/product/11.2.0/db” TYPE=”O” IDX=”2″/>
<HOME NAME=”Ora11g_gridinfrahome1″ LOC=”/apps/11.2.0/grid” TYPE=”O” IDX=”1″/>
</HOME_LIST>
</INVENTORY>


[oracle@my562b bin]$ cd ../..
[oracle@my562b grid]$ ./root.sh
Check /apps/11.2.0/grid/install/root_my562b_2011-05-09_11-39-15.log for the output of root script




What a mess .. trying force delete and re-configuring GRID Home

I don’t think I need to go through the exercise of detaching and re-cloning the oracle home
I think the roothas.pl with the deconfig option followed with the force option works if all else fails.
The other option to deconfig is:
$ORACLE_HOME/perl/bin/perl -I $ORACLE_HOME/perl/lib -I $ORACLE_HOME/crs/install $ORACLE_HOME/crs/install/roothas.pl -delete

[root@my562b utl]# /apps/11.2.0/grid/crs/install/roothas.pl -deconfig -force

Using configuration parameter file: /apps/11.2.0/grid/crs/install/crsconfig_params
CRS-4639: Could not contact Oracle High Availability Services
CRS-4000: Command Stop failed, or completed with errors.
CRS-4639: Could not contact Oracle High Availability Services
CRS-4000: Command Delete failed, or completed with errors.
CLSU-00100: Operating System function: opendir failed with error data: 2
CLSU-00101: Operating System error message: No such file or directory
CLSU-00103: error location: scrsearch1
CLSU-00104: additional error information: cant open scr home dir scls_scr_getval
CRS-4544: Unable to connect to OHAS
CRS-4000: Command Stop failed, or completed with errors.
ACFS-9459: ADVM/ACFS is not supported on this OS version: ’2.6.32-100.26.2.el5
ACFS-9201: Not Supported
Successfully deconfigured Oracle Restart stack
[root@my562b utl]# $ORACLE_HOME/perl/bin/perl -I $ORACLE_HOME/perl/lib -I $ORACLE_HOME/crs/install $ORACLE_HOME/crs/install/roothas.pl
Using configuration parameter file: /apps/11.2.0/grid/crs/install/crsconfig_params
LOCAL ADD MODE
Creating OCR keys for user ‘oracle’, privgrp ‘oinstall’..
Operation successful.
LOCAL ONLY MODE
Successfully accumulated necessary OCR keys.
Creating OCR keys for user ‘root’, privgrp ‘root’..
Operation successful.
CRS-4664: Node my562b successfully pinned.
Adding daemon to inittab
ACFS-9459: ADVM/ACFS is not supported on this OS version: ’2.6.32-100.26.2.el5

my562b     2011/05/09 11:50:06     /apps/11.2.0/grid/cdata/my562b/backup_20110509_115006.olr
Successfully configured Oracle Grid Infrastructure for a Standalone Server

[root@my562b bin]# ./crsctl stop has
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on ‘my562b’
CRS-2673: Attempting to stop ‘ora.evmd’ on ‘my562b’
CRS-2677: Stop of ‘ora.evmd’ on ‘my562b’ succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on ‘my562b’ has completed
CRS-4133: Oracle High Availability Services has been stopped.
[root@my562b bin]# ./crsctl start has
CRS-4123: Oracle High Availability Services has been started.


[oracle@my562b admin]$ srvctl add listener
[oracle@my562b admin]$ srvctl add asm -d ‘ORCL:*’
[oracle@my562b admin]$ srvctl start listener
[oracle@my562b admin]$ srvctl start asm
[oracle@my562b admin]$ srvctl status diskgroup -g data
PRCA-1000 : ASM Disk Group DATA does not exist
PRCR-1001 : Resource ora.DATA.dg does not exist

[oracle@my562b admin]$ asmcmd

ASMCMD> lsdg
ASMCMD> mount data   
ASMCMD> mount mydata
ASMCMD> mount myfra


Now the database home 

[oracle@my562b bin]$ ./detachHome.sh

Starting Oracle Universal Installer…

Checking swap space: must be greater than 500 MB.   Actual 4091 MB    Passed
The inventory pointer is located at /etc/oraInst.loc
The inventory is located at /apps/oraInventory
‘DetachHome’ was successful.


[root@my562b bin]# cd /apps/oraInventory/ContentsXML/
You have new mail in /var/spool/mail/root
[root@my562b ContentsXML]# cat inventory.xml
<?xml version=”1.0″ standalone=”yes” ?>
<!– Copyright (c) 1999, 2010, Oracle. All rights reserved. –>
<!– Do not modify the contents of this file by hand. –>
<INVENTORY>
<VERSION_INFO>
   <SAVED_WITH>11.2.0.2.0</SAVED_WITH>
   <MINIMUM_VER>2.1.0.6.0</MINIMUM_VER>
</VERSION_INFO>
<HOME_LIST>
<HOME NAME=”Ora11g_gridinfrahome1″ LOC=”/apps/11.2.0/grid” TYPE=”O” IDX=”1″/>
</HOME_LIST>
</INVENTORY>


[oracle@my562b bin]$ cd ../../clone/bin

[oracle@my562b bin]$ perl clone.pl -silent ORACLE_BASE=/apps/oracle ORACLE_HOME=/apps/oracle/product/11.2.0/db ORACLE_HOME_NAME=OraDb11g_home1 INVENTORY_LOCATION=/apps/oraInventory

./runInstaller -clone -waitForCompletion  “ORACLE_BASE=/apps/oracle” “ORACLE_HOME=/apps/oracle/product/11.2.0/db” “ORACLE_HOME_NAME=OraDb11g_home1″ “INVENTORY_LOCATION=/apps/oraInventory” -silent -noConfig -nowait
Starting Oracle Universal Installer…

Checking swap space: must be greater than 500 MB.   Actual 4090 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2011-05-09_12-13-20PM. Please wait …Oracle Universal Installer, Version 11.2.0.2.0 Production
Copyright (C) 1999, 2010, Oracle. All rights reserved.

You can find the log of this install session at:
 /apps/oraInventory/logs/cloneActions2011-05-09_12-13-20PM.log
………………………………………………………………………………………. 100% Done.



Installation in progress (Monday, May 9, 2011 12:13:56 PM CDT)
……………………………………………………………………                                                  78% Done.
Install successful

Linking in progress (Monday, May 9, 2011 12:14:05 PM CDT)

Link successful

Setup in progress (Monday, May 9, 2011 12:17:12 PM CDT)
Setup successful

End of install phases.(Monday, May 9, 2011 12:17:18 PM CDT)
WARNING:
The following configuration scripts need to be executed as the “root” user.
/apps/oracle/product/11.2.0/db/root.sh
To execute the configuration scripts:
    1. Open a terminal window
    2. Log in as “root”
    3. Run the scripts
   
The cloning of OraDb11g_home1 was successful.
Please check ‘/apps/oraInventory/logs/cloneActions2011-05-09_12-13-20PM.log’ for more details.


[root@my562b ContentsXML]# cd /apps/oracle/product/11.2.0/db
[root@my562b db]# ./root.sh
Check /apps/oracle/product/11.2.0/db/install/root_my562b_2011-05-09_12-19-12.log for the output of root script


[root@my562b db]# cd -
/apps/oraInventory/ContentsXML
[root@my562b ContentsXML]# cat inventory.xml
<?xml version=”1.0″ standalone=”yes” ?>
<!– Copyright (c) 1999, 2010, Oracle. All rights reserved. –>
<!– Do not modify the contents of this file by hand. –>
<INVENTORY>
<VERSION_INFO>
   <SAVED_WITH>11.2.0.2.0</SAVED_WITH>
   <MINIMUM_VER>2.1.0.6.0</MINIMUM_VER>
</VERSION_INFO>
<HOME_LIST>
<HOME NAME=”Ora11g_gridinfrahome1″ LOC=”/apps/11.2.0/grid” TYPE=”O” IDX=”1″/>
<HOME NAME=”OraDb11g_home1″ LOC=”/apps/oracle/product/11.2.0/db” TYPE=”O” IDX=”2″/>
</HOME_LIST>
</INVENTORY>