Oracle DB 使用RMAN将数据库移植到ASM存储区
- 将数据库移植到ASM 存储区
- 将表空间移植到ASM 存储中
3. 将 TBSASMMIG 移植到ASM 存储中。完成操作后,请检查移植是否成功,并且该表空间中的表是否保持原样。
sys@TEST0924> select FILE_NAME,TABLESPACE_NAME from dba_data_files;
FILE_NAME TABLESPACE_NAME
-------------------------------------------------- ------------------------------
/u01/app/oracle/oradata/test0924/users01.dbf USERS
/u01/app/oracle/oradata/test0924/sysaux01.dbf SYSAUX
/u01/app/oracle/oradata/test0924/system01.dbf SYSTEM
/u01/app/oracle/oradata/test0924/example01.dbf EXAMPLE
/u01/app/oracle/oradata/test0924/undotbs01.dbf UNDOTBS1
sys@TEST0924> create tablespace TBSASMMIG datafile '/u01/app/oracle/oradata/test0924/tbsasmmig01.dbf' size 10m;
Tablespace created.
sys@TEST0924> create table t2 (id number,name varchar2(20)) tablespace TBSASMMIG;
Table created.
sys@TEST0924> insert into t2 values (1,'a1');
1 row created.
sys@TEST0924> commit;
Commit complete.
sys@TEST0924> select file_id,file_name,tablespace_name from dba_data_files;
FILE_ID FILE_NAME TABLESPACE_NAME
---------- -------------------------------------------------- ------------------------------
4 /u01/app/oracle/oradata/test0924/users01.dbf USERS
3 /u01/app/oracle/oradata/test0924/tbsasmmig01.dbf TBSASMMIG
2 /u01/app/oracle/oradata/test0924/sysaux01.dbf SYSAUX
1 /u01/app/oracle/oradata/test0924/system01.dbf SYSTEM
5 /u01/app/oracle/oradata/test0924/example01.dbf EXAMPLE
9 /u01/app/oracle/oradata/test0924/undotbs01.dbf UNDOTBS1
6 rows selected.
[oracle@rtest ~]$ rman target /
Recovery Manager: Release 11.2.0.3.0 - Production on Sun Nov 3 17:02:51 2013
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: TEST0924 (DBID=2720875862)
RMAN> sql 'alter database datafile 3 offline';
sql statement: alter database datafile 3 offline
RMAN> backup as copy datafile 3 format '+DATA';
Starting backup at 03-NOV-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=127 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=191 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=157 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=/u01/app/oracle/oradata/test0924/tbsasmmig01.dbf
output file name=+DATA/test0924/datafile/tbsasmmig.264.830538365 tag=TAG20131103T170603 RECID=13 STAMP=830538366
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
Finished backup at 03-NOV-13
Starting Control File and SPFILE Autobackup at 03-NOV-13
piece handle=/u01/app/oracle/fast_recovery_area/TEST0924/autobackup/2013_11_03/o1_mf_s_830538370_97fl6mr9_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 03-NOV-13
RMAN> switch datafile 3 to copy;
datafile 3 switched to datafile copy "+DATA/test0924/datafile/tbsasmmig.264.830538365"
RMAN> recover datafile 3;
Starting recover at 03-NOV-13
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
starting media recovery
media recovery complete, elapsed time: 00:00:00
Finished recover at 03-NOV-13
RMAN> sql 'alter database datafile 3 online';
sql statement: alter database datafile 3 online
sys@TEST0924> select file_id,file_name,tablespace_name from dba_data_files;
FILE_ID FILE_NAME TABLESPACE_NAME
---------- -------------------------------------------------- ------------------------------
4 /u01/app/oracle/oradata/test0924/users01.dbf USERS
3 +DATA/test0924/datafile/tbsasmmig.264.830538365 TBSASMMIG
2 /u01/app/oracle/oradata/test0924/sysaux01.dbf SYSAUX
1 /u01/app/oracle/oradata/test0924/system01.dbf SYSTEM
5 /u01/app/oracle/oradata/test0924/example01.dbf EXAMPLE
9 /u01/app/oracle/oradata/test0924/undotbs01.dbf UNDOTBS1
6 rows selected.
sys@TEST0924> select * from t2
2 ;
ID NAME
---------- --------------------
1 a1
推荐阅读: