【資料遷移1】Oracle 10gR2 rman異機恢復實驗(FS->RAW)(2)

liuyingfei755發表於2018-06-02

【資料遷移1】Oracle 10gR2 rman異機恢復實驗(FS->RAW)(2)

轉載請註明原文:http://xunzhaoxz.itpub.net/post/40016/521239

PDF版詳細恢復步驟(截圖)

【資料遷移2】Oracle 10gR2 rman異機恢復實驗(FS-FS)(截圖)

上接:【資料遷移1】Oracle 10gR2 rman異機恢復實驗(FS->RAW)(1http://xunzhaoxz.itpub.net/post/40016/521239

3.11. restore and recover database

3.11.1. 編寫rman指令碼

根據實際需要,可以在這裡指明要恢復到某個SCN號或者時間點, 也可以進行全庫恢復。SCN號可以從舊庫rmanlist backup 獲得,或者如果有catalog的話,也可以從catalog中獲得;也可以指定恢復到某個時間點。

[oracle@Ora_tar oracle]$ cat restore.rman

run

{set until scn 556840;

restore database;

recover database;

}

exit

[oracle@Ora_tar oracle]$

3.11.2. 執行rman恢復指令碼

[@more@]

RMAN> @/oracle/restore_raw.rman

RMAN> run

2> {

3> SET NEWNAME FOR DATAFILE '/oracle/oradata/ORADB/datafile/o1_mf_users_6ccmb0x6_.dbf' TO '/oracle/oradata/oradb/user_128m';

4> SET NEWNAME FOR DATAFILE '/oracle/oradata/ORADB/datafile/o1_mf_sysaux_6ccmb0pf_.dbf' TO '/oracle/oradata/oradb/sysaux_512m';

5> SET NEWNAME FOR DATAFILE '/oracle/oradata/ORADB/datafile/o1_mf_undotbs1_6ccmb0w4_.dbf' TO '/oracle/oradata/oradb/undo01_512m';

6> SET NEWNAME FOR DATAFILE '/oracle/oradata/ORADB/datafile/o1_mf_system_6ccmb0oy_.dbf' TO '/oracle/oradata/oradb/system_1g';

7> restore database;

8> switch datafile all;

9> recover database;

10> }

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 2010-11-15 15:00:20

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=156 devtype=DISK

channel ORA_DISK_1: starting datafile backupset restore

channel ORA_DISK_1: specifying datafile(s) to restore from backup set

restoring datafile 00001 to /oracle/oradata/oradb/system_1g

restoring datafile 00002 to /oracle/oradata/oradb/undo01_512m

restoring datafile 00003 to /oracle/oradata/oradb/sysaux_512m

restoring datafile 00004 to /oracle/oradata/oradb/user_128m

channel ORA_DISK_1: reading from backup piece /oracle/oradb-20101114-1jlt0ptg_1_1.rman

channel ORA_DISK_1: restored backup piece 1

piece handle=/oracle/oradb-20101114-1jlt0ptg_1_1.rman tag=TAG20101114T202520

channel ORA_DISK_1: restore complete, elapsed time: 00:01:06

Finished restore at 2010-11-15 15:01:27

datafile 4 switched to datafile copy

input datafile copy recid=7 stamp=735145287 filename=/oracle/oradata/oradb/user_128m

datafile 3 switched to datafile copy

input datafile copy recid=8 stamp=735145287 filename=/oracle/oradata/oradb/sysaux_512m

datafile 2 switched to datafile copy

input datafile copy recid=9 stamp=735145287 filename=/oracle/oradata/oradb/undo01_512m

datafile 1 switched to datafile copy

input datafile copy recid=10 stamp=735145287 filename=/oracle/oradata/oradb/system_1g

Starting recover at 2010-11-15 15:01:28

using channel ORA_DISK_1

starting media recovery

channel ORA_DISK_1: starting archive log restore to default destination

channel ORA_DISK_1: restoring archive log

archive log thread=1 sequence=36

channel ORA_DISK_1: reading from backup piece /oracle/oradb-archlogall-20101114-1llt0q2m_1_1.rman

channel ORA_DISK_1: restored backup piece 1

piece handle=/oracle/oradb-archlogall-20101114-1llt0q2m_1_1.rman tag=TAG20101114T202804

channel ORA_DISK_1: restore complete, elapsed time: 00:00:01

archive log filename=/oracle/oradata/oradb/archivelog/1_36_732323841.dbf thread=1 sequence=36

unable to find archive log

archive log thread=1 sequence=37

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of recover command at 11/15/2010 15:01:34

RMAN-06054: media recovery requesting unknown log: thread 1 seq 37 lowscn 597055

RMAN> exit

Recovery Manager complete.

[oracle@Ora_tar mapper]$

3.12. open database

RMAN> alter database open resetlogs;

using target database control file instead of recovery catalog

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of alter db command at 11/15/2010 15:02:04

ORA-01092: ORACLE instance terminated. Disconnection forced

ORA-00704: bootstrap process failure

ORA-39700: database must be opened with UPGRADE option

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 11/15/2010 15:02:04

ORA-01092: ORACLE instance terminated. Disconnection forced

ORA-00704: bootstrap process failure

ORA-39700: database must be opened with UPGRADE option

[oracle@Ora_tar mapper]$

3.13. 升級資料庫

3.13.1. shutdown 資料庫

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> exit

3.13.2. 修改pfile中控制檔案路徑為新控制檔案

控制檔案為3.8中恢復出來的/oracle/oradata/ORADB/controlfile/o1_mf_6fjh5m9c_.ctl

[oracle@Ora_tar oracle]$ vi /oracle/oradata/initoradb.ora

3.13.3. 以修改後的pfile啟動資料庫

[oracle@Ora_tar oracle]$sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Tue Nov 9 02:26:34 2010

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

Connected to an idle instance.

SQL> startup pfile='/oracle/oradata/initoradb.ora';

ORACLE instance started.

Total System Global Area 167772160 bytes

Fixed Size 1218292 bytes

Variable Size 83888396 bytes

Database Buffers 75497472 bytes

Redo Buffers 7168000 bytes

Database mounted.

Database opened.

SQL>

3.13.4. 建立新的spfile

spfile將自動存放到oracle預設路徑($ORACLE_HOME/dbs)下,並自動命名為spfileSID.ora,資料庫啟動將優先使用該引數檔案。

SQL> create spfile from pfile='/oracle/oradata/initoradb.ora';

shutdown資料庫,下次直接startup就可以啟動了

[oracle@Ora_tar oracle]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Tue Nov 9 02:32:39 2010

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

Connected to an idle instance.

SQL> startup

ORACLE instance started.

Total System Global Area 167772160 bytes

Fixed Size 1218292 bytes

Variable Size 83888396 bytes

Database Buffers 75497472 bytes

Redo Buffers 7168000 bytes

Database mounted.

Database opened.

SQL>

3.14. 檢查、測試資料是否已恢復成功

[oracle@Oradb1 response]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on Tue Nov 16 10:15:28 2010

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

Connected to an idle instance.

SQL> startup upgrade

ORACLE instance started.

Total System Global Area 167772160 bytes

Fixed Size 1266368 bytes

Variable Size 79695168 bytes

Database Buffers 79691776 bytes

Redo Buffers 7118848 bytes

Database mounted.

Database opened.

SQL> spool /oracle/upgrade_info_20101116.log

#執行預升級檢查指令碼utlu102i.sqlRun the Pre-Upgrade Information Tool

SQL> @?/rdbms/admin/utlu102i.sql

Oracle Database 10.2 Upgrade Information Utility 11-16-2010 10:19:20

.**********************************************************************

Database:

**********************************************************************

--> name: ORADB

--> version: 10.2.0.1.0

--> compatible: 10.2.0.1.0

--> blocksize: 8192

.**********************************************************************

Tablespaces: [make adjustments in the current environment]

**********************************************************************

--> SYSTEM tablespace is adequate for the upgrade.

.... minimum required size: 489 MB

.... AUTOEXTEND additional space required: 9 MB

--> UNDOTBS1 tablespace is adequate for the upgrade.

.... minimum required size: 403 MB

.... AUTOEXTEND additional space required: 378 MB

--> SYSAUX tablespace is adequate for the upgrade.

.... minimum required size: 258 MB

.... AUTOEXTEND additional space required: 8 MB

--> TEMP tablespace is adequate for the upgrade.

.... minimum required size: 58 MB

.... AUTOEXTEND additional space required: 38 MB

.**********************************************************************

Update Parameters: [Update Oracle Database 10.2 init.ora or spfile]

**********************************************************************

WARNING: --> "pga_aggregate_target" needs to be increased to at least 25165824

.**********************************************************************

Renamed Parameters: [Update Oracle Database 10.2 init.ora or spfile]

**********************************************************************

-- No renamed parameters found. No changes are required.

.**********************************************************************

Obsolete/Deprecated Parameters: [Update Oracle Database 10.2 init.ora or spfile]

**********************************************************************

-- No obsolete parameters found. No changes are required

.**********************************************************************

Components: [The following database components will be upgraded or installed]

**********************************************************************

--> Oracle Catalog Views [upgrade] VALID

--> Oracle Packages and Types [upgrade] VALID

--> JServer JAVA Virtual Machine [upgrade] VALID

--> Oracle XDK for Java [upgrade] VALID

--> Oracle Java Packages [upgrade] VALID

--> Oracle Text [upgrade] VALID

--> Oracle XML Database [upgrade] VALID

--> Oracle Workspace Manager [upgrade] VALID

--> Oracle Data Mining [upgrade] VALID

--> OLAP Analytic Workspace [upgrade] VALID

--> OLAP Catalog [upgrade] VALID

--> Oracle OLAP API [upgrade] VALID

--> Oracle interMedia [upgrade] VALID

--> Spatial [upgrade] VALID

--> Expression Filter [upgrade] VALID

--> EM Repository [upgrade] VALID

--> Rule Manager [upgrade] VALID

.PL/SQL procedure successfully completed.

SQL> create pfile='/oracle/pfile-before-upgrade.ora' from spfile;

File created.

SQL>

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL>

SQL>

在另一個視窗編輯pfile中的pga_aggregate_target引數以滿足at least 25165824 的要求,編輯完成後使用該pfile建立相應的spfile,這個spfile就可以滿足升級到10.2.0.4的要求了。

#以修改後的pfile啟動資料庫到nomount狀態(在nomount狀態就可以建立spfile了,而且現在也不能直接啟動到open狀態,會報ORA-01092: ORACLE instance terminated.ORA-39700: database must be opened with UPGRADE option.錯誤的)

SQL> startup nomount pfile='/oracle/pfile-before-upgrade.ora';

ORACLE instance started.

Total System Global Area 167772160 bytes

Fixed Size 1266368 bytes

Variable Size 79695168 bytes

Database Buffers 79691776 bytes

Redo Buffers 7118848 bytes

SQL> create spfile from pfile='/oracle/pfile-before-upgrade.ora';

#建立spfile

File created.

SQL>

SQL> shutdown immediate;

ORA-01507: database not mounted

ORACLE instance shut down.

#關閉資料庫例項,並以新的spfile啟動例項到帶upgradeopen狀態。

SQL> startup upgrade

ORACLE instance started.

Total System Global Area 167772160 bytes

Fixed Size 1266368 bytes

Variable Size 79695168 bytes

Database Buffers 79691776 bytes

Redo Buffers 7118848 bytes

Database mounted.

Database opened.

SQL>

SQL>

#記錄升級日誌到/oracle/patch1204_info_20101116.log檔案

SQL> spool /oracle/patch1204_info_20101116.log

SQL>

SQL>

#執行catupgrd.sql進行升級(注意必須以sys使用者執行此指令碼)

SQL> @?/rdbms/admin/catupgrd.sql

DOC>######################################################################

DOC>######################################################################

DOC> The following statement will cause an "ORA-01722: invalid number"

DOC> error if the user running this script is not SYS. Disconnect

DOC> and reconnect with AS SYSDBA.

DOC>######################################################################

DOC>######################################################################

DOC>#

四、 附錄

4.1. 問題1

RMAN> startup force nomount pfile='/oracle/oradata/initoradb.ora';

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of startup command at 11/09/2010 01:18:14

RMAN-04014: startup failed: ORA-09925: Unable to create audit trail file

Linux Error: 2: No such file or directory

Additional information: 9925

RMAN>

對照pfile檢查oracle相關的目錄是否都已建立完成,本案例為$ORACLE_BASE/admin整個目錄及其子目錄都沒有建立,因此出現以上報錯資訊,按照如下步驟建立後,再次執行以上命令就沒有報錯了。

$mkdir -p /oracle/admin/oradb/adump

$mkdir -p /oracle/admin/oradb/bdump

$mkdir -p /oracle/admin/oradb/cdump

$mkdir -p /oracle/admin/oradb/dpdump

$mkdir -p /oracle/admin/oradb/udump

$mkdir -p /oracle/admin/oradb/pfile

4.2. 問題2

無法找到存檔日誌

存檔日誌執行緒 =1 序列=11

RMAN-00571:

===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS

===============

RMAN-00571:

===========================================================

RMAN-03002: failure of recover command at 07/20/2007 17:50:36

RMAN-06054: media recovery requesting unknown log: thread 1 scn 143893

沒有指定恢復到某個SCN號或者指定時間點,若是全庫恢復,只要alter database open resetlogs即可。

-----------------------------------------------------------------

延伸閱讀

(近期整理文件):

主機AIX

【資訊採集】IBM AIX系統硬體資訊檢視命令(shell指令碼)(附PDF完整版下載)

操作規範(一)—— AIX rootvg mirror(附PDF下載)

AIX系統安全加固(一)限制密碼重試次數,超過限制次數後鎖定使用者(附截圖PDF完整版下載)

AIX平臺下建立檔案系統需要注意的問題

IBM伺服器虛擬化PowerVM——也談“雲端計算”

資料庫Oracle

新裝Oracle11gR2 11.2.0.2重要說明——Patchsetp10098816(附補丁下載地址)

Attention:new installation of Oracle 11.2.0.2

AIX 5.3/6.1環境下安裝Oracle10gR2 RAC常見報錯(注意事項)

【資料遷移1】Oracle10gR2 rman異機恢復實驗(FS->RAW)(附截圖PDF完整版下載)

【資料遷移2】Oracle10gR2 rman異機恢復實驗(FS-FS)(附截圖PDF完整版下載)

操作規範(二)——RHEL5.4安裝Oracle 10.2.0.4(附截圖PDF完整版下載)

操作規範(三)——Linux5.4安裝Oracle 11gR1(附截圖PDF完整版下載)

操作規範(四)——Linux5.4安裝Oracle 11gR2(附截圖PDF完整版下載)

Oracle RAC環境下重建ASM磁碟組(Re-createASM diskgroup)(附截圖PDF完整版下載)

Oracle RAC srv服務“首選”與“可用”狀態的調整——srvctl modify service 的使用(附截圖PDF完整版下載)

Linux+ASM+OCFS環境下增加ORACLE RAC聯機重做日誌檔案(附截圖PDF完整版下載)

備份還原Symantec Netbackup:

搭建NBU實驗環境——解決虛擬帶庫vistor License過期問題(附截圖PDF完整版下載)

NBU常用命令1——介質管理

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

相關文章