透過RMAN進行資料庫恢復(step by step)
由於測試的需要,這幾天弄了從生產庫上克隆了幾套測試環境,記錄其中一個,分享給大家。
1、修改pfile檔案
使用在生產端生成的pfile檔案進行修改。
PROD.__db_cache_size=1459617792
PROD.__java_pool_size=16777216
PROD.__large_pool_size=16777216
PROD.__shared_pool_size=314572800
PROD.__streams_pool_size=33554432
*._allow_level_without_connect_by=true
*._log_io_size=524288
*.audit_file_dest='/oratest/10g/PROD/admin/adump'
*.background_dump_dest='/oratest/10g/PROD/admin/bdump'
*.compatible='10.2.0.3.0'
*.control_files='/oratest/10g/PROD/control01.ctl','/oratest/10g/PROD/control02.ctl','/oratest/10g/PROD/control03.ctl'
*.core_dump_dest='/oratest/10g/PROD/admin/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='PROD'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=PRODXDB)'
*.job_queue_processes=10
*.local_listener=''
*.lock_sga=TRUE
*.log_archive_dest_1='location=/oratest/10g/PROD/archive/'
*.log_buffer=1024000
*.open_cursors=800
*.pga_aggregate_target=524288000
*.processes=800
*.recyclebin='OFF'
*.remote_login_passwordfile='EXCLUSIVE'
*.sessions=885
*.sga_max_size=1073741824
*.sga_target=1073741824
*.shared_pool_reserved_size=62914560
*.shared_pool_size=314572800
*.undo_management='AUTO'
*.undo_retention=1800
*.undo_tablespace='UNDOTBS2'
*.user_dump_dest='/oratest/10g/PROD/admin/udump'
2、啟動資料庫例項,即NOMOUNT階段
SQL> startup nomount pfile='/oratest/10g/PROD/PROD_pfile.ora';
ORACLE instance started.
Total System Global Area 1073741824 bytes
Fixed Size 2078368 bytes
Variable Size 327158112 bytes
Database Buffers 738197504 bytes
Redo Buffers 6307840 bytes
3、恢復控制檔案
RMAN> restore controlfile from '/oratest/rmanbak/PROD-c-1503380933-20120728-00.ctl';
Starting restore at 28-JUL-12
using channel ORA_DISK_1
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:26
output filename=/oratest/10g/PROD/control01.ctl
output filename=/oratest/10g/PROD/control02.ctl
output filename=/oratest/10g/PROD/control03.ctl
Finished restore at 28-JUL-12
4、載入資料庫,即啟動到MOUNT階段
RMAN> alter database mount;
database mounted
5、重新命名redo log檔案
由於恢復的資料庫和原生產資料庫的目錄有所變動,所以需要對redo log重新命名。
alter database rename file '/oradata/10g/PROD/redo01.log' to '/oratest/10g/PROD/redo01_a.log';
alter database rename file '/oradata/10g/PROD/redo02.log' to '/oratest/10g/PROD/redo02_a.log';
alter database rename file '/oradata/10g/PROD/redo03.log' to '/oratest/10g/PROD/redo03_a.log';
alter database rename file '/oradata/10g/PROD/redo04.log' to '/oratest/10g/PROD/redo04_a.log';
alter database rename file '/oradata/10g/PROD/redo05.log' to '/oratest/10g/PROD/redo05_a.log';
alter database rename file '/oradata/10g/PROD/redo6.log' to '/oratest/10g/PROD/redo06_a.log';
6、CATALOG資料庫的備份片(backuppiece)
RMAN > catalog backuppiece '/oratest/rmanbak/PROD-j6nh68e9_1_1.db';
7、RESTORE資料庫
由於恢復的資料檔案路徑與原生產端不一致,因此在RESTORE前,需要SET NEWNAME。
RMAN> run {
set newname for datafile 1 to '/oratest/10g/PROD/system01.dbf';
set newname for datafile 3 to '/oratest/10g/PROD/sysaux01.dbf';
set newname for datafile 4 to '/oratest/10g/PROD/users01.dbf';
set newname for datafile 5 to '/oratest/10g/PROD/IFSAPP_ARCHIVE_DATA.DBF';
set newname for datafile 6 to '/oratest/10g/PROD/IFSAPP_ARCHIVE_INDEX.DBF';
set newname for datafile 7 to '/oratest/10g/PROD/IFSAPP_DATA.DBF';
set newname for datafile 8 to '/oratest/10g/PROD/IFSAPP_INDEX.DBF';
set newname for datafile 9 to '/oratest/10g/PROD/IFSAPP_REPORT_DATA.DBF';
set newname for datafile 10 to '/oratest/10g/PROD/IFSAPP_REPORT_INDEX.DBF';
set newname for datafile 11 to '/oratest/10g/PROD/INDX.DBF';
set newname for datafile 12 to '/oratest/10g/PROD/PERFSTAT.DBF';
set newname for datafile 13 to '/oratest/10g/PROD/RBS.DBF';
set newname for datafile 14 to '/oratest/10g/PROD/TOOLS.DBF';
set newname for datafile 15 to '/oratest/10g/PROD/undotbs02.dbf';
restore datafile 1,3,4,5,6,7,8,9,10,11,12,13,14,15;
switch datafile all;
}
8、CATALOG ARCHIVELOG
SQL> catalog backuppiece '/oratest/rmanbak/PROD-j5nh67ta_1_1.arc';
9、RECOVER資料庫
RMAN> recover database;
10、以resetlog方式開啟資料庫
SQL> alter database open resetlogs;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25834554/viewspace-739725/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【資料庫資料恢復】透過恢復NDF檔案修復資料庫的資料恢復過程資料庫資料恢復
- TIDB DM資料同步step by stepTiDB
- 【資料庫資料恢復】透過資料頁恢復Sql Server資料庫資料的過程資料庫資料恢復SQLServer
- 伺服器資料恢復—透過拼接資料庫碎片恢復SqlServer資料庫資料的資料恢復案例伺服器資料恢復資料庫SQLServer
- 2.4.14 Step 13: 備份資料庫資料庫
- 2.4.10 Step 9:手工建立資料庫資料庫
- React Step by StepReact
- MySQL 透過 binlog 恢復資料MySql
- Command 模式 Step by Step模式
- 阿里雲數倉Dataworks資料匯出到檔案step by step阿里
- 透過RMAN備份standby database成功恢復還原Database
- 透過搭建恢復目錄實現RMAN異地備份和恢復
- 【Mysql】如何透過binlog恢復資料MySql
- 資料庫恢復過程資料庫
- RMAN備份恢復典型案例——資料庫卡頓資料庫
- Promise的實現(step by step)Promise
- Shell Step by Step (4) —— Cron & Echo
- 通過duplicat恢復資料庫資料庫
- RMAN資料庫恢復異常報錯ORA-01180資料庫
- 帝國cms如何進行恢復資料庫教程資料庫
- 查詢RMAN恢復進度
- Step by Step 安裝 BizTalk Server 2009Server
- Step by Step Data Replication Using Oracle GoldenGateOracleGo
- 單步除錯 step into/step out/step over 區別詳解除錯
- 【資料庫資料恢復】Sql Server資料庫檔案丟失的資料恢復過程資料庫資料恢復SQLServer
- 實時 Linux 抖動分析 Step by stepLinux
- ABP應用開發(Step by Step)-下篇
- ABP應用開發(Step by Step)-上篇
- 如何進行Oracle資料庫不完全恢復RBOracle資料庫
- 【資料庫資料恢復】SAP資料庫資料恢復案例資料庫資料恢復
- 寶塔資料庫恢復 mysql資料庫丟失恢復 mysql資料庫刪除庫恢復 寶塔mysql資料庫恢復資料庫MySql
- LEARNED STEP SIZE QUANTIZATION論文復現
- 【資料庫資料恢復】Sql Server資料庫資料恢復案例資料庫資料恢復SQLServer
- Linkerd 2.10(Step by Step)—多叢集通訊
- Mysql 誤刪資料進行恢復MySql
- Linux上透過binlog檔案恢復mysql資料庫詳細步驟LinuxMySql資料庫
- Linkerd 2.10(Step by Step)—使用 Debug Sidecar,注入除錯容器來捕獲網路資料包IDE除錯
- 資料庫修復資料恢復資料庫資料恢復
- PostgreSQL 恢復大法 - 恢復部分資料庫、跳過壞塊、修復無法啟動的資料庫SQL資料庫