Tuesday, 18 November 2014

Oracle Installation On RHEL 5.x / 6.x

====================
Oracle 10g On RHEL 5.x
====================

#Unpack Files
Unzip cmd
Unzip the files: unzip 10201_database_linux32.zip

#Hosts File
# hostname
# hostname linux

 The /etc/hosts file must contain a fully qualified name for the server:
<IP-address>  <fully-qualified-machine-name>  <machine-name>
linux.com linux

#Set Oralce Kernel Parameters
 Add the following lines to the /etc/sysctl.conf file:

#shmax set of 50% of ram in byte when 1 GB of ram then 512*1024*1024
kernel.shmmax = 2147483648

#shmall is shmmax/PAGE_SIZE default pagesize is 4096 (4 KB)--- # getconf PAGE_SIZE
kernel.shmall = 2097152

#shmmni minimum size of shared segment is 4 KB (4096 in bytes)
kernel.shmmni = 4096

# Increase the size of shmall without reboot linux reboot system
# cat /etc/proc/sys/kernel/shmall
2097152

# echo 2097152> /etc/proc/sys/kernel/shmall

 Alternative command 
# sysctl -w kernel.shmall=2097152
# echo "kernel.shmall=2097152">> /etc/sysctl.conf

 Removing shared memory when show status 'dest' destroy then crash the shared memory segments.
# $ ipcs -m  //see the shmid column where status is dest then following next command
# $ ipcs -m -i 32768
# $ ipcrm shm 32768  //remove shmid


# semaphores: semmsl, semmns, semopm, semmni
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default=262144
net.core.rmem_max=262144
net.core.wmem_default=262144
net.core.wmem_max=262144

