【資料遷移1】Oracle 10gR2 rman異機恢復實驗(FS->RAW)(2)
【資料遷移1】Oracle 10gR2 rman異機恢復實驗(FS->RAW)(2)
轉載請註明原文:http://xunzhaoxz.itpub.net/post/40016/521239
【資料遷移2】Oracle 10gR2 rman異機恢復實驗(FS-FS)(截圖)
上接:【資料遷移1】Oracle 10gR2 rman異機恢復實驗(FS->RAW)(1)http://xunzhaoxz.itpub.net/post/40016/521239
3.11. restore and recover database
3.11.1. 編寫rman指令碼
根據實際需要,可以在這裡指明要恢復到某個SCN號或者時間點, 也可以進行全庫恢復。SCN號可以從舊庫rman中list 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@]
上接:【資料遷移1】Oracle 10gR2 rman異機恢復實驗(FS->RAW)(1)http://xunzhaoxz.itpub.net/post/40016/521239
3.11. restore and recover database
3.11.1. 編寫rman指令碼
根據實際需要,可以在這裡指明要恢復到某個SCN號或者時間點, 也可以進行全庫恢復。SCN號可以從舊庫rman中list 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恢復指令碼
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.sql(Run 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啟動例項到帶upgrade的open狀態。
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>#
四、 附錄
2.
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完整版下載)
資料庫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:
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31540274/viewspace-2155518/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【資料遷移1】Oracle 10gR2 rman異機恢復實驗(FS->RAW)(1)Oracle 10g
- RMAN備份異機恢復
- ORACLE 11.2.0.4 RAC RMAN異機恢復之ORA-15001Oracle
- oracle 異機恢復Oracle
- RMAN備份恢復典型案例——異機恢復未知DBID
- rman備份異機恢復(原創)
- 用rman遷移資料庫資料庫
- 通過rman為客戶實現linux下oracle11.2.0.4到windows下oracle同版本資料庫的異機恢復。LinuxOracleWindows資料庫
- Oracle RMAN恢復測試Oracle
- Oracle rman duplicate遷移測試Oracle
- RMAN備份恢復典型案例——跨平臺遷移pdb
- G017-ORACLE-MIGRATION-01 RMAN備份異機不完全恢復Oracle
- Oracle使用RMAN從Windows遷移資料到LinuxOracleWindowsLinux
- RMAN資料庫恢復異常報錯ORA-01180資料庫
- 【12c 庫異機恢復】實驗
- Oracle RMAN 表空間恢復Oracle
- 兩篇oracle異機恢復文章Oracle
- RMAN恢復實踐
- 【北亞資料恢復】異常斷電導致Oracle資料庫報錯的oracle資料恢復資料恢復Oracle資料庫
- MySQL資料庫遷移與MySQL資料庫批量恢復MySql資料庫
- 【北亞資料恢復】MongoDB資料遷移檔案丟失的MongoDB資料恢復案例資料恢復MongoDB
- 透過搭建恢復目錄實現RMAN異地備份和恢復
- FastDFS檔案系統遷移和資料恢復AST資料恢復
- mongodb資料庫備份與恢復(資料庫資料遷移)MongoDB資料庫
- 異構資料庫資料遷移 oracle to mysql之oracle sqlloader和mysql load data資料庫OracleMySql
- Oracle 備份恢復篇之RMAN catalogOracle
- ORACLE DG從庫 Rman備份恢復Oracle
- 【伺服器資料恢復】ZFS伺服器遷移資料時資料丟失的資料恢復案例伺服器資料恢復
- 【Oracle 恢復表空間】 實驗Oracle
- 【伺服器資料恢復】伺服器之間遷移資料時資料丟失的資料恢復案例伺服器資料恢復
- 【RMAN】Oracle使用rman將11.2.0.4資料庫遷移至Oracle12c命令參考Oracle資料庫
- AWS RDS Oracle資料遷移Oracle
- 資料遷移的時候出現RMAN-03002,RMAN-06026
- Oracle 12C新特性-RMAN恢復表Oracle
- RMAN增量恢復
- 【伺服器資料恢復】儲存伺服器之間遷移資料時資料丟失恢復成功案例伺服器資料恢復
- 【11g 庫異地恢復】實驗
- Oracle恢復誤刪資料Oracle