Showing posts with label RMAN. Show all posts
Showing posts with label RMAN. Show all posts

Wednesday, February 19, 2014

RMAN 04006 and ORA 17627 | ORA 01017 invalid username/password while RMAN duplicate.


While duplicate database By RMAN using active database command.
I had trouble of connecting from RMAN to non-mounted standby instance.
It was connecting to sqlplus perfectly.

I did copy password file from primary. made connection from tns to non-mounted instance using SQLPLUS.
it worked fine but when i tries from RMAN it gaves error.


ORA-17629: Cannot connect to the remote database server
ORA-17627: ORA-01017: invalid username/password; logon denied
ORA-17629: Cannot connect to the remote database server

Then I recreated password file with below command IGNORECASE=Y is the one which i was missing.
You also need to put sec_case_sensitive_logon=false in your non-mounted standby instance init file.

export ORACLE_SID=DUMMY
orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password=sys password entries=10 force=y/n ignorecase=y 



This works like a charm. ...!!!

Sunday, September 29, 2013

Rman Backup Shell script

This is backup script to schedule in crontab.
Create three rman command file first.
These Rman commandfile will be called by Below shell script to Kick of which Type of Backup you want.

1) Full backup
2) Inremental Backup
3) Archivelog Backup

To run below backup script provide argument as

./script_name FULL|INCR|ARCH
Backup script

#!/bin/ksh
###########################################################
#######CHECK ARGUMENTS
#
if [ $# -lt 2 ] ;
then
echo "Usage :script_name ORACLE_SID FULL|INCR|ARCH POLICY"
exit
else
echo "Enough Argument Passed"
fi
###########################################################
export ALTER SESSION NLS_DATE_FORMAT='DD-MON-YYYY HH24:MI'

export ORACLE_SID=$1
echo $ORACLE_SID
if [[ $( grep -iwc "$ORACLE_SID" /etc/oratab ) -eq 1 ]]
then
echo "ORACLE SID Found"
echo "$ORACLE_SID is instance"
ORACLE_HOME=`grep -iw $ORACLE_SID /etc/oratab | cut -d ":" -f2`
TNS_ADMIN=$ORACLE_HOME/network/admin
PATH=$ORACLE_HOME/bin:$PATH
RMAN=$ORACLE_HOME/bin/rman
echo "Current Oracle Instance :-------------: $ORACLE_SID"
echo "Current Oracle Home :-----------------: $ORACLE_HOME"
echo "Current TNS admin :-------------------: $TNS_ADMIN"
echo "Current RMAN :------------------------: $RMAN"
else
echo "$ORACLE_SID" not found in Oratab file.
exit
fi
###########################################################
export BKTYPE=$2
echo $BKTYPE
case $BKTYPE in
FULL) print "\n You selected FULL DB BACKUP"
export CMD=/u01/test_disk_bkp.rcv
echo $CMD
;;
INCR) print "\n You selected Incremental Backup"
export CMD=/u01/test_disk_incr_bkp.rcv
echo $CMD
;;
ARCH) print "\n You selected Achivelog backup"
export CMD=/u01/test_disk_arch.rcv
echo $CMD
;;
*) print "\n Invalid Argument"
print " choose FULL or INCR or ARCH"
sleep 0
exit
;;
esac
###########################################################

rman  <connect target /
connect catalog rman/dummy@RMAN_CATALOG_STRING
@$CMD
exit
EOF
####################################################################################
RETURN_STATUS=$?
if [ $RETURN_STATUS = 0 ]; then
  echo "$ORACLE_SID Backup successful" | mail -s "$ORACLE_SID backup Completed"
   else
  echo "$ORACLE_SID Backup not successful" | mail -s "$ORACLE_SID backup failed"  
fi
####################################################################################

Thursday, January 3, 2013

Restore Database RAC from multiple Instances

This is restore & recovery of RAC database running on 3 nodes.

While restore & recover database we allocate channel to all Instances for Load balance.

Oracle Database version is 11.2.0.3.

Steps to perform restore & recovery.

Restore spfile
Restore controlfile
Bring all the instances in mount state (do not put cluster_database=false)
Allocate channel using multiple instances
Restore database
Recover database
Open the database in resetlogs in one node
Open the database on other nodes

---------RESTORE SPFILE 

TEST271 | DUMMYGG1 | /export/home/oracle/scripts/rman
> rman target / catalog rman/RMAN@catalogdb

Recovery Manager: Release 11.2.0.3.0 - Production on Thu Jan 3 12:06:05 2013

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

connected to target database (not started)
connected to recovery catalog database

RMAN> set dbid=90275615

executing command: SET DBID
database name is "DUMMYGG" and DBID is 90275615

RMAN> list backup of spfile;


List of Backup Sets
===================


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
7639172 Incr 0  80.00K     DISK        00:00:01     02-JAN-13
        BP Key: 7639190   Status: AVAILABLE  Compressed: NO  Tag: TAG20130102T121926
        Piece Name: /ORAGG/backup/DUMMYGG15_12nudf6q_1_1
  SPFILE Included: Modification time: 02-JAN-13
  SPFILE db_unique_name: DUMMYGG

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
7640203 Incr 0  80.00K     DISK        00:00:01     02-JAN-13
        BP Key: 7640224   Status: AVAILABLE  Compressed: NO  Tag: TAG20130102T124658
        Piece Name: /ORAGG/backup/DUMMYGG05_2gnudgqg_1_1
  SPFILE Included: Modification time: 02-JAN-13
  SPFILE db_unique_name: DUMMYGG

RMAN> STARTUP FORCE NOMOUNT;
  
RMAN> restore spfile from '/ORAGG/backup/DUMMYGG05_2gnudgqg_1_1';

Starting restore at 03-JAN-13
using channel ORA_DISK_1

channel ORA_DISK_1: restoring spfile from AUTOBACKUP /ORAGG/backup/DUMMYGG05_2gnudgqg_1_1
channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
Finished restore at 03-JAN-13

RMAN> exit

Now copy spfile to all nodes & rename according to it.


------Restore controlfile

> rman target / catalog rman/RMAN@catalogdb

Recovery Manager: Release 11.2.0.3.0 - Production on Thu Jan 3 12:14:22 2013

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

connected to target database: DUMMYGG (not mounted)
connected to recovery catalog database

RMAN> set dbid=90275615;

executing command: SET DBID
database name is "DUMMYGG" and DBID is 90275615

RMAN> restore controlfile;

Starting restore at 03-JAN-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=156 instance=DUMMYGG1 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: copied control file copy
input file name=/u00/app/oracle/diag/control.ctl
output file name=+TESTGG/DUMMYGG/controlfile/current.958.803736875
Finished restore at 03-JAN-13

----------Mount all Instance.

Mount database on All nodes & make sure cluster_database parameter is set to TRUE

----------Restore database.

rman target / catalog rman/RMAN@catalogdb

run {
sql 'alter system set "_backup_disk_bufcnt"=64 scope=memory';
sql 'alter system set "_backup_disk_bufsz"=1048576 scope=memory';
sql 'alter system set "_backup_file_bufcnt"=64 scope=memory';
sql 'alter system set "_backup_file_bufsz"=1048576 scope=memory';
allocate channel c01 DEVICE TYPE DISK FORMAT '/ORAGG/backup/DUMMYGG01_%U' CONNECT 'sys/SYSTEM@DUMMYGG1';
allocate channel c02 DEVICE TYPE DISK FORMAT '/ORAGG/backup/DUMMYGG02_%U' CONNECT 'sys/SYSTEM@DUMMYGG1';
allocate channel c03 DEVICE TYPE DISK FORMAT '/ORAGG/backup/DUMMYGG03_%U' CONNECT 'sys/SYSTEM@DUMMYGG1';
allocate channel c04 DEVICE TYPE DISK FORMAT '/ORAGG/backup/DUMMYGG04_%U' CONNECT 'sys/SYSTEM@DUMMYGG1';
allocate channel c05 DEVICE TYPE DISK FORMAT '/ORAGG/backup/DUMMYGG05_%U' CONNECT 'sys/SYSTEM@DUMMYGG1';
allocate channel c06 DEVICE TYPE DISK FORMAT '/ORAGG/backup/DUMMYGG06_%U' CONNECT 'sys/SYSTEM@DUMMYGG1';
allocate channel c07 DEVICE TYPE DISK FORMAT '/ORAGG/backup/DUMMYGG07_%U' CONNECT 'sys/SYSTEM@DUMMYGG2';
allocate channel c08 DEVICE TYPE DISK FORMAT '/ORAGG/backup/DUMMYGG08_%U' CONNECT 'sys/SYSTEM@DUMMYGG2';
allocate channel c09 DEVICE TYPE DISK FORMAT '/ORAGG/backup/DUMMYGG09_%U' CONNECT 'sys/SYSTEM@DUMMYGG2';
allocate channel c10 DEVICE TYPE DISK FORMAT '/ORAGG/backup/DUMMYGG10_%U' CONNECT 'sys/SYSTEM@DUMMYGG2';
allocate channel c11 DEVICE TYPE DISK FORMAT '/ORAGG/backup/DUMMYGG11_%U' CONNECT 'sys/SYSTEM@DUMMYGG2';
allocate channel c12 DEVICE TYPE DISK FORMAT '/ORAGG/backup/DUMMYGG12_%U' CONNECT 'sys/SYSTEM@DUMMYGG2';
allocate channel c13 DEVICE TYPE DISK FORMAT '/ORAGG/backup/DUMMYGG13_%U' CONNECT 'sys/SYSTEM@DUMMYGG3';
allocate channel c14 DEVICE TYPE DISK FORMAT '/ORAGG/backup/DUMMYGG14_%U' CONNECT 'sys/SYSTEM@DUMMYGG3';
allocate channel c15 DEVICE TYPE DISK FORMAT '/ORAGG/backup/DUMMYGG15_%U' CONNECT 'sys/SYSTEM@DUMMYGG3';
allocate channel c16 DEVICE TYPE DISK FORMAT '/ORAGG/backup/DUMMYGG16_%U' CONNECT 'sys/SYSTEM@DUMMYGG3';
allocate channel c17 DEVICE TYPE DISK FORMAT '/ORAGG/backup/DUMMYGG17_%U' CONNECT 'sys/SYSTEM@DUMMYGG3';
allocate channel c18 DEVICE TYPE DISK FORMAT '/ORAGG/backup/DUMMYGG18_%U' CONNECT 'sys/SYSTEM@DUMMYGG3';
restore database;
release channel c01;
release channel c02;
release channel c03;
release channel c04;
release channel c05;
release channel c06;
release channel c07;
release channel c08;
release channel c09;
release channel c10;
release channel c11;
release channel c12;
release channel c13;
release channel c14;
release channel c15;
release channel c16;
release channel c17;
release channel c18;
}