# Run the following command to change the current kernel parameters:
/sbin/sysctl -p   (# sysctl -p)

# Add the following lines to the /etc/security/limits.conf file:
oracle           soft     nproc            2047
oracle           hard    nproc           16384
oracle           soft     nofile            1024
oracle           hard    nofile           65536

# Add the following line to the /etc/pam.d/login file, if it does not already exist:
session    required     pam_limits.so


# Disable secure linux by editing the /etc/selinux/config file, making sure the SELINUX flag is set as follows:

SELINUX=disabled
Alternatively, this alteration can be done using the GUI tool (System > Administration > Security Level and Firewall). Click on the SELinux tab and disable the feature.




Setup
 Install the following packages:
 rpm -ivh binutils*
 rpm -ivh elfutils*
 rpm -ivh setarch-2*
 rpm -ivh make-3*
 rpm -ivh glibc-2.5-12.i386.rpm
 rpm -ivh glibc-2.5-12.i686.rpm
 rpm -ivh libaio-0*
 rpm -ivh compat-libstdc++-*
 rpm -ivh compat-libstdc++-33-3.2.3-61.i386.rpm
 rpm -ivh compat-libf2c*
 rpm -ivh glibc-headers-2.5-12.i386.rpm
 rpm -ivh glibc-devel-2.5-12.i386.rpm
 rpm -ivh compat-gcc-34-3.4.6-4.i386.rpm
 rpm -ivh compat-gcc-34-3*
 rpm -ivh compat-gcc-34-c++-3*
 rpm -ivh libgomp-4.1.1-52.el5.i386.rpm
 rpm -ivh gcc-4*
 rpm -ivh libXp-1*
 rpm -ivh openmotif-2*
 rpm -ivh compat-db-4*
 rpm -ivh glibc-common*
 rpm -ivh libstdc*
 rpm -ivh libgcc*
 rpm -ivh unixODBC*
 rpm -ivh sysstat*



# COMMAND
# cat /etc/passwd
# cat /etc/group
# userdel oracle
# groupdel oracle

# Create the new groups and users:
groupadd oinstall
groupadd dba
groupadd oper

useradd -g oinstall -G dba oracle
passwd oracle

# Create the directories in which the Oracle software will be installed:
mkdir -p /u01/app/oracle/product/10.2.0/db_1
chown -R oracle.oinstall /u01
chown -R oracle.oinstall /u02
chmod -R 775 /u01
chmod -R 775 /u02

# Login as root and issue the following command:
xhost +<machine-name>

# Edit the /etc/redhat-release file replacing the current release information
(Red Hat Enterprise Linux Server release 5 (Tikanga)) with the following:
vim /etc/redhat-release

redhat-4



# Login as the ORACLE user and ADD the following lines at the end of the .bash_profile file:

# su - oracle
$ vi .bash_profile


# Oracle Settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR

ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1; export ORACLE_HOME
ORACLE_SID=TSH1; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH

if [ $USER = "oracle" ]; then
  if [ $SHELL = "/bin/ksh" ]; then
    ulimit -p 16384
    ulimit -n 65536
  else
    ulimit -u 16384 -n 65536
  fi
fi
:wq!

$. .bash_profile  //ROOT COMMANDS:

[root@beam oracle]# chown oracle:oinstall database/
# ls -lrt
# ls -li
# cd database
[root@beam database]# ls -lrt
[root@beam database]# chown -R oracle:oinstall *
[root@beam database]# ls -lrt
[root@beam database]# cd response
[root@beam response]# ls -lrt


# Installation
LOGIN oracle user LOGOUT root user



Log into the oracle user. If you are using X emulation then set the DISPLAY environmental variable:
DISPLAY=<machine-name>:0.0; export DISPLAY

 Start the Oracle Universal Installer (OUI) by issuing the following command in the database directory:
./runInstaller

 During the installation enter the appropriate ORACLE_HOME and name then continue installation. For a more detailed look at the installation process, click on the links below to see screen shots of each stage.

[root@beam oraInventory]# ./orainstRoot.sh

Run the following scripts as root:
   /u01/app/oracle/oraInventory/orainstRoot.sh
   /u01/app/oracle/product/10.2.0/db_1/root.sh




================
11g On RHEL 5.x
================
umount tmpfs
mount -t tmpfs shmfs -o size=2000m /dev/shm

/etc/fstab
shmfs /dev/shm tmpfs size=2000m 0 0

physical recomment 1024Mb > 1100
swap double


 The /etc/hosts file must contain a fully qualified name for the server:
<IP-address>  <fully-qualified-machine-name>  <machine-name>
linux.com linux

#Set Oralce Kernel Parameters
 Add the following lines to the /etc/sysctl.conf file:
fs.suid_dumpable = 1
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
# semaphores: semmsl, semmns, semopm, semmni
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default=262144
net.core.rmem_max=4194304
net.core.wmem_default=262144
net.core.wmem_max=1048576

# Run the following command to change the current kernel parameters:
/sbin/sysctl -p   (# sysctl -p)

# Add the following lines to the /etc/security/limits.conf file:
oracle           soft     nproc         2047
oracle           hard    nproc         16384
oracle           soft     nofile          1024
oracle           hard    nofile          65536
oracle           soft     stack          10240

# Add the following line to the /etc/pam.d/login file, if it does not already exist:
session    required     pam_limits.so


# Disable secure linux by editing the /etc/selinux/config file, making sure the SELINUX flag is set as follows:

SELINUX=disabled
Alternatively, this alteration can be done using the GUI tool (System > Administration > Security Level and Firewall). Click on the SELinux tab and disable the feature.




Setup
 Install the following packages:
 rpm -ivh binutils*
 rpm -ivh elfutils*
 rpm -ivh setarch-2*
 rpm -ivh make-3*
 rpm -ivh glibc-*
 rpm -ivh libaio-0*
 rpm -ivh compat-libstdc++-*
 rpm -ivh compat-libstdc++-33*
 rpm -ivh compat-libf2c*
 rpm -ivh glibc-headers-*
 rpm -ivh glibc-devel-*
 rpm -ivh compat-gcc-*
 rpm -ivh compat-gcc-34-3*
 rpm -ivh compat-gcc-34-c++-3*
 rpm -ivh libgomp-*
 rpm -ivh gcc-4*
 rpm -ivh libXp-1*
 rpm -ivh openmotif-2*
 rpm -ivh compat-db-4*
 rpm -ivh glibc-common*
 rpm -ivh libstdc*
 rpm -ivh libgcc*
 rpm -ivh unixODBC*
 rpm -ivh sysstat*



# COMMAND
# cat /etc/passwd
# cat /etc/group
# userdel oracle
# groupdel oracle

# Create the new groups and users:
groupadd oinstall
groupadd dba
groupadd oper

useradd -g oinstall -G dba oracle
passwd oracle

# Create the directories in which the Oracle software will be installed:
mkdir -p /u01/oracle/product/10.2.0/db_1
chown -R oracle.oinstall /u01
chown -R oracle.oinstall /u02
chmod -R 775 /u01
chmod -R 775 /u02

# Login as root and issue the following command:
xhost +<machine-name>

# Edit the /etc/redhat-release file replacing the current release information
(Red Hat Enterprise Linux Server release 5 (Tikanga)) with the following:
vim /etc/redhat-release

redhat-4



# Login as the ORACLE user and ADD the following lines at the end of the .bash_profile file:

# su - oracle
$ vi .bash_profile


# Oracle Settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR

ORACLE_BASE=/u01/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1; export ORACLE_HOME
ORACLE_SID=TSH1; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH

if [ $USER = "oracle" ]; then
  if [ $SHELL = "/bin/ksh" ]; then
    ulimit -p 16384
    ulimit -n 65536
  else
    ulimit -u 16384 -n 65536
  fi
fi
:wq!

$. .bash_profile  //ROOT COMMANDS:

[root@beam oracle]# chown oracle:oinstall database/
# ls -lrt
# ls -li
# cd database
[root@beam database]# ls -lrt
[root@beam database]# chown -R oracle:oinstall *
[root@beam database]# ls -lrt
[root@beam database]# cd response
[root@beam response]# ls -lrt


# Installation
LOGIN oracle user LOGOUT root user


Log into the oracle user. If you are using X emulation then set the DISPLAY environmental variable:
DISPLAY=<machine-name>:0.0; export DISPLAY

 Start the Oracle Universal Installer (OUI) by issuing the following command in the database directory:
./runInstaller




===================
Oracle  11g On RHEL 6
===================

linux 6.1 on Oracle

---tmp approx 5 gb

#Unpack Files
Unzip cmd
Unzip the files: unzip 10201_database_linux32.zip

#Hosts File
# hostname
# hostname linux

 The /etc/hosts file must contain a fully qualified name for the server:
<IP-address>  <fully-qualified-machine-name>  <machine-name>
linux.com linux

#Set Oralce Kernel Parameters
 Add the following lines to the /etc/sysctl.conf file:

kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
# semaphores: semmsl, semmns, semopm, semmni
kernel.sem = 250 32000 100 128
fs.file-max = 65536
fs.aio-max-nr = 1048576
fs.suid_dumpable= 1
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default=262144
net.core.rmem_max=4194304
net.core.wmem_default=262144
net.core.wmem_max=1048586

# Run the following command to change the current kernel parameters:
/sbin/sysctl -p   (# sysctl -p)

# Add the following lines to the /etc/security/limits.conf file:
oracle           soft     nproc            2047
oracle           hard    nproc           16384
oracle           soft     nofile          4096
oracle           hard    nofile           65536
oracle soft stack 10240


# Add the following lines to the /etc/security/limits.d/90- file:



# Add the following line to the /etc/pam.d/login file, if it does not already exist:
session    required     pam_limits.so


# Disable secure linux by editing the /etc/selinux/config file, making sure the SELINUX flag is set as follows:

SELINUX=permissive
Alternatively, this alteration can be done using the GUI tool (System > Administration > Security Level and Firewall). Click on the SELinux tab and disable the feature.






-----Setup
 Install the following packages:



rpm -ivh libstdc++-devel-4.4.5*
rpm -ivh kernel-header-2.6.32-131*
rpm -ivh glibc-headers-2.12*
rpm -ivh glibc-devel-2.12*

rpm -ivh gnome-icon-theme-2*
rpm -ivh dmz-cursor-themes-0.4.4*
rpm -ivh sgml-common-0.6*
rpm -ivh libaio-devel-0.3.107*
rpm -ivh ncurses-devel-5.7-3*
rpm -ivh elfutils-libelf-devel-0.152*

rpm -ivh compat-gcc-34-3*
rpm -ivh libXxf86misc-1.0.2*
rpm -ivh libXmu-1.0.5*
rpm -ivh mpfr-2.4*
rpm -ivh cpp-4.4.5*

rpm -ivh xorg-x11-xauth-1.0*
rpm -ivh compat-gcc-34*
rpm -ivh libdaemon-0.14-1*
rpm -ivh avahi-0.6.25*


rpm -ivh avahi-glib-0.6.25*
rpm -ivh shared-mime-info-0.70*
rpm -ivh liblDL-0.8*
rpm -ivh ORBit2-2.14*

rpm -ivh GConf2-2.28*
rpm -ivh gnome-vfs2-2*
rpm -ivh libbonobo-ltdl-2.24*
rpm -ivh libtool-ltddl-2.2*

rpm -ivh unixODBC-2.2.14*
rpm -ivh gtk2-engines-2.18.4*
rpm -ivh libmcpp-2.7*
rpm -ivh mcpp-2.7.2*
rpm -ivh xorg-x11-server-utils-7.4*
rpm -ivh ConsoleKit-x11-xinit-1.0*
rpm -ivh libXp-1.0.0*
rpm -ivh libXxf86dga-1.1.1-1*
rpm -ivh libdmx-1.1.0*
rpm -ivh xorg-x11-utils-7.4-8*
rpm -ivh compat-db43-4.3.29*
rpm -ivh compat-db42-4.2.52*
rpm -ivh ppl-0.10.2-11*
rpm -ivh cloog-ppl-0.15.7*
rpm -ivh gcc-4.4.5-6*
rpm -ivh gcc-c++-4.4.5-6*
rpm -ivh compat-libstdc++-33-3*
rpm -ivh compat-db-4.6.21*
rpm -ivh gnome-themes-2.28.1-6*
rpm -ivh system-icon-themes-6*
rpm -ivh system-gnome-themes-6*
rpm -ivh unixODBC-devel-2.2*
rpm -ivh readline-devel-6.0*
rpm -ivh libgnome-2.28.0*




# COMMAND
# cat /etc/passwd
# cat /etc/group
# userdel oracle
# groupdel oracle

# Create the new groups and users:
groupadd oinstall
groupadd dba
groupadd oper

useradd -g oinstall -G dba oracle
passwd oracle

# Create the directories in which the Oracle software will be installed:
mkdir -p /u01/app/oracle/product/11.2.0/db_1
chown -R oracle.oinstall /u01
chown -R oracle.oinstall /u02
chmod -R 775 /u01
chmod -R 775 /u02

# Login as root and issue the following command:
xhost +<machine-name>


# Edit the /etc/redhat-release file replacing the current release information
(Red Hat Enterprise Linux Server release 6 (Tikanga)) with the following:
vim /etc/redhat-release

redhat-4







# Login as the ORACLE user and ADD the following lines at the end of the .bash_profile file:
# su - oracle
$ vi .bash_profile

# Oracle Settings
#TMP=/tmp; export TMP
#TMPDIR=$TMP; export TMPDIR

ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1; export ORACLE_HOME
ORACLE_SID=TSH1; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH

if [ $USER = "oracle" ]; then
  if [ $SHELL = "/bin/ksh" ]; then
    ulimit -p 16384
    ulimit -n 65536
  else
    ulimit -u 16384 -n 65536
  fi
fi
:wq!

$. .bash_profile  //ROOT COMMANDS:



# Installation
LOGIN oracle user LOGOUT root user



Log into the oracle user. If you are using X emulation then set the DISPLAY environmental variable:
DISPLAY=<machine-name>:0.0; export DISPLAY

 Start the Oracle Universal Installer (OUI) by issuing the following command in the database directory:
./runInstaller

 During the installation enter the appropriate ORACLE_HOME and name then continue installation. For a more detailed look at the installation process, click on the links below to see screen shots of each stage.


[root@beam oraInventory]# ./orainstRoot.sh



Run the following scripts as root:
   /u01/app/oracle/oraInventory/orainstRoot.sh
   /u01/app/oracle/product/10.2.0/db_1/root.sh





--------------------------------------------------------------------------------------------------------------------------

What is oraInventory

The Orainventory is the location for the OUI's Book keeping
The inventory stores information about.
  • All the Oracle software products installed on all ORACLE_HOMES on a machine
  • Other non-oracle products such as Java Runtime env's (JRE)

  1. Global Inventory
Global Inventory holds information about Oracle Products on a Machine, The inventory contains the high level list of all oracle products installed on a machine such as ORACLE_HOMES or JRE.
It doesn't have any information about the details of patches applied on each ORACLE_HOMES.
There should be only one per machine. Its locations is defined in the oraInst.loc in /etc (on Linux) or /var/opt/oracle (solaris).
  1. Local Inventory
There is one Local inventory per ORACLE_HOME.
Inventory inside each Oracle Home is called as local Inventory or ORACLE_HOME Inventory. This Inventory holds information to that ORACLE_HOME only.

Can I have multiple Global Inventories on a machine?
Can you have multiple global Inventory and answer is YES you can have multiple global Inventory but if your upgrading or applying patch then change Inventory Pointer oraInst.loc to respective location.
If you are following single global Inventory and if you wish to uninstall any software then remove it from Global Inventory as well.

What to do if my Global Inventory is corrupted?
Follow Link else below : RE-CREATE ORAINVENTORY
If your global Inventory is corrupted, you can recreate global Inventory on machine using Universal Installer and attach already Installed oracle home by option
-attachHome
./runInstaller -silent -attachHome -invPtrLoc $location_to_oraInst.loc ORACLE_HOME=Oracle_Home_Location ORACLE_HOME_NAME=Oracle_Home_Name CLUSTER_NODES={}

Do I need to worry about oraInventory during oracle Apps 11i cloning ?
No, Rapid Clone will update both Global & Local Inventory with required information, you don't have to worry about Inventory during Oracle Apps 11i cloning.

How to Move oraInventory from one location to other?Find the current location of the central inventory (Normally $ORACLE_BASE/oraInventory):
Open the oraInst.loc file in /etc and check the value of inventory_loc
cat /etc/oraInst.loc
inventory_loc=/u01/app/oracle/oraInventory
inst_group=oinstall 

Remark: The oraInst.loc file is simply a pointer to the location of the central inventory (oraInventory)
Copy the oraInventory directory to the destination directory
cp -Rp /u01/app/oracle/oraInventory /u02/app/oracle/oraInventory
Edit the oraInst.loc file to point to the new location
vi /etc/oraInst.loc
inventory_loc=/u02/app/oracle/oraInventory
inst_group=dba




How To Install oracle in silent mode

Wednesday, 12 November 2014

ORA-00354 ORA-00353 ORA-00312 Corrupt redo block header


Error Description:
----------------------------

I ran DML operation on database and it failed with exception. I looked for alert log and the entry is ,
ORA-00354: corrupt redo log block header
ORA-00353: log corruption near block 11037 change 118820174 time 04/22/2008 11:15:12
ORA-00312: online log 2 thread 1: '/oradata1/system/ARJU/redo02.log'

Cause of The Problem:
----------------------------

The redo log file has been corrupted. It may be corrupted through various reasons. Suppose there is disk full or hardware failure.

Solution of The Problem:
------------------------------
.
Solution 1 or 2 is the option while database is open and solution 3 is the option if database is closed.
Solution 1: Look at the disk space usage containing redo log. If disk is full then free it by removing unwanted files. If disk is ok then try to clear the log file. Here from error we see log 2 is corrupted. So , clear group 2 Like,

SQL>ALTER DATABASE CLEAR LOGFILE GROUP 2;

Clear logfile does the thing of dropping logfile and then create. The advantage of this procedure is it can be used if you have only two redo log group.

Solution 2: If redo log was not archived (query from V$LOG) then you must specify UNARCHIVED LOGFILE. Otherwise error will come.
Try, SQL>ALTER DATABASE CLEAR UNARCHIVED LOGFILE GROUP 2;
After issuing this you have lost archived data, so take backup immediately.

In both 1 and 2 if it was the logfile member of online redo log group then you must issue,
SQL> alter system checkpoint;after clearing it.
Solution 3: If both does not work then do a point in time recovery.
SQL>SHUTDOWN ABORT;
SQL>STARTUP MOUNT;
RMAN>RESTORE DATABASE;
SQL>RECOVER DATABASE UNTIL CANCEL; CANCEL
SQL>ALTER DATABASE OPEN RESETLOGS;


Point in time recovery is described in DBPITR
If database can't be opened that solution 3 is the only option

How to perform Database Point in time Recovery DBPITR


About Database Point in time recovery
----------------------------------------------

Database point-in-time recovery is helpful whenever we want to back the whole database to an earlier time. With RMAN you can give a specified target time and RMAN restores the database from backups prior to that time, and then applies archived redo log or incremental backups to perform media recovery to recreate all changes between the time of the datafile backups and the target time.

Disadvantages of Database Point in time Recovery
------------------------------------------------------

1)Unlike TSPITR you can't get back a set of objects to their past state instead you have to back to an earlier with of the entire database.

2)The entire database will be unavailable during the operation.

3)It is time-consuming, because all datafiles must be restored, and redo logs and incremental backups must be restored from backup and used to recover the datafiles.

