12C還原使用舊版本RMAN所建立的備份

eric0435發表於2018-01-02

可以還原使用舊版本RMAN所建立的備份,最舊版本為9.2.0.8。在建立備份的資料庫版本與還原備份的資料庫版本之間必須有支援的升級路徑存在。比如,源資料庫的版本為11gr2並且配置使用spfile引數檔案。資料庫啟用了歸檔與快速閃回區。控制檔案也被配置為自動備份。對源資料庫建立了RMAN備份,並且包含了歸檔重做日誌。要還原這些備份的主機上執行的是Oracle 12cr2的資料庫版本。

還原使用舊版本RMAN所建立備份到當前目標資料庫版本(12.2)的操作步驟如下:
1.驗證建立備份的資料庫版本與還原備份的資料庫版本之間是否存在升級路徑。例如,將Oracle 11.2.0.4所建立的RMAN備份還原到Oracle 12.2,那麼必須支援從11.2.0.4升級到12.2,根據Oracle的升級指南,11.2.0.3及以後版本可以直接升級到Oracle 12.2。

2.對源資料庫(jyrac為rac資料庫)建立RMAN備份

RMAN> backup as compressed backupset database format '/acfs1/rman_back/jyrac_%u_%d_%t_%s_%p'  plus archivelog format '/acfs1/rman_back/arch_%d_%T_%U';


Starting backup at 29-DEC-17
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting compressed archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=497 RECID=1044 STAMP=964006170
input archived log thread=2 sequence=540 RECID=1045 STAMP=964006171
channel ORA_DISK_1: starting piece 1 at 29-DEC-17
channel ORA_DISK_1: finished piece 1 at 29-DEC-17
piece handle=/acfs1/rman_back/arch_JYRAC_20171229_0isnb48r_1_1 tag=TAG20171229T112931 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 29-DEC-17

Starting backup at 29-DEC-17
using channel ORA_DISK_1
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00012 name=+DATADG/jyrac/datafile/ldjc01
input datafile file number=00002 name=+DATADG/jyrac/datafile/sysaux.258.930413055
input datafile file number=00011 name=+DATADG/jyrac/datafile/cdzj01
input datafile file number=00001 name=+DATADG/jyrac/datafile/system.259.930413057
input datafile file number=00003 name=+DATADG/jyrac/datafile/undotbs1.262.930413057
input datafile file number=00008 name=+DATADG/jyrac/datafile/sales_test_01.dbf
input datafile file number=00005 name=+DATADG/jyrac/datafile/example.260.930413057
input datafile file number=00006 name=+DATADG/jyrac/datafile/undotbs2.261.930413057
input datafile file number=00007 name=+DATADG/jyrac/datafile/test01.dbf
input datafile file number=00009 name=+DATADG/jyrac/datafile/emp_test_01.dbf
input datafile file number=00010 name=+DATADG/jyrac/datafile/orders_test_01.dbf
input datafile file number=00004 name=+DATADG/jyrac/datafile/users.263.930413057
channel ORA_DISK_1: starting piece 1 at 29-DEC-17
channel ORA_DISK_1: finished piece 1 at 29-DEC-17
piece handle=/acfs1/rman_back/jyrac_0jsnb48u_JYRAC_964006174_19_1 tag=TAG20171229T112933 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:09:06
Finished backup at 29-DEC-17

Starting backup at 29-DEC-17
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting compressed archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=498 RECID=1046 STAMP=964006723
input archived log thread=2 sequence=541 RECID=1047 STAMP=964006720
channel ORA_DISK_1: starting piece 1 at 29-DEC-17
channel ORA_DISK_1: finished piece 1 at 29-DEC-17
piece handle=/acfs1/rman_back/arch_JYRAC_20171229_0ksnb4q5_1_1 tag=TAG20171229T113845 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 29-DEC-17

Starting Control File and SPFILE Autobackup at 29-DEC-17
piece handle=/acfs1/rman_back/c-2655496871-20171229-00 comment=NONE
Finished Control File and SPFILE Autobackup at 29-DEC-17



RMAN> list backup;