---------recover database.

RMAN> run {
sql 'alter system set "_backup_disk_bufcnt"=64 scope=memory';
sql 'alter system set "_backup_disk_bufsz"=1048576 scope=memory';
sql 'alter system set "_backup_file_bufcnt"=64 scope=memory';
sql 'alter system set "_backup_file_bufsz"=1048576 scope=memory';
allocate channel c01 DEVICE TYPE DISK FORMAT '/ORAGG/backup/' CONNECT 'sys/SYSTEM@DUMMYGG1';
allocate channel c07 DEVICE TYPE DISK FORMAT '/ORAGG/backup/' CONNECT 'sys/SYSTEM@DUMMYGG2';
allocate channel c13 DEVICE TYPE DISK FORMAT '/ORAGG/backup/' CONNECT 'sys/SYSTEM@DUMMYGG3';
set until time "to_date('2013-01-02:13:00:00', 'yyyy-mm-dd:hh24:mi:ss')";
recover database;
release channel c01;
release channel c07;
release channel c13;
}


---------Open database in resetlogs on first instance & rest with normal.

TEST271 | DUMMYGG1 | /export/home/oracle/scripts/rman/log
sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Thu Jan 3 12:46:30 2013

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

12:47:01 @DUMMYGG1 SQL>alter database open resetlogs;

Database altered.

Elapsed: 00:00:14.39

TEST272 | DUMMYGG2 | /export/home/oracle
sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Thu Jan 3 12:47:43 2013

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

12:47:43 @DUMMYGG2 SQL>alter database open;

Database altered.

Elapsed: 00:00:03.92
12:47:50 @DUMMYGG2 SQL>



---------output of restore

sql statement: alter system set "_backup_disk_bufcnt"=64 scope=memory

sql statement: alter system set "_backup_disk_bufsz"=1048576 scope=memory

sql statement: alter system set "_backup_file_bufcnt"=64 scope=memory

sql statement: alter system set "_backup_file_bufsz"=1048576 scope=memory

allocated channel: c01
channel c01: SID=222 instance=DUMMYGG1 device type=DISK

allocated channel: c02
channel c02: SID=5 instance=DUMMYGG1 device type=DISK

allocated channel: c03
channel c03: SID=68 instance=DUMMYGG1 device type=DISK

allocated channel: c04
channel c04: SID=99 instance=DUMMYGG1 device type=DISK

allocated channel: c05
channel c05: SID=129 instance=DUMMYGG1 device type=DISK

allocated channel: c06
channel c06: SID=162 instance=DUMMYGG1 device type=DISK

allocated channel: c07
channel c07: SID=67 instance=DUMMYGG2 device type=DISK

allocated channel: c08
channel c08: SID=161 instance=DUMMYGG2 device type=DISK

allocated channel: c09
channel c09: SID=191 instance=DUMMYGG2 device type=DISK

allocated channel: c10
channel c10: SID=222 instance=DUMMYGG2 device type=DISK

allocated channel: c11
channel c11: SID=5 instance=DUMMYGG2 device type=DISK

allocated channel: c12
channel c12: SID=38 instance=DUMMYGG2 device type=DISK

allocated channel: c13
channel c13: SID=134 instance=DUMMYGG3 device type=DISK

allocated channel: c14
channel c14: SID=72 instance=DUMMYGG3 device type=DISK

allocated channel: c15
channel c15: SID=133 instance=DUMMYGG3 device type=DISK

allocated channel: c16
channel c16: SID=194 instance=DUMMYGG3 device type=DISK

allocated channel: c17
channel c17: SID=10 instance=DUMMYGG3 device type=DISK

allocated channel: c18
channel c18: SID=74 instance=DUMMYGG3 device type=DISK

Starting restore at 03-JAN-13

channel c01: starting datafile backup set restore
channel c01: specifying datafile(s) to restore from backup set
channel c01: restoring datafile 00003 to +TESTGG/DUMMYGG/datafile/undotbs1.258.792518685
channel c01: reading from backup piece /ORAGG/backup/DUMMYGG05_22nudgq6_1_1
channel c02: starting datafile backup set restore
channel c02: specifying datafile(s) to restore from backup set
channel c02: restoring datafile 00005 to +TESTGG/DUMMYGG/datafile/undotbs2.264.792518777
channel c02: reading from backup piece /ORAGG/backup/DUMMYGG06_23nudgq6_1_1
channel c03: starting datafile backup set restore
channel c03: specifying datafile(s) to restore from backup set
channel c03: restoring datafile 00006 to +TESTGG/DUMMYGG/datafile/undotbs3.265.792518777
channel c03: reading from backup piece /ORAGG/backup/DUMMYGG07_24nudgq6_1_1
channel c04: starting datafile backup set restore
channel c04: specifying datafile(s) to restore from backup set
channel c04: restoring datafile 00013 to +TESTGG/DUMMYGG/datafile/c2oindx_tbs.974.799865727
channel c04: reading from backup piece /ORAGG/backup/DUMMYGG08_25nudgq8_1_1
channel c05: starting datafile backup set restore
channel c05: specifying datafile(s) to restore from backup set
channel c05: restoring datafile 00014 to +TESTGG/DUMMYGG/datafile/c2odata_tbs.939.799865745
channel c05: reading from backup piece /ORAGG/backup/DUMMYGG09_26nudgqa_1_1
channel c06: starting datafile backup set restore
channel c06: specifying datafile(s) to restore from backup set
channel c06: restoring datafile 00009 to +TESTGG/DUMMYGG/datafile/idm_data.344.793627825
channel c06: reading from backup piece /ORAGG/backup/DUMMYGG10_27nudgqa_1_1
channel c07: starting datafile backup set restore
channel c07: specifying datafile(s) to restore from backup set
channel c07: restoring datafile 00015 to +TESTGG/DUMMYGG/datafile/c2odata_tbs_reorg1.948.799865763
channel c07: reading from backup piece /ORAGG/backup/DUMMYGG14_2bnudgqc_1_1
channel c08: starting datafile backup set restore
channel c08: specifying datafile(s) to restore from backup set
channel c08: restoring datafile 00016 to +TESTGG/DUMMYGG/datafile/mvlog_data.735.799865763
channel c08: reading from backup piece /ORAGG/backup/DUMMYGG15_2cnudgqc_1_1
channel c09: starting datafile backup set restore
channel c09: specifying datafile(s) to restore from backup set
channel c09: restoring datafile 00017 to +TESTGG/DUMMYGG/datafile/c2odata_tbs_reorg0.305.799865765
channel c09: reading from backup piece /ORAGG/backup/DUMMYGG16_2dnudgqe_1_1
channel c10: starting datafile backup set restore
channel c10: specifying datafile(s) to restore from backup set
channel c10: restoring datafile 00004 to +TESTGG/DUMMYGG/datafile/users.259.792518685
channel c10: reading from backup piece /ORAGG/backup/DUMMYGG18_2fnudgqg_1_1
channel c11: starting datafile backup set restore
channel c11: specifying datafile(s) to restore from backup set
channel c11: restoring datafile 00007 to +TESTGG/DUMMYGG/datafile/gg_data.312.793368947
channel c11: reading from backup piece /ORAGG/backup/DUMMYGG11_28nudgqb_1_1
channel c12: starting datafile backup set restore
channel c12: specifying datafile(s) to restore from backup set
channel c12: restoring datafile 00011 to +TESTGG/DUMMYGG/datafile/soa_data.328.795
channel c12: reading from backup piece /ORAGG/backup/DUMMYGG13_2anudgqc_1_1
channel c13: starting datafile backup set restore
channel c13: specifying datafile(s) to restore from backup set
channel c13: restoring datafile 00001 to +TESTGG/DUMMYGG/datafile/system.256.79251
channel c13: reading from backup piece /ORAGG/backup/DUMMYGG12_29nudgqb_1_1
channel c14: starting datafile backup set restore
channel c14: specifying datafile(s) to restore from backup set
channel c14: restoring datafile 00012 to +TESTGG/DUMMYGG/datafile/taps_data.617.79
channel c14: reading from backup piece /ORAGG/backup/DUMMYGG03_20nudgq5_1_1
channel c15: starting datafile backup set restore
channel c15: specifying datafile(s) to restore from backup set
channel c15: restoring datafile 00002 to +TESTGG/DUMMYGG/datafile/sysaux.257.79251
channel c15: reading from backup piece /ORAGG/backup/DUMMYGG04_21nudgq6_1_1
channel c16: starting datafile backup set restore
channel c16: specifying datafile(s) to restore from backup set
channel c16: restoring datafile 00008 to +TESTGG/DUMMYGG/datafile/identity_data.34
channel c16: reading from backup piece /ORAGG/backup/DUMMYGG01_1unudgq5_1_1
channel c17: starting datafile backup set restore
channel c17: specifying datafile(s) to restore from backup set
channel c17: restoring datafile 00010 to +TESTGG/DUMMYGG/datafile/taps_data.329.79
channel c17: reading from backup piece /ORAGG/backup/DUMMYGG02_1vnudgq5_1_1
channel c07: piece handle=/ORAGG/backup/DUMMYGG14_2bnudgqc_1_1 tag=TAG20130102T124658
channel c07: restored backup piece 1
channel c07: restore complete, elapsed time: 00:00:05
channel c08: piece handle=/ORAGG/backup/DUMMYGG15_2cnudgqc_1_1 tag=TAG20130102T124658
channel c08: restored backup piece 1
channel c08: restore complete, elapsed time: 00:00:05
channel c09: piece handle=/ORAGG/backup/DUMMYGG16_2dnudgqe_1_1 tag=TAG20130102T124658
channel c09: restored backup piece 1
channel c09: restore complete, elapsed time: 00:00:05
channel c10: piece handle=/ORAGG/backup/DUMMYGG18_2fnudgqg_1_1 tag=TAG20130102T124658
channel c10: restored backup piece 1
channel c10: restore complete, elapsed time: 00:00:17
channel c11: piece handle=/ORAGG/backup/DUMMYGG11_28nudgqb_1_1 tag=TAG20130102T124658
channel c11: restored backup piece 1
channel c11: restore complete, elapsed time: 00:00:17
channel c12: piece handle=/ORAGG/backup/DUMMYGG13_2anudgqc_1_1 tag=TAG20130102T124658
channel c12: restored backup piece 1
channel c12: restore complete, elapsed time: 00:00:17
channel c13: piece handle=/ORAGG/backup/DUMMYGG12_29nudgqb_1_1 tag=TAG20130102T124658
channel c13: restored backup piece 1
channel c13: restore complete, elapsed time: 00:00:37
channel c06: piece handle=/ORAGG/backup/DUMMYGG10_27nudgqa_1_1 tag=TAG20130102T124658
channel c06: restored backup piece 1
channel c06: restore complete, elapsed time: 00:00:57
channel c01: piece handle=/ORAGG/backup/DUMMYGG05_22nudgq6_1_1 tag=TAG20130102T124658
channel c01: restored backup piece 1
channel c01: restore complete, elapsed time: 00:01:58
channel c02: piece handle=/ORAGG/backup/DUMMYGG06_23nudgq6_1_1 tag=TAG20130102T124658
channel c02: restored backup piece 1
channel c02: restore complete, elapsed time: 00:02:48
channel c03: piece handle=/ORAGG/backup/DUMMYGG07_24nudgq6_1_1 tag=TAG20130102T124658
channel c03: restored backup piece 1
channel c03: restore complete, elapsed time: 00:02:48
channel c04: piece handle=/ORAGG/backup/DUMMYGG08_25nudgq8_1_1 tag=TAG20130102T124658
channel c04: restored backup piece 1
channel c04: restore complete, elapsed time: 00:02:48
channel c05: piece handle=/ORAGG/backup/DUMMYGG09_26nudgqa_1_1 tag=TAG20130102T124658
channel c05: restored backup piece 1
channel c05: restore complete, elapsed time: 00:02:48
channel c15: piece handle=/ORAGG/backup/DUMMYGG04_21nudgq6_1_1 tag=TAG20130102T124658
channel c15: restored backup piece 1
channel c15: restore complete, elapsed time: 00:04:37
channel c14: piece handle=/ORAGG/backup/DUMMYGG03_20nudgq5_1_1 tag=TAG20130102T124658
channel c14: restored backup piece 1
channel c14: restore complete, elapsed time: 00:05:07
channel c17: piece handle=/ORAGG/backup/DUMMYGG02_1vnudgq5_1_1 tag=TAG20130102T124658
channel c17: restored backup piece 1
channel c17: restore complete, elapsed time: 00:10:38
channel c16: piece handle=/ORAGG/backup/DUMMYGG01_1unudgq5_1_1 tag=TAG20130102T124658
channel c16: restored backup piece 1
channel c16: restore complete, elapsed time: 00:10:48
Finished restore at 03-JAN-13