Requirements of Database Point in time Recovery
--------------------------------------------------------------

1)Your database must be in archivelog mode.
2)You must have backups of all datafiles from before the target SCN for DBPITR and archived redo logs or incremental backups for the period between the SCN of the backups and the target SCN.

Database Point-in-Time Recovery Within the Current Incarnation
----------------------------------------------------------------------

If you want to perform database point in time recovery within current incarnation then you don't have to perform extra work as RMAN by default search for backups within current incarnation. Only you need SET UNTIL clause and then RESTORE and RECOVER. However you can get back your database to an ancestor incarnation .In that case before performing operation set incarnation. Like RESET DATABASE INCARNATION TO 1. In order to do so as well as to know about incarnation please have a look About Database Incarnations

In the following steps I demonstrate an example of how we can perform DBPITR.

1)Create a Table. Just an an extra work. I just created it and want to perform DBPITR before the time of table creation in order to show that this table would not found after DBPITR.

SQL> CONN A/A
Connected.

SQL> CREATE TABLE BEFORE_PITR TABLESPACE USERS AS SELECT LEVEL A FROM DUAL CONNECT BY LEVEL <100;

Table created.

2)Shutdown the database.
SQL> CONN / AS SYSDBA
Connected.

SQL> SHUTDOWN ABORT

ORACLE instance shut down.

3)Connect to rman and Perform DBPITR. Here I wanted to get back of database to 30 minutes ago from current date. So I used SYSDATE-1/24/60*30.

SQL> !rman TARGET /

Recovery Manager: Release 10.2.0.1.0 - Production on Wed May 14 22:31:25 2008

Copyright (c) 1982, 2005, Oracle. All rights reserved.

connected to target database (not started)
RMAN> RUN{
2> RESTORE DATABASE UNTIL TIME 'SYSDATE-1/24/60*30';
3> RECOVER DATABASE UNTIL TIME 'SYSDATE-1/24/60*30';
4> } 

Starting restore at 14-MAY-08
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
.
.
media recovery complete, elapsed time: 00:00:27
Finished recover at 14-MAY-08

4)Open the database with RESETLOGS option.
RMAN> SQL'ALTER DATABASE OPEN RESETLOGS';

using target database control file instead of recovery catalog
sql statement: ALTER DATABASE OPEN RESETLOGS

5)Check the objects under Arju Schema.

SQL> conn a/a
Connected.
SQL> select table_name from tabs;

TABLE_NAME
------------------------------
TesT
MY_TABLE

And see that BEFORE_PITR is lost.

In stead of giving 'SYSDATE-1/24/60*30' you can also use time expressions,SCN restore points,SCN or log sequence numbers with SET UNTIL clause.