List of Backup Sets
===================


BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
9       24.50K     DISK        00:00:01     29-DEC-17      
        BP Key: 9   Status: AVAILABLE  Compressed: YES  Tag: TAG20171229T112931
        Piece Name: /acfs1/rman_back/arch_JYRAC_20171229_0isnb48r_1_1

  List of Archived Logs in backup set 9
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    497     14690299647719 29-DEC-17 14690299647943 29-DEC-17
  2    540     14690299647723 29-DEC-17 14690299647960 29-DEC-17

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
10      Full    1.82G      DISK        00:09:05     29-DEC-17      
        BP Key: 10   Status: AVAILABLE  Compressed: YES  Tag: TAG20171229T112933
        Piece Name: /acfs1/rman_back/jyrac_0jsnb48u_JYRAC_964006174_19_1
  List of Datafiles in backup set 10
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 14690299647966 29-DEC-17 +DATADG/jyrac/datafile/system.259.930413057
  2       Full 14690299647966 29-DEC-17 +DATADG/jyrac/datafile/sysaux.258.930413055
  3       Full 14690299647966 29-DEC-17 +DATADG/jyrac/datafile/undotbs1.262.930413057
  4       Full 14690299647966 29-DEC-17 +DATADG/jyrac/datafile/users.263.930413057
  5       Full 14690299647966 29-DEC-17 +DATADG/jyrac/datafile/example.260.930413057
  6       Full 14690299647966 29-DEC-17 +DATADG/jyrac/datafile/undotbs2.261.930413057
  7       Full 14690299647966 29-DEC-17 +DATADG/jyrac/datafile/test01.dbf
  8       Full 14690299647966 29-DEC-17 +DATADG/jyrac/datafile/sales_test_01.dbf
  9       Full 14690299647966 29-DEC-17 +DATADG/jyrac/datafile/emp_test_01.dbf
  10      Full 14690299647966 29-DEC-17 +DATADG/jyrac/datafile/orders_test_01.dbf
  11      Full 14690299647966 29-DEC-17 +DATADG/jyrac/datafile/cdzj01
  12      Full 14690299647966 29-DEC-17 +DATADG/jyrac/datafile/ldjc01

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
11      92.50K     DISK        00:00:01     29-DEC-17      
        BP Key: 11   Status: AVAILABLE  Compressed: YES  Tag: TAG20171229T113845
        Piece Name: /acfs1/rman_back/arch_JYRAC_20171229_0ksnb4q5_1_1

  List of Archived Logs in backup set 11
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    498     14690299647943 29-DEC-17 14690299648779 29-DEC-17
  2    541     14690299647960 29-DEC-17 14690299648994 29-DEC-17

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
12      Full    17.89M     DISK        00:00:08     29-DEC-17      
        BP Key: 12   Status: AVAILABLE  Compressed: NO  Tag: TAG20171229T113847
        Piece Name: /acfs1/rman_back/c-2655496871-20171229-00
  SPFILE Included: Modification time: 29-DEC-17
  SPFILE db_unique_name: JYRAC
  Control File Included: Ckp SCN: 14690299650469   Ckp time: 29-DEC-17


[grid@jyrac1 rman_back]$ ls -lrt
total 1929424
-rw-r----- 1 oracle asmadmin      25600 Dec 29 11:29 arch_JYRAC_20171229_0isnb48r_1_1
-rw-r----- 1 oracle asmadmin 1951571968 Dec 29 11:38 jyrac_0jsnb48u_JYRAC_964006174_19_1
-rw-r----- 1 oracle asmadmin      95232 Dec 29 11:38 arch_JYRAC_20171229_0ksnb4q5_1_1
-rw-r----- 1 oracle asmadmin   18776064 Dec 29 11:38 c-2655496871-20171229-00

3.將步驟2生成的RMAN備份檔案複製到目標主機相應目錄(/ora_xtts/rman)中