released channel: c01

released channel: c02

released channel: c03

released channel: c04

released channel: c05

released channel: c06

released channel: c07

released channel: c08

released channel: c09

released channel: c10

released channel: c11

released channel: c12

released channel: c13

released channel: c14

released channel: c15

released channel: c16

released channel: c17

released channel: c18

RMAN> quit


Recovery Manager complete.




------output of recover database.

sql statement: alter system set "_backup_disk_bufcnt"=64 scope=memory

sql statement: alter system set "_backup_disk_bufsz"=1048576 scope=memory

sql statement: alter system set "_backup_file_bufcnt"=64 scope=memory

sql statement: alter system set "_backup_file_bufsz"=1048576 scope=memory

allocated channel: c01
channel c01: SID=5 instance=DUMMYGG1 device type=DISK

allocated channel: c07
channel c07: SID=67 instance=DUMMYGG2 device type=DISK

allocated channel: c13
channel c13: SID=133 instance=DUMMYGG3 device type=DISK

executing command: SET until clause

Starting recover at 03-JAN-13

starting media recovery

archived log for thread 1 with sequence 1697 is already on disk as file +TESTGG/DUMMYGG/archivelog/2013_01_02/thread_1_seq_1697.776.803667609
archived log for thread 2 with sequence 1140 is already on disk as file +TESTGG/DUMMYGG/archivelog/2013_01_02/thread_2_seq_1140.1090.803668029
archived log for thread 3 with sequence 1195 is already on disk as file +TESTGG/DUMMYGG/archivelog/2013_01_02/thread_3_seq_1195.485.803669415
archived log file name=+TESTGG/DUMMYGG/archivelog/2013_01_02/thread_1_seq_1697.776.803667609 thread=1 sequence=1697
archived log file name=+TESTGG/DUMMYGG/archivelog/2013_01_02/thread_2_seq_1140.1090.803668029 thread=2 sequence=1140
archived log file name=+TESTGG/DUMMYGG/archivelog/2013_01_02/thread_3_seq_1195.485.803669415 thread=3 sequence=1195
media recovery complete, elapsed time: 00:00:01
Finished recover at 03-JAN-13

released channel: c01

released channel: c07

released channel: c13

RMAN>

Tuesday, June 12, 2012

RMAN-06457: UNTIL scn

I was trying to Duplicate from 3 Node RAC to RAC, which was on 10.2.0.4

After taking backup of full db plus archivelog , It failed at below commands.

Starting Duplicate Db at 11-jun-2012 20:37:28
released channel: CH1
released channel: CH2
released channel: CH3
released channel: CH4
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 06/11/2012 21:53:00
RMAN-06457: UNTIL scn (10763359915928) is ahead of last scn in archived logs (10762406105542)

Issue ALTER SYSTEM ARCHIVELOG CURRENT before taking backup.

In my case, Node 3 was down.so the last & latest SCN was 10762406105542 in Thread 3.


INST_IDGROUP#THREAD#SEQUENCE#BYTESMEMBERSARCHIVEDSTATUSFIRST_CHANGE#FIRST_TIME             
1112502891048576001NOCURRENT107635400375836/12/2012 10:16
1212502881048576001NOACTIVE107635400310766/12/2012 10:15
1322508011048576001YESACTIVE107635377818156/12/2012 4:29
1422508001048576001YESINACTIVE107635377518366/12/2012 4:24
1532076311048576001YESINACTIVE107624060273086/9/2012 9:21
1632076301048576001YESINACTIVE107624059981966/9/2012 9:20
1732076321048576001YESINACTIVE107624060504306/9/2012 9:24
1832076331048576001YESACTIVE10762406105541   6/9/2012 9:59




Thursday, March 29, 2012

ORA-19870, ORA-19507, ORA-27029, ORA-19511 : Error received from media manager layer

run
{
ALLOCATE CHANNEL ch0 DEVICE TYPE 'SBT_TAPE' PARMS 'ENV=(NB_ORA_CLIENT=SERVERNAME.com,
NB_ORA_POLICY=,
NB_ORA_SERV=MASTER_BACKUPSERVER.com)';
RESTORE controlfile from 'c-2440775812-20120222-00';
}


using target database control file instead of recovery catalog
allocated channel: ch0
channel ch0: sid=427 devtype=SBT_TAPE
channel ch0: Veritas NetBackup for Oracle - Release 6.5 (2010042404)

Starting restore at 07-MAR-12

channel ch0: restoring control file
released channel: ch0
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 03/07/2012 12:25:51
ORA-19870: error reading backup piece c-2440775812-20120222-00
ORA-19507: failed to retrieve sequential file, handle="c-2440775812-20120222-00", parms=""
ORA-27029: skgfrtrv: sbtrestore returned error
ORA-19511: Error received from media manager layer, error text:
--see the text here --


Cause      No.   Message                                       
sbtopen   7000 Backup file not found (only returned for read)
          7001 File exists (only returned for write)         
          7002* Bad mode specified                            
          7003 Invalid block size specified                  
          7004 No tape device found                          
          7005 Device found, but busy; try again later       
          7006 Tape volume not found                         
          7007 Tape volume is in-use                         
          7008 I/O Error                                     
          7012* Invalid argument(s) to sbtopen                
sbtclose   7020* Invalid file handle or file not open          
          7021* Invalid flags to sbtclose                     
          7022 I/O error                                     
          7023 O/S error                                     
          7024* Invalid argument(s) to sbtclose               
          7025 Can't connect with Media Manager              
sbtwrite   7040* Invalid file handle or file not open          
          7041 End of volume reached                         
          7042 I/O error                                     
          7043 O/S error                                     
          7044* Invalid argument(s) to sbtwrite               
sbtread   7060* Invalid file handle or file not open          
          7061 EOF encountered                               
          7062 End of volume reached                         
          7063 I/O error                                     
          7064 O/S error                                     
          7065* Invalid argument(s) to sbtread                
sbtremove  7080 Backup file not found                         
          7081 Backup file in use                            
          7082 I/O Error                                     
          7083 Can't connect with Media Manager              
          7084 Permission denied                             
          7085 O/S error                                     
          7086* Invalid argument(s) to sbtremove              
sbtinfo   7090 Backup file not found                         
          7091 I/O Error                                     
          7092 Can't connect with Media Manager              
          7093 Permission denied                             
          7094 O/S error                                     
          7095* Invalid argument(s) to sbtinfo                
