Showing posts with label 11g. Show all posts
Showing posts with label 11g. Show all posts

Wednesday, 9 April 2014

Configure SHMMAX and SHMALL in Linux

SHMMAX and SHMALL are two key shared memory parameters that directly impact’s the way by which Oracle creates an SGA. Shared memory is nothing but part of Unix IPC System (Inter Process Communication) maintained by kernel where multiple processes share a single chunk of memory to communicate with each other.

While trying to create an SGA during a database startup, Oracle chooses from one of the 3 memory management models a) one-segment or b) contiguous-multi segment or c) non-contiguous multi segment. Adoption of any of these models is dependent on the size of SGA and values defined for the shared memory parameters in the linux kernel, most importantly SHMMAX.
 


So what are these parameters - SHMMAX and SHMALL?


SHMMAX is the maximum size of a single shared memory segment set in “bytes”.


silicon:~ #  cat /proc/sys/kernel/shmmax

536870912


SHMALL is the total size of Shared Memory Segments System wide set in “pages”.


silicon:~ #  cat /proc/sys/kernel/shmall

1415577


The key thing to note here is the value of SHMMAX is set in "bytes" but the value of SHMMALL is set in "pages".

What’s the optimal value for SHMALL?


As SHMALL is the total size of Shard Memory Segments System wide, it should always be less than the Physical Memory on the System and should be greater than sum of SGA’s of all the oracle databases on the server. Once this value (sum of SGA’s) hit the limit, i.e. the value of shmall, then any attempt to start a new database (or even an existing database with a resized SGA) will result in an “out of memory” error (below). This is because there won’t be any more shared memory segments that Linux can allocate for SGA.


ORA-27102: out of memory

Linux-x86_64 Error: 28: No space left on device.


So above can happen for two reasons. Either the value of shmall is not set to an optimal value or you have reached the threshold on this server.

Setting the value for SHMALL to optimal is straight forward. All you want to know is how much “Physical Memory” (excluding Cache/Swap) you have on the system and how much of it should be set aside for Linux Kernel and to be dedicated to Oracle Databases.

For e.g. Let say the Physical Memory of a system is 6GB, out of which you want to set aside 1GB for Linux Kernel for OS Operations and dedicate the rest of 5GB to Oracle Databases. Then here’s how you will get the value for SHMALL.

Convert this 5GB to bytes and divide by page size. Remember SHMALL should be set in “pages” not “bytes”.

So here goes the calculation.


Determine Page Size first, can be done in two ways. In my case it’s 4096 and that’s the recommended and default in most cases which you can keep the same. 



silicon:~ # getconf PAGE_SIZE

4096


or

silicon:~ # cat /proc/sys/kernel/shmmni
4096

Convert 5GB into bytes and divide by page size, I used the linux calc to do the math.


silicon:~ # echo "( 5 * 1024 * 1024 * 1024 ) / 4096 " | bc -l

1310720.00000000000000000000


Reset shmall and load it dynamically into kernel


silicon:~ # echo "1310720" > /proc/sys/kernel/shmall
silicon:~ # sysctl –p

Verify if the value has been taken into effect.

silicon:~ # sysctl -a | grep shmall
kernel.shmall = 1310720

Another way to look this up is

silicon:~ # ipcs -lm

------ Shared Memory Limits --------
max number of segments = 4096                          /* SHMMNI  */
max seg size (kbytes) = 524288                  /* SHMMAX  */
max total shared memory (kbytes) = 5242880      /* SHMALL  */
min seg size (bytes) = 1


To keep the value effective after every reboot, add the following line to /etc/sysctl.conf


echo “kernel.shmall = 1310720” >> /etc/sysctl.conf

Also verify if sysctl.conf is enabled or will be read during boot.

silicon:~ # chkconfig boot.sysctl
boot.sysctl  on

If returns “off”, means it’s disabled. Turn it on by running

silicon:~ # chkconfig boot.sysctl on
boot.sysctl  on

What’s the optimal value for SHMMAX?

Oracle makes use of one of the 3 memory management models to create the SGA during database startup and it does this in following sequence. First Oracle attempts to use the one-segment model and if this fails, it proceeds with the next one which's the contiguous multi-segment model and if that fails too, it goes with the last option which is the non-contiguous multi-segment model.

So during startup it looks for shmmax parameter and compares it with the initialization parameter *.sga_target. If shmmax > *.sga_target, then oracle goes with one-segment model approach where the entire SGA is created within a single shared memory segment.

But the above attempt (one-segment) fails if SGA size otherwise *.sga_target  > shmmax, then Oracle proceeds with the 2nd option – contiguous multi-segment model. Contiguous allocations, as the name indicates are a set of shared memory segments which are contiguous within the memory and if it can find such a set of segments then entire SGA is created to fit in within this set. 


But if cannot find a set of contiguous allocations then last of the 3 option’s is chosen – non-contiguous multi-segment allocation and in this Oracle has to grab the free memory segments fragmented between used spaces.

So let’s say if you know the max size of SGA of any database on the server stays below 1GB, you can set shmmax to 1 GB. But say if you have SGA sizes for different databases spread between 512MB to 2GB, then set shmmax to 2Gigs and so on.

Like SHMALL, SHMMAX can be defined by one of these methods..

Dynamically reset and reload it to the kernel..


silicon:~ #  echo "536870912" >  /proc/sys/kernel/shmmax

silicon:~ #  sysctl –p           -- Dynamically reload the parameters.

Or use sysctl to reload and reset ..

silicon:~ #  sysctl -w kernel.shmmax=536870912

To permanently set so it’s effective in reboots…

silicon:~ #  echo "kernel.shmmax=536870912" >>  /etc/systctl.conf


