单机rman异机恢复

因项目需要,要将测试库恢复到另一台服务器上

测试库备份

RMAN> backup format '/u01/app/backup/epmdss/FULLBAK_%d_%T_%s_%p' tag db_full_bak database include current controlfile;
RMAN> backup format '/u01/app/backup/epmdss/init_%d_%T_%s_%p' tag initpara_bak spfile;

1.恢复参数文件、控制文件

[oracle@suykf01 ~]$ export ORACLE_SID=epmdss
[oracle@suykf01 ~]$ rman target /
RMAN> startup nomount
RMAN> restore spfile to '/oracle/u01/app/oracle/product/11.2.0.4/db_1/dbs/spfileepmdss.ora' from '/oracle/dayi_db/init_EPMDSS_20200415_17_1';
RMAN> restore controlfile from '/oracle/dayi_db/FULLBAK_EPMDSS_20200415_16_1';
利用spfile创建pfile并修改对应路径、创建对应路径;
修改控制文件名称;

2.注册备份片

RMAN> catalog backuppiece '/oracle/dayi_db/FULLBAK_EPMDSS_20200415_15_1';

3.还原数据库

RMAN> list backup
RMAN> run{
allocate channel d1 type disk;
allocate channel d2 type disk;
allocate channel d3 type disk;
allocate channel d4 type disk;
allocate channel d5 type disk;
allocate channel d6 type disk;
set newname for datafile  1 to '/oracle/u01/app/oracle/oradata/epmdss/system01.dbf';
set newname for datafile  2 to '/oracle/u01/app/oracle/oradata/epmdss/sysaux01.dbf';
set newname for datafile  3 to '/oracle/u01/app/oracle/oradata/epmdss/undotbs01.dbf';
set newname for datafile  4 to '/oracle/u01/app/oracle/oradata/epmdss/users01.dbf';
set newname for datafile  5 to '/oracle/u01/app/oracle/oradata/epmdss/dssdat01.dbf';
set newname for datafile  6 to '/oracle/u01/app/oracle/oradata/epmdss/dssdat02.dbf';
set newname for datafile  7 to '/oracle/u01/app/oracle/oradata/epmdss/dssdat03.dbf';
set newname for datafile  8 to '/oracle/u01/app/oracle/oradata/epmdss/dssidx01.dbf';
set newname for datafile  9 to '/oracle/u01/app/oracle/oradata/epmdss/dssidx02.dbf';
set newname for datafile  10 to '/oracle/u01/app/oracle/oradata/epmdss/dssidx03.dbf';
restore database;
switch datafile all;
release channel d1;
release channel d2;
release channel d3;
release channel d4;
release channel d5;
release channel d6;
}

4.恢复数据库

RMAN> alter database open resetlogs; 
 
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 08/03/2020 16:59:13
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1: '/oracle/u01/app/oracle/oradata/epmdss/system01.dbf'
 
RMAN> recover database;
 
Starting recover at 03-AUG-20
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=559 device type=DISK
 
starting media recovery
 
unable to find archived log
archived log thread=1 sequence=367
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 08/03/2020 16:59:31
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 367 and starting SCN of 2367502
 
RMAN> recover database until scn 2367502;
 
Starting recover at 03-AUG-20
using channel ORA_DISK_1
 
starting media recovery
media recovery complete, elapsed time: 00:00:01
 
Finished recover at 03-AUG-20
 
 
RMAN> alter database open;
 
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 08/03/2020 17:00:21
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
 
RMAN> alter database open RESETLOGS;
 
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 08/03/2020 17:00:42
ORA-00349: failure obtaining block size for '/u01/app/oracle/oradata/epmdss/redo01.log'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 9

5.日志重命名

SQL> alter database rename file '/u01/app/oracle/oradata/epmdss/redo01.log' to '/oracle/u01/app/oracle/oradata/epmdss/redo01.log';
SQL> alter database rename file '/u01/app/oracle/oradata/epmdss/redo02.log' to '/oracle/u01/app/oracle/oradata/epmdss/redo02.log';
SQL> alter database rename file '/u01/app/oracle/oradata/epmdss/redo03.log' to '/oracle/u01/app/oracle/oradata/epmdss/redo03.log';
 
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-00392: log 1 of thread 1 is being cleared, operation not allowed
ORA-00312: online log 1 thread 1:
'/oracle/u01/app/oracle/oradata/epmdss/redo01.log'

6.清理重做日志

SQL> alter database clear logfile group 1;
SQL> alter database clear logfile group 2;
SQL> alter database clear logfile group 3;
 
SQL> alter database open resetlogs;

7.修改监听端口

SQL> alter system set local_listener="(address=(protocol=tcp)(host=192.168.188.5)(port=11521))";

8.创建临时表空间

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值