基于rman的数据库迁移(单点数据库)

总体概述:
A线上库      源库
B线下库      目标库
采用的方式   rman

 


1 使用rman 全量备份线上A数据库

CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/data/back/%F';
run {
allocate channel ch1 device type disk;
allocate channel ch2 device type disk;
allocate channel ch3 device type disk;
allocate channel ch4 device type disk;
backup full
filesperset=2
tag='Full_%d'
format='/data/backup/%T_full_%d_%s_%p'
database include current controlfile;
release channel ch1;
release channel ch2;
release channel ch3;
release channel ch4;
}

 

 
2 将备份文件scp到B机对应的目录下面
  A机创建pfile文件scp到对应目录下

3开始恢复

加载pfile文件
export ORACLE_SID=rman
sqlplus "/as sysdba"

SQL> startup pfile='/home/oracle/product/10.2.0/dbs/initrman.ora' nomount;
ORA-00119: invalid specification for system parameter LOCAL_LISTENER
ORA-00132: syntax error or unresolved network name 'LISTENER_RMAN'
ORA-01078: failure in processing system parameters
修改pfile参数
注意AB数据库大版本要一致,小版本B库要大于等于A库
LOCAL_LISTENER='(ADDRESS = (PROTOCOL = TCP)(HOST = 10.25.5.43)(PORT = 1521))'

3.1 数据库B到nomount下,恢复控制文件

[oracle@grid ~]$ rman target /

Recovery Manager: Release 10.2.0.3.0 - Production on Mon Feb 8 10:17:30 2010

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

connected to target database: rman (not mounted)

RMAN> set DBID=1564188787

executing command: SET DBID

RMAN> restore controlfile from '/data/back/c-1564188787-20100208-03';

Starting restore at 08-FEB-10
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=540 devtype=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
output filename=/home/oracle/oradata/rman/control01.ctl
output filename=/home/oracle/oradata/rman/control02.ctl
output filename=/home/oracle/oradata/rman/control03.ctl
Finished restore at 08-FEB-10

 

3.2 B数据库到mount下,恢复数据库文件

SQL> alter database mount;

RMAN> restore database from tag='FULL_GPODB_DATA';

RMAN> recover database;

RMAN> recover database;

Starting recover at 08-FEB-10
using channel ORA_DISK_1

starting media recovery

channel ORA_DISK_1: starting archive log restore to default destination
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=776
channel ORA_DISK_1: reading from backup piece /data/back/full_29l5g69h_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/data/back/full_29l5g69h_1_1 tag=TAG20100208T095809
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
archive log filename=/home/oracle/flash_recovery_area/RMAN/archivelog/2010_02_08/o1_mf_1_776_5pyy199f_.arc thread=1 sequence=776
channel default: deleting archive log(s)
archive log filename=/home/oracle/flash_recovery_area/RMAN/archivelog/2010_02_08/o1_mf_1_776_5pyy199f_.arc recid=6 stamp=710418857
unable to find archive log
archive log thread=1 sequence=777
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 02/08/2010 10:34:19
RMAN-06054: media recovery requesting unknown log: thread 1 seq 777 lowscn 24746282


日志有问题,因为没有备份日志,没有日志可用于恢复;

 


4 RMAN> alter database open resetlogs;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 02/08/2010 10:34:38
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00704: bootstrap process failure
ORA-39700: database must be opened with UPGRADE option
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
ORA-03114: not connected to ORACLE
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 02/08/2010 10:34:38
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00704: bootstrap process failure
ORA-39700: database must be opened with UPGRADE option


奇怪的是alter database open resetlogs;不能打开报需要用
SQL> alter database open upgrade;   在mount下执行
这估计发生这个情况的原因是B数据库的版本是10.2.0.3.0,A库是10.2.0.2.0导致的。


关闭数据库再开启数据库同样的报错
SQL> startup
ORACLE instance started.

Total System Global Area 1212153856 bytes
Fixed Size                  2079256 bytes
Variable Size             293602792 bytes
Database Buffers          910163968 bytes
Redo Buffers                6307840 bytes
Database mounted.
ORA-01092: ORACLE instance terminated. Disconnection forced
查看日志发现
ORA-00704: bootstrap process failure
ORA-39700: database must be opened with UPGRADE option
分析原因是B数据库没有升级,迁移过来的数据库是A数据库版本的
升级数据库问题得到解决

sqlplus /nolog
conn /as sysdba
startup upgrade
spool patch.log
@?/rdbms/admin/catupgrd.sql
spool off
shutdown immediate
startup
启LISTENER
lsnrctl start
启Oracle Enterprise Manager
emctl start dbconsole

 

验证下数据库的可用性. OK

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/16719800/viewspace-662806/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/16719800/viewspace-662806/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值