Like,
RMAN>RUN{
#SET UNTIL TIME 'Nov 12 2007 06:00:00'; --Set NLS_DATE_FORMAT setting.
#SET UNTIL SEQUENCE 9923;
#SET UNTIL RESTORE POINT before_update; --The restore point you created early.
SET UNTIL SCN 123456;
RESTORE DATABASE;
RECOVER DATABASE;

Delete Archivelog Using RMAN in Oracle

If your storage is about full, you must either delete old backup and archivelog or move to tape.
If you want to delete archivelog from FRA(ASM Storage-Flash Revovery Area) or filesystem for win space, you can use below commands. You can delete archivelog safely, because archivelog deleting does not harm to database.

Archivelog List Commands

RMAN>list archivelog all;
RMAN>list copy of archivelog until time 'SYSDATE-10';
RMAN>list copy of archivelog from time 'SYSDATE-10';
RMAN>list copy of archivelog from time 'SYSDATE-10' until time 'SYSDATE-2';
RMAN>list copy of archivelog from sequence 1000;
RMAN>list copy of archivelog until sequence 1500;
RMAN>list copy of archivelog from sequence 1000 until sequence 1500;
RMAN> crosscheck archivelog until time 'SYSDATE-10';

Archivelog Delete Commands

RMAN>delete archivelog all;
RMAN>delete archivelog until time 'SYSDATE-10';
RMAN>delete archivelog from time 'SYSDATE-10'
RMAN>delete archivelog from time 'SYSDATE-10' until time 'SYSDATE-2';
RMAN>delete archivelog from sequence 1000;
RMAN>delete archivelog until sequence 1500;
RMAN>delete archivelog from sequence 1000 until sequence 1500;
RMAN> delete expired archivelog until time 'SYSDATE-10';

Note : Also, you can use noprompt statement for do not yes-no question.
RMAN>delete noprompt archivelog until time 'SYSDATE-10';

Monday, 13 October 2014

How to Purge the RECYCLEBIN in Oracle 10g

THE RECYCLE BIN
*****************

The Recycle Bin is a virtual container where all dropped objects reside. Underneath the covers, the objects are occupying the same space as when they were created. If table EMP was created in the USERS tablespace, the dropped table EMP remains in the USERS tablespace. Dropped tables and any associated objects such as indexes, constraints, nested tables, and other dependant objects are not moved, they are simply renamed with a prefix of BIN$$. You can continue to access the data in a
dropped table or even use Flashback Query against it. Each user has the same rights and privileges on Recycle Bin objects before it was dropped. You can view your dropped tables by querying the new RECYCLEBIN view. Objects in the Recycle Bin will remain in the database until the owner of the dropped objects decides to permanently remove them using the new PURGE command. The Recycle Bin objects are counted against a user's quota. But Flashback Drop is a non-intrusive feature. Objects in the Recycle Bin will be automatically purged by the space reclamation process if

o A user creates a new table or adds data that causes their quota to be exceeded.
o The tablespace needs to extend its file size to accommodate create/insert operations.


There is no issues with DROPping the table, behaviour wise. It is the same as in 8i / 9i. The space is not released immediately and is accounted for within the same tablespace / schema after the drop.

When we drop a tablespace or a user there is NO recycling of the objects.

o Recyclebin does not work for SYS objects

Checking the RECYCLEBIN Objects
*******************************

SELECT object_name,original_name,operation,type,dropscn,droptime FROM user_recyclebin;

SELECT owner,original_name,operation,type FROM dba_recyclebin;


Purging the Recyclebin
**************************
Subject: 10g Recyclebin Features And How To Disable it( _recyclebin )
Doc ID: Note:265253.1 Type: BULLETIN

Applies to: Oracle Server - Enterprise Edition - Version: 10.1.0.2 to 10.2.0.0
Information in this document applies to any platform.
Purpose:- This bulletin illustrates the new recyclebin functionality provided with the 10g database

Scope and ApplicationCan be used by Oracle Support Analyst and DBA

10g Recyclebin Features And How To Disable it( _recyclebin )ABOUT 10g RECYCLEBIN
In order to have FLASHBACK DROP functionality a recyclebin is provided to every oracle user.

SQL> desc recyclebin
Name Null? Type
----------------------------------------- -------- ------------
OBJECT_NAME NOT NULL VARCHAR2(30)
ORIGINAL_NAME VARCHAR2(32)
OPERATION VARCHAR2(9)
TYPE VARCHAR2(25)
TS_NAME VARCHAR2(30)
CREATETIME VARCHAR2(19)
DROPTIME VARCHAR2(19)
DROPSCN NUMBER
PARTITION_NAME VARCHAR2(32)
CAN_UNDROP VARCHAR2(3)
CAN_PURGE VARCHAR2(3)
RELATED NOT NULL NUMBER
BASE_OBJECT NOT NULL NUMBER
PURGE_OBJECT NOT NULL NUMBER
SPACE NUMBER

The recyclebin is a public synonym and it is based on the view user_recyclebin which in turn is based on sys.recyclebin$ table.

Related recyclebin objects:

SQL> SELECT SUBSTR(object_name,1,50),object_type,owner
FROM dba_objects
WHERE object_name LIKE '%RECYCLEBIN%';
/
SUBSTR(OBJECT_NAME,1,50) OBJECT_TYPE OWNER
--------------------------- ------------------- ----------
RECYCLEBIN$ TABLE SYS
RECYCLEBIN$_OBJ INDEX SYS
RECYCLEBIN$_TS INDEX SYS
RECYCLEBIN$_OWNER INDEX SYS
USER_RECYCLEBIN VIEW SYS
USER_RECYCLEBIN SYNONYM PUBLIC
RECYCLEBIN SYNONYM PUBLIC
DBA_RECYCLEBIN VIEW SYS
DBA_RECYCLEBIN SYNONYM PUBLIC

9 rows selected.

EXAMPLE
SQL> SELECT * FROM v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - 64bi
PL/SQL Release 10.1.0.2.0 - Production
CORE 10.1.0.2.0 Production
TNS for Solaris: Version 10.1.0.2.0 - Production
NLSRTL Version 10.1.0.2.0 - Production

SQL> sho user
USER is "BH"

SQL> SELECT object_name,original_name,operation,type,dropscn,droptime
2 FROM user_recyclebin
3 /
no rows selected

SQL> CREATE TABLE t1(a NUMBER);
Table created.

SQL> DROP TABLE t1;
Table dropped.

SQL> SELECT object_name,original_name,operation,type,dropscn,droptime
2 FROM user_recyclebin
3 /
OBJECT_NAME ORIGINAL_NAME OPERATION TYPE DROPSCN DROPTIME
------------------------------ -------------------------------- --------- ------------------------- ---------- -------------------
BIN$1Unhj5+DSHDgNAgAIKds8A==$0 T1 DROP TABLE 8.1832E+12 2004-03-10:11:03:49

SQL> sho user
USER is "SYS"

SQL> SELECT owner,original_name,operation,type
2 FROM dba_recyclebin
3 /

OWNER ORIGINAL_NAME OPERATION TYPE
------------------------------ -------------------------------- --------- ------
BH T1 DROP TABLE

We can also create a new table with the same name at this point.

@NOTE:
@Pre-10.1.0.3, the recycled objects can also be viewed in user_tables and dba_tables
@Fix for Bug 3255906 changed this behaviour to maintain compatibility with 9i



PURGING
********

In order to completely remove the table from the DB and to release the space the new PURGE command is used.

From BH user:
SQL> PURGE TABLE t1;
Table purged.

OR

SQL> PURGE TABLE "BIN$1UtrT/b1ScbgNAgAIKds8A==$0";
Table purged.

From SYSDBA user:
SQL> SELECT owner,original_name,operation,type
2 FROM dba_recyclebin
3 /
no rows selected

From BH user:
SQL> SHOW recyclebin
SQL>

There are various ways to PURGE objects:

PURGE TABLE t1;
PURGE INDEX ind1;
PURGE recyclebin; (Purge all objects in Recyclebin)
PURGE dba_recyclebin; (Purge all objects / only SYSDBA can)
PURGE TABLESPACE users; (Purge all objects of the tablespace)
PURGE TABLESPACE users USER bh; (Purge all objects of the tablspace belonging to BH)

For an object, the owner or a user with SYSDBA privilege or a user with DROP ANY... system privilege for the type of object to be purged can PURGE it.


DISABLING RECYCLEBIN
**********************

We can DROP and PURGE a table with a single command

From BH user:
SQL> DROP TABLE t1 PURGE;
Table dropped.

SQL> SELECT *
2 FROM recyclebin
3 /
no rows selected

There is no need to PURGE.

On 10gR1, in case we want to disable the behavior of recycling, there is an underscore parameter
"_recyclebin" which defaults to TRUE. We can disable recyclebin by setting it to FALSE.

From SYSDBA user:
SQL> SELECT a.ksppinm, b.ksppstvl, b.ksppstdf
FROM x$ksppi a, x$ksppcv b
WHERE a.indx = b.indx
AND a.ksppinm like '%recycle%'
ORDER BY a.ksppinm
/
Parameter Value Default?
---------------------------- ---------------------------------------- --------
_recyclebin TRUE TRUE

From BH user:
SQL> CREATE TABLE t1(a NUMBER);
Table created.

SQL> DROP TABLE t1;
Table dropped.

SQL> SELECT original_name
FROM user_recyclebin;
ORIGINAL_NAME
--------------
T1

From SYSDBA user:
SQL> ALTER SYSTEM SET "_recyclebin"=FALSE SCOPE = BOTH;
System altered.

SQL> SELECT a.ksppinm, b.ksppstvl, b.ksppstdf
FROM x$ksppi a, x$ksppcv b
WHERE a.indx = b.indx
AND a.ksppinm like '%recycle%'
ORDER BY a.ksppinm
/
Parameter Value Default?
---------------------------- ---------------------------------------- --------
_recyclebin FALSE TRUE

From BH user:
SQL> CREATE TABLE t1(a NUMBER);
Table created.

SQL> DROP TABLE t1;
Table dropped.

SQL> SELECT original_name
FROM user_recyclebin;
no rows selected

There is no need to PURGE.

As with anyother underscore parameter, setting this parameter is not recommended unless
advised by oracle support services.

On 10gR2 recyclebin is a initialization parameter and bydefault its ON.
We can disable recyclebin by using the following commands:

SQL> ALTER SESSION SET recyclebin = OFF;
SQL> ALTER SYSTEM SET recyclebin = OFF;

The dropped objects, when recyclebin was ON will remain in the recyclebin even if we set the recyclebin parameter to OFF.

Friday, 26 September 2014

oracleasm >= 1.0.4

oracleasm >= 1.0.4 is needed by oracleasmlib-2.0.4-1.el4.x86_64

[root@localhost Downloads]# rpm -ivh oracleasmlib-2.0.4-1.el4.x86_64.rpm
warning: oracleasmlib-2.0.4-1.el4.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID b38a8516: NOKEY
error: Failed dependencies:
    oracleasm >= 1.0.4 is needed by oracleasmlib-2.0.4-1.el4.x86_64


Action Taken

[root@localhost Downloads]# rpm -ivh --nodeps --force oracleasmlib-2.0.4-1.el4.x86_64.rpm
warning: oracleasmlib-2.0.4-1.el4.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID b38a8516: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:oracleasmlib-2.0.4-1.el4         ################################# [100%]
[root@localhost Downloads]# 

Saturday, 20 September 2014

OC4J Configuration issue. /u01/app/oracle/product/10.2.0/db_1/oc4j/j2ee/OC4J_DBConsole_localhost.localdomain

[oracle@localhost ~]$ emctl start dbconsole
TZ set to Asia/Calcutta
OC4J Configuration issue. /u01/app/oracle/product/10.2.0/db_1/oc4j/j2ee/OC4J_DBConsole_localhost.localdomain_xxxxx not found.

emca -repos drop

emca -repos create

 emca -config dbcontrol db

emctl start dbconsole

Saturday, 6 September 2014

SSH LOGIN TAKE TIME

vim /etc/ssh/sshd_config

#GSSAPIAuthentication yes     --- this setting if putty prompt a password after long time
GSSAPIAuthentication no

#UseDNS yes --- this setting after put the password long time
UseDNS no


service sshd restart

Saturday, 23 August 2014

Direct Login to forms in eBusiness Suite


The usual url for loggin in to Oracle Application is 

http://<server name>:<port>/

which most of the times gets directed to 
http://<server name>:<port>/OA_HTML/AppsLocalLogin.jsp

But for some reason or for troubleshooting purpose we may need to login directly to forms.
Below are the urls for directly connecting forms.

For 11i :-  
Socket mode:- http://<server name>:<port>/dev60cgi/f60cgi
Servlet mode:- http://<server name>:<port>/servlet/f60

For R12 :- 
Servlet mode:- http://<server name>:<port>/forms/frmservlet
Socket mode:- http://<server name>:<port>/OA_HTML/frmservlet

You can see the forms opening but after entering login details you may not be able to login and find the error as "APP-FND-01542: This application server is not authorized to access this database"

The reason for this is, direct forms login is disabled. To check and change that check the value for context variable "s_appserverid_authentication". You can make it ON or OFF to change the security level. SECURE doesn't allow you to login directly and gives the message as above.

Below are possible modes.
ON     :- Partial
SECURE :- activates full server security (SECURE mode)
OFF    :- deactivates server security



à COMMAND LINE OFF AUTHENTICATION EXECUTE

1.      java oracle.apps.fnd.security.AdminAppServer apps/apps AUTHENTICATION OFF DBC=PROD.dbc


3.     ./adautocfg.sh

4.     Enter Form User and Password in My Case :- SYSADMIN.    NOTE:- Not getting error as "APP-FND-01542: This application server is not authorized to access this database" And Open the form

5.     java oracle.apps.fnd.security.AdminAppServer apps/apps AUTHENTICATION ON DBC=PROD.dbc



For more details and alternative options refer metalink doc:- 293609.1

Thursday, 31 July 2014

ORACLE APPS LOG FILES

R12 Installation Logs

Database Tier Installation
RDBMS $ORACLE_HOME/appsutil/log/$CONTEXT_NAME/<MMDDHHMM>.logRDBMS $ORACLE_HOME/appsutil/log/$CONTEXT_NAME/ApplyDBTechStack_<MMDDHHMM>.logRDBMS
$ORACLE_HOME/appsutil/log/$CONTEXT_NAME/ohclone.logRDBMS $ORACLE_HOME/appsutil/log/$CONTEXT_NAME/make_<MMDDHHMM>.logRDBMS
$ORACLE_HOME/appsutil/log/$CONTEXT_NAME/installdbf.logRDBMS $ORACLE_HOME/appsutil/log/$CONTEXT_NAME/adcrdb_<SID>.log RDBMS
$ORACLE_HOME/appsutil/log/$CONTEXT_NAME/ApplyDatabase_<MMDDHHMM>.logRDBMS $ORACLE_HOME/appsutil/log/$CONTEXT_NAME/<MMDDHHMM>/adconfig.log    RDBMS
$ORACLE_HOME/appsutil/log/$CONTEXT_NAME/<MMDDHHMM>/NetServiceHandler.log

Application Tier Installation
$INST_TOP/logs/<MMDDHHMM>.log
$APPL_TOP/admin/$CONTEXT_NAME/log/ApplyAppsTechStack.log
$INST_TOP/logs/ora/10.1.2/install/make_<MMDDHHMM>.log
$INST_TOP/logs/ora/10.1.3/install/make_<MMDDHHMM>.log
$INST_TOP/admin/log/ApplyAppsTechStack.log
$INST_TOP/admin/log/ohclone.log
$APPL_TOP/admin/$CONTEXT_NAME/log/installAppl.log
$APPL_TOP/admin/$CONTEXT_NAME/log/ApplyAppltop_<MMDDHHMM>.log
$APPL_TOP/admin/$CONTEXT_NAME/log/<MMDDHHMM>/adconfig.log
$APPL_TOP/admin/$CONTEXT_NAME/log/<MMDDHHMM>/NetServiceHandler.log

Inventory Registration:
$Global Inventory/logs/cloneActions<timestamp>.log
$Global Inventory/logs/oraInstall<timestamp>.log
$Global Inventory/logs/silentInstall<timestamp>.log

Other log files in R12
1) Database Tier

     1.1) Relink Log files :
