有时需要更新存储设备,或者将整个数据库中的文件迁移到其他目录下,对于大数据库,文件较多时,操作容易出错,可以利用oracle的rman中backup as copy database方法实现高效搬迁。
(迁移大数据库)
export ORACLE_SID=hbsfcs
rman target /
configure device type disk parallelism 128;
STARTUP nomount;
restore controlfile from '/oradata/old/control1.ctl';
alter databae mount;
backup as copy database format '/oradata/new/%U.dbf';
switch database to copy;
recover database;
alter database open;
select name from v$tempfile;
run
{
set newname for tempfile 1 to '/oradata/new/%U.dbf';
switch tempfile all;
alter database open;
}
alter database add logfile '/oradata/new/%U.log' size 200m;
alter database add logfile '/oradata/new/%U.log' size 200m;
set pages 100 lines 100
select * from v$logfile;
alter system switch logfile;
alter database drop logfile group 1;
alter database drop logfile group 2;
select name from v$dbfile union all
select name from v$controlfile union all
select member from v$logfile union all
select name from v$tempfile;
结束
阅读(2562) | 评论(0) | 转发(0) |