Thursday 28 June 2012

RMAN Errors during DUPLICATE/Clone database.


RMAN Duplicate command errors and possible solutions.


Oracle instance shut down
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 06/27/2012 16:49:13
RMAN-05501: aborting duplication of target database
RMAN-03015: error occurred in stored script Memory Script
RMAN-06026: some targets not found - aborting restore
RMAN-06101: no channel to restore a backup or copy of the control file


sql statement: alter system reset  db_unique_name scope=spfile

Oracle instance shut down
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 06/27/2012 22:35:01
RMAN-05501: aborting duplication of target database
RMAN-05556: not all datafiles have backups that can be recovered to SCN 10162977180003
RMAN-03015: error occurred in stored script Memory Script
RMAN-06026: some targets not found - aborting restore
RMAN-06100: no channel to restore a backup or copy of datafile 407
RMAN-06100: no channel to restore a backup or copy of datafile 406
RMAN-06100: no channel to restore a backup or copy of datafile 405
RMAN-06100: no channel to restore a backup or copy of datafile 404
RMAN-06100: no channel to restore a backup or copy of datafile 403

These errors are quite misleading and attempts to resolve go in vain, unless the proper backups and SCNs are provided for recover.

our recovery script looked like this...
##begin script##
connect target sys/<pw>@SID
connect auxiliary /

run {
SET UNTIL SEQUENCE ## THREAD #;
DUPLICATE TARGET DATABASE
TO "APPSTRDE" device type disk;
}
##end script##
here the sequence has to be picked very carefully, in the below backup logfile review the highlighted sequences and time stamps.

Thrd Seq     Low SCN    Low Time             Next SCN   Next Time
  ---- ------- ---------- -------------------- ---------- ---------
  1    1362    10162976618798 27-JUN-2012 19:11:00 10162976838904 27-JUN-2012 20:03:08
  1    1363    10162976838904 27-JUN-2012 20:03:08 10162976839270 27-JUN-2012 20:03:17
  1    1364    10162976839270 27-JUN-2012 20:03:17 10162977148308 27-JUN-2012 21:04:04
  1    1365    10162977148308 27-JUN-2012 21:04:04 10162977149494 27-JUN-2012 21:04:31
  1    1366    10162977149494 27-JUN-2012 21:04:31 10162977180003 27-JUN-2012 21:13:13
  1    1367    10162977180003 27-JUN-2012 21:13:13 10162977280169 27-JUN-2012 21:40:29
  1    1368    10162977280169 27-JUN-2012 21:40:29 10162977280458 27-JUN-2012 21:40:36
  2    1102    10162976618794 27-JUN-2012 19:11:00 10162976838969 27-JUN-2012 20:03:10
  2    1103    10162976838969 27-JUN-2012 20:03:10 10162976839265 27-JUN-2012 20:03:16
  2    1104    10162976839265 27-JUN-2012 20:03:16 10162977148305 27-JUN-2012 21:04:04
  2    1105    10162977148305 27-JUN-2012 21:04:04 10162977149491 27-JUN-2012 21:04:31
  2    1106    10162977149491 27-JUN-2012 21:04:31 10162977179948 27-JUN-2012 21:13:13
  2    1107    10162977179948 27-JUN-2012 21:13:13 10162977280166 27-JUN-2012 21:40:29
  2    1108    10162977280166 27-JUN-2012 21:40:29 10162977280455 27-JUN-2012 21:40:35
  3    1105    10162976618786 27-JUN-2012 19:10:58 10162976838963 27-JUN-2012 20:03:09
  3    1106    10162976838963 27-JUN-2012 20:03:09 10162976839318 27-JUN-2012 20:03:18
  3    1107    10162976839318 27-JUN-2012 20:03:18 10162977148313 27-JUN-2012 21:04:05
  3    1108    10162977148313 27-JUN-2012 21:04:05 10162977149542 27-JUN-2012 21:04:32
  3    1109    10162977149542 27-JUN-2012 21:04:32 10162977180036 27-JUN-2012 21:13:15
  3    1110    10162977180036 27-JUN-2012 21:13:15 10162977280201 27-JUN-2012 21:40:30
  3    1111    10162977280201 27-JUN-2012 21:40:30 10162977280594 27-JUN-2012 21:40:37

I've decided to go for the last sequence based on the time stamp, as this backup was completed arount 21:45, chosing the time stamp to be 21:40..so there are 4 time stamps with same time but having difference in seconds. 
So the time latest time stamp around the highlighted time is 21:40:37,  my script should have a sequence number 1111 with THREAD 3.

run {
SET UNTIL SEQUENCE 1111 THREAD 3;
DUPLICATE TARGET DATABASE
TO "APPSTRDE" device type disk;
}

though even now I'm not allocating any channels in the run block RMAN did not complain of not having channels etc as specified initially(RMAN-06100: no channel to restore a backup or copy of datafile ) .

for some reason, if sequence based recovery doesn't go through then we can try for backup location based recovery, you can use the below commands to accomplish the task...