Install doc for 11g recommends the value of shmmax to be set to "4GB – 1byte" or half the size of physical memory whichever is lower. I believe “4GB – 1byte” is related to the limitation on the 32 bit (x86) systems where the virtual address space for a user process can only be little less than 4GB. As there’s no such limitation for 64bit (x86_64) bit systems, you can define SGA’s larger than 4 Gig’s. But idea here is to let Oracle use the efficient one-segment model and for this shmmax should stay higher than SGA size of any individual database on the system.

Wednesday, 29 May 2013

Prereq check warning for missing rpm package libstdc++43 on SUSE 11

on SuSE 11 SP1 - 11.2.0.3 Grid Installation - ./runInstaller and prereq check is failing because compat-libstdc++-33.3.2.3-47.3 is not installed.

on SuSE 11 SP2 - 11.2.0.3 Grid Installation - ./runInstaller and prereq check is failing because the following packages are not installed:-

 Package: compat-libstdc++-33-3.2.3-47.3
 Package: libstdc++43-4.3.4_20091019-0.7.35 (s390x)
 Package: libgcc43-4.3.4_20091019-0.7.35.

This prereq issue is also seen on generic Linux SuSE 11 platforms.

Changes

SuSE 11 SP1 SP2
11.2.0.3

Cause

This is documented in unpublished Bug 13445763 and Bug 14366019
The rpm compat-libstdc++-33.3.2.3-47.3 is not available on  SuSE 11. The rpm libstdc++-33 provides the required files.  Both the 32-bit version and 64-bit versions are required.
This is the same as the 11.2.0.2 requirements for this platform.
On SuSE 11 SP2 the libstdc++43 and libgcc43 checks fail as the rpm has changed to libstdc++46 but providing both the 32-bit version and 64-bit versions of libstdc++43-devel rpms are installed - this is not a problem.

Solution

You can safely ignore these warnings - click on ignore button in the top right hand corner of the screen.

You should, however, ensure that you meet all the other rpm prereqs.  To assist you, please refer to Getting Started - 11gR2 Grid Infrastructure,SI(Single Instance), ASM and DB (IBM: Linux on System z) Document 1306465.1 - specifically the rpm validation section.

For SLES11 - you should download the attachment at the end of the above article:

- SLES 11 - 11.2. Grid Infrastructure, SIHA, DB Install

To assist further - here is the "rpm -qa" output from a SuSE 11 SP2 in-house system which resulted in a successful installation of 11.2.0.3 Grid Infrastructure.:-
zhost:/home/oracle # rpm -qa | grep libstdc
libstdc++46-32bit-4.6.1_20110701-0.13.9
libstdc++43-devel-4.3.4_20091019-0.22.17
libstdc++33-3.3.3-11.9
libstdc++46-4.6.1_20110701-0.13.9
libstdc++33-32bit-3.3.3-11.9
libstdc++43-devel-32bit-4.3.4_20091019-0.22.17
libstdc++-devel-4.3-62.198

zhost:/home/oracle # rpm -qa | grep libgcc
libgcc46-32bit-4.6.1_20110701-0.13.9
libgcc46-4.6.1_20110701-0.13.9

 which gcc
/usr/bin/gcc
zhost:/home/oracle # gcc --version
gcc (SUSE Linux) 4.3.4 [gcc-4_3-branch revision 152973]
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

zhost:/home/oracle/sjc # c++ --version
c++ (SUSE Linux) 4.3.4 [gcc-4_3-branch revision 152973]
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Monday, 19 November 2012

Oracle Grid Infra 11.2.0.3.1 and Oracle RDBMS Download location

Hi,

 I regularly discuss about oracle databases at OTN discussion form. During discussion,i observed that most of oracle ppl dont know from 11gR2 each patchset is now full release. For e.g if you want your database to be 11.2.0.3 then you dont need to first install 11.2.0.1 and then apply 11.2.0.3 patchset on top of it.

But 11.2.0.1 is directly downloadable from eDelivery site and from OTN site and 11.2.0.3 is not. So below is the Metalink note from where you can download 11.2.0.3 database. Remember you can directly download and install 11.2.0.3 to your server if you dont have 11.2.0.1 or 11.2.0.2.

However if you already have 11.2.0.1 or 11.2.0.2 and want to upgrade to 11.2.0.3, then install 11.2.0.3 into new oracle home. This is called out-of-place upgrade. From 11gR2 every patchset is out-of-place upgrade. If you install 11.2.0.3 in existing oracle home, then installer will give you warning about this.
Some customer still want to upgrade to 11.2.0.3 and want to install this in existing 11gR2 home. This is still possible(using-detachHome while running runInstaller).The reason for this case might be customer want to safe space on server etc.

As of now 11.2.0.3.1 i.e. PSU1 is current PSU available on 11.2.0.3.

11.2.0.3 download location from MOS - 11.2.0.3 Patchset Location For Grid Infrastructure And RDBMS. [ID 1362393.1]

Friday, 16 November 2012

Oracle Validate Package on Red Hat 6


Oracle Preinstall on Red Hat 6

Not so simple. Look what happens if I try to perform a yum localinstall of this package when I only have the RHN channels configured:
[root@server1 ~]# yum localinstall oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64.rpm
Loaded plugins: product-id, rhnplugin, security
Setting up Local Package Process
Examining oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64.rpm: oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64
Marking oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64.rpm to be installed
Resolving Dependencies
...
--> Finished Dependency Resolution
Error: Package: oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64 (/oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64)
 Requires: kernel-uek
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest
Why the error message? Because of the dependency on the UEK which is only available from Oracle. So if you are going to be using Red Hat, what are the choices?
  1. Use the Oracle Public Yum server to install the UEK and then switch back to the RHEL kernel post installation, potentially impacting your support agreement
  2. Manually install all of the packages and set the kernel / security settings instead of using Oracle Preinstall
  3. Hack the RPM database so it thinks the UEK is installed when it isn’t
  4. Rewrite and recompile the Oracle Preinstall RPM so that it no longer includes the dependency on the UEK
