RAC中数据文件创建到了本地路径(非系统表空间)使用rman转移

环境: 11.2.0.1 + RHEL6.5

 参考文档ID:1678747.1

1.模拟创建
一节点:
SQL> create tablespace tdb datafile '/u02/app/oracle/datafile/tdb.dbf' size 10m autoextend off;

Tablespace created.

2.查看数据文件
一节点:
     FILE# NAME
---------- ----------------------------------------------------------------------------------------------------
         4 +DATA/orcl/datafile/users.257.901333687
         3 +DATA/orcl/datafile/undotbs1.264.901333687
         2 +DATA/orcl/datafile/sysaux.256.901333685
         1 +DATA/orcl/datafile/system.265.901333685
         5 +DATA/orcl/datafile/undotbs2.266.901333943
         6 /u02/app/oracle/datafile/tdb.dbf

二节点:
SQL> select file_name,file_id,ONLINE_STATUS,tablespace_name from dba_data_files;
ERROR:
ORA-01157: cannot identify/lock data file 6 - see DBWR trace file
ORA-01110: data file 6: '/u02/app/oracle/datafile/tdb.dbf'

3.将数据文件offline
SQL> alter database datafile 6 offline;

Database altered.

4.使用RMAN移动本地文件到asm

RMAN> copy datafile '/u02/app/oracle/datafile/tdb.dbf' to '+DATA';

Starting backup at 03-FEB-16
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=35 instance=orcl1 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00006 name=/u02/app/oracle/datafile/tdb.dbf
output file name=+DATA/orcl/datafile/tdb.268.902813699 tag=TAG20160203T053456 RECID=1 STAMP=902813699
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 03-FEB-16

5.重命名文件

SQL> alter database rename file '/u02/app/oracle/datafile/tdb.dbf' to '+DATA/orcl/datafile/tdb.268.902813699';

Database altered.

6.查看数据文件状态
FILE_NAME                                                       FILE_ID ONLINE_ TABLESPACE_NAME
------------------------------------------------------------ ---------- ------- ----------------------------------------
+DATA/orcl/datafile/users.257.901333687                               4 ONLINE  USERS
+DATA/orcl/datafile/undotbs1.264.901333687                            3 ONLINE  UNDOTBS1
+DATA/orcl/datafile/sysaux.256.901333685                              2 ONLINE  SYSAUX
+DATA/orcl/datafile/system.265.901333685                              1 SYSTEM  SYSTEM
+DATA/orcl/datafile/undotbs2.266.901333943                            5 ONLINE  UNDOTBS2
+DATA/orcl/datafile/tdb.dbf                                           6 RECOVER TDB

7.对数据文件recover一下
SQL> recover datafile 6;
Media recovery complete.


FILE_NAME                                                       FILE_ID ONLINE_ TABLESPACE_NAME
------------------------------------------------------------ ---------- ------- ----------------------------------------
+DATA/orcl/datafile/users.257.901333687                               4 ONLINE  USERS
+DATA/orcl/datafile/undotbs1.264.901333687                            3 ONLINE  UNDOTBS1
+DATA/orcl/datafile/sysaux.256.901333685                              2 ONLINE  SYSAUX
+DATA/orcl/datafile/system.265.901333685                              1 SYSTEM  SYSTEM
+DATA/orcl/datafile/undotbs2.266.901333943                            5 ONLINE  UNDOTBS2
+DATA/orcl/datafile/tdb.dbf                                           6 OFFLINE TDB

8.将数据文件online
SQL> alter database datafile 6 online;

Database altered.

9.检查数据文件
FILE_NAME                                                       FILE_ID ONLINE_ TABLESPACE_NAME
------------------------------------------------------------ ---------- ------- ----------------------------------------
+DATA/orcl/datafile/users.257.901333687                               4 ONLINE  USERS
+DATA/orcl/datafile/undotbs1.264.901333687                            3 ONLINE  UNDOTBS1
+DATA/orcl/datafile/sysaux.256.901333685                              2 ONLINE  SYSAUX
+DATA/orcl/datafile/system.265.901333685                              1 SYSTEM  SYSTEM
+DATA/orcl/datafile/undotbs2.266.901333943                            5 ONLINE  UNDOTBS2
+DATA/orcl/datafile/tdb.dbf                                           6 ONLINE  TDB

(0)
上一篇 2022年3月21日
下一篇 2022年3月21日

相关推荐