暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

ASM 迁移表空间

原创 章芋文 2013-04-22
663
1、检查数据文件
SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
+DATA/enmo10/datafile/system.261.803141869
+DATA/enmo10/datafile/undotbs1.262.803141877
+DATA/enmo10/datafile/sysaux.263.803141881
+DATA/enmo10/datafile/undotbs2.265.803141887
+DATA/enmo10/datafile/users.266.803141893
+DATA/enmo10/datafile/awen02.271.812361655
+DATA/enmo10/datafile/awen01.dbf

7 rows selected.

2、创建新的asm磁盘组
[oracle@node2 ~]$ export ORACLE_SID=+ASM2
[oracle@node2 ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.5.0 - Production on Wed Apr 10 08:30:39 2013

Copyright (c) 1982, 2010, Oracle. All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
SQL> select name,path from v$asm_disk;

NAME PATH
------------------------------ ------------------------------
/dev/raw/raw8
/dev/raw/raw10
/dev/raw/raw9
/dev/raw/raw2
/dev/raw/raw1
NEW_DG_0000 /dev/raw/raw7
DATA_0001 /dev/raw/raw4
DATA_0000 /dev/raw/raw3

8 rows selected.

SQL> create diskgroup awen external redundancy disk '/dev/raw/raw8','/dev/raw/raw9';

Diskgroup created.
SQL> select name,path from v$asm_disk;

NAME PATH
------------------------------ ------------------------------
/dev/raw/raw10
/dev/raw/raw2
/dev/raw/raw1
AWEN_0000 /dev/raw/raw8
NEW_DG_0000 /dev/raw/raw7
AWEN_0001 /dev/raw/raw9
DATA_0001 /dev/raw/raw4
DATA_0000 /dev/raw/raw3

8 rows selected.
SQL> select name from v$asm_diskgroup;

NAME
------------------------------
DATA
NEW_DG
AWEN

3、设置ORACLE_SID,RMAN连接到目标库
[oracle@node2 ~]$ export ORACLE_SID=enmo102
[oracle@node2 ~]$ rman target /

Recovery Manager: Release 10.2.0.5.0 - Production on Wed Apr 10 08:48:30 2013

Copyright (c) 1982, 2007, Oracle. All rights reserved.

connected to target database: ENMO10 (DBID=1929125217)

4、离线表空间
RMAN> sql "alter tablespace awen02 offline";

using target database control file instead of recovery catalog
sql statement: alter tablespace awen02 offline

5、备份datafile
RMAN> copy datafile '+DATA/enmo10/datafile/awen02.271.812361655' to '+AWEN';

Starting backup at 10-APR-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=304 instance=enmo102 devtype=DISK
channel ORA_DISK_1: starting datafile copy
input datafile fno=00006 name=+DATA/enmo10/datafile/awen02.271.812361655
output filename=+AWEN/enmo10/datafile/awen02.256.812364755 tag=TAG20130410T085221 recid=1 stamp=812364782
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:41
Finished backup at 10-APR-13

6、交换datafile
RMAN> switch datafile '+DATA/enmo10/datafile/awen02.271.812361655' to copy;

datafile 6 switched to datafile copy "+AWEN/enmo10/datafile/awen02.256.812364755"

7、恢复datafile
RMAN> recover datafile '+AWEN/enmo10/datafile/awen02.256.812364755';

Starting recover at 10-APR-13
using channel ORA_DISK_1

starting media recovery
media recovery complete, elapsed time: 00:00:00

Finished recover at 10-APR-13

8、上线表空间
RMAN> sql "alter tablespace awen02 online";

sql statement: alter tablespace awen02 online

RMAN> exit


Recovery Manager complete.

9、验证迁移后的数据文件
[oracle@node2 ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.5.0 - Production on Wed Apr 10 08:59:58 2013

Copyright (c) 1982, 2010, Oracle. All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options

SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
+DATA/enmo10/datafile/system.261.803141869
+DATA/enmo10/datafile/undotbs1.262.803141877
+DATA/enmo10/datafile/sysaux.263.803141881
+DATA/enmo10/datafile/undotbs2.265.803141887
+DATA/enmo10/datafile/users.266.803141893
+AWEN/enmo10/datafile/awen02.256.812364755
+DATA/enmo10/datafile/awen01.dbf

7 rows selected.
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论