• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

迁移ASM文件之backup as copy tablespace

mysql 搞代码 4年前 (2022-01-09) 17次浏览 已收录 0个评论

在Oracle 10g数据库中,如果需要本文来源gao@!dai!ma.com搞$$代^@码网*将ASM实例中一个磁盘组的数据文件转移到另一个磁盘组上。可以采用以前传统的文件系统的方式迁移,

在Oracle 10g数据库中,如果需要将ASM实例中一个磁盘组的数据文件转移到另一个磁盘组上。可以采用以前传统的文件系统的方式迁移,也可以采用表空间级别拷贝的方式迁移。
例如有一个库sdb,users表空间的数据文件都在vg1磁盘组上,现在要移动vg2磁盘组上,,这样操作一下就能完成这个任务。
backup as copy tablespace users format ‘+vg2’;
switch tablespace users to copy;
这两个命令需要在rman下操作,因为只有rman下才能管理ASM磁盘组中的文件。

测试环境为oracle 10.2.0.4 for linux x86,以下为测试过程。

第一步,检查环境,确认users表空间,并将数据库重启到mounted状态。

[oracle@db-172-17-2-8 bdump]$ export ORACLE_SID=sdb
[oracle@db-172-17-2-8 bdump]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 – Production on Tue Feb 19 16:47:13 2013

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

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

SQL> select name from v$tablespace
2 ;

NAME
——————————
USERS
UNDOTBS1
SYSTEM
SYSAUX
OFCARDQUERY
TEMP

6 rows selected.

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area 1610612736 bytes
Fixed Size 2084296 bytes
Variable Size 385876536 bytes
Database Buffers 1207959552 bytes
Redo Buffers 14692352 bytes
Database mounted.

第二步,使用rman工具copy表空间,再switch。这个switch操作完成了数据字典的修改。

[oracle@db-172-17-2-8 bdump]$ rman target /

Recovery Manager: Release 10.2.0.4.0 – Production on Tue Feb 19 16:48:20 2013

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

connected to target database: SDB (DBID=2245827732, not open)

RMAN> backup as copy tablespace users format ‘+vg2’;

Starting backup at 19-FEB-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=151 devtype=DISK
channel ORA_DISK_1: starting datafile copy
input datafile fno=00005 name=+VG1/sdb/users02.dbf
output filename=+VG2/sdb/datafile/users.285.807814137 tag=TAG20130219T164857 recid=17 stamp=807814139
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
input datafile fno=00004 name=+VG1/sdb/users01.dbf
output filename=+VG2/sdb/datafile/users.284.807814141 tag=TAG20130219T164857 recid=18 stamp=807814141
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 19-FEB-13

RMAN> switch tablespace users to copy;

datafile 4 switched to datafile copy “+VG2/sdb/datafile/users.284.807814141”
datafile 5 switched to datafile copy “+VG2/sdb/datafile/users.285.807814137”

RMAN> recover database;

Starting recover at 19-FEB-13
using channel ORA_DISK_1

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

Finished recover at 19-FEB-13


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:迁移ASM文件之backup as copy tablespace

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址