Oracle RMAN异机恢复归档RMAN-07518(供日志挖掘使用)及修改dbid步骤
2016-07-17 12:04
861 查看
测试环境和生产库数据库名称相同,但dbid不同,执行catalog时报错,需修改dbid一致,如下:
[oracle@lkdb u01]$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Sat Jul 16 15:35:06 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: LKDB (DBID=1488801557)
RMAN> catalog start with '/u01/orcl_arch_full_gprangja_1_1';
using target database control file instead of recovery catalog
searching for all files that match the pattern /u01/orcl_arch_full_gprangja_1_1
List of Files Unknown to the Database
=====================================
File Name: /u01/orcl_arch_full_gprangja_1_1
Do you really want to catalog the above files (enter YES or NO)? yes
cataloging files...
no files cataloged
List of Files Which Where Not Cataloged
=======================================
File Name: /u01/orcl_arch_full_gprangja_1_1
RMAN-07518: Reason: Foreign database file DBID: 1460399894 Database Name: LKDB
SQL> select dbid from v$database;
DBID
----------
1488801557
SQL> exec dbms_backup_restore.nidbegin('lkdb','LKDB','1460399894','1488801557',0,0,10);
PL/SQL procedure successfully completed.
SQL> variable a number;
SQL> variable b number
SQL> variable c number;
SQL> exec dbms_backup_restore.nidprocessdf(0,0,:a,:b,:c);
PL/SQL procedure successfully completed.
SQL> print a;
A
----------
0
SQL> print b
B
----------
1
SQL> print c
C
----------
1
SQL> exec dbms_backup_restore.nidprocesscf(:a,:b);
PL/SQL procedure successfully completed.
SQL> print a
A
----------
1
SQL> print b
B
----------
1
SQL> print c
C
----------
1
SQL> exec dbms_backup_restore.nidend;
PL/SQL procedure successfully completed.
SQL> select dbid from v$database;
DBID
----------
1460399894
SQL> shutdown immediate;
ORA-03113: end-of-file on communication channel
Process ID: 4509
Session ID: 22 Serial number: 9
SQL> startup
ORA-24324: service handle not initialized
ORA-01041: internal error. hostdef extension doesn't exist
SQL> conn / as sysdba
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 413372416 bytes
Fixed Size 2253784 bytes
Variable Size 327158824 bytes
Database Buffers 79691776 bytes
Redo Buffers 4268032 bytes
Database mounted.
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SQL> recover database using backup controlfile until cancel;
ORA-00279: change 1120700 generated at 07/16/2016 15:36:37 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/product/11.2.0/db_1/dbs/arch/1_10_917364373.dbf
ORA-00280: change 1120700 for thread 1 is in sequence #10
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
AUTO
ORA-00308: cannot open archived log
'/u01/app/oracle/product/11.2.0/db_1/dbs/arch/1_10_917364373.dbf'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00308: cannot open archived log
'/u01/app/oracle/product/11.2.0/db_1/dbs/arch/1_10_917364373.dbf'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/u01/app/oracle/oradata/lkdb/system01.dbf'
SQL> alter system set undo_management='manual' scope=spfile;
System altered.
SQL> shutdown immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 413372416 bytes
Fixed Size 2253784 bytes
Variable Size 318770216 bytes
Database Buffers 88080384 bytes
Redo Buffers 4268032 bytes
Database mounted.
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/u01/app/oracle/oradata/lkdb/system01.dbf'
SQL> alter system set "_allow_resetlogs_corruption"=true scope=spfile;
System altered.
SQL> shutdown immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 413372416 bytes
Fixed Size 2253784 bytes
Variable Size 318770216 bytes
Database Buffers 88080384 bytes
Redo Buffers 4268032 bytes
Database mounted.
SQL> alter database open resetlogs;
Database altered.
SQL> alter system set undo_management='auto' scope=spfile;
System altered.
SQL> alter system set "_allow_resetlogs_corruption"=false scope=spfile;
System altered.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 413372416 bytes
Fixed Size 2253784 bytes
Variable Size 327158824 bytes
Database Buffers 79691776 bytes
Redo Buffers 4268032 bytes
Database mounted.
Database opened.
SQL> select name,dbid from v$database;
NAME DBID
--------- ----------
lkdb 1460399894
[oracle@lkdb u01]$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Sat Jul 16 15:42:21 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: lkdb (DBID=1460399894)
RMAN> catalog start with '/u01/orcl_arch_full_gprangja_1_1';
using target database control file instead of recovery catalog
searching for all files that match the pattern /u01/orcl_arch_full_gprangja_1_1
List of Files Unknown to the Database
=====================================
File Name: /u01/orcl_arch_full_gprangja_1_1
Do you really want to catalog the above files (enter YES or NO)? yes
cataloging files...
cataloging done
List of Cataloged Files
=======================
File Name: /u01/orcl_arch_full_gprangja_1_1
RMAN> run
2> {allocate channel ci type disk;
3> set archivelog destination to '/u01/';
4> restore archivelog all;
5> release channel ci;
6> }
released channel: ORA_DISK_1
allocated channel: ci
channel ci: SID=28 device type=DISK
executing command: SET ARCHIVELOG DESTINATION
Starting restore at 16-JUL-16
channel ci: starting archived log restore to user-specified destination
archived log destination=/u01/
channel ci: restoring archived log
archived log thread=1 sequence=3900
channel ci: restoring archived log
archived log thread=2 sequence=3066
channel ci: restoring archived log
archived log thread=1 sequence=3901
channel ci: restoring archived log
archived log thread=2 sequence=3067
channel ci: restoring archived log
archived log thread=1 sequence=3902
channel ci: restoring archived log
archived log thread=1 sequence=3903
channel ci: restoring archived log
archived log thread=2 sequence=3068
channel ci: restoring archived log
archived log thread=1 sequence=3904
channel ci: restoring archived log
archived log thread=2 sequence=3069
channel ci: restoring archived log
archived log thread=1 sequence=3905
channel ci: reading from backup piece /u01/orcl_arch_full_gprangja_1_1
channel ci: piece handle=/u01/orcl_arch_full_gprangja_1_1 tag=TAG20160715T010129
channel ci: restored backup piece 1
channel ci: restore complete, elapsed time: 00:02:55
Finished restore at 16-JUL-16
released channel: ci
[root@lkdb u01]# du -sh *
213M 1_3900_888962712.dbf
213M 1_3901_888962712.dbf
213M 1_3902_888962712.dbf
213M 1_3903_888962712.dbf
213M 1_3904_888962712.dbf
213M 2_3066_888962712.dbf
213M 2_3067_888962712.dbf
213M 2_3068_888962712.dbf
8.7G app
853M orcl_arch_full_gprangja_1_1
日志挖掘步骤略。
[oracle@lkdb u01]$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Sat Jul 16 15:35:06 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: LKDB (DBID=1488801557)
RMAN> catalog start with '/u01/orcl_arch_full_gprangja_1_1';
using target database control file instead of recovery catalog
searching for all files that match the pattern /u01/orcl_arch_full_gprangja_1_1
List of Files Unknown to the Database
=====================================
File Name: /u01/orcl_arch_full_gprangja_1_1
Do you really want to catalog the above files (enter YES or NO)? yes
cataloging files...
no files cataloged
List of Files Which Where Not Cataloged
=======================================
File Name: /u01/orcl_arch_full_gprangja_1_1
RMAN-07518: Reason: Foreign database file DBID: 1460399894 Database Name: LKDB
SQL> select dbid from v$database;
DBID
----------
1488801557
SQL> exec dbms_backup_restore.nidbegin('lkdb','LKDB','1460399894','1488801557',0,0,10);
PL/SQL procedure successfully completed.
SQL> variable a number;
SQL> variable b number
SQL> variable c number;
SQL> exec dbms_backup_restore.nidprocessdf(0,0,:a,:b,:c);
PL/SQL procedure successfully completed.
SQL> print a;
A
----------
0
SQL> print b
B
----------
1
SQL> print c
C
----------
1
SQL> exec dbms_backup_restore.nidprocesscf(:a,:b);
PL/SQL procedure successfully completed.
SQL> print a
A
----------
1
SQL> print b
B
----------
1
SQL> print c
C
----------
1
SQL> exec dbms_backup_restore.nidend;
PL/SQL procedure successfully completed.
SQL> select dbid from v$database;
DBID
----------
1460399894
SQL> shutdown immediate;
ORA-03113: end-of-file on communication channel
Process ID: 4509
Session ID: 22 Serial number: 9
SQL> startup
ORA-24324: service handle not initialized
ORA-01041: internal error. hostdef extension doesn't exist
SQL> conn / as sysdba
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 413372416 bytes
Fixed Size 2253784 bytes
Variable Size 327158824 bytes
Database Buffers 79691776 bytes
Redo Buffers 4268032 bytes
Database mounted.
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SQL> recover database using backup controlfile until cancel;
ORA-00279: change 1120700 generated at 07/16/2016 15:36:37 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/product/11.2.0/db_1/dbs/arch/1_10_917364373.dbf
ORA-00280: change 1120700 for thread 1 is in sequence #10
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
AUTO
ORA-00308: cannot open archived log
'/u01/app/oracle/product/11.2.0/db_1/dbs/arch/1_10_917364373.dbf'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00308: cannot open archived log
'/u01/app/oracle/product/11.2.0/db_1/dbs/arch/1_10_917364373.dbf'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/u01/app/oracle/oradata/lkdb/system01.dbf'
SQL> alter system set undo_management='manual' scope=spfile;
System altered.
SQL> shutdown immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 413372416 bytes
Fixed Size 2253784 bytes
Variable Size 318770216 bytes
Database Buffers 88080384 bytes
Redo Buffers 4268032 bytes
Database mounted.
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/u01/app/oracle/oradata/lkdb/system01.dbf'
SQL> alter system set "_allow_resetlogs_corruption"=true scope=spfile;
System altered.
SQL> shutdown immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 413372416 bytes
Fixed Size 2253784 bytes
Variable Size 318770216 bytes
Database Buffers 88080384 bytes
Redo Buffers 4268032 bytes
Database mounted.
SQL> alter database open resetlogs;
Database altered.
SQL> alter system set undo_management='auto' scope=spfile;
System altered.
SQL> alter system set "_allow_resetlogs_corruption"=false scope=spfile;
System altered.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 413372416 bytes
Fixed Size 2253784 bytes
Variable Size 327158824 bytes
Database Buffers 79691776 bytes
Redo Buffers 4268032 bytes
Database mounted.
Database opened.
SQL> select name,dbid from v$database;
NAME DBID
--------- ----------
lkdb 1460399894
[oracle@lkdb u01]$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Sat Jul 16 15:42:21 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: lkdb (DBID=1460399894)
RMAN> catalog start with '/u01/orcl_arch_full_gprangja_1_1';
using target database control file instead of recovery catalog
searching for all files that match the pattern /u01/orcl_arch_full_gprangja_1_1
List of Files Unknown to the Database
=====================================
File Name: /u01/orcl_arch_full_gprangja_1_1
Do you really want to catalog the above files (enter YES or NO)? yes
cataloging files...
cataloging done
List of Cataloged Files
=======================
File Name: /u01/orcl_arch_full_gprangja_1_1
RMAN> run
2> {allocate channel ci type disk;
3> set archivelog destination to '/u01/';
4> restore archivelog all;
5> release channel ci;
6> }
released channel: ORA_DISK_1
allocated channel: ci
channel ci: SID=28 device type=DISK
executing command: SET ARCHIVELOG DESTINATION
Starting restore at 16-JUL-16
channel ci: starting archived log restore to user-specified destination
archived log destination=/u01/
channel ci: restoring archived log
archived log thread=1 sequence=3900
channel ci: restoring archived log
archived log thread=2 sequence=3066
channel ci: restoring archived log
archived log thread=1 sequence=3901
channel ci: restoring archived log
archived log thread=2 sequence=3067
channel ci: restoring archived log
archived log thread=1 sequence=3902
channel ci: restoring archived log
archived log thread=1 sequence=3903
channel ci: restoring archived log
archived log thread=2 sequence=3068
channel ci: restoring archived log
archived log thread=1 sequence=3904
channel ci: restoring archived log
archived log thread=2 sequence=3069
channel ci: restoring archived log
archived log thread=1 sequence=3905
channel ci: reading from backup piece /u01/orcl_arch_full_gprangja_1_1
channel ci: piece handle=/u01/orcl_arch_full_gprangja_1_1 tag=TAG20160715T010129
channel ci: restored backup piece 1
channel ci: restore complete, elapsed time: 00:02:55
Finished restore at 16-JUL-16
released channel: ci
[root@lkdb u01]# du -sh *
213M 1_3900_888962712.dbf
213M 1_3901_888962712.dbf
213M 1_3902_888962712.dbf
213M 1_3903_888962712.dbf
213M 1_3904_888962712.dbf
213M 2_3066_888962712.dbf
213M 2_3067_888962712.dbf
213M 2_3068_888962712.dbf
8.7G app
853M orcl_arch_full_gprangja_1_1
日志挖掘步骤略。
相关文章推荐
- ORACLE删除某用户下所有对象
- 一种高效的 vector 四则运算处理方法
- Oracle的使用经验
- Oracle内存学习笔记
- Oracle的rollup、cube、grouping sets函数
- oracle 中GROUP BY的用法
- Oracle函数及操作符
- 数据库(学习整理)----7--Oracle多表查询,三种join连接
- oracle和mysql驱动连接配置
- kali(ubuntu)linux Oracle jdk 8安装
- Oracle clob无法修改为blob
- java和scala实现oracle lpad\rpad函数
- 【读书笔记】ORACLE 内存管理
- Linux 安装 Oracle 11g——手工建库(RAC)
- oracle SQL语句(转)
- oracle表分区详解
- ORACLE使用DBCA建数据库时错误ORA-01503,ORA-01158解决
- delphi导入导出excel|oracle
- 监视oracle执行的SQL语句
- pl/sql oracle