在rman異機還原的時候,忘記設定dbid導致,且機器資料庫小版本不一致

like052629發表於2015-07-07
在rman異機還原的時候,忘記設定dbid導致   --且源庫是11.2.0.1,將源庫的備份還原至目標庫11.2.0.4
RMAN> set dbid 930813055 --未設定


先restore database;
RMAN> recover database;


Starting recover at 01-JUL-2015 09:30:26
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 07/01/2015 09:30:26
ORA-19698: /home/oracle/app/oradata/test/redo01.log is from different database: id=943007602, db_name=test


RMAN> sql "alter database rename file ''/home/oracle/app/oradata/test/redo03.log'' to ''/home/oracle/oracle/oradata/pstest/redo03.log''";


sql statement: alter database rename file ''/home/oracle/app/oradata/test/redo03.log'' to ''/home/oracle/oracle/oradata/pstest/redo03.log''
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of sql command on default channel at 07/01/2015 09:31:40
RMAN-11003: failure during parse/execution of SQL statement: alter database rename file '/home/oracle/app/oradata/test/redo03.log' to '/home/oracle/oracle/oradata/pstest/redo03.log'
ORA-01511: error in renaming log/data files
ORA-01516: nonexistent log file, data file, or temporary file "/home/oracle/app/oradata/test/redo03.log"


RMAN> sql "alter database drop logfile group 1";


sql statement: alter database drop logfile group 1


RMAN> sql "alter database drop logfile group 2";


sql statement: alter database drop logfile group 2
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of sql command on default channel at 07/01/2015 09:35:09
RMAN-11003: failure during parse/execution of SQL statement: alter database drop logfile group 2
ORA-01567: dropping log 2 would leave less than 2 log files for instance pstest (thread 1)
ORA-00312: online log 2 thread 1: '/home/oracle/oracle/oradata/pstest/redo02.log'


RMAN> sql "alter database add logfile group 1 '/home/oracle/oracle/oradata/pstest/redo01.log' size 300m";


sql statement: alter database add logfile group 1 '/home/oracle/oracle/oradata/pstest/redo01.log' size 300m
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of sql command on default channel at 07/01/2015 09:38:05
RMAN-10015: error compiling PL/SQL program


RMAN> sql "alter database add logfile group 1 ''/home/oracle/oracle/oradata/pstest/redo01.log'' size 300m";


sql statement: alter database add logfile group 1 ''/home/oracle/oracle/oradata/pstest/redo01.log'' size 300m


RMAN> sql "alter database drop logfile group 2";


sql statement: alter database drop logfile group 2


RMAN> sql "alter database add logfile group 1 ''/home/oracle/oracle/oradata/pstest/redo02.log'' size 300m";


sql statement: alter database add logfile group 1 ''/home/oracle/oracle/oradata/pstest/redo02.log'' size 300m
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of sql command on default channel at 07/01/2015 09:38:59
RMAN-11003: failure during parse/execution of SQL statement: alter database add logfile group 1 '/home/oracle/oracle/oradata/pstest/redo02.log' size 300m
ORA-01184: logfile group 1 already exists


RMAN> sql "alter database add logfile group 2 ''/home/oracle/oracle/oradata/pstest/redo02.log'' size 300m";


sql statement: alter database add logfile group 2 ''/home/oracle/oracle/oradata/pstest/redo02.log'' size 300m


RMAN> sql "alter database drop logfile group 3";


sql statement: alter database drop logfile group 3
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of sql command on default channel at 07/01/2015 09:39:15
RMAN-11003: failure during parse/execution of SQL statement: alter database drop logfile group 3
ORA-01623: log 3 is current log for instance pstest (thread 1) - cannot drop
ORA-00312: online log 3 thread 1: '/home/oracle/oracle/oradata/pstest/redo03.log'




--standbylogfile
RMAN> sql "alter database drop logfile group 4";


sql statement: alter database drop logfile group 4


RMAN> sql "alter database drop logfile group 5";


sql statement: alter database drop logfile group 5


RMAN> sql "alter database drop logfile group 6";


sql statement: alter database drop logfile group 6


RMAN> sql "alter database drop logfile group 7";


sql statement: alter database drop logfile group 7


RMAN> sql "alter system switch logfile"
2> ;


sql statement: alter system switch logfile
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of sql command on default channel at 07/01/2015 09:41:15
RMAN-11003: failure during parse/execution of SQL statement: alter system switch logfile
ORA-01109: database not open


RMAN> recover database;


Starting recover at 01-JUL-2015 09:43:34
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4


starting media recovery


channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=5043
channel ORA_DISK_1: reading from backup piece /home/oracle/rman_bak/20150630-pstest/archivelog/log_skqaps9n_1_1
channel ORA_DISK_1: piece handle=/home/oracle/rman_bak/20150630-pstest/archivelog/log_skqaps9n_1_1 tag=TAG20150630T135255
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
archived log file name=/home/oracle/oracle/arch/pstest1_5043_858705120.dbf thread=1 sequence=5043
unable to find archived log
archived log thread=1 sequence=5044
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 07/01/2015 09:43:44
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 5044 and starting SCN of 11431827976888


RMAN> alter database open resetlogs;


RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 07/01/2015 09:45:07
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00704: bootstrap process failure
ORA-39700: database must be opened with UPGRADE option
Process ID: 39575
Session ID: 101 Serial number: 9
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 07/01/2015 09:45:07
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00704: bootstrap process failure
ORA-39700: database must be opened with UPGRADE option
Process ID: 39575
Session ID: 101 Serial number: 9
[oracle@ryxr1 dbs]$ 
[oracle@ryxr1 dbs]$ sqlplus / as sysdba


