oracle数据库表空间下数据文件迁移的三种方法

教程发布:风哥 教程分类:ITPUX技术网 更新日期:2022-02-12 浏览学习:240

oracle数据库表空间下数据文件迁移的三种方法

一个数据文件迁移案例,主要是换存储,有raid 0+1 迁移到 raid 5 存储类型
上,下面记录下几种迁移方法,文件系统是裸设备类型,首先要在raid 5存储上建好相应的lv 裸设备数据文件,注意大小一定要和原来一样大或更大。

1. 用cplv的方法
alter tablespace tablespace_name offline;
cplv old_lv to new_lv
alter database rename file 'old_lv' to 'new_lv';
alter tablespace tablespace_name online;

2.用rman copy的方法
sqlplus 下
alter tablespace tablespace_name offline;
rman 工具下
rman target /
copy datafile 'old_lv ' to 'new_lv';
sqlplus 下
alter database rename file 'old_lv' to 'new_lv';
alter tablespace tablespace_name online;

3. 全部用rman工具+rman copy 来实现的方法 一个脚本搞定
run{
allocate channel c1 type disk;
sql 'alter tablespace tablespace_name offline';
copy datafile 'old_lv' to 'new_lv';
set newname for datafile 6 to 'new_lv';
switch datafile 6;
sql 'alter tablespace tablespace_name online';
release channel c1;
}

本文标签:
网站声明:本文由风哥整理发布,转载请保留此段声明,本站所有内容将不对其使用后果做任何承诺,请读者谨慎使用!
【上一篇】
【下一篇】