sbtinit   7110* Invalid argument(s) to sbtinit                
          7111 O/S error                                     


-check content of /usr/openv/netbackup/bp.conf


SERVER = masterserver.com
SERVER = devserver.com
SERVER = prodserver.com
EMMSERVER = masterserver.com
CLIENT_NAME = devserver.com
CLIENT_NAME = prodserver.com


THINGS TO CHECK

1) check link between Oracle and Netbackup.
lrwxr-xr-x   1 oracle     dba             36 Mar  7  2011 libobk.sl -> /usr/openv/netbackup/bin/libobk.sl64

Below are the API library for different Platform.

NetBackup API libraries

Platform        Oracle    Library Name     
AIX             32-bit    libobk.a              
AIX             64-bit    libobk.a64            
HP-UX           32-bit    libobk.sl           
HP-UX           64-bit    libobk.sl64         
IRIX            64-bit    libobk.so64          
Linux           32-bit    libobk.so           
Linux           64-bit    libobk.so64         
Linux Itanium   64-bit    libobk.so   
IBM pSeries     64-bit    libobk.so     
Solaris(SPARC)  32-bit    libobk.so.1                  
Solaris (SPARC) 64-bit    libobk.so64.1
Tru64           64-bit    libobk.so.1            

1 Use RMAN to make a backup directly to disk. Do not use NetBackup.
2 Use RMAN with NetBackup to create a backup.
3 Check the /usr/openv/netbackup/logs/dbclient directory permissions. They should be set to 777.
4 Look for a log file in /usr/openv/netbackup/logs/dbclient
If no log file exists, libobk is not linked into Oracle properly.

Note: you dont need to shutdown all instances.
You can create softlink without shutting down Database.
ln -s /usr/openv/netbackup/bin/libobk.sl64 /u01/app/oracle/product/10.2.0.3.0_1/lib/libobk.sl

if you want to create softlink safely , execute /usr/openv/netbackup/bin/oracle_link as below.

/usr/openv/netbackup->/usr/openv/netbackup/bin/oracle_link
Fri Mar 23 16:26:48 EDT 2012
All Oracle instances should be shutdown before running this script.

Please log into the Unix system as the Oracle owner for running this script

Do you want to continue? (y/n) [n] y


LIBOBK path: /usr/openv/netbackup/bin
ORACLE_HOME: /u01/app/oracle/product/10.2.0.3.0_1
Oracle version: 10.2.0.3.0
Linking LIBOBK (64 bits):
Moving libobk.sl to libobk.sl.back
ln -s /usr/openv/netbackup/bin/libobk.sl64 /u01/app/oracle/product/10.2.0.3.0_1/lib/libobk.sl
Done

Please check the trace file located in /tmp/make_trace.18515
to make sure the linking process was successful.



2) Check using sbttest.

(ncsci012):dncryp:/u01/app/oracle/product/10.2.0.3.0_1/dbs->sbttest mml.tst
The sbt function pointers are loaded from libobk.sl library.
-- sbtinit succeeded
-- sbtinit (2nd time) succeeded
sbtinit: Media manager supports SBT API version 2.0
sbtinit: Media manager is version 5.0.0.0
sbtinit: vendor description string=Veritas NetBackup for Oracle - Release 6.5 (2010042404)
sbtinit: allocated sbt context area of 8 bytes
sbtinit: proxy copy is supported
-- sbtinit2 succeeded
-- regular_backup_restore starts ................................
MMAPI error from sbtbackup: 7501, VxBSACreateObject: Failed with error:
   Server Status:  Communication with the server has not been initiated or the server status has not been retrieved from the serve
-- sbtbackup failed


% sbttest
The program displays the list of possible arguments for the program:

Error: backup file name must be specified
Usage: sbttest backup_file_name # this is the only required parameter
               <-dbname database_name>
               <-trace trace_file_name>
               <-remove_before>
               <-no_remove_after> 
               <-read_only>
               <-no_regular_backup_restore>
               <-no_proxy_backup>
               <-no_proxy_restore>
               <-file_type n>
               <-copy_number n>
               <-media_pool n>
               <-os_res_size n>
               <-pl_res_size n>
               <-block_size block_size> 
               <-block_count block_count>
               <-proxy_file os_file_name bk_file_name 
               [os_res_size pl_res_size block_size block_count]>
               <-libname sbt_library_name>


3) Read More into logfiles.
/usr/openv/netbackup/logs/dbclient

4) check below directory and files
/opt/openv/netbackup/db/altnames/No.Restrictions

Sunday, March 25, 2012

11gR2 backup-based DUPLICATE / Duplicate from Backup Location


1) Take full backup of SOURCE db + Archivelog.
2) Move backup to Target server on backup location.
3) Prepare init file for Auxiliary Instance.
4) Start Duplicate using RMAN. ( please see the Note at end of the Post )

=================================================================

1) TAKE THE BACKUP OF DB PLUS ARCHIVELOG
TESTDGP:DGP:/u01/dgp/backup->rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Fri Mar 2 18:36:14 2012

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

connected to target database: DGP (DBID=1579930627)

RMAN> backup database plus archivelog not backed up 1 times;

Starting backup at 02-MAR-12

current log archived

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=32 device type=DISK

allocated channel: ORA_DISK_2

channel ORA_DISK_2: SID=51 device type=DISK

skipping archived log file /u00/app/oracle/admin/DGP/arch/1_23_772639109.dbf; already backed up 1 time(s)

skipping archived log file /u00/app/oracle/admin/DGP/arch/1_24_772639109.dbf; already backed up 1 time(s)

skipping archived log file /u00/app/oracle/admin/DGP/arch/1_25_772639109.dbf; already backed up 1 time(s)

skipping archived log file /u00/app/oracle/admin/DGP/arch/1_26_772639109.dbf; already backed up 1 time(s)

skipping archived log file /u00/app/oracle/admin/DGP/arch/1_27_772639109.dbf; already backed up 1 time(s)

skipping archived log file /u00/app/oracle/admin/DGP/arch/1_28_772639109.dbf; already backed up 1 time(s)

skipping archived log file /u00/app/oracle/admin/DGP/arch/1_29_772639109.dbf; already backed up 1 time(s)

skipping archived log file /u00/app/oracle/admin/DGP/arch/1_30_772639109.dbf; already backed up 1 time(s)

skipping archived log file /u00/app/oracle/admin/DGP/arch/1_31_772639109.dbf; already backed up 1 time(s)

skipping archived log file /u00/app/oracle/admin/DGP/arch/1_32_772639109.dbf; already backed up 1 time(s)

skipping archived log file /u00/app/oracle/admin/DGP/arch/1_33_772639109.dbf; already backed up 1 time(s)

skipping archived log file /u00/app/oracle/admin/DGP/arch/1_34_772639109.dbf; already backed up 1 time(s)

skipping archived log file /u00/app/oracle/admin/DGP/arch/1_35_772639109.dbf; already backed up 1 time(s)

skipping archived log file /u00/app/oracle/admin/DGP/arch/1_36_772639109.dbf; already backed up 1 time(s)

skipping archived log file /u00/app/oracle/admin/DGP/arch/1_37_772639109.dbf; already backed up 1 time(s)

skipping archived log file /u00/app/oracle/admin/DGP/arch/1_38_772639109.dbf; already backed up 1 time(s)

skipping archived log file /u00/app/oracle/admin/DGP/arch/1_39_772639109.dbf; already backed up 1 time(s)

skipping archived log file /u00/app/oracle/admin/DGP/arch/1_40_772639109.dbf; already backed up 1 time(s)

channel ORA_DISK_1: starting archived log backup set

channel ORA_DISK_1: specifying archived log(s) in backup set

input archived log thread=1 sequence=41 RECID=26 STAMP=774636558

input archived log thread=1 sequence=42 RECID=27 STAMP=774636857

channel ORA_DISK_1: starting piece 1 at 02-MAR-12

channel ORA_DISK_2: starting archived log backup set

channel ORA_DISK_2: specifying archived log(s) in backup set

input archived log thread=1 sequence=43 RECID=28 STAMP=776889380

channel ORA_DISK_2: starting piece 1 at 02-MAR-12

channel ORA_DISK_1: finished piece 1 at 02-MAR-12

piece handle=/u01/dgp/backup/Backup_0rn4sp15_1_1 tag=TAG20120302T183621 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

channel ORA_DISK_2: finished piece 1 at 02-MAR-12

piece handle=/u01/dgp/backup/Backup_0sn4sp15_1_1 tag=TAG20120302T183621 comment=NONE

channel ORA_DISK_2: backup set complete, elapsed time: 00:00:01

Finished backup at 02-MAR-12

Starting backup at 02-MAR-12

using channel ORA_DISK_1

using channel ORA_DISK_2

channel ORA_DISK_1: starting full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

input datafile file number=00001 name=/u01/dgp/data/system01.dbf

input datafile file number=00005 name=/u01/dgp/data/TEST.dbf

channel ORA_DISK_1: starting piece 1 at 02-MAR-12

channel ORA_DISK_2: starting full datafile backup set

channel ORA_DISK_2: specifying datafile(s) in backup set

input datafile file number=00002 name=/u01/dgp/data/sysaux01.dbf

input datafile file number=00003 name=/u01/dgp/data/undotbs01.dbf

input datafile file number=00004 name=/u01/dgp/data/users01.dbf

channel ORA_DISK_2: starting piece 1 at 02-MAR-12

channel ORA_DISK_1: finished piece 1 at 02-MAR-12

piece handle=/u01/dgp/backup/Backup_0tn4sp17_1_1 tag=TAG20120302T183622 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:01:05

channel ORA_DISK_2: finished piece 1 at 02-MAR-12

piece handle=/u01/dgp/backup/Backup_0un4sp17_1_1 tag=TAG20120302T183622 comment=NONE

channel ORA_DISK_2: backup set complete, elapsed time: 00:01:05

