rman复制数据库ORA01547ORA01194ORA01110,强制打开并修改日志文件

    我用rman复制数据库,做好前期准备了:创建了路径,建密码文件,参数文件,启动到nomount,用RMAN同时连接到源库
和辅助nomount库,当然也提前做了全库备份,并把备份复制到了目标库。

然后执行:
run{
DUPLICATE TARGET DATABASE TO sgpmdb2b
pfile='/oracle/base/admin/sgpmdb2b/pfile/pfilesgpmdb2b.ora'
db_file_name_convert=('/app/oracle/base/oradata/sgpmdb2/','/oracle/base/oradata/sgpmdb2b/');
}

如果顺利的话,数据库会自动重启到open状态,
不顺利的事情十有八九,呵呵。以下是报错
....
b2b/DATA_OUT.DBF
datafile 30 switched to datafile copy
input datafile copy recid=29 stamp=723570072 filename=/oracle/base/oradata/sgpmdb2b/IDX_OUT.DBF
datafile 31 switched to datafile copy
input datafile copy recid=30 stamp=723570072 filename=/oracle/base/oradata/sgpmdb2b/DATA_ARC001.DBF
datafile 32 switched to datafile copy
input datafile copy recid=31 stamp=723570072 filename=/oracle/base/oradata/sgpmdb2b/IDX_ARC001.DBF
datafile 33 switched to datafile copy
input datafile copy recid=32 stamp=723570072 filename=/oracle/base/oradata/sgpmdb2b/tbs_wz.dbf

contents of Memory Script:
{
   set until scn  10161135334995;
   recover
   clone database
    delete archivelog
   ;
}
executing Memory Script

executing command: SET until clause

Starting recover at 05-JUL-10
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=36 devtype=DISK

starting media recovery

Oracle Error:
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01194: file 25 needs more recovery to be consistent
ORA-01110: data file 25: '/oracle/base/oradata/sgpmdb2b/DATA_MAN001.DBF'

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 07/05/2010 15:41:17
RMAN-03015: error occurred in stored script Memory Script
RMAN-06053: unable to perform media recovery because of missing log
RMAN-06025: no backup of log thread 1 seq 2425 lowscn 10161135334770 found to restore
RMAN-06025: no backup of log thread 1 seq 2424 lowscn 10161135334764 found to restore
RMAN-06025: no backup of log thread 1 seq 2423 lowscn 10161135334758 found to restore
RMAN-06025: no backup of log thread 1 seq 2422 lowscn 10161135334751 found to restore
RMAN-06025: no backup of log thread 1 seq 2421 lowscn 10161135334745 found to restore
RMAN-06025: no backup of log thread 1 seq 2420 lowscn 10161135332958 found to restore


我的处理办法:
idle> create spfile from pfile='/oracle/base/admin/sgpmdb2b/pfile/pfilesgpmdb2b.ora' ;

File created.

idle> shutdown immediate
ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.
idle> startup mount
ORACLE instance started.

Total System Global Area  205520896 bytes
Fixed Size                  2082816 bytes
Variable Size             150996992 bytes
Database Buffers           46137344 bytes
Redo Buffers                6303744 bytes
Database mounted.
idle> select status from v$instance ;

STATUS
------------
MOUNTED

idle> show parameter db_name ;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_name                              string      sgpmdb2b
idle> alter system set "_allow_resetlogs_corruption"=true scope=spfile;

System altered.

idle> shutdown immediate
ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.
idle> startup
ORACLE instance started.

Total System Global Area  205520896 bytes
Fixed Size                  2082816 bytes
Variable Size             155191296 bytes
Database Buffers           41943040 bytes
Redo Buffers                6303744 bytes
Database mounted.
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open


idle> alter database open resetlogs ;
alter database open resetlogs
*
ERROR at line 1:
ORA-00344: unable to re-create online log '/oracle/base/oradata/
sgpmdb2b/redo01.log'
ORA-27040: file create error, unable to create file
Linux-x86_64 Error: 2: No such file or directory


idle> select * from v$log ;

    GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
         1          1          0   52428800          1 YES UNUSED              0
         3          1          0   52428800          1 YES CURRENT             0
         2          1          0   52428800          1 YES UNUSED              0

idle> alter database drop logfile group 1 ;

Database altered.

idle> alter database add logfile '/oracle/base/oradata/sgpmdb2b/redo01.log' size 52m ;

Database altered.

idle> select * from v$log ;

    GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
         1          1          0   54525952          1 YES UNUSED              0
         3          1          0   52428800          1 YES CURRENT             0
         2          1          0   52428800          1 YES UNUSED              0

idle> select * from v$logfile ;

    GROUP# STATUS  TYPE
---------- ------- -------
MEMBER
----------------------------------------------------------------------------------------------------
IS_
---
         3 STALE   ONLINE
/oracle/base/oradata/
sgpmdb2b/redo03.log
NO

         2 STALE   ONLINE
