=================================================
RELLOCATE DATABASE TO A NEW LOCATION WITH RMAN
=================================================
C:\>RMAN TARGET 'SYS/ORACLE@ORCL1112SRV AS SYSDBA'
Recovery Manager: Release 10.2.0.3.0 - Production on Fri Jul 29 12:11:58 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ORCL1011 (DBID=2521181406, not open)
RMAN> RUN{
2> SET NEWNAME FOR DATAFILE 1 TO 'D:\ORCLD1112\SYSAUX01.DBF';
3> SET NEWNAME FOR DATAFILE 2 TO 'D:\ORCLD1112\SYSTEM01.DBF';
4> SET NEWNAME FOR DATAFILE 3 TO 'D:\ORCLD1112\UNDOTBS01.DBF';
5> SET NEWNAME FOR DATAFILE 4 TO 'D:\ORCLD1112\USERS01.DBF';
6> SET NEWNAME FOR DATAFILE 5 TO 'D:\ORCLD1112\RMAN.DBF';
7> RESTORE DATAFILE 1;
8> RESTORE DATAFILE 2;
9> RESTORE DATAFILE 3;
10> RESTORE DATAFILE 4;
11> RESTORE DATAFILE 5;
12> switch DATAFILE ALL;
13> }
executing command: SET NEWNAME
using target database control file instead of recovery catalog
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting restore at 29-JUL-11
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=155 devtype=DISK
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to D:\ORCLD1112\SYSAUX01.DBF
channel ORA_DISK_1: reading from backup piece E:\RMANBACKUP\DB_ORCL1011_01MIL6OJ
channel ORA_DISK_1: restored backup piece 1
piece handle=E:\RMANBACKUP\DB_ORCL1011_01MIL6OJ tag=TAG20110729T104850
channel ORA_DISK_1: restore complete, elapsed time: 00:01:07
Finished restore at 29-JUL-11
Starting restore at 29-JUL-11
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00002 to D:\ORCLD1112\SYSTEM01.DBF
channel ORA_DISK_1: reading from backup piece E:\RMANBACKUP\DB_ORCL1011_01MIL6OJ
channel ORA_DISK_1: restored backup piece 1
piece handle=E:\RMANBACKUP\DB_ORCL1011_01MIL6OJ tag=TAG20110729T104850
channel ORA_DISK_1: restore complete, elapsed time: 00:00:27
Finished restore at 29-JUL-11
Starting restore at 29-JUL-11
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00003 to D:\ORCLD1112\UNDOTBS01.DBF
channel ORA_DISK_1: reading from backup piece E:\RMANBACKUP\DB_ORCL1011_01MIL6OJ
channel ORA_DISK_1: restored backup piece 1
piece handle=E:\RMANBACKUP\DB_ORCL1011_01MIL6OJ tag=TAG20110729T104850
channel ORA_DISK_1: restore complete, elapsed time: 00:00:46
Finished restore at 29-JUL-11
Starting restore at 29-JUL-11
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00004 to D:\ORCLD1112\USERS01.DBF
channel ORA_DISK_1: reading from backup piece E:\RMANBACKUP\DB_ORCL1011_01MIL6OJ
channel ORA_DISK_1: restored backup piece 1
piece handle=E:\RMANBACKUP\DB_ORCL1011_01MIL6OJ tag=TAG20110729T104850
channel ORA_DISK_1: restore complete, elapsed time: 00:00:17
Finished restore at 29-JUL-11
Starting restore at 29-JUL-11
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00005 to D:\ORCLD1112\RMAN.DBF
channel ORA_DISK_1: reading from backup piece E:\RMANBACKUP\DB_ORCL1011_01MIL6OJ
channel ORA_DISK_1: restored backup piece 1
piece handle=E:\RMANBACKUP\DB_ORCL1011_01MIL6OJ tag=TAG20110729T104850
channel ORA_DISK_1: restore complete, elapsed time: 00:00:26
Finished restore at 29-JUL-11
datafile 1 switched to datafile copy
input datafile copy recid=6 stamp=757772139 filename=D:\ORCLD1112\SYSAUX01.DBF
datafile 2 switched to datafile copy
input datafile copy recid=7 stamp=757772140 filename=D:\ORCLD1112\SYSTEM01.DBF
datafile 3 switched to datafile copy
input datafile copy recid=8 stamp=757772140 filename=D:\ORCLD1112\UNDOTBS01.DBF
datafile 4 switched to datafile copy
input datafile copy recid=9 stamp=757772140 filename=D:\ORCLD1112\USERS01.DBF
datafile 5 switched to datafile copy
input datafile copy recid=10 stamp=757772141 filename=D:\ORCLD1112\RMAN.DBF
RMAN>
=======================================================================
RELLOCATE DATABASE TO A NEW LOCATION WITH USER-MANAGED PROCEDURES:-
=======================================================================
THROUGH THIS CLAUSE "RENAME" IT'S USES TO RENAME DATAFILES & RELOCATE THE LOCATION
*Shutdown
*Copy & Paste new location / USE O.S command to restore the datafiles to the new location
NOTE:- BUT NOTE IN CONTROL FILE.
or
*Rename the datafile & Else
*Startup Mount Exclusive
*ALTER DATABASE RENAME FILE 'D:\ALMD1011\SYSAUX01.DBF' TO 'E:\ALMD1011\SYSAUX01.DBF'
*ALTER DATABASE RENAME FILE 'D:\ALMD1011\INDEX01.DBF' TO 'E:\ALMD1011\INDEX01.DBF'
*ALTER DATABASE RENAME FILE 'D:\ALMD1011\UNDOTBST01.DBF' TO 'E:\ALMD1011\UNDOTBST01.DBF'
*ALTER DATABASE RENAME FILE 'D:\ALMD1011\TEMP01.DBF' TO 'E:\ALMD1011\TEMP01.DBF'
*ALTER DATABASE OPEN;
*SELECT * FROM V$TABLESPACE;
*SELECT * FROM V$DATAFILE;
*SELECT * FORM V$CONTROLFILE;
*ALTER DATABASE BACKUP CONTROLFILE TO TRACE;
*ALTER SYSTEM SET CONTROL_FILES=''E:\ALMD1011\control01.ctl','E:\ALMD1011\control02.ctl','E:\ALMD1011\control03.ctl' SCOPE=SPFILE;
*SHUTDOWN IMMEDIATE
*STARTUP NOMOUNT
##CONTROLFILESCRIPT.SQL
CREATE CONTROLFILE SET DATABASE "ALM1011" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 2920
LOGFILE
GROUP 1 'E:\ALMD1011\REDO01.LOG' SIZE 50M,
GROUP 2 'E:\ALMD1011\REDO02.LOG' SIZE 50M,
GROUP 3 'E:\ALMD1011\REDO03.LOG' SIZE 50M
-- STANDBY LOGFILE
DATAFILE
'E:\ALMD1011\SYSTEM01.ORA',
'E:\ALMD1011\UNDOTBS01.ORA',
'E:\ALMD1011\SYSAUX01.ORA',
'E:\ALMD1011\INDEX01.ORA',
'E:\ALMD1011\USERS01.ORA'
CHARACTER SET WE8MSWIN1252
;
*ALTER DATABASE OPEN RESETLOGS;
*SELECT * FROM V$TABLESPACE;
*SELECT * FROM V$DATAFILE;
*SELECT * FORM V$CONTROLFILE;
######ELSE PART
SHUTDOWN IMMEDIATE
COPY & PASTE NEW LOCATION
STARTUP MOUNT
ALTER DATABASE RENAME FILE 'D:\ALMD1011\SYSTEM01.ORA' TO 'E:\ALMD1011\SYSTEM01.ORA';
ALTER DATABASE OPEN;
ALTER DATABASE OPEN RESETLOGS;
SHUTDOWN IMMEDIATE
STARTUP
Database mounted.
ORA-01190: control file or data file 1 is from before the last RESETLOGS
ORA-01110: data file 1: 'E:\ALMD1011\SYSTEM01.ORA'
SQL> RECOVER DATABASE;
ORA-00279: change 932929863 generated at 02/25/2011 12:36:19 needed for thread 1
ORA-00289: suggestion : D:\ARCHIVE1011\ARC00001_0744038587.001
ORA-00280: change 932929863 for thread 1 is in sequence #1
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
AUTO
Log applied.
Media recovery complete.
SQL> CANCLE;
SQL> ALTER DATABASE OPEN;
No comments:
Post a Comment