Finished backup at 02-MAR-12

Starting backup at 02-MAR-12

current log archived

using channel ORA_DISK_1

using channel ORA_DISK_2

channel ORA_DISK_1: starting archived log backup set

channel ORA_DISK_1: specifying archived log(s) in backup set

input archived log thread=1 sequence=44 RECID=29 STAMP=776889448

channel ORA_DISK_1: starting piece 1 at 02-MAR-12

channel ORA_DISK_1: finished piece 1 at 02-MAR-12

piece handle=/u01/dgp/backup/Backup_0vn4sp38_1_1 tag=TAG20120302T183728 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

Finished backup at 02-MAR-12

Starting Control File and SPFILE Autobackup at 02-MAR-12

piece handle=/u01/dgp/backup/CONTROL_c-1579930627-20120302-00 comment=NONE

Finished Control File and SPFILE Autobackup at 02-MAR-12

2) MOVE TO BACKUP TO TARGET SERVER.

TESTDGP:DGP:/u01/dgp/backup->scp * oracle@169.254.12.77:/u01/dgd/backup

The authenticity of host '169.254.12.77 (169.254.12.77)' can't be established.

RSA key fingerprint is 8a:8f:1e:14:63:4f:41:0c:20:6f:7c:d1:73:a8:0a:78.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added '169.254.12.77' (RSA) to the list of known hosts.

oracle@169.254.12.77's password:

TESTDGD:DGD:/u01/dgd/backup->ll

total 1270188

-rwxrwxrwx 1 oracle oinstall 9920000 Mar 2 18:53 Backup_0ln2o0da_1_1

-rwxrwxrwx 1 oracle oinstall 9459712 Mar 2 18:53 Backup_0mn2o0da_1_1

-rwxrwxrwx 1 oracle oinstall 186466304 Mar 2 18:53 Backup_0nn2o0di_1_1

-rwxrwxrwx 1 oracle oinstall 77037568 Mar 2 18:53 Backup_0on2o0di_1_1

-rwxrwxrwx 1 oracle oinstall 13312 Mar 2 18:53 Backup_0pn2o0fj_1_1

-rwxrwxrwx 1 oracle oinstall 10483712 Mar 2 18:53 Backup_0rn4sp15_1_1

-rwxrwxrwx 1 oracle oinstall 1315328 Mar 2 18:53 Backup_0sn4sp15_1_1

-rwxrwxrwx 1 oracle oinstall 612065280 Mar 2 18:54 Backup_0tn4sp17_1_1

-rwxrwxrwx 1 oracle oinstall 372899840 Mar 2 18:55 Backup_0un4sp17_1_1

-rwxrwxrwx 1 oracle oinstall 5120 Mar 2 18:55 Backup_0vn4sp38_1_1

-rwxrwxrwx 1 oracle oinstall 9830400 Mar 2 18:55 CONTROL_c-1579930627-20120207-00

-rwxrwxrwx 1 oracle oinstall 9830400 Mar 2 18:55 CONTROL_c-1579930627-20120302-00

drwxr-x--- 3 oracle oinstall 4096 Mar 2 20:23 DGD


3) Make init file for auxiliary db on Target side.
audit_file_dest='/u00/app/oracle/admin/DGD/adump'

audit_trail='DB'

compatible='11.2.0.0.0'

control_files='/u01/dgd/control/control01.ctl'

control_files='/u01/dgd/control/control02.ctl'

core_dump_dest='/u00/app/oracle/diag/rdbms/dgd/DGD/cdump'

db_block_size=8192

db_domain=''

db_name='DGD'

db_recovery_file_dest='/u01/dgd/backup'

db_recovery_file_dest_size=1000M

diagnostic_dest='/u00/app/oracle'

dispatchers='(PROTOCOL=TCP) (SERVICE=DGDXDB)'

log_buffer=4726784 # log buffer update

memory_target=252M

open_cursors=300

optimizer_dynamic_sampling=2

optimizer_mode='ALL_ROWS'

plsql_warnings='DISABLE:ALL' # PL/SQL warnings at init.ora

processes=150

query_rewrite_enabled='TRUE'

remote_login_passwordfile='EXCLUSIVE'

result_cache_max_size=672K

skip_unusable_indexes=TRUE

undo_tablespace='UNDOTBS1'

LOCAL_LISTENER=LISTENER_TESTDGD

#parameter_value_convert=('/dgp','/dgd','/DGP','/DGD')

log_file_name_convert=('dgp','dgd') db_file_name_convert=('dgp','dgd')


4) see how far you want restore.

RMAN> list backup of archivelog from sequence 39;

using target database control file instead of recovery catalog

List of Backup Sets

===================

BS Key Size Device Type Elapsed Time Completion Time

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

1 9.02M DISK 00:00:02 07-feb-2012 16:39:08

BP Key: 1 Status: AVAILABLE Compressed: YES Tag: TAG20120207T163906

Piece Name: /u01/dgp/backup/Backup_0mn2o0da_1_1

List of Archived Logs in backup set 1

Thrd Seq Low SCN Low Time Next SCN Next Time

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

1 39 1009921 07-feb-2012 16:36:55 1009995 07-feb-2012 16:39:06

BS Key Size Device Type Elapsed Time Completion Time

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

5 12.50K DISK 00:00:00 07-feb-2012 16:40:19

BP Key: 5 Status: AVAILABLE Compressed: YES Tag: TAG20120207T164019

Piece Name: /u01/dgp/backup/Backup_0pn2o0fj_1_1

List of Archived Logs in backup set 5

Thrd Seq Low SCN Low Time Next SCN Next Time

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

1 40 1009995 07-feb-2012 16:39:06 1010041 07-feb-2012 16:40:19

BS Key Size Device Type Elapsed Time Completion Time

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

7 1.25M DISK 00:00:00 02-mar-2012 18:36:21

BP Key: 7 Status: AVAILABLE Compressed: NO Tag: TAG20120302T183621

Piece Name: /u01/dgp/backup/Backup_0sn4sp15_1_1

List of Archived Logs in backup set 7

Thrd Seq Low SCN Low Time Next SCN Next Time

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

1 43 1011700 07-feb-2012 16:54:16 1013321 02-mar-2012 18:36:20

BS Key Size Device Type Elapsed Time Completion Time

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

8 10.00M DISK 00:00:01 02-mar-2012 18:36:22

BP Key: 8 Status: AVAILABLE Compressed: NO Tag: TAG20120302T183621

Piece Name: /u01/dgp/backup/Backup_0rn4sp15_1_1

List of Archived Logs in backup set 8

Thrd Seq Low SCN Low Time Next SCN Next Time

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

1 41 1010041 07-feb-2012 16:40:19 1010398 07-feb-2012 16:49:18

1 42 1010398 07-feb-2012 16:49:18 1011700 07-feb-2012 16:54:16

BS Key Size Device Type Elapsed Time Completion Time

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

11 4.50K DISK 00:00:00 02-mar-2012 18:37:28

BP Key: 11 Status: AVAILABLE Compressed: NO Tag: TAG20120302T183728

Piece Name: /u01/dgp/backup/Backup_0vn4sp38_1_1

List of Archived Logs in backup set 11

Thrd Seq Low SCN Low Time Next SCN Next Time

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

1 44 1013321 02-mar-2012 18:36:20 1013361 02-mar-2012 18:37:28


5) Duplicate

TESTDGD:DGD:/u01/dgd/backup->rman auxiliary /

Recovery Manager: Release 11.2.0.1.0 - Production on Fri Mar 2 19:55:49 2012

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

connected to auxiliary database: DGD (not mounted)

RMAN> run

{

allocate auxiliary channel DUP1 type disk;

allocate auxiliary channel DUP2 type disk;

duplicate target database to DGD until time "to_date('03/02/2012 18:35:00','mm/dd/yy hh24:mi:ss')" backup location '/u01/dgd/backup';

}2> 3> 4> 5> 6>

allocated channel: DUP1

channel DUP1: SID=20 device type=DISK

allocated channel: DUP2

channel DUP2: SID=21 device type=DISK

Starting Duplicate Db at 02-MAR-12

contents of Memory Script:

{

sql clone "create spfile from memory";

}

executing Memory Script

sql statement: create spfile from memory

contents of Memory Script:

{

shutdown clone immediate;

startup clone nomount;

}

executing Memory Script

Oracle instance shut down

connected to auxiliary database (not started)

Oracle instance started

Total System Global Area 263049216 bytes

Fixed Size 2212448 bytes

Variable Size 209718688 bytes

Database Buffers 46137344 bytes

Redo Buffers 4980736 bytes

allocated channel: DUP1

channel DUP1: SID=18 device type=DISK

allocated channel: DUP2

channel DUP2: SID=19 device type=DISK

contents of Memory Script:

{

sql clone "alter system set db_name =

''DGP'' comment=

''Modified by RMAN duplicate'' scope=spfile";

sql clone "alter system set db_unique_name =

''DGD'' comment=

''Modified by RMAN duplicate'' scope=spfile";

shutdown clone immediate;

startup clone force nomount

restore clone primary controlfile from '/u01/dgd/backup/CONTROL_c-1579930627-20120207-00';

alter clone database mount;

}

executing Memory Script

sql statement: alter system set db_name = ''DGP'' comment= ''Modified by RMAN duplicate'' scope=spfile

sql statement: alter system set db_unique_name = ''DGD'' comment= ''Modified by RMAN duplicate'' scope=spfile

Oracle instance shut down

Oracle instance started

Total System Global Area 263049216 bytes

Fixed Size 2212448 bytes

Variable Size 209718688 bytes

Database Buffers 46137344 bytes

Redo Buffers 4980736 bytes

allocated channel: DUP1

channel DUP1: SID=18 device type=DISK

allocated channel: DUP2

channel DUP2: SID=19 device type=DISK

Starting restore at 02-MAR-12

channel DUP2: skipped, AUTOBACKUP already found

channel DUP1: restoring control file

channel DUP1: restore complete, elapsed time: 00:00:09

