In sweet memories of my ever loving brother "kutty thambi " ARUN KUMAR

Tuesday, October 18, 2011

steps to upgrade 11.1.0.6.0 to 11.1.0.7.0

steps to upgrade 11.1.0.6.0 to 11.1.0.7.0

Step1:

using winSCP or anyother tool copy the patch file p6890831_111070_Linux-x86-64.zip to the environment from the machine where you are having patch file.

Step2:
login : oracle
password:
Uncompress the binary source
$unzip p6890831_111070_Linux-x86-64.zip
Example:-
After unzipping , you can find the below folder Disk1
c111ptqhdd009: /home/oracle
$ cd /oracle/app/patches/
c111ptqhdd009: /oracle/app/patches
$ ls
Disk1 p6890831_111070_Linux-x86-64.zip

Step3:
Bring down the application


Step4:
login : oracle
password:
Bring down the database
sqlplus '/as sysdba'
sql>shutdown immediate;
sql>exit
>ps -ef |grep pmon


Make sure that oracle is not running
>lsnrctl stop
>lsnrctl status
Make sure that the listener is not running.
Take a cold database backup
Controlfiles, datafiles, redo logs, archive files, tempfiles must be included in the backup. If the files are in different paths, the same has to be backedup.
>mkdir /backup_date
>cp /App1/oracle/oradata/orcl/*.* /backup/backup_date
>cd $ORACLE_HOME/dbs
>cp inittest.ora inittest.ora_bkpdate
>cp spfiletest.ora spfiletest.or_bkpdate
>cp orapwtest.ora orapwtest.ora_bkpdate

Step5:
login : oracle
password:
Take a backup of home path
>mkdir product_bkp
>cd /App1/oracle/product
>tar czf /backup/oracle_11106.tar.gz 11.1.0


Step6:
dbhome, coraenv,oraenv backup
login : root
password:
#cd /usr/local/bin
#cp dbhome dhome_bkpdate
#cp coraenv coraenv_bkpdate
#cp oraenv oraenv_bkpdate

Step7:
login : oracle
Installation of patchset

Invoke the runInstaller using the software xming to install patch graphically.

cd /oracle/app/patches/Disk1/
>./runInstaller




Select the ORACLE_HOME to upgrade and then click next, the prerequisites steps will complete last click INSTALL. At the end up the installation it will ask to run root.sh as root user. We need root user password or sudo user privilege to run root.sh script. Follow the step 8


Step8:
login : root
password:
or
login : your_SUDU_USERNAME
password:

cd /App1/oracle/product/11.1.0/db_1
./root.sh
Or
Sudu ./root.sh

The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /App1/oracle/product/11.1.0/db_1

Enter the full pathname of the local bin directory: [/usr/local/bin]:
Copying dbhome to /usr/local/bin ... overwrite (Y/N) : Y
Copying oraenv to /usr/local/bin ... overwrite (Y/N) : Y
Copying coraenv to /usr/local/bin ... overwrite (Y/N) : Y

Step9:
login : oracle
password:

Prerequisite check before upgradation
cd $ORACLE_HOME/rdbms/admin
sqlplus '/as sysdba'
sql> startup upgrade;
sql>spool pre_upgrade.log
sql> @utlu111i.sql

If the all the values obtained above are valid, please proceed to step 10 , otherwise please correct it.

Step10:
Upgradation script execution
login : oracle
password:

cd $ORACLE_HOME/rdbms/admin
sqlplus '/as sysdba'
sql> spool upgrade_date.log
sql> @catupgrd.sql

Step11:
login : oracle
password:
Take check the validity, version of the installed components

sqlplus '/as sysdba'
sql>set pages 250
sql> set lines 1000
sql> col comp_name for a40
sql> select comp_name, version, status from dba_registry;

Note : The status column of the displayed output should be 'Valid' and the version column should be '11.1.0.7'
Upgradation ends with this step12. If in case any problem during the installation and the old version needs to be reverted back

sql>shutdown immediate;

Step12:
Recompiling the invalid objects
login : oracle
password:
cd $ORACLE_HOME/rdbms/admin
sqlplus '/as sysdba'
sql>startup;
sql>spool recompile.log
sql> @utlrp.sql


Fallback plan Or To revert back to old version (11.1.0.6.0)
1. untar the binary backup
2. Backup the database the current database and then replace them with cold back taken before applying the patch.

login : root
password:
cd /usr/local/bin
#cp dbhome_bkpdate dbhome
#cp coraenv_bkpdate coraenv
#cp oraenv_bkpdate oraenv

login : oracle
password:

oracle binary restoration
cd /App1/oracle/product
>\rm -rf 11.1.0
>mkdir 11.1.0
>cp /backup/oracle_11106.tar.gz 11.1.0
>cd 11.1.0
>gunzip oracle_11106.tar.gz
>tar -xvf oracle_11106.tar


Datafile backup restoration
cd /App/oracle/oradata/orcl/
>\rm *
>cd /backup/backup_date
>cp *.* /App1/oracle/oradata/orcl/
>cd $ORACLE_HOME/dbs
>cp inittest.ora_bkpdate inittest.ora
>cp spfiletest.ora_bkpdate spfiletest.ora
>cp orapwtest.ora_bkpdate orapwtest.ora


sqlplus '/as sysdba'
sql>startup;
sql>select * from v$version;
sql>select comp_name, version, status from dba_registry;

Output should be 11.1.0.6 for version column and valid for status column.

*******************************************************************************
Thank You

Thursday, September 1, 2011

Physical Standby Database for Read/Write Testing and Reporting and revert back to the physical standby database using flashback restore point.

Using a combination of Data Guard, restore points, and Flashback Database, a physical standby database can be opened temporarily in read/write mode for development, reporting, or testing purposes, and then flashed back to a point in the past to be reverted back to a physical standby database. When the database is flashed back, Data Guard automatically synchronizes the standby database with the primary database, without the need to re-create the physical standby database from a backup copy of the primary database.

You can repeat this cycle of activate, flashback and revert as many times as is necessary.


+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ on standby database +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


step 1:
Cancel Redo Apply and create a guaranteed restore point.

SQL> select flashback_on from v$database;

FLASHBACK_ON
------------------
NO

SQL> show parameter recovery

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string /home/u01/app/oracle/flash_rec
overy_area
db_recovery_file_dest_size big integer 2G
recovery_parallelism integer 0
SQL>

SQL> alter database recover managed standby database cancel;

Database altered.

SQL> alter database recover managed standby database cancel;

Database altered.

SQL> create restore point before_switch_to_primary guarantee flashback database;

Restore point created.

SQL> select scn,name,time from v$restore_point;

SCN
----------
NAME
--------------------------------------------------------------------------------
TIME
---------------------------------------------------------------------------
481243
BEFORE_SWITCH_TO_PRIMARY
31-AUG-11 10.49.34.000000000 AM

alertlog file
------------------------------------------------------------------------------
Wed Aug 31 10:48:09 2011
MRP0: Background Media Recovery process shutdown (dbstby)
Wed Aug 31 10:48:10 2011
Managed Standby Recovery Canceled (dbstby)
Wed Aug 31 10:48:10 2011
Completed: alter database recover managed standby database cancel
Wed Aug 31 10:49:33 2011
Starting background process RVWR
RVWR started with pid=49, OS id=1629
Wed Aug 31 10:49:34 2011
Created guaranteed restore point BEFORE_SWITCH_TO_PRIMARY
------------------------------------------------------------------------------

SQL> select current_scn from v$database;

CURRENT_SCN
-----------
481243

SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /home/u01/app/oracle/oradata/dbstby/arch/
Oldest online log sequence 47
Next log sequence to archive 0
Current log sequence 49
SQL>


+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ on primary database +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Step 2:
Prepare the primary database to have the physical standby be diverged.

SQL> select current_scn from v$database;

CURRENT_SCN
-----------
481860

SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /home/u01/app/oracle/oradata/dbtest/arch/
Oldest online log sequence 47
Next log sequence to archive 49
Current log sequence 49
SQL>

SQL> alter system archive log current;

System altered.

SQL> alter system set log_archive_dest_state_2=defer;

System altered.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ on standby database +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Step 3 Activate the physical standby database.

SQL> alter database activate standby database;

Database altered.


SQL> startup mount force;
ORACLE instance started.

Total System Global Area 746586112 bytes
Fixed Size 1221636 bytes
Variable Size 209718268 bytes
Database Buffers 532676608 bytes
Redo Buffers 2969600 bytes
Database mounted.
SQL> ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE;

Database altered.

SQL> alter database open;

Database altered.


SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /home/u01/app/oracle/oradata/dbstby/arch/
Oldest online log sequence 1
Next log sequence to archive 2
Current log sequence 2
SQL>


Once the standby database has been activated, you can run reporting tools or perform other testing and activities for days or even weeks, independent of the primary database.

alert log file
------------------------------------------------------
Wed Aug 31 10:54:18 2011
Redo Shipping Client Connected as PUBLIC
-- Connected User is Valid
RFS[9]: Assigned to RFS process 8542
RFS[9]: Identified database type as 'physical standby'
Primary database is in MAXIMUM PERFORMANCE mode
Primary database is in MAXIMUM PERFORMANCE mode
RFS[9]: No standby redo logfiles created
Wed Aug 31 10:54:32 2011
Redo Shipping Client Connected as PUBLIC
-- Connected User is Valid
RFS[10]: Assigned to RFS process 8884
RFS[10]: Identified database type as 'physical standby'
RFS[10]: No standby redo logfiles created
RFS[10]: Archived Log: '/home/u01/app/oracle/oradata/dbstby/arch/1_49_760329654.arc'
Wed Aug 31 10:55:33 2011
alter database activate standby database
Wed Aug 31 10:55:33 2011
ALTER DATABASE ACTIVATE [PHYSICAL] STANDBY DATABASE (dbstby)
Wed Aug 31 10:55:35 2011
RESETLOGS after complete recovery through change 481244
Resetting resetlogs activation ID 1153152819 (0x44bbb733)
Online log /home/u01/app/oracle/oradata/dbstby/redo01.log: Thread 1 Group 1 was previously cleared
Online log /home/u01/app/oracle/oradata/dbstby/redo02.log: Thread 1 Group 2 was previously cleared
Online log /home/u01/app/oracle/oradata/dbstby/redo03.log: Thread 1 Group 3 was previously cleared
Standby became primary SCN: 481242
Wed Aug 31 10:55:35 2011
Setting recovery target incarnation to 5
Wed Aug 31 10:55:35 2011
Converting standby mount to primary mount.
Wed Aug 31 10:55:35 2011
ACTIVATE STANDBY: Complete - Database mounted as primary (dbstby)
Completed: alter database activate standby database
-----------------------------------------------------------------------------


+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ on primary database +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

SQL> alter system switch logfile;

System altered.

SQL> /

System altered.

SQL> /

System altered.

SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /home/u01/app/oracle/oradata/dbtest/arch/
Oldest online log sequence 51
Next log sequence to archive 53
Current log sequence 53
SQL>

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ on standby database +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Step 4: Revert the activated database back to a physical standby database.

SQL> startup force mount
ORACLE instance started.

Total System Global Area 746586112 bytes
Fixed Size 1221636 bytes
Variable Size 209718268 bytes
Database Buffers 532676608 bytes
Redo Buffers 2969600 bytes
Database mounted.
SQL> select name,scn,time from v$restore_point;

NAME SCN TIME
------------------------------ ---------- ---------------------------------------------------------------------------
BEFORE_SWITCH_TO_PRIMARY 481243 31-AUG-11 10.49.34.000000000 AM

SQL> flashback database to restore point BEFORE_SWITCH_TO_PRIMARY;

Flashback complete.

SQL> alter database convert to physical standby ;

Database altered.

SQL> startup mount force;
ORACLE instance started.

Total System Global Area 746586112 bytes
Fixed Size 1221636 bytes
Variable Size 209718268 bytes
Database Buffers 532676608 bytes
Redo Buffers 2969600 bytes
Database mounted.

SQL> alter database recover managed standby database disconnect;

Database altered.

SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /home/u01/app/oracle/oradata/dbstby/arch/
Oldest online log sequence 53
Next log sequence to archive 0
Current log sequence 54
SQL>





reference:-
Oracle® Data Guard Concepts and Administration 10g Release 2 (10.2)
Part Number B14239-05

Monday, August 8, 2011

Duplicate a database without connecting to a target database and a recovery catalog (11gR2 New Features)

Users can duplicate a database without connecting to a target database. The only requirements for this operation are a connection to a catalog and an auxiliary database. This new functionality is useful when the target database is not always available.
Users can also duplicate a database without connecting to a target database and a recovery catalog. In this case, the only requirement is that you provide a disk backup location where RMAN can find all the backups, datafile copies, archived logs, and control file copies for database duplication. This database duplication enhancement is helpful when it is not possible to connect to the target database and the recovery catalog.

here is an demo, In our example i am going to create a duplicate database with the name CLONEDB from the database DB2


1. Take backup of target database.
2. Copy the backupsets to the machine where you would like to clone the target database.
3. Create a new pfile for clone database or copy the pfile of target database and replace/edit the pfile entries for the clone database.
4. Create a password file
5. Create required folders for dump and database files.
6. Add an entry in /etc/oratab file
7. Create pfile for duplicate database
8. Add required TNS entry in tnsnames.ora file
9. startup nomount the clone/duplicate database.
10. Duplicate command in auxiliary instance.


  
SQL> select name from v$database;

NAME
--------------------------------------------------------
DB2

[oracle@node2 backupnew]$ . oraenv
ORACLE_SID = [db2] ?
The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 is /u01/app/oracle
[oracle@node2 backupnew]$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Mon Aug 8 00:31:43 2011

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.

connected to target database: DB2 (DBID=1922019997)

RMAN> backup as compressed backupset database format '/u01/app/oracle/backup/%d_%s_%I_%T' plus archivelog format '/u01/app/oracle/backup/%d_%s_%I_%T';

RMAN> backup archivelog all format '/u01/app/oracle/backup/%d_%s_%I_%T';

RMAN> EXIT;

[oracle@node2 backup]$ cd /u01/app/oracle/backup
[oracle@node2 backup]$ pwd
/u01/app/oracle/backup
[oracle@node2 backup]$ ls -ltr
total 463128
-rw-r----- 1 oracle dba 28600320 Aug 8 00:33 DB2_26_1922019997_20110808
-rw-r----- 1 oracle dba 265560064 Aug 8 00:35 DB2_27_1922019997_20110808
-rw-r----- 1 oracle dba 1114112 Aug 8 00:35 DB2_28_1922019997_20110808
-rw-r----- 1 oracle dba 94208 Aug 8 00:35 DB2_29_1922019997_20110808
-rw-r----- 1 oracle dba 89183232 Aug 8 00:36 DB2_30_1922019997_20110808
-rw-r----- 1 oracle dba 89189376 Aug 8 00:37 DB2_31_1922019997_20110808
******************************************************************************
copy the backups to the second server where you would like to clone the database

[oracle@node1 oracle]$ pwd
/u01/app/oracle
[oracle@node1 oracle]$ mkdir backup

[oracle@node2 backup]$ pwd
/u01/app/oracle/backup
[oracle@node2 backup]$ scp * oracle@192.168.2.101:/u01/app/oracle/backup
DB2_26_1922019997_20110808 100% 27MB 13.6MB/s 00:02
DB2_27_1922019997_20110808 100% 253MB 6.5MB/s 00:39
DB2_28_1922019997_20110808 100% 1088KB 1.1MB/s 00:00
DB2_29_1922019997_20110808 100% 92KB 92.0KB/s 00:00
DB2_30_1922019997_20110808 100% 85MB 6.5MB/s 00:13
DB2_31_1922019997_20110808 100% 85MB 14.2MB/s 00:06
[oracle@node2 backup]$

[oracle@node2 dbs]$ pwd
/u01/app/oracle/product/11.2.0/dbhome_1/dbs
[oracle@node2 dbs]$ ls | grep init
initdb2.ora
init.ora
initorcl2.ora
[oracle@node2 dbs]$ scp initdb2.ora oracle@192.168.2.101:/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initclonedb.ora

edit/replace the name and directory/folder for the clone database

eg:- I have replaced/edited the pfile as below
clonedb.__db_cache_size=541065216
clonedb.__java_pool_size=4194304
clonedb.__large_pool_size=4194304
clonedb.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
clonedb.__pga_aggregate_target=260046848
clonedb.__sga_target=780140544
clonedb.__shared_io_pool_size=0
clonedb.__shared_pool_size=218103808
clonedb.__streams_pool_size=4194304
*.audit_file_dest='/u01/app/oracle/admin/clonedb/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u01/app/oracle/clonedb/control01.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='clonedb'
*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=4039114752
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=clonedbXDB)'
*.open_cursors=300
*.pga_aggregate_target=258998272
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=776994816
*.undo_tablespace='UNDOTBS1'
db_file_name_convert='/u01/app/oracle/db2/','/u01/app/oracle/clonedb/'
log_file_name_convert='/u01/app/oracle/db2/','/u01/app/oracle/clonedb/'
*******************************************************************************
create a password file for clonedb
*******************************************************************************
[oracle@node1 dbs]$ orapwd file=$ORACLE_HOME/dbs/orapwclonedb password=oracle

create required folders and directories for database files and dump files
[oracle@node1 clonedb]$ mkdir -p /u01/app/oracle/admin/clonedb/adump
[oracle@node1 clonedb]$ mkdir -p /u01/app/oracle/admin/clonedb/udump
[oracle@node1 clonedb]$ mkdir -p /u01/app/oracle/admin/clonedb/bdump
[oracle@node1 clonedb]$ mkdir -p /u01/app/oracle/admin/clonedb/cdump
[oracle@node1 clonedb]$ mkdir -p /u01/app/oracle/clonedb

add an entry in the /etc/oratab file
clonedb:/u01/app/oracle/product/11.2.0/dbhome_1:N

[oracle@node1 clonedb]$ . oraenv
ORACLE_SID = [RAC1] ? clonedb
The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 is /u01/app/oracle
[oracle@node1 clonedb]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Mon Aug 8 01:05:39 2011

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

Connected to an idle instance.

SQL> startup nomount
ORACLE instance started.

Total System Global Area 778387456 bytes
Fixed Size 1339344 bytes
Variable Size 222298160 bytes
Database Buffers 549453824 bytes
Redo Buffers 5296128 bytes
SQL>

[oracle@node1 clonedb]$ . oraenv
ORACLE_SID = [RAC1] ? clonedb
The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 is /u01/app/oracle
[oracle@node1 clonedb]$ rman auxiliary /

Recovery Manager: Release 11.2.0.1.0 - Production on Mon Aug 8 01:06:32 2011

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.

connected to auxiliary database: CLONEDB (not mounted)

RMAN> duplicate database to clonedb backup location '/u01/app/oracle/backup' nofilenamecheck;


SQL> select name from v$database;

NAME
---------
CLONEDB

SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 1
Next log sequence to archive 1
Current log sequence 1


RMAN Tablespace Point-in-Time Recovery (TSPITR) 11gR2 Enhancements

One of the good new features in 11g Release 2 is that it enables us to recover from a case of a dropped tablespace. TSPITR (tablespace point in time recovery) has been around in earlier releases, but we could not recover a dropped tablespace.

here is an demo for your reference

  

22:33:43 SQL> select file_name,tablespace_name from dba_data_files;

FILE_NAME TABLESPACE_NAME
-------------------------------------------------------- ---------------
/u01/app/oracle/db2/users01.dbf USERS
/u01/app/oracle/db2/undotbs01.dbf UNDOTBS1
/u01/app/oracle/db2/sysaux01.dbf SYSAUX
/u01/app/oracle/db2/system01.dbf SYSTEM

22:33:52 SQL> create tablespace newtbs1 datafile '/u01/app/oracle/db2/newtbs01.dbf' size 10m;

Tablespace created.

22:34:31 SQL> create user shyam identified by shyam default tablespace newtbs1;

User created.

22:35:24 SQL> grant connect,resource to shyam;

Grant succeeded.

22:35:57 SQL> conn shyam/shyam
Connected.
22:36:16 SQL> create table tb1 ( id number);

Table created.

22:36:26 SQL> insert into tb1 values (123);

1 row created.

Commit complete.
22:36:41 SQL> create table tb2 ( id number);

Table created.

22:37:01 SQL> insert into tb2 values (234);

1 row created.

Commit complete.
22:37:14 SQL> select * from tab;

TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
TB1 TABLE
TB2 TABLE


22:37:20 SQL> conn / as sysdba
Connected.
22:38:16 SQL> alter system switch logfile;

System altered.

22:38:33 SQL> select current_scn from v$database;

CURRENT_SCN
-----------
799576

[oracle@node2 backupnew]$ . oraenv
ORACLE_SID = [db2] ?
The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 is /u01/app/oracle
[oracle@node2 backupnew]$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Sun Aug 7 22:39:17 2011

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.

connected to target database: DB2 (DBID=1922019997)

RMAN> backup as compressed backupset database format '/u01/app/oracle/backup/backupnew/%d_%s_%I_%T' plus archivelog format '/u01/app/oracle/backup/backupnew/%d_%s_%I_

%T';


Starting backup at 07-AUG-11
current log archived
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=55 device type=DISK
channel ORA_DISK_1: starting compressed archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=3 RECID=1 STAMP=758566663
input archived log thread=1 sequence=4 RECID=2 STAMP=758566818
input archived log thread=1 sequence=5 RECID=3 STAMP=758566872
input archived log thread=1 sequence=6 RECID=4 STAMP=758574317
input archived log thread=1 sequence=7 RECID=5 STAMP=758574431
input archived log thread=1 sequence=8 RECID=6 STAMP=758574724
input archived log thread=1 sequence=9 RECID=7 STAMP=758575149
input archived log thread=1 sequence=10 RECID=8 STAMP=758575987
input archived log thread=1 sequence=11 RECID=9 STAMP=758581906
input archived log thread=1 sequence=12 RECID=10 STAMP=758581906
input archived log thread=1 sequence=13 RECID=11 STAMP=758582156
input archived log thread=1 sequence=14 RECID=12 STAMP=758582234
input archived log thread=1 sequence=15 RECID=13 STAMP=758582326
input archived log thread=1 sequence=16 RECID=14 STAMP=758582432
input archived log thread=1 sequence=17 RECID=15 STAMP=758582528
input archived log thread=1 sequence=18 RECID=16 STAMP=758582961
input archived log thread=1 sequence=19 RECID=17 STAMP=758584593
input archived log thread=1 sequence=20 RECID=18 STAMP=758587114
input archived log thread=1 sequence=21 RECID=19 STAMP=758587224
channel ORA_DISK_1: starting piece 1 at 07-AUG-11
channel ORA_DISK_1: finished piece 1 at 07-AUG-11
piece handle=/u01/app/oracle/backup/backupnew/DB2_22_1922019997_20110807 tag=TAG20110807T224025 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
Finished backup at 07-AUG-11

Starting backup at 07-AUG-11
using channel ORA_DISK_1
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/db2/system01.dbf
input datafile file number=00002 name=/u01/app/oracle/db2/sysaux01.dbf
input datafile file number=00003 name=/u01/app/oracle/db2/undotbs01.dbf
input datafile file number=00005 name=/u01/app/oracle/db2/newtbs01.dbf
input datafile file number=00004 name=/u01/app/oracle/db2/users01.dbf
channel ORA_DISK_1: starting piece 1 at 07-AUG-11
channel ORA_DISK_1: finished piece 1 at 07-AUG-11
piece handle=/u01/app/oracle/backup/backupnew/DB2_23_1922019997_20110807 tag=TAG20110807T224041 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:45
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 07-AUG-11
channel ORA_DISK_1: finished piece 1 at 07-AUG-11
piece handle=/u01/app/oracle/backup/backupnew/DB2_24_1922019997_20110807 tag=TAG20110807T224041 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 07-AUG-11

Starting backup at 07-AUG-11
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting compressed archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=22 RECID=20 STAMP=758587349
channel ORA_DISK_1: starting piece 1 at 07-AUG-11
channel ORA_DISK_1: finished piece 1 at 07-AUG-11
piece handle=/u01/app/oracle/backup/backupnew/DB2_25_1922019997_20110807 tag=TAG20110807T224229 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 07-AUG-11

RMAN> exit


Recovery Manager complete.
[oracle@node2 backupnew]$

22:38:46 SQL> conn shyam/shyam
Connected.
22:43:37 SQL> create table tb3 (id number);

Table created.

22:47:33 SQL> insert into tb3 values(123);

1 row created.

Commit complete.
22:48:27 SQL> select * from tb3;

ID
----------
123

22:48:37 SQL> conn / as sysdba
Connected.
22:48:47 SQL> alter system switch logfile;

System altered.

22:48:54 SQL> select current_scn from v$database;

CURRENT_SCN
-----------
800205

22:49:06 SQL>


22:50:14 SQL> drop tablespace newtbs1 including contents and datafiles;

Tablespace dropped.

22:51:06 SQL>


RMAN> recover tablespace newtbs1 until scn 800205 auxiliary destination '/u01/app/oracle/backup/backupnew';

Starting recover at 07-AUG-11
using channel ORA_DISK_1
RMAN-05026: WARNING: presuming following set of tablespaces applies to specified point-in-time

List of tablespaces expected to have UNDO segments
Tablespace SYSTEM
Tablespace UNDOTBS1

Creating automatic instance, with SID='Aunx'

initialization parameters used for automatic instance:
db_name=DB2
db_unique_name=Aunx_tspitr_DB2
compatible=11.2.0.0.0
db_block_size=8192
db_files=200
sga_target=280M
processes=50
db_create_file_dest=/u01/app/oracle/backup/backupnew
log_archive_dest_1='location=/u01/app/oracle/backup/backupnew'
#No auxiliary parameter file used


starting up automatic instance DB2

Oracle instance started

Total System Global Area 292933632 bytes

Fixed Size 1336092 bytes
Variable Size 100666596 bytes
Database Buffers 184549376 bytes
Redo Buffers 6381568 bytes
Automatic instance created


List of tablespaces that have been dropped from the target database:
Tablespace newtbs1

contents of Memory Script:
{
# set requested point in time
set until scn 800205;
# restore the controlfile
restore clone controlfile;
# mount the controlfile
sql clone 'alter database mount clone database';
# archive current online log
sql 'alter system archive log current';
# avoid unnecessary autobackups for structural changes during TSPITR
sql 'begin dbms_backup_restore.AutoBackupFlag(FALSE); end;';
}
executing Memory Script

executing command: SET until clause

Starting restore at 07-AUG-11
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=25 device type=DISK

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/backup/backupnew/DB2_24_1922019997_20110807
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/backup/backupnew/DB2_24_1922019997_20110807 tag=TAG20110807T224041
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u01/app/oracle/backup/backupnew/DB2/controlfile/o1_mf_73xmbtfc_.ctl
Finished restore at 07-AUG-11

sql statement: alter database mount clone database

sql statement: alter system archive log current

sql statement: begin dbms_backup_restore.AutoBackupFlag(FALSE); end;

contents of Memory Script:
{
# set requested point in time
set until scn 800205;
# set destinations for recovery set and auxiliary set datafiles
set newname for clone datafile 1 to new;
set newname for clone datafile 3 to new;
set newname for clone datafile 2 to new;
set newname for clone tempfile 1 to new;
set newname for datafile 5 to
"/u01/app/oracle/db2/newtbs01.dbf";
# switch all tempfiles
switch clone tempfile all;
# restore the tablespaces in the recovery set and the auxiliary set
restore clone datafile 1, 3, 2, 5;
switch clone datafile all;
}
executing Memory Script

executing command: SET until clause

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

renamed tempfile 1 to /u01/app/oracle/backup/backupnew/DB2/datafile/o1_mf_temp_%u_.tmp in control file

Starting restore at 07-AUG-11
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 /u01/app/oracle/backup/backupnew/DB2/datafile/o1_mf_system_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00003 to /u01/app/oracle/backup/backupnew/DB2/datafile/o1_mf_undotbs1_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00002 to /u01/app/oracle/backup/backupnew/DB2/datafile/o1_mf_sysaux_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00005 to /u01/app/oracle/db2/newtbs01.dbf
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/backup/backupnew/DB2_23_1922019997_20110807
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/backup/backupnew/DB2_23_1922019997_20110807 tag=TAG20110807T224041
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:45
Finished restore at 07-AUG-11

datafile 1 switched to datafile copy
input datafile copy RECID=4 STAMP=758588962 file name=/u01/app/oracle/backup/backupnew/DB2/datafile/o1_mf_system_73xmc12w_.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=5 STAMP=758588962 file name=/u01/app/oracle/backup/backupnew/DB2/datafile/o1_mf_undotbs1_73xmc148_.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=6 STAMP=758588962 file name=/u01/app/oracle/backup/backupnew/DB2/datafile/o1_mf_sysaux_73xmc13r_.dbf

contents of Memory Script:
{
# set requested point in time
set until scn 800205;
# online the datafiles restored or switched
sql clone "alter database datafile 1 online";
sql clone "alter database datafile 3 online";
sql clone "alter database datafile 2 online";
sql clone "alter database datafile 5 online";
# recover and open resetlogs
recover clone database tablespace "NEWTBS1", "SYSTEM", "UNDOTBS1", "SYSAUX" delete archivelog;
alter clone database open resetlogs;
}
executing Memory Script

executing command: SET until clause

sql statement: alter database datafile 1 online

sql statement: alter database datafile 3 online

sql statement: alter database datafile 2 online

sql statement: alter database datafile 5 online

Starting recover at 07-AUG-11
using channel ORA_AUX_DISK_1

starting media recovery

archived log for thread 1 with sequence 22 is already on disk as file /u01/app/oracle/flash_recovery_area/DB2/archivelog/2011_08_07/o1_mf_1_22_73xkvxsz_.arc
archived log for thread 1 with sequence 23 is already on disk as file /u01/app/oracle/flash_recovery_area/DB2/archivelog/2011_08_07/o1_mf_1_23_73xl7yvr_.arc
archived log for thread 1 with sequence 24 is already on disk as file /u01/app/oracle/flash_recovery_area/DB2/archivelog/2011_08_07/o1_mf_1_24_73xlmfdj_.arc
archived log file name=/u01/app/oracle/flash_recovery_area/DB2/archivelog/2011_08_07/o1_mf_1_22_73xkvxsz_.arc thread=1 sequence=22
archived log file name=/u01/app/oracle/flash_recovery_area/DB2/archivelog/2011_08_07/o1_mf_1_23_73xl7yvr_.arc thread=1 sequence=23
archived log file name=/u01/app/oracle/flash_recovery_area/DB2/archivelog/2011_08_07/o1_mf_1_24_73xlmfdj_.arc thread=1 sequence=24
media recovery complete, elapsed time: 00:00:03
Finished recover at 07-AUG-11

database opened

contents of Memory Script:
{
# make read only the tablespace that will be exported
sql clone 'alter tablespace NEWTBS1 read only';
# create directory for datapump import
sql "create or replace directory TSPITR_DIROBJ_DPDIR as ''
/u01/app/oracle/backup/backupnew''";
# create directory for datapump export
sql clone "create or replace directory TSPITR_DIROBJ_DPDIR as ''
/u01/app/oracle/backup/backupnew''";
}
executing Memory Script

sql statement: alter tablespace NEWTBS1 read only

sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/u01/app/oracle/backup/backupnew''

sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/u01/app/oracle/backup/backupnew''

Performing export of metadata...
EXPDP> Starting "SYS"."TSPITR_EXP_Aunx":
EXPDP> Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
EXPDP> Processing object type TRANSPORTABLE_EXPORT/TABLE
EXPDP> Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
EXPDP> Master table "SYS"."TSPITR_EXP_Aunx" successfully loaded/unloaded
EXPDP> ******************************************************************************
EXPDP> Dump file set for SYS.TSPITR_EXP_Aunx is:
EXPDP> /u01/app/oracle/backup/backupnew/tspitr_Aunx_72915.dmp
EXPDP> ******************************************************************************
EXPDP> Datafiles required for transportable tablespace NEWTBS1:
EXPDP> /u01/app/oracle/db2/newtbs01.dbf
EXPDP> Job "SYS"."TSPITR_EXP_Aunx" successfully completed at 23:11:06
Export completed


contents of Memory Script:
{
# shutdown clone before import
shutdown clone immediate
}
executing Memory Script

database closed
database dismounted
Oracle instance shut down

Performing import of metadata...
IMPDP> Master table "SYS"."TSPITR_IMP_Aunx" successfully loaded/unloaded
IMPDP> Starting "SYS"."TSPITR_IMP_Aunx":
IMPDP> Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
IMPDP> Processing object type TRANSPORTABLE_EXPORT/TABLE
IMPDP> Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
IMPDP> Job "SYS"."TSPITR_IMP_Aunx" successfully completed at 23:11:35
Import completed


contents of Memory Script:
{
# make read write and offline the imported tablespaces
sql 'alter tablespace NEWTBS1 read write';
sql 'alter tablespace NEWTBS1 offline';
# enable autobackups after TSPITR is finished
sql 'begin dbms_backup_restore.AutoBackupFlag(TRUE); end;';
}
executing Memory Script

sql statement: alter tablespace NEWTBS1 read write

sql statement: alter tablespace NEWTBS1 offline

sql statement: begin dbms_backup_restore.AutoBackupFlag(TRUE); end;

Removing automatic instance
Automatic instance removed
auxiliary instance file /u01/app/oracle/backup/backupnew/DB2/datafile/o1_mf_temp_73xmgrpk_.tmp deleted
auxiliary instance file /u01/app/oracle/backup/backupnew/DB2/onlinelog/o1_mf_3_73xmglwq_.log deleted
auxiliary instance file /u01/app/oracle/backup/backupnew/DB2/onlinelog/o1_mf_2_73xmgk7t_.log deleted
auxiliary instance file /u01/app/oracle/backup/backupnew/DB2/onlinelog/o1_mf_1_73xmghq1_.log deleted
auxiliary instance file /u01/app/oracle/backup/backupnew/DB2/datafile/o1_mf_sysaux_73xmc13r_.dbf deleted
auxiliary instance file /u01/app/oracle/backup/backupnew/DB2/datafile/o1_mf_undotbs1_73xmc148_.dbf deleted
auxiliary instance file /u01/app/oracle/backup/backupnew/DB2/datafile/o1_mf_system_73xmc12w_.dbf deleted
auxiliary instance file /u01/app/oracle/backup/backupnew/DB2/controlfile/o1_mf_73xmbtfc_.ctl deleted
Finished recover at 07-AUG-11

RMAN>



23:14:57 SQL> select file_name,tablespace_name from dba_data_files;

FILE_NAME TABLESPACE_NAME
-------------------------------------------------------- ---------------
/u01/app/oracle/db2/users01.dbf USERS
/u01/app/oracle/db2/undotbs01.dbf UNDOTBS1
/u01/app/oracle/db2/sysaux01.dbf SYSAUX
/u01/app/oracle/db2/system01.dbf SYSTEM
/u01/app/oracle/db2/newtbs01.dbf NEWTBS1


SQL> alter tablespace newtbs1 online;

Tablespace altered.


23:15:28 SQL> conn shyam/shyam
Connected.
23:15:54 SQL> select * from tab;

TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
TB1 TABLE
TB2 TABLE
TB3 TABLE




Monday, May 23, 2011

RMAN cloning in archive log mode

i have cloned the database SUNU in RAC2 machine to RAC1 Machine in the name DBDEMO.


****************************************************************
RAC2 MACHINE
****************************************************************
ORACLE_SID = [test] ? sunu
[oracle@rac2 ~]$ sqlplus '/as sysdba'

SQL*Plus: Release 10.2.0.1.0 - Production on Sun May 15 19:27:41 2011

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


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options

SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 5
Next log sequence to archive 7
Current log sequence 7
SQL>

[oracle@rac2 ~]$ . oraenv
ORACLE_SID = [oracle] ? sunu
[oracle@rac2 ~]$ rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Sun May 15 19:34:50 2011

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

connected to target database: SUNU (DBID=555109830)

RMAN> backup full database format '/home/u01/app/backup/%d_%U.bkp' plus archivelog format '/home/u01/app/backup/%d_%U.bkp';


[oracle@rac2 backup]$ pwd
/home/u01/app/backup
[oracle@rac2 backup]$ ls -ltr
total 516356
-rw-r----- 1 oracle oinstall 2124800 May 15 19:37 SUNU_01mcdp74_1_1.bkp
-rw-r----- 1 oracle oinstall 518946816 May 15 19:37 SUNU_02mcdp76_1_1.bkp
-rw-r----- 1 oracle oinstall 7143424 May 15 19:37 SUNU_03mcdp8j_1_1.bkp
-rw-r----- 1 oracle oinstall 2560 May 15 19:37 SUNU_04mcdp8l_1_1.bkp
[oracle@rac2 backup]$



step 2:-
copy the initsunu.ora file to rac1 machine and also create a password file in rac1 machine for dbdemo database
add an entry in oratab file in rac1 machine
also move the backup files to rac1 machine to exact folder as it is in rac2(source) machine

note: make sure the folder is available in RAC1 machine
here we are taking backup in /home/u01/app/backup so now i am going to create a folder in RAC1 machine and also moving the backup from RAC2 to RAC1.
[oracle@rac2 backup]$ scp * oracle@192.168.1.1:/home/u01/app/backup/


or you can create a symbolic link for the backup location

example, in machine RAC1(the machine/host/server i dont have exact folder or exact mount point as it is in RAC2 machine(target)
do like this,

[oracle@rac2 dbs]$ cd /home/u01/app/backup/
[oracle@rac2 backup]$ pwd
/home/u01/app/backup
[oracle@rac2 backup]$ scp * oracle@192.168.1.1:/home/u01/app/test_bk/

and then create a symbolic link:
[oracle@rac1 app]$ ln -s /home/u01/app/test_bk /home/u01/app/backup

[oracle@rac1 app]$ ls
backup oracle test_bk
[oracle@rac1 app]$ cd backup/
[oracle@rac1 backup]$ ls -ltr
total 671932
-rw-r----- 1 oracle oinstall 7029760 May 22 12:35 SUNU_09mcoc44_1_1.bkp
-rw-r----- 1 oracle oinstall 97460224 May 22 12:36 SUNU_0amcoc48_1_1.bkp
-rw-r----- 1 oracle oinstall 6144 May 22 12:36 SUNU_0cmcoc7a_1_1.bkp
-rw-r----- 1 oracle oinstall 1097728 May 22 12:36 SUNU_0bmcoc78_1_1.bkp
-rw-r----- 1 oracle oinstall 39838720 May 22 12:36 SUNU_0dmcvels_1_1.bkp
-rw-r----- 1 oracle oinstall 534740992 May 22 12:38 SUNU_0emcvem5_1_1.bkp
-rw-r----- 1 oracle oinstall 27648 May 22 12:38 SUNU_0gmcvepg_1_1.bkp
-rw-r----- 1 oracle oinstall 7143424 May 22 12:38 SUNU_0fmcvepe_1_1.bkp
[oracle@rac1 backup]$

now we are going to copy the init files from RAC2 to RAC1 machine using scp , as shown below.
you can mention hostname or ipaddress in scp command

[oracle@rac2 dbs]$ scp initsunu.ora oracle@192.168.1.1:$ORACLE_HOME/dbs/
initsunu.ora 100% 1070 1.0KB/s 00:00
***********************************************************************
IN RAC1 MACHINE
***********************************************************************

i copied the initsunu.ora file to the RAC1 machine and now i am going to replace
the database name sunu by dbdemo
also,
adding the parameter log_file_name_convert and db_file_name_convert parameters to clone database with different directory structure.

dbdemo.__db_cache_size=541065216
dbdemo.__java_pool_size=4194304
dbdemo.__large_pool_size=4194304
dbdemo.__shared_pool_size=192937984
dbdemo.__streams_pool_size=0
*.audit_file_dest='/home/u01/app/oracle/admin/dbdemo/adump'
*.background_dump_dest='/home/u01/app/oracle/admin/dbdemo/bdump'
*.compatible='10.2.0.1.0'
*.control_files='/home/u01/app/oracle/oradata/dbdemo/control01.ctl','/home/u01/app/oracle/oradata/dbdemo/control02.ctl','/home/u01/app/oracle/oradata/dbdemo/control03.ctl'
*.core_dump_dest='/home/u01/app/oracle/admin/dbdemo/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='dbdemo'
*.db_recovery_file_dest='/home/u01/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=2147483648
*.dispatchers='(PROTOCOL=TCP) (SERVICE=dbdemoXDB)'
*.job_queue_processes=10
*.log_archive_format='%t_%s_%r.dbf'
*.open_cursors=300
*.pga_aggregate_target=248512512
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/home/u01/app/oracle/admin/dbdemo/udump'
db_file_name_convert=(/home/u01/app/oracle/oradata/sunu/,/home/u01/app/oracle/oradata/dbdemo/)
log_file_name_convert=(/home/u01/app/oracle/oradata/sunu/,/home/u01/app/oracle/oradata/dbdemo/)

*.sga_target=745537536


Now i am going to add an entry in the /etc/oratab file for dbdemo database

dbdemo:/home/u01/app/oracle/product/10.2.0/db_1:N


going to create required folders for the dbdemo database files

[oracle@rac1 dbdemo]$ pwd
/home/u01/app/oracle/admin/dbdemo

[oracle@rac1 dbdemo]$ ls
adump bdump cdump dpdump hdump pfile udump
[oracle@rac1 dbdemo]$

[oracle@rac1 oradata]$ pwd
/home/u01/app/oracle/oradata
[oracle@rac1 oradata]$ ls
dbdemo
[oracle@rac1 oradata]$


creating a pwd file for dbdemo database

[oracle@rac1 oradata]$ orapwd file=$ORACLE_HOME/dbs/orapwdbdemo password=oracle
bash: orapwd: command not found
[oracle@rac1 oradata]$ . oraenv
ORACLE_SID = [orcl] ? dbdemo
[oracle@rac1 oradata]$ orapwd file=$ORACLE_HOME/dbs/orapwdbdemo password=oracle
[oracle@rac1 oradata]$

now i am going to start dbdemo database in nomount mode
and then do cloning

before that we should have add the tns entry of sunu database in RAC1 machine


[oracle@rac1 backup]$ cd /home/u01/app/oracle/product/10.2.0/db_1/network/admin/
[oracle@rac1 admin]$ ls -ltr

add/check this entries available in both machines else add this entry in tnsnames.ora file of both machines.

SUNU =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.2)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = sunu)
)
)

DBDEMO =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.1)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = dbdemo)
)
)
[oracle@rac1 admin]$ tnsping DBDEMO

TNS Ping Utility for Linux: Version 10.2.0.1.0 - Production on 19-MAY-2011 20:31:21

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

Used parameter files:
/home/u01/app/oracle/product/10.2.0/db_1/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.1)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = dbdemo)))
OK (0 msec)
[oracle@rac1 admin]$ tnsping SUNU

TNS Ping Utility for Linux: Version 10.2.0.1.0 - Production on 19-MAY-2011 20:31:26

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

Used parameter files:
/home/u01/app/oracle/product/10.2.0/db_1/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.2)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = sunu)))
OK (10 msec)
[oracle@rac1 admin]$

[oracle@rac2 admin]$ tnsping DBDEMO

TNS Ping Utility for Linux: Version 10.2.0.1.0 - Production on 19-MAY-2011 20:29:09

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

Used parameter files:
/home/u01/app/oracle/product/10.2.0/db_1/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.1)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = dbdemo)))
OK (10 msec)
[oracle@rac2 admin]$ tnsping SUNU

TNS Ping Utility for Linux: Version 10.2.0.1.0 - Production on 19-MAY-2011 20:29:15

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

Used parameter files:
/home/u01/app/oracle/product/10.2.0/db_1/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip.localdomain)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = sunu)))
OK (10 msec)
[oracle@rac2 admin]$

we are checking connectivity b/n the two machines using tnsping command.

now all the pre cloning steps finished.

now we can start the cloning in RAC1 machine.


startup nomount the DATABASE dbdemo in RAC1 machine


making/creating flash recovery area in RAC1 machine

[oracle@rac1 oracle]$ mkdir -p /home/u01/app/oracle/flash_recovery_area
[oracle@rac1 oracle]$ ls
admin flash_recovery_area oradata oraInventory product
[oracle@rac1 oracle]$ cd flash_recovery_area/
[oracle@rac1 flash_recovery_area]$ ls
[oracle@rac1 flash_recovery_area]$ mkdir dbdemo
[oracle@rac1 flash_recovery_area]$ ls
dbdemo


[oracle@rac1 dbs]$ . oraenv
ORACLE_SID = [dbdemo] ?
[oracle@rac1 dbs]$ sqlplus '/as sysdba'

SQL*Plus: Release 10.2.0.1.0 - Production on Thu May 19 20:40:50 2011

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

Connected to an idle instance.

SQL> startup nomount
ORACLE instance started.

Total System Global Area 746586112 bytes
Fixed Size 1221636 bytes
Variable Size 201329660 bytes
Database Buffers 541065216 bytes
Redo Buffers 2969600 bytes
SQL>

[oracle@rac1 flash_recovery_area]$ . oraenv
ORACLE_SID = [ORCL1] ? dbdemo
[oracle@rac1 flash_recovery_area]$ rman target sys/oracle@SUNU auxiliary /

Recovery Manager: Release 10.2.0.1.0 - Production on Thu May 19 20:42:06 2011

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

connected to target database: SUNU (DBID=555109830)
connected to auxiliary database: DBDEMO (not mounted)

RMAN> duplicate target database to dbdemo;

[oracle@rac1 dbdemo]$ . oraenv
ORACLE_SID = [dbdemo] ?
[oracle@rac1 dbdemo]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Thu May 19 21:20:23 2011

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


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options

SQL> select name from v$database;

NAME
---------
DBDEMO

Wednesday, April 27, 2011

ORA-01591: lock held by in-doubt distributed transaction



ORA-01591: lock held by in-doubt distributed transaction 
i restarted the server but of no use

solution:

SQL> select local_tran_id from dba_2pc_pending;

LOCAL_TRAN_ID
------------------------------------------------------------------
6.44.24689

SQL> rollback force '6.44.24689';

Rollback complete.

SQL> exec dbms_transaction.purge_lost_db_entry('6.44.24689');

PL/SQL procedure successfully completed.

SQL> select local_tran_id from dba_2pc_pending;

no rows selected
reference:

Saturday, January 1, 2011

Happy New Year 2011

Dear All,


“Another fresh new year is here . . .
Another year to live!
To banish worry, doubt, and fear,
To love and laugh and give!


This bright new year is given me
To live each day with zest . . .
To daily grow and try to be
My highest and my best!


I have the opportunity
Once more to right some wrongs,
To pray for peace, to plant a tree,
And sing more joyful songs!

“We will open the book. Its pages are blank. We are going to put words on them ourselves. The book is called Opportunity and its first chapter is New Year's Day.”


Thanks and Regards,
Rajesh Kumar Govindarajan
 
Share/Bookmark