I’m not keen on the first one as I haven’t read all of the small print in my Red Hat support agreement. I’m even less keen on the second one because I am a DBA and therefore inherently lazy… I’d rather spend 10 hours working out how to hack it than 5 hours doing it properly.
So let’s look at the remaining options…

Hack the RPM Database

RPM uses a local database to keep track of which packages are installed. So one simple if unclean option is to tell the RPM database that the UEK is installed even when it isn’t.
I have a Linux system running Red Hat 6 Update 3 and have disabled selinux and turned off the iptables firewall. I have also used rhn_register to register the system with the Red Hat Network in order to be able to use Red Hat’s yum servers.
[root@server1 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.3 (Santiago)
[root@server1 ~]# uname -s -n -r -m
Linux server1.vmem.local 2.6.32-279.9.1.el6.x86_64 x86_64
I want to install the Oracle Preinstall RPM, but of course the package is only available from Oracle so first I need to fetch it from Oracle’s public OL6 repository:
[root@server1 ~]# wget http://public-yum.oracle.com/repo/OracleLinux/OL6/latest/x86_64/oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64.rpm
[root@server1 ~]# ls -l oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64.rpm
-rw-r--r-- 1 root root 15416 Jun 8 02:16 oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64.rpm
I also need a kernel-uek RPM in order to run the command which will alter the database. There are ways of doing this without the actual kernel-uek RPM but this is just simpler, so I’ll also download it from the Oracle Public Yum server:
[root@server1 ~]# wget http://public-yum.oracle.com/repo/OracleLinux/OL6/latest/x86_64/kernel-uek-2.6.32-300.32.3.el6uek.x86_64.rpm
Now remember that earlier I ran a yum localinstall of the oracle-preinstall RPM and it failed with the message:
Error: Package: oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64 (/oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64)
 Requires: kernel-uek
This time I will fake the installation of the kernel-uek package using the rpm option “–justdb”. However, kernel-uek also has dependencies, so it’s going to fail with a message saying that it needs the kernel-uek-firmware package:
[root@server1 ~]# rpm -ivh kernel-uek-2.6.32-300.32.3.el6uek.x86_64.rpm --justdb
warning: kernel-uek-2.6.32-300.32.3.el6uek.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
error: Failed dependencies:
 kernel-uek-firmware = 2.6.32-300.32.3.el6uek is needed by kernel-uek-2.6.32-300.32.3.el6uek.x86_64
That’s ok, I can add another option to the rpm call which is “–nodeps” to ignore any dependencies:
[root@server1 ~]# rpm -ivh kernel-uek-2.6.32-300.32.3.el6uek.x86_64.rpm --justdb --nodeps
warning: kernel-uek-2.6.32-300.32.3.el6uek.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing... ########################################### [100%]
This time the package “installs” into the RPM database with no issues. Now I can call the yum localinstall option on the oracle-preinstall package to setup the environment for my database. First though, because I know that oracle-preinstall adds lines to my /boot/grub/grub.conf file (specifically to disable numa) I will take a copy of it:
[root@server1 ~]# cp /boot/grub/grub.conf /root/grub.conf
[root@server1 ~]# yum localinstall oracle-rdbms-server-11gR2-preinstall-1.0-3.el6.x86_64.rpm
Loaded plugins: product-id, rhnplugin, security
Setting up Local Package Process
Examining oracle-rdbms-server-11gR2-preinstall-1.0-3.el6.x86_64.rpm: oracle-rdbms-server-11gR2-preinstall-1.0-3.el6.x86_64
Marking oracle-rdbms-server-11gR2-preinstall-1.0-3.el6.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package oracle-rdbms-server-11gR2-preinstall.x86_64 0:1.0-3.el6 will be installed

<...snip!...>

--> Finished Dependency Resolution

Dependencies Resolved

<...snip!...>

Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
** Found 1 pre-existing rpmdb problem(s), 'yum check' output follows:
kernel-uek-2.6.32-300.32.3.el6uek.x86_64 has missing requires of kernel-uek-firmware = ('0', '2.6.32', '300.32.3.el6uek')

<...snip!...>

Installed:
  oracle-rdbms-server-11gR2-preinstall.x86_64 0:1.0-3.el6
It works (despite the warning message) and now the environment is setup ready for the database to be installed. I need to check the new /boot/grub/grub.conf against my copy and of course check the contents of the log file in /var/log/oracle-rdbms-server-11gR2-preinstall but my system is good to go. This method works… but it’s dirty.

Rewrite and Recompile the Oracle Preinstall RPM

WARNING: I am offering this example for educational purposes. If you rewrite and recompile any code written by a third party it is your duty to first investigate license agreements and support policies.
An alternative method to installing Oracle Preinstall on a Red Hat system (or I guess any other RPM-based Linux system) is to download the source RPM file and then remove the dependency on the UEK and recompile. Here’s an example:
First I’m going to install the rpm tools necessary to do this work:
[root@rh6u3 ~]# yum install rpm-build rpmdevtools -y
Now I am ready to create the RPM development environment, but first I must point out the golden rule of RPM package creation: Never create RPMs as the root user!!! Oracle appears (at least in recent oracle-preinstall packages) to use a user called mockbuild, so that’s exactly what I am going to use:
[root@rh6u3 ~]# useradd mockbuild -p mockbuild -m -s /bin/bash
[root@rh6u3 ~]# su - mockbuild

[mockbuild@rh6u3 ~]$ wget http://public-yum.oracle.com/repo/OracleLinux/OL6/3/base/x86_64/oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.src.rpm
I’ve created the mockbuild user and switched to that account, then downloaded the source RPM for the latest oracle-preinstall file. I now need to create the RPM development environment which goes off and creates (amongst other things) a load of subdirectories for me under a top-level directory called “rpmbuild”:
[mockbuild@rh6u3 ~]$ rpmdev-setuptree
[mockbuild@rh6u3 ~]$ ls -l
total 20
-rw-rw-r--. 1 mockbuild mockbuild 14422 Jun 8 02:16 oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.src.rpm
drwxrwxr-x. 7 mockbuild mockbuild 4096 Oct 9 11:44 rpmbuild
[mockbuild@rh6u3 ~]$ ls -l rpmbuild/
total 20
drwxrwxr-x. 2 mockbuild mockbuild 4096 Oct 9 11:44 BUILD
drwxrwxr-x. 2 mockbuild mockbuild 4096 Oct 9 11:44 RPMS
drwxrwxr-x. 2 mockbuild mockbuild 4096 Oct 9 11:44 SOURCES
drwxrwxr-x. 2 mockbuild mockbuild 4096 Oct 9 11:44 SPECS
drwxrwxr-x. 2 mockbuild mockbuild 4096 Oct 9 11:44 SRPMS
I will now install the source RPM (as the mockbuild user) which will unpack itself into these directories:
[mockbuild@rh6u3 ~]$ rpm -ivh oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.src.rpm
warning: oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.src.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
1:oracle-rdbms-server-11g########################################### [100%]

[mockbuild@rh6u3 ~]$ ls -l rpmbuild/SOURCES rpmbuild/SPECS
rpmbuild/SOURCES:
total 8
-rw-r--r--. 1 mockbuild mockbuild 7016 Jun 8 02:14 oracle-rdbms-server-11gR2-preinstall-1.0.tar.gz
rpmbuild/SPECS:
total 8
-rw-r--r--. 1 mockbuild mockbuild 5947 Jun 8 02:14 oracle-rdbms-server-11gR2-preinstall.spec
[mockbuild@rh6u3 ~]$ vi rpmbuild/SPECS/oracle-rdbms-server-11gR2-preinstall.spec
The important file here is the SPEC file which contains all of the dependency information for RPM and yum. You can see the last command is to edit the spec file in order to remove the line which says kernel-uek:
#System requirement
Requires:procps module-init-tools ethtool initscripts 
Requires:bc bind-utils nfs-utils util-linux-ng pam
Requires:xorg-x11-utils xorg-x11-xauth 
Requires:kernel-uek
Requires:smartmontools
Once that dependency is removed the modification is complete and I can repackage – I don’t need to change anything in the RPM payload (the tarball located in the SOURCES directory). The build command will throw some interesting warnings but they can (usually) be ignored… stand by because this is going to create a long spool of output:
[mockbuild@rh6u3 ~]$ rpmbuild -ba rpmbuild/SPECS/oracle-rdbms-server-11gR2-preinstall.spec
warning: line 18: prereq is deprecated: PreReq:/etc/redhat-release
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.wgaFJn
+ umask 022
+ cd /home/mockbuild/rpmbuild/BUILD
+ echo RPM_BUILD_ROOT=/home/mockbuild/rpmbuild/BUILDROOT/oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64
RPM_BUILD_ROOT=/home/mockbuild/rpmbuild/BUILDROOT/oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64
+ cd /home/mockbuild/rpmbuild/BUILD
+ rm -rf oracle-rdbms-server-11gR2-preinstall-1.0
+ /usr/bin/gzip -dc /home/mockbuild/rpmbuild/SOURCES/oracle-rdbms-server-11gR2-preinstall-1.0.tar.gz
+ /bin/tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd oracle-rdbms-server-11gR2-preinstall-1.0
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.oNjPub
+ umask 022
+ cd /home/mockbuild/rpmbuild/BUILD
+ cd oracle-rdbms-server-11gR2-preinstall-1.0
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.1Htc90
+ umask 022
+ cd /home/mockbuild/rpmbuild/BUILD
+ cd oracle-rdbms-server-11gR2-preinstall-1.0
+ rm -rf /home/mockbuild/rpmbuild/BUILDROOT/oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64
+ mkdir -p -m 755 /home/mockbuild/rpmbuild/BUILDROOT/oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64/etc/sysconfig/oracle-rdbms-server-11gR2-preinstall
+ mkdir -p -m 755 /home/mockbuild/rpmbuild/BUILDROOT/oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64/usr/bin
+ mkdir -p -m 755 /home/mockbuild/rpmbuild/BUILDROOT/oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64/etc/rc.d/init.d
+ install -m 755 oracle-rdbms-server-11gR2-preinstall-verify /home/mockbuild/rpmbuild/BUILDROOT/oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64/etc/sysconfig/oracle-rdbms-server-11gR2-preinstall
+ install -m 755 oracle-rdbms-server-11gR2-preinstall-verify /home/mockbuild/rpmbuild/BUILDROOT/oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64/usr/bin
+ install -m 644 oracle-rdbms-server-11gR2-preinstall.param /home/mockbuild/rpmbuild/BUILDROOT/oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64/etc/sysconfig/oracle-rdbms-server-11gR2-preinstall
+ install -m 755 oracle-rdbms-server-11gR2-preinstall-firstboot /home/mockbuild/rpmbuild/BUILDROOT/oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64/etc/rc.d/init.d
+ ln -f -s /etc/sysconfig/oracle-rdbms-server-11gR2-preinstall/oracle-rdbms-server-11gR2-preinstall-verify /home/mockbuild/rpmbuild/BUILDROOT/oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64/usr/bin/oracle-rdbms-server-11gR2-preinstall-verify
+ /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot
+ /usr/lib/rpm/brp-compress
+ /usr/lib/rpm/brp-strip
+ /usr/lib/rpm/brp-strip-static-archive
+ /usr/lib/rpm/brp-strip-comment-note
Processing files: oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64
Provides: config(oracle-rdbms-server-11gR2-preinstall) = 1.0-6.el6 oracle-rdbms-server-11gR2-preinstall = 1.0
Requires(interp): /bin/sh /bin/sh /bin/sh /bin/sh
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1 rpmlib(VersionedDependencies) <= 3.0.3-1
Requires(pre): /bin/sh /etc/redhat-release
Requires(post): /bin/sh
Requires(preun): /bin/sh /etc/redhat-release
Requires(postun): /bin/sh
Requires: /bin/bash
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/mockbuild/rpmbuild/BUILDROOT/oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64
warning: Could not canonicalize hostname: rh6u3
Wrote: /home/mockbuild/rpmbuild/SRPMS/oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.src.rpm
Wrote: /home/mockbuild/rpmbuild/RPMS/x86_64/oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.04LldE
+ umask 022
+ cd /home/mockbuild/rpmbuild/BUILD
+ cd oracle-rdbms-server-11gR2-preinstall-1.0
+ rm -rf /home/mockbuild/rpmbuild/BUILDROOT/oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64
+ exit 0
The result of all that madness is a new RPM file located in the RPM/ directory:
[mockbuild@rh6u3 ~]$ ls -lR rpmbuild/RPMS/
rpmbuild/RPMS/:
total 4
drwxr-xr-x. 2 mockbuild mockbuild 4096 Oct 9 12:10 x86_64
rpmbuild/RPMS/x86_64:
total 16
-rw-rw-r--. 1 mockbuild mockbuild 14437 Oct 9 12:10 oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64.rpm
Now I can log out of the mockbuild account and run yum localinstall (as root) of the newly created RPM. My work is done! And unlike the “hack the RPM database” option I haven’t got a load of broken dependencies hiding somewhere which might cause me trouble later.
[root@rh6u3 ~]# yum localinstall ~mockbuild/rpmbuild/RPMS/x86_64/oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64.rpm
Loaded plugins: product-id, rhnplugin, security
Setting up Local Package Process
Examining /home/mockbuild/rpmbuild/RPMS/x86_64/oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64.rpm: oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64
Marking /home/mockbuild/rpmbuild/RPMS/x86_64/oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package oracle-rdbms-server-11gR2-preinstall.x86_64 0:1.0-6.el6 will be installed
--> Processing Dependency: compat-libcap1 for package: oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64
--> Processing Dependency: compat-libstdc++-33 for package: oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64
--> Processing Dependency: gcc for package: oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64
--> Processing Dependency: gcc-c++ for package: oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64
--> Processing Dependency: glibc-devel for package: oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64
--> Processing Dependency: ksh for package: oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64
--> Processing Dependency: libaio-devel for package: oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64
--> Processing Dependency: libstdc++-devel for package: oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64
--> Processing Dependency: make for package: oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64
--> Processing Dependency: nfs-utils for package: oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64
--> Running transaction check
---> Package compat-libcap1.i686 0:1.10-1 will be installed
---> Package compat-libstdc++-33.i686 0:3.2.3-69.el6 will be installed
---> Package gcc.i686 0:4.4.6-4.el6 will be installed
--> Processing Dependency: libgomp = 4.4.6-4.el6 for package: gcc-4.4.6-4.el6.i686
--> Processing Dependency: cpp = 4.4.6-4.el6 for package: gcc-4.4.6-4.el6.i686
--> Processing Dependency: cloog-ppl >= 0.15 for package: gcc-4.4.6-4.el6.i686
--> Processing Dependency: libgomp.so.1 for package: gcc-4.4.6-4.el6.i686
---> Package gcc-c++.i686 0:4.4.6-4.el6 will be installed
--> Processing Dependency: libmpfr.so.1 for package: gcc-c++-4.4.6-4.el6.i686
---> Package glibc-devel.i686 0:2.12-1.80.el6_3.5 will be installed
--> Processing Dependency: glibc-headers = 2.12-1.80.el6_3.5 for package: glibc-devel-2.12-1.80.el6_3.5.i686
--> Processing Dependency: glibc = 2.12-1.80.el6_3.5 for package: glibc-devel-2.12-1.80.el6_3.5.i686
--> Processing Dependency: glibc-headers for package: glibc-devel-2.12-1.80.el6_3.5.i686
---> Package ksh.i686 0:20100621-16.el6 will be installed
---> Package libaio-devel.i686 0:0.3.107-10.el6 will be installed
---> Package libstdc++-devel.i686 0:4.4.6-4.el6 will be installed
---> Package make.i686 1:3.81-20.el6 will be installed
---> Package nfs-utils.i686 1:1.2.3-26.el6 will be installed
--> Processing Dependency: nfs-utils-lib >= 1.1.0-3 for package: 1:nfs-utils-1.2.3-26.el6.i686
--> Processing Dependency: keyutils >= 1.4-4 for package: 1:nfs-utils-1.2.3-26.el6.i686
--> Processing Dependency: rpcbind for package: 1:nfs-utils-1.2.3-26.el6.i686
--> Processing Dependency: libtirpc.so.1 for package: 1:nfs-utils-1.2.3-26.el6.i686
--> Processing Dependency: libtirpc for package: 1:nfs-utils-1.2.3-26.el6.i686
--> Processing Dependency: libnfsidmap.so.0 for package: 1:nfs-utils-1.2.3-26.el6.i686
--> Processing Dependency: libgssglue.so.1(libgssapi_CITI_2) for package: 1:nfs-utils-1.2.3-26.el6.i686
--> Processing Dependency: libgssglue.so.1 for package: 1:nfs-utils-1.2.3-26.el6.i686
--> Processing Dependency: libgssglue for package: 1:nfs-utils-1.2.3-26.el6.i686
--> Processing Dependency: libevent-1.4.so.2 for package: 1:nfs-utils-1.2.3-26.el6.i686
--> Processing Dependency: libevent for package: 1:nfs-utils-1.2.3-26.el6.i686
--> Running transaction check
---> Package cloog-ppl.i686 0:0.15.7-1.2.el6 will be installed
--> Processing Dependency: libppl_c.so.2 for package: cloog-ppl-0.15.7-1.2.el6.i686
--> Processing Dependency: libppl.so.7 for package: cloog-ppl-0.15.7-1.2.el6.i686
---> Package cpp.i686 0:4.4.6-4.el6 will be installed
---> Package glibc.i686 0:2.12-1.80.el6 will be updated
--> Processing Dependency: glibc = 2.12-1.80.el6 for package: glibc-common-2.12-1.80.el6.i686
---> Package glibc.i686 0:2.12-1.80.el6_3.5 will be an update
---> Package glibc-headers.i686 0:2.12-1.80.el6_3.5 will be installed
--> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers-2.12-1.80.el6_3.5.i686
--> Processing Dependency: kernel-headers for package: glibc-headers-2.12-1.80.el6_3.5.i686
---> Package keyutils.i686 0:1.4-4.el6 will be installed
---> Package libevent.i686 0:1.4.13-4.el6 will be installed
---> Package libgomp.i686 0:4.4.6-4.el6 will be installed
---> Package libgssglue.i686 0:0.1-11.el6 will be installed
---> Package libtirpc.i686 0:0.2.1-5.el6 will be installed
---> Package mpfr.i686 0:2.4.1-6.el6 will be installed
---> Package nfs-utils-lib.i686 0:1.1.5-4.el6 will be installed
---> Package rpcbind.i686 0:0.2.0-9.el6 will be installed
--> Running transaction check
---> Package glibc-common.i686 0:2.12-1.80.el6 will be updated
---> Package glibc-common.i686 0:2.12-1.80.el6_3.5 will be an update
---> Package kernel-headers.i686 0:2.6.32-279.9.1.el6 will be installed
---> Package ppl.i686 0:0.10.2-11.el6 will be installed
--> Finished Dependency Resolution



And log file will be here

ls -lrt /var/log/oracle-rdbms-server-11gR2-preinstall/results/orakernel.log


 ls -lrt /etc/sysconfig/oracle-rdbms-server-11gR2-preinstall/oracle-rdbms-server-11gR2-preinstall*

Monday, 10 September 2012

11g - automatically changes audit_trail to OS



11g - automatically changes audit_trail to OS



From Audit Trail-----


Mon Sep 10 10:53:06 2012
alter database open read only
AUDIT_TRAIL initialization parameter is changed to OS, as DB is NOT compatible for database opened with read-onlyccess




SYS@STANDBY >> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@STANDBY >> startup mount
ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance
ORACLE instance started.

Total System Global Area  217157632 bytes
Fixed Size                  2225064 bytes
Variable Size             159386712 bytes
Database Buffers           50331648 bytes
Redo Buffers                5214208 bytes
Database mounted.
SYS@STANDBY >> show parameter audit

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
audit_file_dest                      string      /cluster/app/grid/product/11.2
                                                 .0/db_1/admin/STANDBY/adump
audit_sys_operations                 boolean     FALSE
audit_syslog_level                   string
audit_trail                          string      DB
SYS@STANDBY >> alter database open read only;

Database altered.

SYS@STANDBY >> show parameter audit

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
audit_file_dest                      string      /cluster/app/grid/product/11.2
                                                 .0/db_1/admin/STANDBY/adump
audit_sys_operations                 boolean     FALSE
audit_syslog_level                   string
audit_trail                          string       OS
SYS@STANDBY >>
SYS@STANDBY >>
SYS@STANDBY >> alter database recover managed standby database using current logfile disconnect;

Database altered.

Thursday, 26 July 2012

Duplicating Database without connecting to Target Database or Catalog Database in Oracle 11g


In Oracle 10g version or earlier, while duplicating a database using RMAN, we had to connect to the Target database along with the Auxiliary Database. In oracle 11g, there is a new feature available, where in the duplication from the Target Database to the Auxiliary Database can be done using RMAN without connecting to the Target database or to the Catalog Database. Only thing what is required the full backup of the Target database. Below is the details on how to go ahead with duplicating the database without connecting to the Target Database or to the Auxiliary Database.
Target Database : myprim
Target Database Server : dev
Auxiliary Database : testdb
Auxiliary Database Server : uat
Step 1:
Take the incremental level 0 backup of the Target database using RMAN.
In my case, I had the backup of my target database (myprim) taken at the location “/u02/bkp”
[oracle@dev bkp]$ pwd
/u02/bkp
[oracle@dev bkp]$ ls -lrt
total 1076968
-rw-r–r– 1 oracle oinstall        75 Apr 14 21:59 dbid.txt
-rw-r—– 1 oracle oinstall  53648384 Apr 25 10:04 MYPRIM_inc0_06n9a795_1_1.bak
-rw-r—– 1 oracle oinstall 984506368 Apr 25 10:06 MYPRIM_inc0_07n9a79l_1_1.bak
-rw-r—– 1 oracle oinstall   9830400 Apr 25 10:06 MYPRIM_inc0_08n9a7cb_1_1.bak
-rw-r—– 1 oracle oinstall     37376 Apr 25 10:06 MYPRIM_inc0_09n9a7cg_1_1.bak
-rw-r—– 1 oracle oinstall  53684224 Apr 25 10:06 MYPRIM_inc0_0an9a7ci_1_1.bak
Step 2:
Copy these backup pieces from the Target server (location /u02/bkp) to the auxiliary server (location /u03/backup)
Also, copy the pfile (initmyprim.ora) of the Target database to the Auxiliary server.
Copying Backup Pieces:
[oracle@dev bkp]$ scp *.bak uat:/u03/backup
oracle@uat’s password:
MYPRIM_inc0_06n9a795_1_1.bak                  100%   51MB   3.4MB/s   00:15  
MYPRIM_inc0_07n9a79l_1_1.bak                  100%  939MB   1.8MB/s   08:29  
MYPRIM_inc0_08n9a7cb_1_1.bak                  100% 9600KB   4.7MB/s   00:02  
MYPRIM_inc0_09n9a7cg_1_1.bak                  100%   37KB  36.5KB/s   00:00  
MYPRIM_inc0_0an9a7ci_1_1.bak                  100%   51MB   5.1MB/s   00:10  
[oracle@dev bkp]$
Copying pfile of Target Database to Auxiliary Server:
[oracle@dev dbs]$ scp initmyprim.ora uat:/u01/app/oracle/product/11.2.0/dbhome_1/dbs/
oracle@uat’s password:
initmyprim.ora                                100%  921     0.9KB/s   00:01  
[oracle@dev dbs]$
Step 3:
On the Auxiliary server, edit the pfile that was copied earlier to the desired entries (dump locations, control file location, datafile locations, if using ASM then specify the desired disk group) and rename it to the desired instance name file (init.ora). Below is the sample I had it done.
inittestdb.ora
testdb.__db_cache_size=297795584
testdb.__java_pool_size=4194304
testdb.__large_pool_size=4194304
testdb.__oracle_base=’/u01/app/oracle’#ORACLE_BASE set from environment
testdb.__pga_aggregate_target=167772160
testdb.__sga_target=494927872
testdb.__shared_io_pool_size=0
testdb.__shared_pool_size=176160768
testdb.__streams_pool_size=4194304
*.audit_file_dest=‘/u01/app/oracle/admin/testdb/adump’
# *.audit_trail=’db’
*.compatible=’11.2.0.0.0′
*.control_files=’+DATA’
*.db_block_size=8192
*.db_create_file_dest=’+DATA’
*.db_domain=”
*.db_name=’testdb’
*.db_recovery_file_dest=’+ARCH’
*.db_recovery_file_dest_size=1073741824
*.diagnostic_dest=’/u01/app/oracle’
*.dispatchers=’(PROTOCOL=TCP) (SERVICE=testdbXDB)’
*.log_archive_format=’%t_%s_%r.dbf’
*.open_cursors=300
*.pga_aggregate_target=164626432
*.processes=150
*.remote_login_passwordfile=’EXCLUSIVE’
*.sga_target=494927872
*.undo_tablespace=’UNDOTBS1′
Step 4:
Create a password file for the Auxiliary Database using the ORAPWD utility.
orapwd file=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwtestdb password=
Step 5:
Start the auxiliary instance using the modified by pfile.
[oracle@uat ~]$ export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
[oracle@uat ~]$ export ORACLE_SID=testdb
[oracle@uat ~]$ sqlplus sys/oracle as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Wed Apr 25 10:46:24 2012
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
Connected to an idle instance.
SQL> startup nomount pfile=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/inittestdb.ora
ORACLE instance started.
Total System Global Area  492707840 bytes
Fixed Size                  2214656 bytes
Variable Size             188744960 bytes
Database Buffers          297795584 bytes
Redo Buffers                3952640 bytes
SQL>
Step 6:
Connect the auxiliary instance through RMAN and start the duplication.
The duplication is done by specifying the location of the backup pieces. The command to be used is DUPLICATE DATABASE TO ‘’ BACKUP LOCATION ‘’
[oracle@uat ~]$ rman auxiliary /
Recovery Manager: Release 11.2.0.1.0 – Production on Wed Apr 25 10:48:36 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
connected to auxiliary database: TESTDB (not mounted)
RMAN> duplicate database to ‘testdb’ backup location ‘/u03/backup’;
Starting Duplicate Db at 26-APR-12
contents of Memory Script:
{
   sql clone “create spfile from memory”;
}
executing Memory Script
sql statement: create spfile from memory
contents of Memory Script:
{
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area     492707840 bytes
Fixed Size                     2214656 bytes
Variable Size                155190528 bytes
Database Buffers             331350016 bytes
Redo Buffers                   3952640 bytes
contents of Memory Script:
{
   sql clone “alter system set  control_files =
  ”+DATA/testdb/controlfile/current.293.781612663” comment=
 ”Set by RMAN” scope=spfile”;
   sql clone “alter system set  db_name =
 ”MYPRIM” comment=
 ”Modified by RMAN duplicate” scope=spfile”;
   sql clone “alter system set  db_unique_name =
 ”TESTDB” comment=
 ”Modified by RMAN duplicate” scope=spfile”;
   shutdown clone immediate;
   startup clone force nomount
   restore clone primary controlfile from  ‘/u03/backup/MYPRIM_inc0_08n9a7cb_1_1.bak’;
   alter clone database mount;
}
executing Memory Script
sql statement: alter system set  control_files =   ”+DATA/testdb/controlfile/current.293.781612663” comment= ”Set by RMAN” scope=spfile
sql statement: alter system set  db_name =  ”MYPRIM” comment= ”Modified by RMAN duplicate” scope=spfile
sql statement: alter system set  db_unique_name =  ”TESTDB” comment= ”Modified by RMAN duplicate” scope=spfile
Oracle instance shut down
Oracle instance started
Total System Global Area     492707840 bytes
Fixed Size                     2214656 bytes
Variable Size                155190528 bytes
Database Buffers             331350016 bytes
Redo Buffers                   3952640 bytes
Starting restore at 26-APR-12
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=23 device type=DISK
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:09
output file name=+DATA/testdb/controlfile/current.293.781612663
Finished restore at 26-APR-12
database mounted
released channel: ORA_AUX_DISK_1
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=23 device type=DISK
contents of Memory Script:
{
   set until scn  1015172;
   set newname for clone datafile  1 to new;
   set newname for clone datafile  2 to new;
   set newname for clone datafile  3 to new;
   set newname for clone datafile  4 to new;
   restore
   clone database
   ;
}
executing Memory Script
executing command: SET until clause
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting restore at 26-APR-12
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to +DATA
channel ORA_AUX_DISK_1: restoring datafile 00002 to +DATA
channel ORA_AUX_DISK_1: restoring datafile 00003 to +DATA
channel ORA_AUX_DISK_1: restoring datafile 00004 to +DATA
channel ORA_AUX_DISK_1: reading from backup piece /u03/backup/MYPRIM_inc0_07n9a79l_1_1.bak
channel ORA_AUX_DISK_1: piece handle=/u03/backup/MYPRIM_inc0_07n9a79l_1_1.bak tag=TAG20120425T100437
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:02:17
Finished restore at 26-APR-12
contents of Memory Script:
{
   switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafile copy RECID=5 STAMP=781612862 file name=+DATA/testdb/datafile/system.292.781612727
datafile 2 switched to datafile copy
input datafile copy RECID=6 STAMP=781612862 file name=+DATA/testdb/datafile/sysaux.291.781612729
datafile 3 switched to datafile copy
input datafile copy RECID=7 STAMP=781612862 file name=+DATA/testdb/datafile/undotbs1.290.781612731
datafile 4 switched to datafile copy
input datafile copy RECID=8 STAMP=781612862 file name=+DATA/testdb/datafile/users.289.781612731
contents of Memory Script:
{
   set until scn  1015172;
   recover
   clone database
    delete archivelog
   ;
}
executing Memory Script
executing command: SET until clause
Starting recover at 26-APR-12
using channel ORA_AUX_DISK_1
starting media recovery
channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=10
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=11
channel ORA_AUX_DISK_1: reading from backup piece /u03/backup/MYPRIM_inc0_0an9a7ci_1_1.bak
channel ORA_AUX_DISK_1: piece handle=/u03/backup/MYPRIM_inc0_0an9a7ci_1_1.bak tag=TAG20120425T100610
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=+ARCH/testdb/archivelog/2012_04_26/thread_1_seq_10.1075.781612867 thread=1 sequence=10
channel clone_default: deleting archived log(s)
archived log file name=+ARCH/testdb/archivelog/2012_04_26/thread_1_seq_10.1075.781612867 RECID=1 STAMP=781612868
archived log file name=+ARCH/testdb/archivelog/2012_04_26/thread_1_seq_11.1076.781612869 thread=1 sequence=11
channel clone_default: deleting archived log(s)
archived log file name=+ARCH/testdb/archivelog/2012_04_26/thread_1_seq_11.1076.781612869 RECID=2 STAMP=781612868
media recovery complete, elapsed time: 00:00:03
Finished recover at 26-APR-12
contents of Memory Script:
{
   shutdown clone immediate;
   startup clone nomount;
   sql clone “alter system set  db_name =
 ”TESTDB” comment=
 ”Reset to original value by RMAN” scope=spfile”;
   sql clone “alter system reset  db_unique_name scope=spfile”;
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script
database dismounted
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area     492707840 bytes
Fixed Size                     2214656 bytes
Variable Size                155190528 bytes
Database Buffers             331350016 bytes
Redo Buffers                   3952640 bytes
sql statement: alter system set  db_name =  ”TESTDB” comment= ”Reset to original value by RMAN” scope=spfile
sql statement: alter system reset  db_unique_name scope=spfile
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area     492707840 bytes
Fixed Size                     2214656 bytes
Variable Size                155190528 bytes
Database Buffers             331350016 bytes
Redo Buffers                   3952640 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE “TESTDB” RESETLOGS ARCHIVELOG
  MAXLOGFILES     16
  MAXLOGMEMBERS      3
  MAXDATAFILES      100
  MAXINSTANCES     8
  MAXLOGHISTORY      292
 LOGFILE
  GROUP  1  SIZE 50 M ,
  GROUP  2  SIZE 50 M ,
  GROUP  3  SIZE 50 M
 DATAFILE
  ‘+DATA/testdb/datafile/system.292.781612727′
 CHARACTER SET WE8MSWIN1252
contents of Memory Script:
{
   set newname for clone tempfile  1 to new;
   switch clone tempfile all;
   catalog clone datafilecopy  “+DATA/testdb/datafile/sysaux.291.781612729″,
 ”+DATA/testdb/datafile/undotbs1.290.781612731″,
 ”+DATA/testdb/datafile/users.289.781612731″;
   switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to +DATA in control file
cataloged datafile copy
datafile copy file name=+DATA/testdb/datafile/sysaux.291.781612729 RECID=1 STAMP=781612964
cataloged datafile copy
datafile copy file name=+DATA/testdb/datafile/undotbs1.290.781612731 RECID=2 STAMP=781612964
cataloged datafile copy
datafile copy file name=+DATA/testdb/datafile/users.289.781612731 RECID=3 STAMP=781612964
datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=781612964 file name=+DATA/testdb/datafile/sysaux.291.781612729
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=781612964 file name=+DATA/testdb/datafile/undotbs1.290.781612731
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=781612964 file name=+DATA/testdb/datafile/users.289.781612731
contents of Memory Script:
{
   Alter clone database open resetlogs;
}
executing Memory Script
database opened
Finished Duplicate Db at 26-APR-12
RMAN>
Step 7:
Connect to the newly created database.
[oracle@uat ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Thu Apr 26 10:44:36 2012
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 – 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
SQL> select status,instance_name from v$instance;
STATUS       INSTANCE_NAME
———— —————-
OPEN         testdb
SQL> select name from v$database;
NAME
———
TESTDB

Job Done!!