$ORACLE_HOME/appsutil/log/$CONTEXT_NAME /MMDDHHMM/ make_$MMDDHHMM.log

    1.2) Alert Log Files :
$ORACLE_HOME/admin/$CONTEXT_NAME/bdump/alert_$SID.log
 
   1.3) Network Logs :
$ORACLE_HOME/network/admin/$SID.log

   1.4) OUI Logs : OUI Inventory Logs :
$ORACLE_HOME/admin/oui/$CONTEXT_NAME/oraInventory/logs

2) Application Tier
$ORACLE_HOME/j2ee/DevSuite/log
$ORACLE_HOME/opmn/logs
$ORACLE_HOME/network/logs

Tech Stack Patch 10.1.3 (Web/HTTP Server)
$IAS_ORACLE_HOME/j2ee/forms/logs
$IAS_ORACLE_HOME/j2ee/oafm/logs
$IAS_ORACLE_HOME/j2ee/oacore/logs
$IAS_ORACLE_HOME/opmn/logs
$IAS_ORACLE_HOME/network/log
$INST_TOP/logs/ora/10.1.2
$INST_TOP/logs/ora/10.1.3
$INST_TOP/logs/appl/conc/log
$INST_TOP/logs/appl/admin/log


- Autoconfig log file:
Apps:

$INST_TOP/logs/appl/admin/log

Db:
$ORACLE_HOME/appsutil/log/$CONTEXT_NAME//adconfig.log $ORACLE_HOME/appsutil/log/$CONTEXT_NAME//NetServiceHandler.log

- Startup/Shutdown AD SCRIPTS Log files:
$INST_TOP/logs/appl/admin/log

- Apache, OC4J and OPMN:


$LOG_HOME : - /u01/app/prod/inst/apps/PROD_oracle/logs
$INST_TOP :-      /u01/app/prod/inst/apps/PROD_oracle

$LOG_HOME/ora/10.1.3/Apache       or    $INST_TOP/log/ora/10.1.3/Apache/

$LOG_HOME/ora/10.1.3/j2ee            or    $INST_TOP/log/ora/10.1.3/j2ee/oacore/    # OC4J logfile (Text)
                                                         or    $INST_TOP/log/ora/10.1.3/j2ee/oacore/log/oacore_default_group_1/oc4j         # OC4J logfile ODL

$LOG_HOME/ora/10.1.3/opmn          or    $INST_TOP/log/ora/10.1.3/opmn

- Patch log:
$APPL_TOP/admin/$SID/log/

- Concurrent Manager log:
$INST_TOP/apps/$CONTEXT_NAME/logs/appl/conc/log

or
$INST_TOP/logs/appl/conc/log

AD tools log files:
$APPL_CONFIG_HOME/admin/$TWO_TASK/log



Log files related to cloning in R12
Preclone log files in source instance 
    i) Database Tier – /$ORACLE_HOME/appsutil/log/$CONTEXT_NAME/(StageDBTier_MMDDHHMM.log)
    ii) Application Tier – $INST_TOP/apps/$CONTEXT_NAME/admin/log/ (StageAppsTier_MMDDHHMM.log)

Clone log files in target instance
Database Tier - $ORACLE_HOME/appsutil/log/$CONTEXT_NAME/ApplyDBTier_<time>.log
Apps Tier  – $INST_TOP/apps/$CONTEXT_NAME/admin/log/ApplyAppsTier_<time>.log


—–
If your clone on DB Tier fails while running txkConfigDBOcm.pl  (Check metalink note – 415020.1)
During clone step on DB Tier it prompts for “Target System base directory for source homes” and during this you have to give like /base_install_dir like ../../r12 and not oracle home like ../../r12/db/tech_st_10.2.0
—–

Wednesday, 30 July 2014

R12 Apache login issue common error

If Login Page (AppsLocalLogin.jsp ) doesn’t work
a. Stop Application Services
b. Clear $COMMON_TOP/_pages directory
c. cd $FND_TOP/patch/115/bin ./ojspCompile.pl --compile --flush -p 10
d. If error something like this

Caused by: oracle.apps.jtf.base.resources.FrameworkException:

ORA-01578: ORACLE data block corrupted (file # 25, block # 228173)
ORA-01110: data file 25: 'apps_ts_tx_data.290.743539659'
ORA-26040: Data block was loaded using the NOLOGGING option


---run below as apps user

begin
apps.wf_local_synch.BULKSYNCHRONIZATION(P_ORIG_SYSTEM=>'ALL',
P_PARALLEL_PROCESSES=>2,
P_LOGGING=>'LOGGING',
P_RAISEERRORS=>TRUE,
P_TEMPTABLESPACE=>'APPS_TS_TX_DATA');
END;

Saturday, 19 July 2014

txkWfClone.sh INSTALL_SETUP 1 (Autocongif completed with errors)


When Runing adconfig.sh on apps tier after clone some time this error.
[AutoConfig Error Report]
The following report lists errors AutoConfig encountered during each
phase of its execution. Errors are grouped by directory and phase.
The report format is:
<filename> <phase> <return code where appropriate>

[SETUP PHASE]
AutoConfig could not successfully execute the following scripts:
Directory: /f11/app/applp032/inst/apps/P032_tgpora3/admin/install
txkWfClone.sh INSTALL_SETUP -1
AutoConfig is exiting with status 1
RC-50014: Fatal: Execution of AutoConfig was failed
Raised by oracle.apps.ad.clone.ApplyApplTop
ERROR: AutoConfig completed with errors. Check logfile at /f11/app/applp032/inst/apps/P032_tgpora3/admin/log/ApplyAppsTier_07180828.log for details.
ApplyApplTop Completed Successfully


REASON :

1. Received the following error running Autoconfig:
[AutoConfig Error Report]
The following report lists errors AutoConfig encountered during each
phase of its execution.  Errors are grouped  by directory and phase.
The report format is:
      <filename>  <phase>  <return code where appropriate>
  [SETUP PHASE]
  AutoConfig could not successfully execute the following scripts:
    Directory: /apps/ifswmisc/common/admin/install/MISC_findvcl2
      txkWfClone.sh           INSTE8_SETUP       1

2. The adconfig.log shows txkWfClone.sh errors with the following:
ERROR at line 1:
ORA-06550: line 10, column 7:
PLS-00201: identifier 'WF_CLONE.DETERMINECLONE' must be declared
ORA-06550: line 10, column 3:
PL/SQL: Statement ignored


CAUSE:

This error means one of the following:
(a) WF_CLONE pkg and/or pkg body doesn't exist in the db or is invalid
or
(b) The DETERMINECLONE method/procedure doesn't exist within WF_CLONE pkg/pkg body.

(c) Some time Permission issue

Solution
1. Please verify if WF_CLONE is valid in the database. If it is not, please
recompile it.
2. If the actions in #1 do not resolve the issue, then do the following:
a. Run the following SQL query:

SQL> select text
2 from all_source
3 where name = 'WF_CLONE' and line < 7;

b. Go to the $FND_TOP/patch/115/sql directory and obtain the version of wfclones.pls
and wfcloneb.pls.
c. Compare the two versions. If they are different, then go to the
$FND_TOP/patch/115/sql directory and recreate the spec/body by running:

- sqlplus apps/<passwd> @WFCLONES.pls
- sqlplus apps/<passwd> @WFCLONEB.pls

3. Rerun AutoConfig.
  

Friday, 18 July 2014

Reinstating a Failed Primary Database (After Failover to swith the PRIMARY TO STANDBY) in DGMGRL

If your primary database had been configured with Flashback Database, you can easily reinstate the failed primary database as a standby database of the new primary database.
The failed primary database will be reinstated as a standby type that matches the old standby database. For example, if you failed over to a physical standby database,
 the old primary will be reinstated as a physical standby database.

To reinstate the failed primary database, start it to the mounted state. Then run DGMGRL, connect to the new primary database and reinstate the old primary database.


Step 1   Restart the Old Primary Database.

% sqlplus sys as sysdba
Enter password: password

SQL> STARTUP MOUNT;
ORACLE instance started.
Total System Global Area  234364928 bytes
Fixed Size                  1296352 bytes
Variable Size             209717280 bytes
Database Buffers           16777216 bytes
Redo Buffers                6574080 bytes
Database mounted.


Step 2   Reinstate the old primary database.

% dgmgrl connect sys
Password: password
Connected.

DGMGRL> REINSTATE DATABASE 'North_Sales';
Reinstating database "North_Sales", please wait...
Operation requires shutdown of instance "sales1" on database "North_Sales"
Shutting down instance "sales1"...
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "sales1" on database "North_Sales"
Starting instance "sales1"...
ORACLE instance started.
Database mounted.
Continuing to reinstate database "North_Sales" ...
Reinstatement of database "North_Sales" succeeded


After the primary has been reinstated, issue the SHOW CONFIGURATION and SHOW DATABASE commands to confirm that the old primary has been successfully reinstated.


Step 3   Show the Configuration and Databases.

DGMGRL> SHOW CONFIGURATION; 
Configuration
 Name:                DRSolution
 Enabled:             YES
 Protection Mode:     MaxAvailability
 Databases:
 DR_Sales     - Primary database
 North_Sales  - Physical standby database

Fast-Start Failover: DISABLED

Current status for "DRSolution":
SUCCESS

DGMGRL> SHOW DATABASE 'DR_Sales';
 Database
 Name:            DR_Sales
 Role:            PRIMARY
 Enabled:         YES
 Intended State:  TRANSPORT-ON
 Instance(s):
 dr_sales1
 Current status for "DR_Sales":
SUCCESS

DGMGRL> SHOW DATABASE 'North_Sales'; 
Database
 Name:            North_Sales
 Role:            PHYSICAL STANDBY
 Enabled:         YES
 Intended State:  APPLY-ON
 Instance(s):
 sales1
 Current status for "North_Sales":
SUCCESS

Performing a Manual Failover Operation without DGMGRL

You invoke a failover operation in response to an emergency situation, usually when the primary database cannot be accessed or is unavailable.
See before you fail over to decide which standby database should be the target of the failover. The following scenario describes a failover to the remote database called DR_Sales.

Note:
If fast-start failover is enabled, you can perform a manual failover only to the standby database that was specified as the target of a fast-start failover and only when the observer is running.
If you want to perform a manual failover to a standby database that is not the fast-start failover target standby database, you must first disable fast-start failover using the FORCE option on the standby database you want to fail over. See Section 5.5.5, "Disabling Fast-Start Failover" for more information about the FORCE option.


Step 1   Connect to the target standby database.
To perform the failover operation, you must connect to the standby database to which you want to fail over to as a user that has the SYSDBA privilege. For example:

DGMGRL> CONNECT sys@DR_Sales.foo.com;
Password: password
Connected.

Step 2   Issue the failover command.
Now you can issue the failover command to make the target standby database the new primary database for the configuration. Note that after the failover completes, the original primary database cannot be used as a standby database of the new primary database unless it is reenabled (as described in Section 5.4.3).

Step 3   Show the configuration.
Issue the SHOW CONFIGURATION command to verify the failover.


DGMGRL> SHOW CONFIGURATION;
Configuration
 Name:                DRSolution
 Enabled:             YES
 Protection Mode:     MaxAvailability
 Databases:
   DR_Sales     - Primary database
   North_Sales  - Physical standby database (disabled)

Fast-Start Failover: DISABLED

Current status for "DRSolution":
Warning: ORA-16608: one or more databases have warnings
Note that in this example, the configuration was operating in maximum availability mode. The protection mode was preserved after the failover. The configuration also has a warning status. If you show the StatusReport monitorable database property of the new primary, you will see that the warning is the result of not having an enabled physical standby database. As a result, the warning status indicates that the protection level of the configuration is not the same as the configured mode.


Step 4   Show StatusReport property of the new primary database.
DGMGRL> SHOW DATABASE 'DR_Sales' StatusReport;
STATUS REPORT
      INSTANCE_NAME   SEVERITY ERROR_TEXT
                  *    WARNING ORA-16629: database reports a different protection level from the protection mode

Step 5   Show the database.
Issue the SHOW DATABASE command to see that the former (failed) primary database was disabled by the broker as a consequence of the failover. It must be reenabled (as described in Section 5.4.3).


DGMGRL> SHOW DATABASE 'North_Sales';
Database
 Name:            North_Sales
 Role:            PHYSICAL STANDBY
 Enabled:         NO
 Intended State:  APPLY-ON
 Instance(s):
   sales1

Current status for "North_Sales":
Error: ORA-16661: the standby database needs to be reinstated





Enabling Fast-Start Failover and Starting the Observer With DGMGRL

Step 1   Ensure standby redo logs are configured on the primary and target standby databases.
Standby redo logs must be configured on the primary and standby databases. You must stop log apply services prior to configuring standby redo logs.


Step 2   Ensure the LogXptMode Property is set to SYNC.
The LogXptMode configurable database property must be set to SYNC on the primary and target standby databases.

To set the redo transport service that corresponds to the protection mode you plan to set, use the EDIT DATABASE (property) command on the primary and target standby databases.
For example, if the protection mode to be set is MAXAVAILABILITY, you must set the LogXptMode property to SYNC on the primary database and on the target standby database, as shown in the following examples:

DGMGRL> EDIT DATABASE 'North_Sales' SET PROPERTY 'LogXptMode'='SYNC';
Property "LogXptMode" updated

DGMGRL> EDIT DATABASE 'DR_Sales' SET PROPERTY 'LogXptMode'='SYNC';
Property "LogXptMode" updated

The broker does not allow these commands to succeed unless the databases are configured with standby redo log files.

Step 3   Set the FastStartFailoverTarget configuration property.
If you have two or more standby databases, set up the FastStartFailoverTarget configuration property on the primary database to indicate the desired target standby database. For example:

DGMGRL> EDIT DATABASE 'North_Sales' SET PROPERTY FastStartFailoverTarget='DR_Sales';
Property "FastStartFailoverTarget" updated

Step 4   Upgrade the protection mode to MAXAVAILABILITY, if necessary.
If it is necessary to upgrade the protection mode, use the following DGMGRL EDIT CONFIGURATION command. For example:

DGMGRL> EDIT CONFIGURATION SET PROTECTION MODE AS MAXAVAILABILITY;

Step 5   Enable Flashback Database on the primary and target standby databases, if necessary.

If it is not already enabled on the primary and standby databases, enable Flashback Database by issuing the following statements on each database:

ALTER SYSTEM SET UNDO_RETENTION=3600 SCOPE=SPFILE;
ALTER SYSTEM SET UNDO_MANAGEMENT='AUTO' SCOPE=SPFILE;
SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
SHOW PARAMETER UNDO;
ALTER SYSTEM SET DB_FLASHBACK_RETENTION_TARGET=4320 SCOPE=BOTH;
ALTER DATABASE ARCHIVELOG;
ALTER DATABASE FLASHBACK ON;
ALTER DATABASE OPEN;
Ensure the UNDO_RETENTION and DB_FLASHBACK_RETENTION_TARGET initialization parameters are set to sufficiently large values so that reinstatement is still possible after a prolonged outage.

Step 6   Start the observer.
Start the observer by logging into the observer computer and running DGMGRL. Connect to the configuration as SYS and then issue the START OBSERVER command. Note that the command does not return; that is you will not get DGMGRL prompt after issuing the command.

DGMGRL> CONNECT sys@North_Sales.foo.com;
Password: password
Connected.
DGMGRL> START OBSERVER;
Observer started

When starting the observer interactively, Oracle recommends that connection credentials be supplied as a command parameter to the DGMGRL CONNECT command, as shown in the example, rather than as a command line parameter to the DGMGRL command. This practice prevents other users on the system from using a utility (for example, the UNIX ps utility) to display the connection credentials.
When starting the observer from a script, Oracle recommends that you use a method that supports 'connect /', so that database connection credentials do not have to be embedded within the script. If you choose to use a client-side Oracle Wallet as a secure external password store (see Oracle Database Advanced Security Administrator's Guide), be sure to add credentials for both the primary and fast-start failover target standby databases. The database connect string that you specify when adding the credentials for each database must match the ObserverConnectIdentifer or DGConnectIdentifier configurable database property.


Step 7   Enable fast start failover.
You can enable fast-start failover while connected to any database system in the broker configuration. For example:

DGMGRL> ENABLE FAST_START FAILOVER;
Enabled.


Step 8   Verify the fast-start failover configuration.
Use the SHOW FAST_START FAILOVER command to display the fast-start failover settings:

DGMGRL> SHOW FAST_START FAILOVER;

Fast-Start Failover: ENABLED
 Threshold:           30 seconds
 Target:              DR_Sales
 Observer:            observer.foo.com
 Lag Limit:           30 seconds (not in use)
 Shutdown Primary:    TRUE
 Auto-reinstate:      TRUE

Configurable Failover Conditions
 Health Conditions:
   Corrupted Controlfile          YES
   Corrupted Dictionary           YES
   Inaccessible Logfile            NO
   Stuck Archiver                  NO
   Datafile Offline               YES

 Oracle Error Conditions:

   (none)

Configuration Protection Mode with DGMGRL

Step 1   Configure standby redo log files, if necessary.
Because you will be setting the protection mode to the MAXAVAILABILITY mode, it is important to ensure that sufficient standby redo log files are configured on the standby database.

Step 2   Set the LogXptMode configurable database property appropriately.
Use the EDIT DATABASE (property) command on the standby database to set the redo transport service that corresponds to the protection mode you plan to set. If the protection mode to be set is MAXAVAILABILITY, it is required that the redo transport service of at least one standby database is set to SYNC. For example:

DGMGRL> EDIT DATABASE 'DR_Sales' SET PROPERTY 'LogXptMode'='SYNC';
Property "LogXptMode" updated

The broker will not allow this command to succeed unless the standby database is configured with standby redo log files in the configuration.

Step 3   Change the overall protection mode for the configuration.
Use the EDIT CONFIGURATION command to upgrade the broker configuration to the MAXAVAILABILITY protection mode:

DGMGRL> EDIT CONFIGURATION SET PROTECTION MODE AS MAXAVAILABILITY;
Succeeded.
If the configuration is disabled when you enter this command, the actual protection mode change is not applied until you enable the configuration with the ENABLE CONFIGURATION command. The broker will not allow you to enable the configuration if it does not find a standby database in the configuration that can support the requirements of the protection mode.

Step 4   Verify the protection mode was changed.
Use the SHOW CONFIGURATION command to display the current protection mode for the configuration:

DGMGRL> SHOW CONFIGURATION;

Configuration
 Name:                DRSolution
 Enabled:             YES
 Protection Mode:     MaxAvailability      
 Databases:
   North_Sales  - Primary database
   DR_Sales     - Physical standby database

Fast-Start Failover: DISABLED

Current status for "DRSolution":
SUCCESS



Converting a Physical Standby to a Snapshot Standby With DGMGRL

If you have a physical standby database that the Flashback Database feature enabled and you would like to create a temporary, updatable snapshot of that database, use the DGMGRL CONVERT DATABASE command. Note that redo data will be received by the database while it is operating as a snapshot standby database but will not be applied until it is converted back into a physical standby database.

DGMGRL> CONVERT DATABASE 'DR_Sales' to SNAPSHOT STANDBY;
Converting database "DR_Sales" to a Snapshot Standby database, please wait...
Database "DR_Sales" converted successfully

DGMGRL> SHOW CONFIGURATION;
Configuration
Name: DRSolution
Enabled: YES
Protection Mode: MaxPerformance
Databases:
North_Sales - Primary database
DR_Sales - Snapshot standby database
Fast-Start Failover: DISABLED
Current status for "DRSolution":
SUCCESS
When you are ready to revert the database back to a physical standby database, use the DGMGRL CONVERT DATABASE command again as follows. Any updates made to the database while it was operating as a snapshot standby database will be discarded. All accumulated redo data will be applied by Redo Apply services after the database is converted back to a physical standby database.

DGMGRL> CONVERT DATABASE 'DR_Sales' to PHYSICAL STANDBY;

Converting database "DR_Sales" to a Physical Standby database, please wait...
Operation requires shutdown of instance "dr_sales1" on database "DR_Sales"
Shutting down instance "dr_sales1"...
Database closed.
Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "dr_sales1" on database "DR_Sales"
Starting instance "dr_sales1"...
ORACLE instance started.
Database mounted.
Continuing to convert database "DR_Sales" ...
Operation requires shutdown of instance "dr_sales1" on database "DR_Sales"
Shutting down instance "dr_sales1"...
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "dr_sales1" on database "DR_Sales"
Starting instance "dr_sales1"...
ORACLE instance started.
Database mounted.
Database "DR_Sales" converted successfully

Applying CPU/PSU/Opatch with DGMGRL in Oracle 10g..


============================
PART SECOND ON STANDBY SIDE
============================

1.Disable Log Shipping From Primary To Standby

----DGMGRL
connect sys/oracle@PRIMARY

edit database PRIMARY set property LogShipping='OFF';      // IF hang then first clean shutdown the database and restart server then after try;
show database verbose PRIMARY;
show database verbose STANDBY;

2.Shutdown All The Standby Database Services

alter database recover managed standby database cancel;
shutdown immediate
lsnrctl stop

3.Apply PSU patch to Standby Database


A) .Ensure that your Oracle Database installation is the same release for which you are applying this patch. In other words, only apply the Release 10.2.0.1 CPUJul2006 patch to an Oracle Database Release 10.2.0.1.


B) .Review Section 4, "Known Issues" before proceeding with this installation.


