1 在新ORACLE_HOME下干净关闭实例,并启动到mount,执行闪回操作,并关闭实例
注:不能在旧ORACLE_HOME下做闪回操作,否则会遇到 ORA-38792: encountered unknown flashback record from release 11.0.0.0.0
[oracle@redhat ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Tue Jan 21 13:24:33 2014
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 835104768 bytes
Fixed Size 2232960 bytes
Variable Size 230690176 bytes
Database Buffers 595591168 bytes
Redo Buffers 6590464 bytes
Database mounted.
SQL> set linesize 200
SQL> select * from v$restore_point;
SCN DATABASE_INCARNATION# GUA STORAGE_SIZE TIME NAME
---------- --------------------- --- ------------ --------------------------------------------------------------------------- --------------------------------------------------------------------------
523168 2 YES 810450944 21-JAN-14 11.24.40.000000000 AM BEFORE_UPGRADE
SQL> flashback database to restore point before_upgrade;
Flashback complete.
新ORACLE_HOME中警告日志中闪回的记录,闪回完毕后自动应用归档日志前推至指定时间点:
ALTER DATABASE MOUNT
Successful mount of redo thread 1, with mount id 960220067
Allocated 3981120 bytes in shared pool for flashback generation buffer
Starting background process RVWR
Tue Jan 21 13:32:23 2014
RVWR started with pid=20, OS id=8060
Database mounted in Exclusive Mode
Lost write protection disabled
Completed: ALTER DATABASE MOUNT
Tue Jan 21 13:34:59 2014
flashback database to restore point before_upgrade
Flashback Restore Start
Tue Jan 21 13:35:32 2014
Flashback Restore Complete
Flashback Media Recovery Start
started logmerger process
Parallel Media Recovery started with 2 slaves
Flashback Media Recovery Log /u01/archivelog/test3/1_14_792770784.dbf
Tue Jan 21 13:35:32 2014
Incomplete Recovery applied until change 523169 time 01/21/2014 11:24:40
Flashback Media Recovery Complete
Completed: flashback database to restore point before_upgrade
注:如果闪回后,启动实例出现问题,必须在新home中startup upgrade后,shutdown immediate.才能再次flashback database.
2 在旧ORACLE_HOME中mount数据库,并open resetlogs
[oracle@redhat ~]$ su - oracle
Password:
[oracle@redhat ~]$ export ORACLE_SID=test3
[oracle@redhat ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.5.0 - Production on Tue Jan 21 13:57:57 2014
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to an idle instance.
SQL> startup mount
ORACLE instance started.
Total System Global Area 599785472 bytes
Fixed Size 2098112 bytes
Variable Size 163580992 bytes
Database Buffers 427819008 bytes
Redo Buffers 6287360 bytes
Database mounted.
SQL> alter database open resetlogs;
Database altered.
SQL> set linesize 200
set wrap off
col comp_name for a30
select substr(comp_name,1,40) comp_name, status, substr(version,1,10) version from dba_registry order by comp_name;
SQL> SQL> SQL>
COMP_NAME STATUS VERSION
------------------------------ -------------------------------------------- ----------------------------------------
JServer JAVA Virtual Machine VALID 10.2.0.5.0
OLAP Analytic Workspace VALID 10.2.0.5.0
OLAP Catalog VALID 10.2.0.5.0
Oracle Data Mining VALID 10.2.0.5.0
Oracle Database Catalog Views VALID 10.2.0.5.0
Oracle Database Java Packages VALID 10.2.0.5.0
Oracle Database Packages and T VALID 10.2.0.5.0
Oracle Enterprise Manager VALID 10.2.0.5.0
Oracle Expression Filter VALID 10.2.0.5.0
Oracle OLAP API VALID 10.2.0.5.0
Oracle Rules Manager VALID 10.2.0.5.0
Oracle Text VALID 10.2.0.5.0
Oracle Workspace Manager VALID 10.2.0.5.0
Oracle XDK VALID 10.2.0.5.0
Oracle XML Database VALID 10.2.0.5.0
Oracle interMedia VALID 10.2.0.5.0
Spatial VALID 10.2.0.5.0
17 rows selected.