[oracle@nerv00 ~]$ rman target /
Recovery Manager: Release 12.1.0.1.0 - Production on Mon Mar 31 18:51:58 2014
Copyright (c) 1982, 2013, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL (DBID=1370757760)
RMAN> run
{
report schema;
alter database datafile 5 offline;
backup datafile 5;
set newname for datafile 5 to '+DATA';
restore datafile 5;
switch datafile 5;
recover datafile 5;
alter database datafile 5 online;
report schema;
}
2> 3> 4> 5> 6> 7> 8> 9> 10> 11> 12>
using target database control file instead of recovery catalog
Report of database schema for database with db_unique_name ORCL
List of Permanent Datafiles
===========================
File Size(MB) Tablespace RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1 790 SYSTEM *** /u01/oradata/ORCL/system01.dbf
2 358 EXAMPLE *** /u01/oradata/ORCL/example01.dbf
3 1040 SYSAUX *** /u01/oradata/ORCL/sysaux01.dbf
4 2375 UNDOTBS1 *** /u01/oradata/ORCL/undotbs01.dbf
5 10240 SOE *** /u01/oradata/ORCL/soe01.dbf
6 5 USERS *** /u01/oradata/ORCL/users01.dbf
List of Temporary Files
=======================
File Size(MB) Tablespace Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1 60 TEMP 32767 /u01/oradata/ORCL/temp01.dbf
Statement processed
Starting backup at 31-MAR-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=41 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=210 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=421 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=609 device type=DISK
allocated channel: ORA_DISK_5
channel ORA_DISK_5: SID=39 device type=DISK
allocated channel: ORA_DISK_6
channel ORA_DISK_6: SID=230 device type=DISK
allocated channel: ORA_DISK_7
channel ORA_DISK_7: SID=401 device type=DISK
allocated channel: ORA_DISK_8
channel ORA_DISK_8: SID=607 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00005 name=/u01/oradata/ORCL/soe01.dbf
channel ORA_DISK_1: starting piece 1 at 31-MAR-14
channel ORA_DISK_1: finished piece 1 at 31-MAR-14
piece handle=/u01/FRA/ORCL/backupset/2014_03_31/o1_mf_nnndf_TAG20140331T185222_9mmrwpof_.bkp tag=TAG20140331T185222 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:35
Finished backup at 31-MAR-14
executing command: SET NEWNAME
Starting restore at 31-MAR-14
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4
using channel ORA_DISK_5
using channel ORA_DISK_6
using channel ORA_DISK_7
using channel ORA_DISK_8
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00005 to +DATA
channel ORA_DISK_1: reading from backup piece /u01/FRA/ORCL/backupset/2014_03_31/o1_mf_nnndf_TAG20140331T185222_9mmrwpof_.bkp
channel ORA_DISK_1: piece handle=/u01/FRA/ORCL/backupset/2014_03_31/o1_mf_nnndf_TAG20140331T185222_9mmrwpof_.bkp tag=TAG20140331T185222
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:03:45
Finished restore at 31-MAR-14
datafile 5 switched to datafile copy
input datafile copy RECID=12 STAMP=843677863 file name=+DATA/ORCL/DATAFILE/soe.275.843677643
Starting recover at 31-MAR-14
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4
using channel ORA_DISK_5
using channel ORA_DISK_6
using channel ORA_DISK_7
using channel ORA_DISK_8
starting media recovery
media recovery complete, elapsed time: 00:10:47
Finished recover at 31-MAR-14
Statement processed
Report of database schema for database with db_unique_name ORCL
List of Permanent Datafiles
===========================
File Size(MB) Tablespace RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1 790 SYSTEM *** /u01/oradata/ORCL/system01.dbf
2 358 EXAMPLE *** /u01/oradata/ORCL/example01.dbf
3 1040 SYSAUX *** /u01/oradata/ORCL/sysaux01.dbf
4 2375 UNDOTBS1 *** /u01/oradata/ORCL/undotbs01.dbf
5 10240 SOE *** +DATA/ORCL/DATAFILE/soe.275.843677643
6 5 USERS *** /u01/oradata/ORCL/users01.dbf
List of Temporary Files
=======================
File Size(MB) Tablespace Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1 60 TEMP 32767 /u01/oradata/ORCL/temp01.dbf
RMAN>
Relacionado
Bom dia,
No 12c pode-se utilizar direto alter database move datafile 5 to ‘+DATA’;
Online e sem downtime.
Abs
Ah, esta é a funcionalidade que mais gostei do 12c!
http://nervinformatica.ddns.com.br/blog/?p=3156
Obrigado pelo comentário, grande Alex Zaballa!
Eu faço quase a mesma coisa, só que com comandos um pouco diferentes:
rman target /
REPORT SCHEMA;
List of Permanent Datafiles
===========================
File Size(MB) Tablespace RB segs Datafile Name
—- ——– ——————– ——- ————————
223 5000 TASY_INDEX *** /u03/oradata/dbtrn/tasy_index61.dbf
sql ‘alter tablespace TASY_INDEX offline’;
copy datafile 223 to ‘/u02/oradata/dbtrn/tasy_index61.dbf’;
switch datafile 223 to copy;
recover tablespace TASY_INDEX;
sql ‘alter tablespace TASY_INDEX online’;
REPORT SCHEMA;
List of Permanent Datafiles
===========================
File Size(MB) Tablespace RB segs Datafile Name
—- ——– ——————– ——- ————————
223 5000 TASY_INDEX *** /u02/oradata/dbtrn/tasy_index61.dbf
DELETE DATAFILECOPY “/u03/oradata/dbtrn/tasy_index61.dbf”;
Ah, funciona para mover de filesystem para ASM também e vice-versa.
Realmente, também temos o COPY… mais uma maneira de preparar Neston! 😀