/oracle/base/oradata/
sgpmdb2b/redo02.log
NO

         1         ONLINE
/oracle/base/oradata/sgpmdb2b/redo01.log
NO

--看到这里就清楚了,原来我的初始化文件pfilesgpmdb2b.ora里面的路径有回车,出现了错误。

idle> alter database drop logfile group 2 ;

Database altered.

idle> alter database add logfile '/oracle/base/oradata/sgpmdb2b/redo02.log' size 52m ;

Database altered.

idle>
idle>
idle> alter system switch logfile ;
alter system switch logfile
*
ERROR at line 1:
ORA-01109: database not open

idle> select * from v$logfile ;

    GROUP# STATUS  TYPE
---------- ------- -------
MEMBER
----------------------------------------------------------------------------------------------------
IS_
---
         3 STALE   ONLINE
/oracle/base/oradata/
sgpmdb2b/redo03.log
NO

         2         ONLINE
/oracle/base/oradata/sgpmdb2b/redo02.log
NO

         1         ONLINE
/oracle/base/oradata/sgpmdb2b/redo01.log
NO


idle> alter database open ;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open


idle> alter database open resetlogs ;
alter database open resetlogs
*
ERROR at line 1:
ORA-00344: unable to re-create online log '/oracle/base/oradata/
sgpmdb2b/redo03.log'
ORA-27040: file create error, unable to create file
Linux-x86_64 Error: 2: No such file or directory


idle> alter database drop logfile group 3 ;
alter database drop logfile group 3
*
ERROR at line 1:
ORA-01623: log 3 is current log for instance sgpmdb2b (thread 1) - cannot drop
ORA-00312: online log 3 thread 1: '/oracle/base/oradata/
sgpmdb2b/redo03.log'


idle> alter database clear unarchived logfile group 3 ;
alter database clear unarchived logfile group 3
*
ERROR at line 1:
ORA-00344: unable to re-create online log '/oracle/base/oradata/
sgpmdb2b/redo03.log'
ORA-27040: file create error, unable to create file
Linux-x86_64 Error: 2: No such file or directory


idle> alter database drop logfile group 3 ;
alter database drop logfile group 3
*
ERROR at line 1:
ORA-01623: log 3 is current log for instance sgpmdb2b (thread 1) - cannot drop
ORA-00312: online log 3 thread 1: '/oracle/base/oradata/
sgpmdb2b/redo03.log'


idle> alter system switch logfile ;
alter system switch logfile
*
ERROR at line 1:
ORA-01109: database not open


idle> alter database open resetlogs ;
alter database open resetlogs
*
ERROR at line 1:
ORA-00344: unable to re-create online log '/oracle/base/oradata/
sgpmdb2b/redo03.log'
ORA-27040: file create error, unable to create file
Linux-x86_64 Error: 2: No such file or directory


idle> alter database rename file '/oracle/base/oradata/
  2  sgpmdb2b/redo03.log' to '/oracle/base/oradata/sgpmdb2b/redo03.log' ;

Database altered.

idle>
idle>
idle>
idle>
idle>
idle> alter database open resetlogs ;

Database altered.

idle> create undo tablespace UNDOTBS2
  2  datafile '/oracle/base/oradata/sgpmdb2b/undotbs02.dbf'
  3  size 200m ;

Tablespace created.

idle> create pfile='/oracle/base/admin/sgpmdb2b/pfile/pfilesgpmdb2b.ora' from spfile ;

File created.

idle> shutdown immediate ;
Database closed.
Database dismounted.
ORACLE instance shut down.

idle> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on Mon Jul 5 16:35:08 2010

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

Connected to an idle instance.


idle> startup pfile='/oracle/base/admin/sgpmdb2b/pfile/pfilesgpmdb2b.ora';
ORACLE instance started.

Total System Global Area  205520896 bytes
Fixed Size                  2082816 bytes
Variable Size             155191296 bytes
Database Buffers           41943040 bytes
Redo Buffers                6303744 bytes
Database mounted.
Database opened.
idle>
idle>
idle>
idle> create spfile from pfile='/oracle/base/admin/sgpmdb2b/pfile/pfilesgpmdb2b.ora';

File created.

idle>
idle>
idle>
idle> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

idle> startup
ORACLE instance started.

Total System Global Area  205520896 bytes
Fixed Size                  2082816 bytes
Variable Size             155191296 bytes
Database Buffers           41943040 bytes
Redo Buffers                6303744 bytes
Database mounted.
Database opened.
idle>
idle>
idle>
idle> show parameter db_name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_name                              string      sgpmdb2b
idle>
idle>
idle>
idle>
idle> show parameter pfile

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      /oracle/base/product/10.2.0/db
                                                 _1/dbs/spfilesgpmdb2b.ora
idle>
idle>
idle>
idle>
idle> select status from v$instance ;

STATUS
------------
OPEN

至此搞定。

原文地址:https://www.cnblogs.com/caibird2005/p/1771536.html