迁移ASM文件之backup as copy tablespace

php中文网
发布: 2016-06-07 17:26:52
原创
1158人浏览过

在Oracle 10g数据库中,如果需要将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

linux

最佳 Windows 性能的顶级免费优化软件
最佳 Windows 性能的顶级免费优化软件

每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号