output file name=/u01/dgd/control/control01.ctl

output file name=/u01/dgd/control/control02.ctl

Finished restore at 02-MAR-12

database mounted

contents of Memory Script:

{

set until scn 1010006;

set newname for datafile 1 to

"/u01/dgd/data/system01.dbf";

set newname for datafile 2 to

"/u01/dgd/data/sysaux01.dbf";

set newname for datafile 3 to

"/u01/dgd/data/undotbs01.dbf";

set newname for datafile 4 to

"/u01/dgd/data/users01.dbf";

set newname for datafile 5 to

"/u01/dgd/data/TEST.dbf";

restore

clone database

;

}

executing Memory Script

executing command: SET until clause

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 02-MAR-12

channel DUP1: starting datafile backup set restore

channel DUP1: specifying datafile(s) to restore from backup set

channel DUP1: restoring datafile 00001 to /u01/dgd/data/system01.dbf

channel DUP1: restoring datafile 00005 to /u01/dgd/data/TEST.dbf

channel DUP1: reading from backup piece /u01/dgd/backup/Backup_0nn2o0di_1_1

channel DUP2: starting datafile backup set restore

channel DUP2: specifying datafile(s) to restore from backup set

channel DUP2: restoring datafile 00002 to /u01/dgd/data/sysaux01.dbf

channel DUP2: restoring datafile 00003 to /u01/dgd/data/undotbs01.dbf

channel DUP2: restoring datafile 00004 to /u01/dgd/data/users01.dbf

channel DUP2: reading from backup piece /u01/dgd/backup/Backup_0on2o0di_1_1

channel DUP2: piece handle=/u01/dgd/backup/Backup_0on2o0di_1_1 tag=TAG20120207T163913

channel DUP2: restored backup piece 1

channel DUP2: restore complete, elapsed time: 00:01:06

channel DUP1: piece handle=/u01/dgd/backup/Backup_0nn2o0di_1_1 tag=TAG20120207T163913

channel DUP1: restored backup piece 1

channel DUP1: restore complete, elapsed time: 00:01:20

Finished restore at 02-MAR-12

contents of Memory Script:

{

switch clone datafile all;

}

executing Memory Script

datafile 1 switched to datafile copy

input datafile copy RECID=6 STAMP=776895801 file name=/u01/dgd/data/system01.dbf

datafile 2 switched to datafile copy

input datafile copy RECID=7 STAMP=776895801 file name=/u01/dgd/data/sysaux01.dbf

datafile 3 switched to datafile copy

input datafile copy RECID=8 STAMP=776895801 file name=/u01/dgd/data/undotbs01.dbf

datafile 4 switched to datafile copy

input datafile copy RECID=9 STAMP=776895801 file name=/u01/dgd/data/users01.dbf

datafile 5 switched to datafile copy

input datafile copy RECID=10 STAMP=776895801 file name=/u01/dgd/data/TEST.dbf

contents of Memory Script:

{

set until time "to_date('03/02/2012 18:35:00','mm/dd/yy hh24:mi:ss')";

recover

clone database

delete archivelog

;

}

executing Memory Script

executing command: SET until clause

Starting recover at 02-MAR-12

starting media recovery

channel DUP1: starting archived log restore to default destination

channel DUP1: restoring archived log

archived log thread=1 sequence=40

channel DUP1: reading from backup piece /u01/dgd/backup/Backup_0pn2o0fj_1_1

channel DUP2: starting archived log restore to default destination

channel DUP2: restoring archived log

archived log thread=1 sequence=41

channel DUP2: restoring archived log

archived log thread=1 sequence=42

channel DUP2: reading from backup piece /u01/dgd/backup/Backup_0rn4sp15_1_1

channel DUP1: piece handle=/u01/dgd/backup/Backup_0pn2o0fj_1_1 tag=TAG20120207T164019

channel DUP1: restored backup piece 1

channel DUP1: restore complete, elapsed time: 00:00:01

archived log file name=/u01/dgd/backup/DGD/archivelog/2012_03_02/o1_mf_1_40_7o2wnclz_.arc thread=1 sequence=40

channel clone_default: deleting archived log(s)

archived log file name=/u01/dgd/backup/DGD/archivelog/2012_03_02/o1_mf_1_40_7o2wnclz_.arc RECID=1 STAMP=776895803

channel DUP1: starting archived log restore to default destination

channel DUP1: restoring archived log

archived log thread=1 sequence=43

channel DUP1: reading from backup piece /u01/dgd/backup/Backup_0sn4sp15_1_1

channel DUP2: piece handle=/u01/dgd/backup/Backup_0rn4sp15_1_1 tag=TAG20120302T183621

channel DUP2: restored backup piece 1

channel DUP2: restore complete, elapsed time: 00:00:02

archived log file name=/u01/dgd/backup/DGD/archivelog/2012_03_02/o1_mf_1_41_7o2wnclo_.arc thread=1 sequence=41

channel clone_default: deleting archived log(s)

archived log file name=/u01/dgd/backup/DGD/archivelog/2012_03_02/o1_mf_1_41_7o2wnclo_.arc RECID=2 STAMP=776895804

archived log file name=/u01/dgd/backup/DGD/archivelog/2012_03_02/o1_mf_1_42_7o2wncnw_.arc thread=1 sequence=42

channel clone_default: deleting archived log(s)

archived log file name=/u01/dgd/backup/DGD/archivelog/2012_03_02/o1_mf_1_42_7o2wncnw_.arc RECID=3 STAMP=776895804

channel DUP1: piece handle=/u01/dgd/backup/Backup_0sn4sp15_1_1 tag=TAG20120302T183621

channel DUP1: restored backup piece 1

channel DUP1: restore complete, elapsed time: 00:00:10

archived log file name=/u01/dgd/backup/DGD/archivelog/2012_03_02/o1_mf_1_43_7o2wnfmf_.arc thread=1 sequence=43

channel clone_default: deleting archived log(s)

archived log file name=/u01/dgd/backup/DGD/archivelog/2012_03_02/o1_mf_1_43_7o2wnfmf_.arc RECID=4 STAMP=776895805

media recovery complete, elapsed time: 00:00:03

Finished recover at 02-MAR-12

contents of Memory Script:

{

shutdown clone immediate;

startup clone nomount;

sql clone "alter system set db_name =

''DGD'' comment=

''Reset to original value by RMAN'' scope=spfile";

sql clone "alter system reset db_unique_name scope=spfile";

shutdown clone immediate;

startup clone nomount;

}

executing Memory Script

database dismounted

Oracle instance shut down

connected to auxiliary database (not started)

Oracle instance started

Total System Global Area 263049216 bytes

Fixed Size 2212448 bytes

Variable Size 209718688 bytes

Database Buffers 46137344 bytes

Redo Buffers 4980736 bytes

allocated channel: DUP1

channel DUP1: SID=18 device type=DISK

allocated channel: DUP2

channel DUP2: SID=19 device type=DISK

sql statement: alter system set db_name = ''DGD'' comment= ''Reset to original value by RMAN'' scope=spfile

sql statement: alter system reset db_unique_name scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)

Oracle instance started

Total System Global Area 263049216 bytes

Fixed Size 2212448 bytes

Variable Size 209718688 bytes

Database Buffers 46137344 bytes

Redo Buffers 4980736 bytes

allocated channel: DUP1

channel DUP1: SID=18 device type=DISK

allocated channel: DUP2

channel DUP2: SID=19 device type=DISK

sql statement: CREATE CONTROLFILE REUSE SET DATABASE "DGD" RESETLOGS ARCHIVELOG

MAXLOGFILES 16

MAXLOGMEMBERS 3

MAXDATAFILES 100

MAXINSTANCES 8

MAXLOGHISTORY 292

LOGFILE

GROUP 1 ( '/u01/dgd/redo/redo01.log' ) SIZE 5 M REUSE,

GROUP 2 ( '/u01/dgd/redo/redo02.log' ) SIZE 5 M REUSE,

GROUP 3 ( '/u01/dgd/redo/redo03.log' ) SIZE 5 M REUSE

DATAFILE

'/u01/dgd/data/system01.dbf'

CHARACTER SET WE8MSWIN1252

contents of Memory Script:

{

set newname for tempfile 1 to

"/u01/dgd/data/temp01.dbf";

switch clone tempfile all;

catalog clone datafilecopy "/u01/dgd/data/sysaux01.dbf",

"/u01/dgd/data/undotbs01.dbf",

"/u01/dgd/data/users01.dbf",

"/u01/dgd/data/TEST.dbf";

switch clone datafile all;

}

executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to /u01/dgd/data/temp01.dbf in control file

cataloged datafile copy

datafile copy file name=/u01/dgd/data/sysaux01.dbf RECID=1 STAMP=776895859

cataloged datafile copy

datafile copy file name=/u01/dgd/data/undotbs01.dbf RECID=2 STAMP=776895859

cataloged datafile copy

datafile copy file name=/u01/dgd/data/users01.dbf RECID=3 STAMP=776895859

cataloged datafile copy

datafile copy file name=/u01/dgd/data/TEST.dbf RECID=4 STAMP=776895859

datafile 2 switched to datafile copy

input datafile copy RECID=1 STAMP=776895859 file name=/u01/dgd/data/sysaux01.dbf

datafile 3 switched to datafile copy

input datafile copy RECID=2 STAMP=776895859 file name=/u01/dgd/data/undotbs01.dbf

datafile 4 switched to datafile copy

input datafile copy RECID=3 STAMP=776895859 file name=/u01/dgd/data/users01.dbf

datafile 5 switched to datafile copy

input datafile copy RECID=4 STAMP=776895859 file name=/u01/dgd/data/TEST.dbf

contents of Memory Script:

{

Alter clone database open resetlogs;

}

executing Memory Script

database opened

Finished Duplicate Db at 02-MAR-12

released channel: DUP1

released channel: DUP2


NOTE:

• log_file_name_convert=('dgp','dgd') is not allowed by Rman
• until SCN Clause is not allowed by RMAN.
• if no log_file_name_convert found than Oracle will create Redo into backup location /BACKUP_LOCATION/DB_NAME/onlinelog/

Thursday, February 9, 2012

Rename/Move Datafile without putting Tablespace offline.

Below is a Demo where I had to Move datafile . its always a best practice & safe to offline whole Tablespace. But sometimes we don't get that liberty. Just for experimental purpose I Move/rename single Datafile of Tablespace which has 8 more Datafiles. The method dont applied to database running on Noarchivelog mode,because Recovery will be needed.

=======================================
Offline datafile. 
=======================================
SQL> ALTER DATABASE DATAFILE 62 OFFLINE;

Database altered.

=======================================
Move datafile 
=======================================
[NEW_DB](SERVERABC)/u01/oradata03/OLD_DB-> cp /u01/oradata03/OLD_DB/grr_04_d_17.dbf /u01/oradata01/NEW_DB/

=======================================
Rename datafile 
=======================================
SQL> ALTER DATABASE RENAME FILE '/u01/oradata03/OLD_DB/grr_04_d_17.dbf' TO '/u01/oradata01/NEW_DB/grr_04_d_17.dbf';

Database altered.

SQL> ALTER DATABASE DATAFILE 62 ONLINE;
ALTER DATABASE DATAFILE 62 ONLINE
*
ERROR at line 1:
ORA-01113: file 62 needs media recovery if it was restored from backup, or END
BACKUP if it was not
ORA-01110: data file 62: '/u01/oradata01/NEW_DB/grr_04_d_17.dbf'

=======================================
Recover datafile
=======================================

SQL> recover datafile 62;

Media recovery complete.

=======================================
Online datafile
=======================================

SQL> ALTER DATABASE DATAFILE 62 online;

Sunday, January 22, 2012

Duplicate database from Active database.


This Post is to Duplicate database from Active database.

Visit to  To Duplicate database from Active database for standby

Target Auxiliary
SERVERDGPDGS
DATABASEDGPDGS
LISTENERLISTENER_TESTDGP ON 1521LISTENER_TESTDGS ON 1524
SID_LIST_LISTENER_TESTDGP =
 (SID_LIST =
   (SID_DESC =
     (SID_NAME = PLSExtProc)
     (ORACLE_HOME = /u00/app/oracle/product/11.2.0/db_1)
     (PROGRAM = extproc)
   )
  (SID_DESC =
     (GLOBAL_DBNAME = DGP)
     (SID_NAME = DGP)
     (ORACLE_HOME = /u00/app/oracle/product/11.2.0/db_1)
    )
 )

LISTENER_TESTDGP =
 (DESCRIPTION_LIST =
   (DESCRIPTION =
     (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
     (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.80.173 )(PORT = 1521))
   )
 )

SID_LIST_LISTENER_TESTDGS =
 (SID_LIST =
   (SID_DESC =
     (SID_NAME = PLSExtProc)
     (ORACLE_HOME = /u00/app/oracle/product/11.2.0/db_1)
     (PROGRAM = extproc)
   )
  (SID_DESC =
     (GLOBAL_DB_NAME=DGS)
     (SID_NAME = DGS)
     (ORACLE_HOME = /u00/app/oracle/product/11.2.0/db_1)
    )
 )

LISTENER_TESTDGS =
 (DESCRIPTION_LIST =
   (DESCRIPTION =
     (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
     (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.80.176 )(PORT = 1524))
   )
 )


========================================================================
NOTE: You must set LOCAL_LISTENER parameter in PFILE and enter Listener Defination in tsnames.ora.
if your listener is not running on default port. MAKE STATIC REGISTRATION OF AUXILIARY INSTANCE in LISTENER.
Test connection make sure if you can connect and restart Auxiliary instance from Target server.
If it fails to connect auxiliary instance use (UR=A) in your tnsentry ,as showed below.
========================================================================

--tnsnames.ora on Target side

DGP=(description=(address=(protocol=tcp)(host= 192.168.80.173 )(port=1521))(connect_data=(SERVER=DEDICATED)(SID=DGP)))
DGD=(description=(address=(protocol=tcp)(host=192.168.80.177 )(port=1524))(connect_data=(SERVER=DEDICATED)(service_name=DGD)))
DGS=(description=(address=(protocol=tcp)(host=192.168.80.176 )(port=1524))(connect_data=(SERVER=DEDICATED)(service_name=DGS)(UR=A)))


--tnsnames.ora on Auxilary side

DGP=(description=(address=(protocol=tcp)(host= 192.168.80.173 )(port=1521))(connect_data=(SERVER=DEDICATED)(SID=DGP)))
DGS=(description=(address=(protocol=tcp)(host=192.168.80.176 )(port=1524))(connect_data=(SERVER=DEDICATED)(service_name=DGS)(UR=A) ))

LISTENER_TESTDGS =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.80.176 )(PORT = 1524))
    )
  )

========================================================================
LOCATION

TARGET SIDE.

--DATAFILES 
/u01/dgp/data/users01.dbf
/u01/dgp/data/undotbs01.dbf
/u01/dgp/data/sysaux01.dbf
/u01/dgp/data/system01.dbf
/u01/dgp/data/TEST.dbf

--REDOLOG
/u01/dgp/redo/redo03.log
/u01/dgp/redo/redo02.log
/u01/dgp/redo/redo01.log

--OTHER PARAMETERS
audit_file_dest='/u00/app/oracle/admin/DGP/adump'
audit_trail='DB'
compatible='11.2.0.0.0'
control_files='/u01/dgp/control/control01.ctl'
control_files='/u01/dgp/control/control02.ctl'
core_dump_dest='/u00/app/oracle/diag/rdbms/dgp/DGP/cdump'
db_block_size=8192
db_domain=''
db_name='DGP'
db_recovery_file_dest='/u00/app/oracle/admin/dgp/flashback'
db_recovery_file_dest_size=1000M
diagnostic_dest='/u00/app/oracle'
dispatchers='(PROTOCOL=TCP) (SERVICE=DGPXDB)'
remote_login_passwordfile='EXCLUSIVE'
result_cache_max_size=672K
log_archive_dest_1     LOCATION=/u00/app/oracle/admin/DGP/arch

========================================================================
Password File

Copy password file of target database to auxiliary database and rename Accordigly.
========================================================================
Lets Duplicate.

Note : if you Invoke RMAN from Auxiliary server. you can connect "rman target sys/system@DGP auxiliary /"

TESTDGS:DGS:/u00/app/oracle/product/11.2.0/db_1/dbs::rman target sys/system@DGP auxiliary=sys/system@DGS

connected to target database: DGP (DBID=1579930627)
connected to auxiliary database: DGS (not mounted)

Below is RMAN run block to duplicate.

RMAN>>
run
{
allocate channel prmy1 type disk;
allocate auxiliary channel stby1 type disk;
duplicate target database to DGS from active database
spfile
parameter_value_convert '/dgp','/dgs','/DGP','/DGS'
set db_file_name_convert='dgp','dgs'
set log_file_name_convert='dgp','dgs'
set local_listener='LISTENER_TESTDGS'        
set log_archive_dest_1='';
}

RMAN
using target database control file instead of recovery catalog
allocated channel: prmy1
channel prmy1: SID=33 device type=DISK

allocated channel: stby1
channel stby1: SID=18 device type=DISK

Starting Duplicate Db at 18-JAN-12

contents of Memory Script:
{
   backup as copy reuse
   targetfile  '/u00/app/oracle/product/11.2.0/db_1/dbs/spfileDGP.ora' auxiliary format
 '/u00/app/oracle/product/11.2.0/db_1/dbs/spfileDGS.ora'   ;
   sql clone "alter system set spfile= ''/u00/app/oracle/product/11.2.0/db_1/dbs/spfileDGS.ora''";
}
executing Memory Script

Starting backup at 18-JAN-12
Finished backup at 18-JAN-12

sql statement: alter system set spfile= ''/u00/app/oracle/product/11.2.0/db_1/dbs/spfileDGS.ora''