SQL*Plus: Release 11.2.0.4.0 Production on Wed Jul 1 09:50:13 2015


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


Connected to an idle instance.


SQL> startup mount;
ORACLE instance started.


Total System Global Area 9954570240 bytes
Fixed Size                  2261768 bytes
Variable Size            5435821304 bytes
Database Buffers         4496293888 bytes
Redo Buffers               20193280 bytes
Database mounted.
SQL> alter database open resetlogs upgrade;
alter database open resetlogs upgrade
*
ERROR at line 1:
ORA-01139: RESETLOGS option only valid after an incomplete database recovery




SQL> recover database;
ORA-00283: recovery session canceled due to errors
ORA-16433: The database must be opened in read/write mode.




SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
[oracle@ryxr1 dbs]$ rman target /


Recovery Manager: Release 11.2.0.4.0 - Production on Wed Jul 1 09:51:09 2015


Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.


connected to target database: test (DBID=942741790, not open)


RMAN> recover database;


Starting recover at 01-JUL-2015 09:51:15
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=167 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=200 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=233 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=266 device type=DISK


starting media recovery
media recovery failed
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 07/01/2015 09:51:19
ORA-00283: recovery session canceled due to errors
RMAN-11003: failure during parse/execution of SQL statement: alter database recover if needed
 start
ORA-00283: recovery session canceled due to errors
ORA-16433: The database must be opened in read/write mode.


RMAN> alter database open resetlogs upgrade;


RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "upgrade": expecting one of: ";"
RMAN-01007: at line 1 column 31 file: standard input


RMAN> alter database open resetlogs;


RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 07/01/2015 09:51:49
ORA-01139: RESETLOGS option only valid after an incomplete database recovery


RMAN> alter database open;


RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 07/01/2015 09:52:03
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00704: bootstrap process failure
ORA-39700: database must be opened with UPGRADE option
Process ID: 4179
Session ID: 101 Serial number: 11
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 07/01/2015 09:52:03
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00704: bootstrap process failure
ORA-39700: database must be opened with UPGRADE option
Process ID: 4179
Session ID: 101 Serial number: 11
[oracle@ryxr1 dbs]$ sqlplus / as sysdba


SQL*Plus: Release 11.2.0.4.0 Production on Wed Jul 1 09:52:55 2015


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


Connected to an idle instance.


SQL> startup mount;
ORACLE instance started.


Total System Global Area 9954570240 bytes
Fixed Size                  2261768 bytes
Variable Size            5435821304 bytes
Database Buffers         4496293888 bytes
Redo Buffers               20193280 bytes
Database mounted.
SQL> alter database open resetlogs upgrade;
alter database open resetlogs upgrade
*
ERROR at line 1:
ORA-01139: RESETLOGS option only valid after an incomplete database recovery




SQL> alter database open upgrade;


Database altered.


SQL> 
SQL> select group#,status from v$log;


    GROUP# STATUS
---------- ----------------
         1 CURRENT
         2 INACTIVE
         3 INACTIVE


SQL> select member from v$logfile;


MEMBER
--------------------------------------------------------------------------------
/home/oracle/oracle/oradata/pstest/redo03.log
/home/oracle/oracle/oradata/pstest/redo02.log
/home/oracle/oracle/oradata/pstest/redo01.log


--重建臨時表空間
SQL> alter tablespace temp add tempfile '/home/oracle/oracle/oradata/pstest/temp01.dbf' size 500M reuse;


Tablespace altered.


SQL> select * from dba_temp_files;
select * from dba_temp_files
              *
ERROR at line 1:
ORA-01187: cannot read from file  because it failed verification tests
ORA-01110: data file 201: '/home/oracle/app/oradata/test/temp01.dbf'




SQL> alter tablespace temp drop tempfile '/home/oracle/app/oradata/test/temp01.dbf';


Tablespace altered.
--執行以下指令碼,使用sys as sysdba登入
@/home/oracle/oracle/product/11.2.0/dbhome_1/rdbms/admin/catupgrd.sql
刷刷刷刷的跑很久
……
Oracle Application Express
.                                         VALID     3.2.1.00.10
Final Actions
.                                                                00:00:00
Total Upgrade Time: 00:19:06


PL/SQL procedure successfully completed.


SQL> 
SQL> SET SERVEROUTPUT OFF
SQL> SET VERIFY ON
SQL> commit;


Commit complete.


SQL> 
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> 
SQL> 
SQL> DOC
DOC>#######################################################################
DOC>#######################################################################
DOC>
DOC>   The above sql script is the final step of the upgrade. Please
DOC>   review any errors in the spool log file. If there are any errors in
DOC>   the spool file, consult the Oracle Database Upgrade Guide for
DOC>   troubleshooting recommendations.
DOC>
DOC>   Next restart for normal operation, and then run utlrp.sql to
DOC>   recompile any invalid application objects.
DOC>
DOC>   If the source database had an older time zone version prior to
DOC>   upgrade, then please run the DBMS_DST package.  DBMS_DST will upgrade
DOC>   TIMESTAMP WITH TIME ZONE data to use the latest time zone file shipped
DOC>   with Oracle.
DOC>
DOC>#######################################################################
DOC>#######################################################################
DOC>#
SQL> 
SQL> Rem Set errorlogging off
SQL> SET ERRORLOGGING OFF;
SQL> 
SQL> REM END OF CATUPGRD.SQL
SQL> 
SQL> REM bug 12337546 - Exit current sqlplus session at end of catupgrd.sql.
SQL> REM                This forces user to start a new sqlplus session in order
SQL> REM                to connect to the upgraded db.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
再次重啟資料庫即可正式訪問。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28258625/viewspace-1725265/,如需轉載,請註明出處,否則將追究法律責任。

相關文章