[oracle@jytest3 rman]$ scp oracle@10.138.130.151:/acfs1/rman_back/* /ora_xtts/rman/
The authenticity of host '10.138.130.151 (10.138.130.151)' can't be established.
RSA key fingerprint is 92:b7:e1:f5:a4:99:5a:de:d5:d3:f2:25:f7:98:0a:a1.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.138.130.151' (RSA) to the list of known hosts.
oracle@10.138.130.151's password: 
arch_JYRAC_20171229_0isnb48r_1_1                                                                                                                                                              

            100%   25KB  25.0KB/s   00:00    
arch_JYRAC_20171229_0ksnb4q5_1_1                                                                                                                                                              

            100%   93KB  93.0KB/s   00:00    
c-2655496871-20171229-00                                                                                                                                                                      

            100%   18MB  17.9MB/s   00:01    
jyrac_0jsnb48u_JYRAC_964006174_19_1                                                                                                                                                           

            100% 1861MB  38.0MB/s   00:49    
[oracle@jytest3 rman]$ ls -lrt
total 1924300
-rw-r-----. 1 oracle oinstall      25600 Dec 30 01:48 arch_JYRAC_20171229_0isnb48r_1_1
-rw-r-----. 1 oracle oinstall      95232 Dec 30 01:48 arch_JYRAC_20171229_0ksnb4q5_1_1
-rw-r-----. 1 oracle oinstall   18776064 Dec 30 01:48 c-2655496871-20171229-00
-rw-r-----. 1 oracle oinstall 1951571968 Dec 30 01:49 jyrac_0jsnb48u_JYRAC_964006174_19_1

4.在目標主機上,設定ORACLE_SID為源資料庫的SID(jyrac1為單例項資料庫)

[oracle@jytest3 ~]$ export ORACLE_SID=jyrac1

5.在目標主機上啟動RMAN並連線到目標資料庫

[oracle@jytest3 ~]$ rman target/ nocatalog

Recovery Manager: Release 12.2.0.1.0 - Production on Sat Dec 30 02:06:59 2017

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

connected to target database (not started)

6.設定DBID,該值為源資料庫的DBID

RMAN> set DBID 2655496871

executing command: SET DBID

7.啟動目標資料庫到nomount狀態

RMAN> startup nomount

startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/12.2.0/db/dbs/initjyrac1.ora'

starting Oracle instance without parameter file for retrieval of spfile
Oracle instance started

Total System Global Area    1073741824 bytes

Fixed Size                     8628936 bytes
Variable Size                293602616 bytes
Database Buffers             763363328 bytes
Redo Buffers                   8146944 bytes

RMAN查詢spfile引數檔案失敗,因為它還沒有被還原,然而,例項將會使用虛擬引數檔案來進行啟動。

8.從源資料庫的自動備份檔案中還原spfile引數檔案
因為源資料庫啟用了控制檔案自動備份,所以spfile引數檔案會被包含在自動備份檔案中。為了還原非預設格式的自動備份,需要執行set controlfile autobackup format命令來指定格式。下面的命令將設定控制檔案自動備份格式,將源資料庫的spfile引數檔案還原為/u01/app/oracle/product/12.2.0/db/dbs/initjyrac1.ora檔案,然後關閉目標資料庫。

RMAN> run
2> {
3> set controlfile autobackup format for device type disk to '/ora_xtts/rman/%F';
4> restore spfile to pfile '/u01/app/oracle/product/12.2.0/db/dbs/initjyrac1.ora' from autobackup;
5> shutdown abort;
6> }

executing command: SET CONTROLFILE AUTOBACKUP FORMAT

Starting restore at 30-DEC-17
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=6 device type=DISK

channel ORA_DISK_1: looking for AUTOBACKUP on day: 20171230
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20171229
channel ORA_DISK_1: AUTOBACKUP found: /ora_xtts/rman/c-2655496871-20171229-00
channel ORA_DISK_1: restoring spfile from AUTOBACKUP /ora_xtts/rman/c-2655496871-20171229-00
channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
Finished restore at 30-DEC-17

Oracle instance shut down

9.編輯pfile引數檔案並修改所需要的引數。這包括compatible引數,如果目標資料庫的compatible引數不同於源資料庫的設定,那麼在目標資料庫版本中這個引數會被棄用。更新以_DEST結尾的引數來反映新的目錄結構。

[oracle@jytest3 dbs]$ mv initjyrac1.ora initjyrac1.ora.bak
[oracle@jytest3 dbs]$ vi initjyrac1.ora

*.audit_file_dest='/u01/app/oracle/admin/jyrac/adump'
*.audit_trail='db'
*.cluster_database=false
*.compatible='11.2.0.4.0'
*.control_files='+DATA/jyrac/controlfile/current.257.930412709'
*.db_block_size=8192
*.db_create_file_dest='+DATA'
*.db_domain=''
*.db_name='jyrac'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=jyracXDB)'
jyrac1.dispatchers='(PROTOCOL=TCP) (SERVICE=jyrac1XDB)'
jyrac1.instance_number=1
*.job_queue_processes=1000
*.log_archive_dest_1='location=+data/arch/jyrac'
*.open_cursors=300
*.pga_aggregate_target=836763648
*.processes=150
*.remote_login_passwordfile='exclusive'
*.sga_target=2510290944
jyrac2.thread=2
jyrac1.thread=1
jyrac1.undo_tablespace='UNDOTBS1'
jyrac2.undo_tablespace='UNDOTBS2'

10.使用編輯後的pfile引數檔案來啟動例項到nomount狀態

RMAN> startup force nomount pfile='/u01/app/oracle/product/12.2.0/db/dbs/initjyrac1.ora'

Oracle instance started

Total System Global Area    2516582400 bytes

Fixed Size                     8623832 bytes
Variable Size                637536552 bytes
Database Buffers            1862270976 bytes
Redo Buffers                   8151040 bytes

11.從控制檔案自動備份檔案中還原控制檔案並將目標資料庫啟動到mount狀態,為了還原非預設格式的自動備份,需要執行set controlfile autobackup format命令來指定格式。

RMAN> run
2> {
3> set controlfile autobackup format for device type disk to '/ora_xtts/rman/%F';
4> restore controlfile from autobackup;
5> alter database mount;
6> }

executing command: SET CONTROLFILE AUTOBACKUP FORMAT

Starting restore at 30-DEC-17
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=6 device type=DISK

channel ORA_DISK_1: looking for AUTOBACKUP on day: 20171230
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20171229
channel ORA_DISK_1: AUTOBACKUP found: /ora_xtts/rman/c-2655496871-20171229-00
channel ORA_DISK_1: restoring control file from AUTOBACKUP /ora_xtts/rman/c-2655496871-20171229-00
channel ORA_DISK_1: control file restore from AUTOBACKUP complete
output file name=+DATA/JYRAC/CONTROLFILE/current.329.964063767
Finished restore at 30-DEC-17

Statement processed
released channel: ORA_DISK_1

控制檔案會被還原到pfile引數檔案中control_files引數所指定的目錄中。

12.在目標主機上將源資料庫的備份檔案註冊到rman檔案庫中。如果目錄中的所有檔案有共同的字首,那麼可以使用catalog start with命令。如果想要單獨指定檔名來進行註冊,那麼執行catalog datafilecopy命令。我這裡所有的備份檔案儲存在/ora_xtts/rman目錄中,因此使用catalog start with命令進行註冊。

RMAN> catalog start with '/ora_xtts/rman/';

searching for all files that match the pattern /ora_xtts/rman/

List of Files Unknown to the Database
=====================================
File Name: /ora_xtts/rman/arch_JYRAC_20171229_0isnb48r_1_1
File Name: /ora_xtts/rman/arch_JYRAC_20171229_0ksnb4q5_1_1
File Name: /ora_xtts/rman/c-2655496871-20171229-00
File Name: /ora_xtts/rman/jyrac_0jsnb48u_JYRAC_964006174_19_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: /ora_xtts/rman/arch_JYRAC_20171229_0isnb48r_1_1
File Name: /ora_xtts/rman/arch_JYRAC_20171229_0ksnb4q5_1_1
File Name: /ora_xtts/rman/c-2655496871-20171229-00
File Name: /ora_xtts/rman/jyrac_0jsnb48u_JYRAC_964006174_19_1

13.還原與恢復源資料庫
如果資料檔案要被還原到目標主機上的目錄與源資料庫所在的目錄不相同,那麼必須使用set newname命令來對還原的資料檔案指定新的目錄路徑。如果聯機重做日誌將建立在與源資料庫不相同的目錄中,那麼必須使用alter database rename file命令來為每個聯機重做日誌指定新的目錄路徑,在這裡使用set newname for database命令來為所有被還原的資料檔案指定新目錄,新的聯機重做日誌檔案使用alter database rename file命令來指定,並且指定恢復目標scn。

RMAN> run
2> {
3> set newname for database to '+data/jyrac/datafile/%U';
4> alter database rename file '+DATADG/jyrac/onlinelog/group_1.264.930413221' to '+data/jyrac/onlinelog/redo1.log';
5> alter database rename file '+DATADG/jyrac/onlinelog/group_2.265.930413225' to '+data/jyrac/onlinelog/redo2.log';
6> alter database rename file '+DATADG/jyrac/onlinelog/group_3.266.930413227' to '+data/jyrac/onlinelog/redo3.log';
7> alter database rename file '+DATADG/jyrac/onlinelog/group_4.267.930413231' to '+data/jyrac/onlinelog/redo4.log';
8> set until scn 14690299648200;
9> restore database;
10> switch datafile all;
11> recover database;
12> }

executing command: SET NEWNAME

Statement processed

Statement processed

Statement processed

Statement processed

executing command: SET until clause

Starting restore at 30-DEC-17
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=93 device type=DISK

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to +data/jyrac/datafile/data_D-JYRAC_TS-SYSTEM_FNO-1
channel ORA_DISK_1: restoring datafile 00002 to +data/jyrac/datafile/data_D-JYRAC_TS-SYSAUX_FNO-2
channel ORA_DISK_1: restoring datafile 00003 to +data/jyrac/datafile/data_D-JYRAC_TS-UNDOTBS1_FNO-3
channel ORA_DISK_1: restoring datafile 00004 to +data/jyrac/datafile/data_D-JYRAC_TS-USERS_FNO-4
channel ORA_DISK_1: restoring datafile 00005 to +data/jyrac/datafile/data_D-JYRAC_TS-EXAMPLE_FNO-5
channel ORA_DISK_1: restoring datafile 00006 to +data/jyrac/datafile/data_D-JYRAC_TS-UNDOTBS2_FNO-6
channel ORA_DISK_1: restoring datafile 00007 to +data/jyrac/datafile/data_D-JYRAC_TS-TEST_FNO-7
channel ORA_DISK_1: restoring datafile 00008 to +data/jyrac/datafile/data_D-JYRAC_TS-SALES_TEST_FNO-8
channel ORA_DISK_1: restoring datafile 00009 to +data/jyrac/datafile/data_D-JYRAC_TS-EMP_TEST_FNO-9
channel ORA_DISK_1: restoring datafile 00010 to +data/jyrac/datafile/data_D-JYRAC_TS-ORDERS_TEST_FNO-10
channel ORA_DISK_1: restoring datafile 00011 to +data/jyrac/datafile/data_D-JYRAC_TS-CDZJ_FNO-11
channel ORA_DISK_1: restoring datafile 00012 to +data/jyrac/datafile/data_D-JYRAC_TS-LDJC_FNO-12
channel ORA_DISK_1: reading from backup piece /acfs1/rman_back/jyrac_0jsnb48u_JYRAC_964006174_19_1
channel ORA_DISK_1: errors found reading piece handle=/acfs1/rman_back/jyrac_0jsnb48u_JYRAC_964006174_19_1
channel ORA_DISK_1: failover to piece handle=/ora_xtts/rman/jyrac_0jsnb48u_JYRAC_964006174_19_1 tag=TAG20171229T112933
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:09:55
Finished restore at 30-DEC-17

datafile 1 switched to datafile copy
input datafile copy RECID=14 STAMP=964064400 file name=+DATA/jyrac/datafile/data_d-jyrac_ts-system_fno-1
datafile 2 switched to datafile copy
input datafile copy RECID=15 STAMP=964064401 file name=+DATA/jyrac/datafile/data_d-jyrac_ts-sysaux_fno-2
datafile 3 switched to datafile copy
input datafile copy RECID=16 STAMP=964064401 file name=+DATA/jyrac/datafile/data_d-jyrac_ts-undotbs1_fno-3
datafile 4 switched to datafile copy
input datafile copy RECID=17 STAMP=964064401 file name=+DATA/jyrac/datafile/data_d-jyrac_ts-users_fno-4
datafile 5 switched to datafile copy
input datafile copy RECID=18 STAMP=964064402 file name=+DATA/jyrac/datafile/data_d-jyrac_ts-example_fno-5
datafile 6 switched to datafile copy
input datafile copy RECID=19 STAMP=964064402 file name=+DATA/jyrac/datafile/data_d-jyrac_ts-undotbs2_fno-6
datafile 7 switched to datafile copy
input datafile copy RECID=20 STAMP=964064402 file name=+DATA/jyrac/datafile/data_d-jyrac_ts-test_fno-7
datafile 8 switched to datafile copy
input datafile copy RECID=21 STAMP=964064403 file name=+DATA/jyrac/datafile/data_d-jyrac_ts-sales_test_fno-8
datafile 9 switched to datafile copy
input datafile copy RECID=22 STAMP=964064403 file name=+DATA/jyrac/datafile/data_d-jyrac_ts-emp_test_fno-9
datafile 10 switched to datafile copy
input datafile copy RECID=23 STAMP=964064403 file name=+DATA/jyrac/datafile/data_d-jyrac_ts-orders_test_fno-10
datafile 11 switched to datafile copy
input datafile copy RECID=24 STAMP=964064404 file name=+DATA/jyrac/datafile/data_d-jyrac_ts-cdzj_fno-11
datafile 12 switched to datafile copy
input datafile copy RECID=25 STAMP=964064404 file name=+DATA/jyrac/datafile/data_d-jyrac_ts-ldjc_fno-12

Starting recover at 30-DEC-17
using channel ORA_DISK_1

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=498
channel ORA_DISK_1: restoring archived log
archived log thread=2 sequence=541
channel ORA_DISK_1: reading from backup piece /acfs1/rman_back/arch_JYRAC_20171229_0ksnb4q5_1_1
channel ORA_DISK_1: errors found reading piece handle=/acfs1/rman_back/arch_JYRAC_20171229_0ksnb4q5_1_1
channel ORA_DISK_1: failover to piece handle=/ora_xtts/rman/arch_JYRAC_20171229_0ksnb4q5_1_1 tag=TAG20171229T113845
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=+DATA/arch/jyrac/1_498_930413221.dbf thread=1 sequence=498
archived log file name=+DATA/arch/jyrac/2_541_930413221.dbf thread=2 sequence=541
media recovery complete, elapsed time: 00:00:02
Finished recover at 30-DEC-17

14.使用resetlogs與upgrade選項來開啟資料庫

RMAN> alter database open resetlogs upgrade;

Statement processed
RMAN-06900: warning: unable to generate V$RMAN_STATUS or V$RMAN_OUTPUT row
RMAN-06901: warning: disabling update of the V$RMAN_STATUS and V$RMAN_OUTPUT rows
ORACLE error from target database: 
ORA-04023: Object SYS.STANDARD could not be validated or authorized

錯誤資訊是由於資料庫相關plsql包作為升級處理需要被重新驗證。

15.退出RMAN

RMAN> exit


Recovery Manager complete.

16.對還原後的目標資料庫升級

SQL> shutdown abort
ORACLE instance shut down.
SQL> startup upgrade
ORACLE instance started.

Total System Global Area 2516582400 bytes
Fixed Size                  8623832 bytes
Variable Size             637536552 bytes
Database Buffers         1862270976 bytes
Redo Buffers                8151040 bytes
Database mounted.
Database opened.
SQL> @$ORACLE_HOME/rdbms/admin/catupgrd.sql
DOC>######################################################################
DOC>######################################################################
DOC>                                 ERROR
DOC>
DOC>
DOC>    As of 12.2, customers must use the parallel upgrade utility, catctl.pl,
DOC>    to invoke catupgrd.sql when upgrading the database dictionary.
DOC>    Running catupgrd.sql directly from SQL*Plus is no longer supported.
DOC>
DOC>    For Example:
DOC>
DOC>          cd $ORACLE_HOME/rdbms/admin
DOC>          catctl
DOC>
DOC>          or
DOC>
DOC>          cd $ORACLE_HOME/rdbms/admin
DOC>          $ORACLE_HOME/perl/bin/perl catctl.pl catupgrd.sql
DOC>
DOC>    Refer to the Oracle Database Upgrade Guide for more information.
DOC>
DOC>
DOC>######################################################################
DOC>######################################################################
DOC>#
Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

12cr2升級方法與之前不同,要執行如下命令:

[oracle@jytest3 admin]$ cd $ORACLE_HOME/rdbms/admin
[oracle@jytest3 admin]$ $ORACLE_HOME/perl/bin/perl catctl.pl catupgrd.sql

Argument list for [catctl.pl]
Run in                c = 0
Do not run in         C = 0
Input Directory       d = 0
Echo OFF              e = 1
Simulate              E = 0
Forced cleanup        F = 0
Log Id                i = 0
Child Process         I = 0
Log Dir               l = 0
Priority List Name    L = 0
Upgrade Mode active   M = 0
SQL Process Count     n = 0
SQL PDB Process Count N = 0
Open Mode Normal      o = 0
Start Phase           p = 0
End Phase             P = 0
Reverse Order         r = 0
AutoUpgrade Resume    R = 0
Script                s = 0
Serial Run            S = 0
RO User Tablespaces   T = 0
Display Phases        y = 0
Debug catcon.pm       z = 0
Debug catctl.pl       Z = 0

catctl.pl VERSION: [12.2.0.1.0]
           STATUS: [production]
            BUILD: [RDBMS_12.2.0.1.0_LINUX.X64_170125]


/u01/app/oracle/product/12.2.0/db/rdbms/admin/orahome = [/u01/app/oracle/product/12.2.0/db]
/u01/app/oracle/product/12.2.0/db/bin/orabasehome = [/u01/app/oracle/product/12.2.0/db]
catctlGetOrabase = [/u01/app/oracle/product/12.2.0/db]

Analyzing file /u01/app/oracle/product/12.2.0/db/rdbms/admin/catupgrd.sql

Log file directory = [/tmp/cfgtoollogs/upgrade20171230035616]

catcon: ALL catcon-related output will be written to [/tmp/cfgtoollogs/upgrade20171230035616/catupgrd_catcon_11460.lst]
catcon: See [/tmp/cfgtoollogs/upgrade20171230035616/catupgrd*.log] files for output generated by scripts
catcon: See [/tmp/cfgtoollogs/upgrade20171230035616/catupgrd_*.lst] files for spool files, if any

Number of Cpus        = 6
Database Name         = jyrac
DataBase Version      = 11.2.0.4.0
catcon: ALL catcon-related output will be written to [/u01/app/oracle/product/12.2.0/db/cfgtoollogs/jyrac/upgrade20171230035617/catupgrd_catcon_11460.lst]
catcon: See [/u01/app/oracle/product/12.2.0/db/cfgtoollogs/jyrac/upgrade20171230035617/catupgrd*.log] files for output generated by scripts
catcon: See [/u01/app/oracle/product/12.2.0/db/cfgtoollogs/jyrac/upgrade20171230035617/catupgrd_*.lst] files for spool files, if any

Log file directory = [/u01/app/oracle/product/12.2.0/db/cfgtoollogs/jyrac/upgrade20171230035617]

Parallel SQL Process Count            = 4
Components in [jyrac]
    Installed [APEX APS CATALOG CATJAVA CATPROC CONTEXT EM JAVAVM ORDIM OWM RAC SDO XDB XML XOQ]
Not Installed [DV MGW ODM OLS WK]
....省略....

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

相關文章