Note ** No need to connect to your source (RMAN target) instance, connecting to your auxiliary is sufficient.
##begin script##
connect auxiliary /
run {
debug all;
allocate auxiliary channel c1 device type disk;
allocate auxiliary channel c2 device type disk;
duplicate database to TARGET backup location '/stage/stagedb/SOURCE/'
 NOFILENAMECHECK;
}
##end script##
*enable debug if required, but this will have lot of messages in the logs which would be a little difficult to skim through*.


Following this has resolved my issue, hope it helps!!



Saturday 16 June 2012

Opatch error - OPatch failed with error code 73

Recently when patching one of the instances in a RAC environment, received below error during
$opatch lsinventory


OracleHomeInventory::createInventoryObj() construction done
LsInventory::loadAndPrintInventory()
Retrieving inventory from Oracle Home...
OracleHomeInventory::load()
Inventory load failed... OPatch cannot load inventory for the given Oracle Home.
Possible causes are:
   Oracle Home dir. path does not exist in Central Inventory
   Oracle Home is a symbolic link
   Oracle Home inventory is corrupted
Locker::release()
OUISessionManager::unRegister()
Un-Registering the caller : OPatch
LsInventory::getInstance() returns
LsInventorySession failed: OracleHomeInventory gets null oracleHomeInfo
Cleaning up the directory : "/u01/app/oracle/DEV/db/tech_st/11.2.0.2/.patch_storage/patch_unzip"...

OPatch failed with error code 73

Initially compared ContentsXML on other 2 nodes of the RAC and couldn't find much of differences...

Here the issue was that the opatch was checking on the ORACLE_HOME as below


[oracle@ora-rac01 ]$ opatch lsinventory
Invoking OPatch 11.2.0.1.1

Oracle Interim Patch Installer version 11.2.0.1.1
Copyright (c) 2009, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/app/oracle/DEV/db/tech_st/11.2.0.2
Central Inventory : /u01/app/oraInventory
   from           : /etc/oraInst.loc
OPatch version    : 11.2.0.1.1
OUI version       : 11.2.0.2.0


These commands would provide details about the issue.

$ORACLE_HOME/OPatch/opatch lsinventory -all
$ORACLE_HOME/OPatch/opatch lsinventory -detail
export OPATCH_DEBUG=TRUE
$ORACLE_HOME/OPatch/opatch lsinventory > error_details.lst



ORACLE_HOME that was referenced by the opatch did not exist in ContentsXML file, So we need to attach this ORACLE_HOME to inventory for the opatch to succeed, using the below command..

Note : Before proceeding, please make a back up of your central inventory, location can be picked from /etc/oraInst.loc

from $ORACLE_HOME/oui/bin


 ./runInstaller -silent -local -ignoreSysPrereqs -attachHome ORACLE_HOME="/u01/app/oracle/DEV/db/tech_st/11.2.0.2" ORACLE_HOME_NAME="DEV1_DB__u01_app_oracle_DEV1_db_tech_st_11_2_0_2" CLUSTER_NODES=ora-rac01,ora-rac02,ora-rac03 LOCAL_NODE=ora-rac01

this should attach the ORACLE_HOME to the local node and opatch lsinventory run would be successful.

Note : This is purely to share the experience and anticipating this article would help some one in similar situations. Please be cautious when working on your environments.





Wednesday 6 June 2012

Setting up Guest additions in Oracle Linux and sharing your local host folders..

Here are some brief steps in setting up the Guest additions in your new virtual machine in virtual box.

Step1 : Mounting the iso image from your host OS.

--> Startup the Guest OS and click on Devices menu

Select the iso image file usually will be in the location (on Windows :- C:\Program Files\Oracle\VirtualBox\VBoxGuestAdditions.iso).

and an icon will be placed on your guest operating system desktop as shown in the above screen.

Step 2: Depending on your OS(this case it's Oracle linux).

setup the oracle yum as detailed in this link http://public-yum.oracle.com

Check your operating system kernel by executing the below command.
$uname -a
if the output has a uek string then please execute the below commands as root

#yum update
#yum install gcc
#yum install kernel-uek-devel

If it's the standard linux

#yum install
#yum install gcc
#yum install kernel-devel

this is required for installing kernel drivers, if the above step is not carefully done then you are most likely to get the following error...

Building the main Guest additions module error



/tmp/vbox.0/Makefile.include.header:97: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR=<directory> and run Make again.  Stop.
Creating user for the Guest Additions.
Creating udev rule for the Guest Additions kernel module.


from your root prompt, execute the below command to install the guest additions...
navigate to iso mount point

#sh ./VBoxLinuxAdditions.run

Sharing and mounting your folders from host operating system.

Click on the Shared Folders from your VM Box manager.

and select the folder from your host operating system...
Note : Please share this folder at your operating system level first..
\

and then shutdown the guest operating system and restart, the shared folder should be auto-mounted onto your guest operating system.

II. While installing Guest additions on Oracle Linux 6.3  encountered the below error, this popped up in spite of following all the above mentioned steps.



















It complains of the missing package,

kernel-uek-devel-2.6.39-200.24.1.el6uek.x86_64

just execute the below if the yum is already setup in your system.

yum install kernel-uek-devel-2.6.39-200.24.1.el6uek.x86_64

this should address the above issue.

Good Luck!!