码迷,mamicode.com
首页 > 数据库 > 详细

oracle之 RAC本地数据文件迁移至ASM

时间:2017-09-16 20:42:57      阅读:230      评论:0      收藏:0      [点我收藏+]

标签:ace   comm   because   hand   oracle   xxx   ann   prot   errors   

系统环境:
CentOS release 6.7 (Final)
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit

操作过程:

1、添加数据文件或者创建表空间时,误操作将路径指定为单节点本地

SQL> alter tablespace users add datafile ‘/home/oracle/test.dbf‘ size 4m;
Tablespace altered.


SQL>
set line 180
col file_name for a60
col tablespace_name for a15
select file_name,file_id,online_status,tablespace_name from dba_data_files;

FILE_NAME FILE_ID ONLINE_ TABLESPACE_NAME
------------------------------------------------------------ ---------- ------- ---------------
+DATA/devdb/datafile/users.259.936769201 4 ONLINE USERS
+DATA/devdb/datafile/undotbs1.258.936769201 3 ONLINE UNDOTBS1
+DATA/devdb/datafile/sysaux.257.936769199 2 ONLINE SYSAUX
+DATA/devdb/datafile/system.256.936769199 1 SYSTEM SYSTEM
+DATA/devdb/datafile/example.265.936769441 5 ONLINE EXAMPLE
/home/oracle/test.dbf 6 ONLINE USERS
6 rows selected.

2.干净关闭RAC2,RAC1
srvctl stop database -d XXX

3.将RAC1启动mount状态
SQL> startup mount;

4.通过RMAN CP命令拷贝数据文件
node1-> rman target /
connected to target database: DEVDB (DBID=841499351, not open)

RMAN> copy datafile ‘/home/oracle/test.dbf‘ to ‘+data‘;

Starting backup at 2017/09/17 02:13:03
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=36 instance=devdb1 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00006 name=/home/oracle/test.dbf
output file name=+DATA/devdb/datafile/users.273.954900787 tag=TAG20170917T021305 RECID=3 STAMP=954900786
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 2017/09/17 02:13:07

Starting Control File and SPFILE Autobackup at 2017/09/17 02:13:07
piece handle=+FLASH/devdb/autobackup/2017_09_17/s_954900552.304.954900789 comment=NONE
Finished Control File and SPFILE Autobackup at 2017/09/17 02:13:10

5.在 ASM 中查找 /home/oracle/test.dbf 映射过来对应的 ASM 文件名
ASMCMD> cd data/devdb/datafile
ASMCMD> pwd
+data/devdb/datafile
ASMCMD> ls -lt user*
Type Redund Striped Time Sys Name
DATAFILE UNPROT COARSE SEP 17 03:00:00 Y USERS.273.954900787
DATAFILE UNPROT COARSE SEP 17 03:00:00 Y USERS.259.936769201
说明: /home/oracle/test.dbf 对应为 USERS 表空间, 所以这里为 user*

6.在sqlplus中将数据库启动到mount状态,rename数据文件
SQL> alter database rename file ‘/home/oracle/test.dbf‘ to ‘+DATA/devdb/datafile/USERS.273.954900787‘;

7.将rac1,rac2启动
#RAC1
SQL> alter database open;
Database altered.
SQL>

#RAC2
SQL> startup;


附:SYSTEM数据文件移植步骤(过程说明):
1. Stop DB.
2. Move the datafile using asmcmd.
3. Mount the DB.
4. Rename the datafile.
5. Open the DB.
6. On other RAC nodes you still need to bounce the database because it is SYSTEM tablespace, otherwise you will keep getting errors ORA-01516 or original error ORA-01157: cannot identify/lock data file.

oracle之 RAC本地数据文件迁移至ASM

标签:ace   comm   because   hand   oracle   xxx   ann   prot   errors   

原文地址:http://www.cnblogs.com/andy6/p/7532458.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!