contents of Memory Script:
{
   sql clone "alter system set  db_name =
 ''DGS'' comment=
 ''duplicate'' scope=spfile";
   sql clone "alter system set  audit_file_dest =
 ''/u00/app/oracle/admin/DGS/adump'' comment=
 '''' scope=spfile";
   sql clone "alter system set  control_files =
 ''/u01/dgs/control/control01.ctl'', ''/u01/dgs/control/control02.ctl'' comment=
 '''' scope=spfile";
   sql clone "alter system set  db_recovery_file_dest =
 ''/u00/app/oracle/admin/dgs/flashback'' comment=
 '''' scope=spfile";
   sql clone "alter system set  db_file_name_convert =
 ''dgp'', ''dgs'' comment=
 '''' scope=spfile";
   sql clone "alter system set  log_file_name_convert =
 ''dgp'', ''dgs'' comment=
 '''' scope=spfile";
   sql clone "alter system set  local_listener =
 ''LISTENER_TESTDGS'' comment=
 '''' scope=spfile";
   sql clone "alter system set  log_archive_dest_1 =
 '''' comment=
 '''' scope=spfile";
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script

sql statement: alter system set  db_name =  ''DGS'' comment= ''duplicate'' scope=spfile

sql statement: alter system set  audit_file_dest =  ''/u00/app/oracle/admin/DGS/adump'' comment= '''' scope=spfile

sql statement: alter system set  control_files =  ''/u01/dgs/control/control01.ctl'', ''/u01/dgs/control/control02.ctl'' comment= '''' scope=spfile

sql statement: alter system set  db_recovery_file_dest =  ''/u00/app/oracle/admin/dgs/flashback'' comment= '''' scope=spfile

sql statement: alter system set  db_file_name_convert =  ''dgp'', ''dgs'' comment= '''' scope=spfile

sql statement: alter system set  log_file_name_convert =  ''dgp'', ''dgs'' comment= '''' scope=spfile

sql statement: alter system set  local_listener =  ''LISTENER_TESTDGS'' comment= '''' scope=spfile

sql statement: alter system set  log_archive_dest_1 =  '''' comment= '''' scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area     263049216 bytes

Fixed Size                     2212448 bytes
Variable Size                205524384 bytes
Database Buffers              50331648 bytes
Redo Buffers                   4980736 bytes
allocated channel: stby1
channel stby1: SID=1 device type=DISK

contents of Memory Script:
{
   sql clone "alter system set  db_name =
 ''DGP'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   sql clone "alter system set  db_unique_name =
 ''DGS'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   shutdown clone immediate;
   startup clone force nomount
   backup as copy current controlfile auxiliary format  '/u01/dgs/control/control01.ctl';
   restore clone controlfile to  '/u01/dgs/control/control02.ctl' from
 '/u01/dgs/control/control01.ctl';
   alter clone database mount;
}
executing Memory Script

sql statement: alter system set  db_name =  ''DGP'' comment= ''Modified by RMAN duplicate'' scope=spfile

sql statement: alter system set  db_unique_name =  ''DGS'' comment= ''Modified by RMAN duplicate'' scope=spfile

Oracle instance shut down

Oracle instance started

Total System Global Area     263049216 bytes

Fixed Size                     2212448 bytes
Variable Size                205524384 bytes
Database Buffers              50331648 bytes
Redo Buffers                   4980736 bytes
allocated channel: stby1
channel stby1: SID=19 device type=DISK

Starting backup at 18-JAN-12
channel prmy1: starting datafile copy
copying current control file
output file name=/u00/app/oracle/product/11.2.0/db_1/dbs/snapcf_DGP.f tag=TAG20120118T192934 RECID=1 STAMP=772918185
channel prmy1: datafile copy complete, elapsed time: 00:00:16
Finished backup at 18-JAN-12

Starting restore at 18-JAN-12

channel stby1: copied control file copy
Finished restore at 18-JAN-12

database mounted

contents of Memory Script:
{
   set newname for datafile  1 to
 "/u01/dgs/data/system01.dbf";
   set newname for datafile  2 to
 "/u01/dgs/data/sysaux01.dbf";
   set newname for datafile  3 to
 "/u01/dgs/data/undotbs01.dbf";
   set newname for datafile  4 to
 "/u01/dgs/data/users01.dbf";
   backup as copy reuse
   datafile  1 auxiliary format
 "/u01/dgs/data/system01.dbf"   datafile
 2 auxiliary format
 "/u01/dgs/data/sysaux01.dbf"   datafile
 3 auxiliary format
 "/u01/dgs/data/undotbs01.dbf"   datafile
 4 auxiliary format
 "/u01/dgs/data/users01.dbf"   ;
   sql 'alter system archive log current';
}
executing Memory Script

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting backup at 18-JAN-12
channel prmy1: starting datafile copy
input datafile file number=00001 name=/u01/dgp/data/system01.dbf
output file name=/u01/dgs/data/system01.dbf tag=TAG20120118T192955
channel prmy1: datafile copy complete, elapsed time: 00:00:56
channel prmy1: starting datafile copy
input datafile file number=00002 name=/u01/dgp/data/sysaux01.dbf
output file name=/u01/dgs/data/sysaux01.dbf tag=TAG20120118T192955
channel prmy1: datafile copy complete, elapsed time: 00:01:05
channel prmy1: starting datafile copy
input datafile file number=00003 name=/u01/dgp/data/undotbs01.dbf
output file name=/u01/dgs/data/undotbs01.dbf tag=TAG20120118T192955
channel prmy1: datafile copy complete, elapsed time: 00:00:16
channel prmy1: starting datafile copy
input datafile file number=00004 name=/u01/dgp/data/users01.dbf
output file name=/u01/dgs/data/users01.dbf tag=TAG20120118T192955
channel prmy1: datafile copy complete, elapsed time: 00:00:15
Finished backup at 18-JAN-12

sql statement: alter system archive log current

contents of Memory Script:
{
   backup as copy reuse
   archivelog like  "/u00/app/oracle/admin/DGP/arch/1_27_772639109.dbf" auxiliary format
 "/u00/app/oracle/admin/dgs/flashback/DGS/archivelog/2012_01_18/o1_mf_1_27_%u_.arc"   ;
   catalog clone recovery area;
   switch clone datafile all;
}
executing Memory Script

Starting backup at 18-JAN-12
channel prmy1: starting archived log copy
input archived log thread=1 sequence=27 RECID=12 STAMP=772918348
output file name=/u00/app/oracle/admin/dgs/flashback/DGS/archivelog/2012_01_18/o1_mf_1_27_06n13j2d_.arc RECID=0 STAMP=0
channel prmy1: archived log copy complete, elapsed time: 00:00:15
Finished backup at 18-JAN-12

searching for all files in the recovery area

List of Files Unknown to the Database
===========================
File Name: /u00/app/oracle/admin/dgs/flashback/DGS/archivelog/2012_01_18/o1_mf_1_27_06n13j2d_.arc
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /u00/app/oracle/admin/dgs/flashback/DGS/archivelog/2012_01_18/o1_mf_1_27_06n13j2d_.arc

datafile 1 switched to datafile copy
input datafile copy RECID=1 STAMP=772918375 file name=/u01/dgs/data/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=2 STAMP=772918375 file name=/u01/dgs/data/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=3 STAMP=772918375 file name=/u01/dgs/data/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=4 STAMP=772918375 file name=/u01/dgs/data/users01.dbf

contents of Memory Script:
{
   set until scn  992279;
   recover
   clone database
    delete archivelog
   ;
}
executing Memory Script

executing command: SET until clause

Starting recover at 18-JAN-12

starting media recovery

archived log for thread 1 with sequence 27 is already on disk as file /u00/app/oracle/admin/dgs/flashback/DGS/archivelog/2012_01_18/o1_mf_1_27_06n13j2d_.arc
archived log file name=/u00/app/oracle/admin/dgs/flashback/DGS/archivelog/2012_01_18/o1_mf_1_27_06n13j2d_.arc thread=1 sequence=27
media recovery complete, elapsed time: 00:00:00
Finished recover at 18-JAN-12

contents of Memory Script:
{
   shutdown clone immediate;
   startup clone nomount;
   sql clone "alter system set  db_name =
 ''DGS'' comment=
 ''Reset to original value by RMAN'' scope=spfile";
   sql clone "alter system reset  db_unique_name scope=spfile";
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script

database dismounted
Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area     263049216 bytes

Fixed Size                     2212448 bytes
Variable Size                205524384 bytes
Database Buffers              50331648 bytes
Redo Buffers                   4980736 bytes
allocated channel: stby1
channel stby1: SID=19 device type=DISK

sql statement: alter system set  db_name =  ''DGS'' comment= ''Reset to original value by RMAN'' scope=spfile

sql statement: alter system reset  db_unique_name scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area     263049216 bytes

Fixed Size                     2212448 bytes
Variable Size                205524384 bytes
Database Buffers              50331648 bytes
Redo Buffers                   4980736 bytes
allocated channel: stby1
channel stby1: SID=19 device type=DISK
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "DGS" RESETLOGS ARCHIVELOG
  MAXLOGFILES     16
  MAXLOGMEMBERS      3
  MAXDATAFILES      100
  MAXINSTANCES     8
  MAXLOGHISTORY      292
 LOGFILE
  GROUP  1 ( '/u01/dgs/redo/redo01.log' ) SIZE 5 M  REUSE,
  GROUP  2 ( '/u01/dgs/redo/redo02.log' ) SIZE 5 M  REUSE,
  GROUP  3 ( '/u01/dgs/redo/redo03.log' ) SIZE 5 M  REUSE
 DATAFILE
  '/u01/dgs/data/system01.dbf'
 CHARACTER SET WE8MSWIN1252


contents of Memory Script:
{
   set newname for tempfile  1 to
 "/u01/dgs/data/temp01.dbf";
   switch clone tempfile all;
   catalog clone datafilecopy  "/u01/dgs/data/sysaux01.dbf",
 "/u01/dgs/data/undotbs01.dbf",
 "/u01/dgs/data/users01.dbf";
   switch clone datafile all;
}
executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to /u01/dgs/data/temp01.dbf in control file

cataloged datafile copy
datafile copy file name=/u01/dgs/data/sysaux01.dbf RECID=1 STAMP=772918523
cataloged datafile copy
datafile copy file name=/u01/dgs/data/undotbs01.dbf RECID=2 STAMP=772918523
cataloged datafile copy
datafile copy file name=/u01/dgs/data/users01.dbf RECID=3 STAMP=772918523

datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=772918523 file name=/u01/dgs/data/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=772918523 file name=/u01/dgs/data/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=772918523 file name=/u01/dgs/data/users01.dbf

contents of Memory Script:
{
   Alter clone database open resetlogs;
}
executing Memory Script

database opened
Finished Duplicate Db at 18-JAN-12
released channel: prmy1
released channel: stby1

RMAN&gt; exit

========================================================================

ERRORS

========================================================================

error: (most common error while doing duplicate)

ORA-17629: Cannot connect to the remote database server

ORA-17627: ORA-12528: TNS:listener: all appropriate instances are blocking new connections

ORA-17629: Cannot connect to the remote database server



solution : Make static registration of instance in listener.ADD (SERVICE_NAME = AUXLIARY_DB) (UR=A) TO YOUR TARGET SERVER's tnsnames entry combination of both is must.



error:

ORA-17627: ORA-12154: TNS:could not resolve the connect identifier specified

solution: Add tns entries on both side.



error:

RMAN-05501: aborting duplication of target database

RMAN-05517: tempfile /u01/TEST11/temp01.dbf conflicts with file used by target database



solution: USE set newname for tempfile 1 to '/u01/dgs/data/temp11.dbf';



error

ORA-17629: Cannot connect to the remote database server

ORA-17627: ORA-01017: invalid username/password; logon denied

ORA-17629: Cannot connect to the remote database server



solution: connect to target as rman target sys/system@DGP