1.AMAÇ VE KAPSAM
Restore işleminde datafileların pathlerinin yerlerinin değiştirilmesi
2.UYGULAMA
2.1. Database’i mount posizyonunda açıyoruz.
[oracle@oracle dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.1.0.6.0 – Production on Sat Oct 23 17:35:15 2010
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 422670336 bytes
Fixed Size 1300352 bytes
Variable Size 251660416 bytes
Database Buffers 163577856 bytes
Redo Buffers 6131712 bytes
Database mounted.
SQL>
2.2. Şuan OS üstünde hiçbir datafile bulunmuyor. Datafileların numarasının ve controlfile ustundeki lokosyonlarını öğrenmek için aşağıdaki sorguyu yazıyoruz.
SQL> select file#,name from v$datafile;
FILE#
———-
NAME
——————————————————————————–
1
/u02/app/oracle/standby/oradata/data/system01.dbf
2
/u02/app/oracle/standby/oradata/data/sysaux01.dbf
3
/u02/app/oracle/standby/oradata/data/undotbs01.dbf
FILE#
———-
NAME
——————————————————————————–
4
/u02/app/oracle/standby/oradata/data/users01.dbf
5
/u02/app/oracle/standby/oradata/data/example01.dbf
SQL>
2.3. Backupdan geri dönüş yaparken 1 ve 5 numaralı datafile’ın lokasyonunu değiştirmek istiyorum o yüzden recover scriptinin içine bu tanımı ekliyorum.
RMAN> run {
set newname for datafile 1 to ‘/u02/app/oracle/standby/oradata/datafile/system01.dbf’;
set newname for datafile 5 to ‘/u02/app/oracle/standby/oradata/datafile/example01.dbf’;
allocate channel t1 type disk format ‘/home/oracle/Desktop/yedek/%d_%Y%M%D_t%t_s%s_p%p.rman’;
allocate channel t2 type disk format ‘/home/oracle/Desktop/yedek/%d_%Y%M%D_t%t_s%s_p%p.rman’;
allocate channel t3 type disk format ‘/home/oracle/Desktop/yedek/%d_%Y%M%D_t%t_s%s_p%p.rman’;
allocate channel t4 type disk format ‘/home/oracle/Desktop/yedek/%d_%Y%M%D_t%t_s%s_p%p.rman’;
allocate channel t5 type disk format ‘/home/oracle/Desktop/yedek/%d_%Y%M%D_t%t_s%s_p%p.rman’;
restore database;
release channel t1;
release channel t2;
release channel t3;
release channel t4;
release channel t5;
}
executing command: SET NEWNAME
using target database control file instead of recovery catalog
executing command: SET NEWNAME
allocated channel: t1
channel t1: SID=143 device
allocated channel: t2
channel t2: SID=144 device
allocated channel: t3
channel t3: SID=145 device
allocated channel: t4
channel t4: SID=148 device
allocated channel: t5
channel t5: SID=147 device
Starting restore at 23-OCT-10
channel t1: starting datafile backup set restore
channel t1: specifying datafile(s) to restore from backup set
channel t1: restoring datafile 00003 to /u02/app/oracle/standby/oradata/data/undotbs01.dbf
channel t1: reading from backup piece /home/oracle/Desktop/yedek/ORCL_20101015_t732466629_s12_p1.rman
channel t2: starting datafile backup set restore
channel t2: specifying datafile(s) to restore from backup set
channel t2: restoring datafile 00005 to /u02/app/oracle/standby/oradata/datafile/example01.dbf
channel t2: reading from backup piece /home/oracle/Desktop/yedek/ORCL_20101015_t732466623_s11_p1.rman
channel t3: starting datafile backup set restore
channel t3: specifying datafile(s) to restore from backup set
channel t3: restoring datafile 00004 to /u02/app/oracle/standby/oradata/data/users01.dbf
channel t3: reading from backup piece /home/oracle/Desktop/yedek/ORCL_20101015_t732466629_s13_p1.rman
channel t4: starting datafile backup set restore
channel t4: specifying datafile(s) to restore from backup set
channel t4: restoring datafile 00002 to /u02/app/oracle/standby/oradata/data/sysaux01.dbf
channel t4: reading from backup piece /home/oracle/Desktop/yedek/ORCL_20101015_t732466623_s10_p1.rman
channel t5: starting datafile backup set restore
channel t5: specifying datafile(s) to restore from backup set
channel t5: restoring datafile 00001 to /u02/app/oracle/standby/oradata/datafile/system01.dbf
channel t5: reading from backup piece /home/oracle/Desktop/yedek/ORCL_20101015_t732466622_s9_p1.rman
channel t1: piece handle=/home/oracle/Desktop/yedek/ORCL_20101015_t732466629_s12_p1.rman tag=TAG20101015T145701
channel t1: restored backup piece 1
channel t1: restore complete, elapsed time: 00:00:08
channel t3: piece handle=/home/oracle/Desktop/yedek/ORCL_20101015_t732466629_s13_p1.rman tag=TAG20101015T145701
channel t3: restored backup piece 1
channel t3: restore complete, elapsed time: 00:00:33
channel t2: piece handle=/home/oracle/Desktop/yedek/ORCL_20101015_t732466623_s11_p1.rman tag=TAG20101015T145701
channel t2: restored backup piece 1
channel t2: restore complete, elapsed time: 00:00:33
channel t4: piece handle=/home/oracle/Desktop/yedek/ORCL_20101015_t732466623_s10_p1.rman tag=TAG20101015T145701
channel t4: restored backup piece 1
channel t4: restore complete, elapsed time: 00:02:04
channel t5: piece handle=/home/oracle/Desktop/yedek/ORCL_20101015_t732466622_s9_p1.rman tag=TAG20101015T145701
channel t5: restored backup piece 1
channel t5: restore complete, elapsed time: 00:02:25
Finished restore at 23-OCT-10
released channel: t1
released channel: t2
released channel: t3
released channel: t4
released channel: t5
RMAN>
2.4. Farklı lokasyonlara restore ettiğimiz 2 datafile’ı controlfile ustundede değiştirmemiz gerekiyor.
SQL> ALTER DATABASE RENAME FILE ‘/u02/app/oracle/standby/oradata/data/example01.dbf’ to ‘/u02/app/oracle/standby/oradata/datafile/example01.dbf’;
Database altered.
SQL> ALTER DATABASE RENAME FILE ‘/u02/app/oracle/standby/oradata/data/system01.dbf’ to ‘/u02/app/oracle/standby/oradata/datafile/system01.dbf’;
Database altered.
SQL> select name from v$datafile;
NAME
——————————————————————————–
/u02/app/oracle/standby/oradata/datafile/system01.dbf
/u02/app/oracle/standby/oradata/data/sysaux01.dbf
/u02/app/oracle/standby/oradata/data/undotbs01.dbf
/u02/app/oracle/standby/oradata/data/users01.dbf
/u02/app/oracle/standby/oradata/datafile/example01.dbf
Bir Cevap Yazın