C) .Shut down all instances and listeners associated with the Oracle home that you are updating. For more information, see Oracle Database Administrator's Guide.


D) .Ensure that the $PATH has the following executables: make, ar, ld, and nm.

which make
which ar
which ld
which nm


E) .Check whether the java and jar executables are present in your Oracle home.

In a standard Oracle installation, java is available in $ORACLE_BASE/jre/JDK version/bin directory and jar is available in $ORACLE_HOME/jdk/bin directory. By default, the OPatch utility uses the executables from these locations. However, if they are located elsewhere, you can use the opatch apply command with the -jdk flag, and then specify the full path to the JDK to be used. For more information, refer to OPatch User's Guide, which is available with the OPatch utility distribution.


$ export PATH=$PATH:$HOME:$ORACLE_HOME/OPatch:/bin

$ opatch napply -skip_subset -skip_duplicate



F) .Set your current directory to the directory where the patch is located and then run the OPatch utility by entering the following command:
cd  5225798
opatch apply



----startup mount
4.Mount The Standby Database and lsnrctl start


============================
PART SECOND ON PRIMARY SIDE
============================
5 .Stop Primary Database Services stop listener
6 .Apply CPU Patch To Primary Database
7 .Start Primary Database
8 .Re-Enable Log Shipping
9 .Put Standby Database In Recovery Mode
10.Verify The CPU Patch Application.



Post Installation Instructions for a Non-RAC Environment

Follow these steps:

A) .Start all database instances running from the Oracle home that you are patching.


B) .For each database instance running of the Oracle home being patched, connect to the database using SQL*Plus. Connect as SYSDBA and run the catcpu.sql script as follows:

(Due to changes in the installation scripts, it is no longer a requirement to startup the database in MIGRATE mode.)
cd $ORACLE_HOME/cpu/CPUJul2006
sqlplus /nolog
SQL> CONNECT /AS SYSDBA
SQL> STARTUP
SQL> @catcpu.sql
SQL> QUIT


C) .Check the log file for any errors. If there are errors, refer to Section 4, "Known Issues".


D) .If catcpu.sql reports any Invalid Objects, run the following commands:



Note: For large numbers of objects, this compilation step can take some time. If you are applying this patch through the Enterprise Manager console,
you will be prompted to run this compilation script.


You can check for any invalid objects by executing following statement:
SQL> SELECT OBJECT_NAME FROM DBA_OBJECTS WHERE STATUS= 'INVALID';


 cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT /AS SYSDBA
SQL> STARTUP
SQL> @utlrp.sql


You can check for any invalid objects by executing following statement:
SQL> SELECT OBJECT_NAME FROM DBA_OBJECTS WHERE STATUS= 'INVALID';




----DGMGRL
connect sys/oracle@PRIMARY

edit database PRIMARY set property LogShipping='ON';      // IF hang then first clean shutdown the database and restart server then after try;
show database verbose PRIMARY;
show database verbose STANDBY;