您好,登錄后才能下訂單哦!
注意:本文檔操作系統(tǒng)環(huán)境以HPUX為主,假設(shè)要恢復(fù)HPUX 上oracle RAC數(shù)據(jù)庫到單機(jī);
本文當(dāng)主要以數(shù)據(jù)庫恢復(fù)為主,操作系統(tǒng)安裝、數(shù)據(jù)庫安裝配置和NBU客戶端安裝配置忽略;
1. 確定要恢復(fù)的數(shù)據(jù)庫信息,如果數(shù)據(jù)庫和操作系統(tǒng)可以正常訪問,則可以登錄數(shù)據(jù)庫和操作系統(tǒng)查看和恢復(fù)信息相關(guān)的信息,如果數(shù)據(jù)庫甚至是操作系統(tǒng)不可訪問,則可以參考《oracle數(shù)據(jù)庫信息收集》文檔,里面記錄了oracle數(shù)據(jù)庫恢復(fù)的相關(guān)信息;
2. 為了確?;謴?fù)后的數(shù)據(jù)庫可以盡快使用,盡量減少應(yīng)用程序的修改,恢復(fù)完以后修改主機(jī)IP地址和原數(shù)據(jù)庫地址保持一致;
1. 根據(jù)《oracle數(shù)據(jù)庫信息收集》文檔,安裝操作系統(tǒng)和數(shù)據(jù)庫軟件,其中操作系統(tǒng)的版本盡量相同,數(shù)據(jù)庫版本則需要一致;
2. 根據(jù)《oracle數(shù)據(jù)庫信息收集》文檔,掛載合適的存儲(chǔ),主要是存儲(chǔ)的大小,所掛載的存儲(chǔ)不可小于要恢復(fù)的數(shù)據(jù)庫總?cè)萘看笮?,并配置合適的ASM磁盤組,磁盤組的大小和名稱建議原來一樣,磁盤組的容量可以大于原磁盤組;
3. 在客戶端安裝好NBU client,并保證通過NBU client可以正常訪問備份文件;
在操作系統(tǒng)上執(zhí)行如下命令:
/usr/openv/netbackup/bin/bplist -C ZMDB -t 4 -l -R / ,列出數(shù)據(jù)庫備份信息,此處列出信息忽律,詳細(xì)信息可參看《oracle單實(shí)例恢復(fù)到單實(shí)例》文檔。
本文檔選取 c-1996633987-20140902-0e作為恢復(fù)對(duì)象,設(shè)置數(shù)據(jù)庫DBID,并把數(shù)據(jù)庫啟動(dòng)到nomount狀態(tài):
connected to target database (not started)
$ rman target /
Recovery Manager: Release 10.2.0.5.0 - Production on Tue Sep 2 10:05:38 2014
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database (not started)
RMAN> set DBID=1996633954
executing command: SET DBID
RMAN>
(1)恢復(fù)spfile:
RMAN> startup nomount
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/app/oracle/product/10.2.0/db/dbs/initgbdb.ora'
starting Oracle instance without parameter file for retrival of spfile
Oracle instance started
Total System Global Area 159383552 bytes
Fixed Size 2066400 bytes
Variable Size 67110944 bytes
Database Buffers 83886080 bytes
Redo Buffers 6320128 bytes
run
{
allocate channel c1 type 'SBT_TAPE';
send 'NB_ORA_SERV=NBUServer,NB_ORA_CLIENT=bl890s1';
restore spfile from 'c-1996633987-20140902-0e';
release channel c1;
}
create pfile='/app/oracle/product/10.2.0/db/dbs/initgbdb.ora' from spfile;
編輯pfile:
根據(jù)$ORACLE_BASE、$ORACLE_HOME創(chuàng)建相應(yīng)的目錄,并且刪除掉RAC參數(shù),修改后的pfile如下(僅作參考):
*.audit_file_dest='/app/oracle/admin/gbdb/adump'
*.background_dump_dest='/app/oracle/admin/gbdb/bdump'
*.compatible='10.2.0.5.0'
*.control_files='+DATA/gbdb/controlfile/current.493.857233793'
*.core_dump_dest='/app/oracle/admin/gbdb/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='gbdb'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=gbdbXDB)'
*.job_queue_processes=10
*.log_archive_dest_1='LOCATION=+DATA/gbdb/ARCHIVELOG/'
*.open_cursors=300
*.pga_aggregate_target=98283200
*.processes=300
*.remote_login_passwordfile='exclusive'
*.resource_limit=TRUE
*.sessions=335
*.sga_max_size=414748360
*.sga_target=414748360
*.LARGE_POOL_SIZE=214748360
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/app/oracle/admin/gbdb/udump'
關(guān)閉數(shù)據(jù)庫:
SQL> shutdown immediate
ORA-01507: database not mounted
ORACLE instance shut down.
用新的pfile啟動(dòng)數(shù)據(jù)庫到nomount
SQL> startup nomount pfile='/app/oracle/product/10.2.0/db/dbs/initgbdb.ora';
創(chuàng)建spfile:
SQL> create spfile from pfile='/app/oracle/product/10.2.0/db/dbs/initgbdb.ora';
File created.
關(guān)閉數(shù)據(jù)庫并啟動(dòng)數(shù)據(jù)庫到nomount狀態(tài):
SQL> shutdown immediate
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 4.2446E+10 bytes
Fixed Size 2174824 bytes
Variable Size 3422552216 bytes
Database Buffers 3.9007E+10 bytes
Redo Buffers 14602240 bytes
SQL>
[oracle@bridge ~]$ rman target /
Recovery Manager: Release 10.2.0.5.0 - Production on Wed Aug 27 14:40:44 2014
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: fxzmd (not mounted)
RMAN> run
{
allocate channel c1 type 'SBT_TAPE';
send 'NB_ORA_SERV=NBUServer,NB_ORA_CLIENT=bl890s1';
restore controlfile from 'cntrl_4923_1_857210701';
release channel c1;
}
啟動(dòng)數(shù)據(jù)庫到mount狀態(tài):
RMAN> alter database mount;
database mounted
恢復(fù)數(shù)據(jù)文件:
RMAN> run
{
allocate channel c1 type 'SBT_TAPE';
allocate channel c2 type 'SBT_TAPE';
allocate channel c3 type 'SBT_TAPE';
allocate channel c4 type 'SBT_TAPE';
send 'NB_ORA_SERV=NBUServer,NB_ORA_CLIENT=bl890s1';
restore database;
recover database;
release channel c1;
release channel c2;
release channel c3;
release channel c4;
}
以下信息為恢復(fù)結(jié)束時(shí)候的信息,僅作參考:
archive log filename=+DATA/gbdb/archivelog/1_171159_766064650.dbf thread=1 sequence=171159
archive log filename=+DATA/gbdb/archivelog/1_171160_766064650.dbf thread=1 sequence=171160
archive log filename=+DATA/gbdb/archivelog/2_177002_766064650.dbf thread=2 sequence=177002
archive log filename=+DATA/gbdb/archivelog/1_171161_766064650.dbf thread=1 sequence=171161
archive log filename=+DATA/gbdb/archivelog/2_177003_766064650.dbf thread=2 sequence=177003
archive log filename=+DATA/gbdb/archivelog/1_171162_766064650.dbf thread=1 sequence=171162
archive log filename=+DATA/gbdb/archivelog/2_177004_766064650.dbf thread=2 sequence=177004
archive log filename=+DATA/gbdb/archivelog/1_171163_766064650.dbf thread=1 sequence=171163
archive log filename=+DATA/gbdb/archivelog/2_177005_766064650.dbf thread=2 sequence=177005
archive log filename=+DATA/gbdb/archivelog/1_171164_766064650.dbf thread=1 sequence=171164
archive log filename=+DATA/gbdb/archivelog/2_177006_766064650.dbf thread=2 sequence=177006
archive log filename=+DATA/gbdb/archivelog/1_171165_766064650.dbf thread=1 sequence=171165
archive log filename=+DATA/gbdb/archivelog/2_177007_766064650.dbf thread=2 sequence=177007
archive log filename=+DATA/gbdb/archivelog/1_171166_766064650.dbf thread=1 sequence=171166
archive log filename=+DATA/gbdb/archivelog/2_177008_766064650.dbf thread=2 sequence=177008
archive log filename=+DATA/gbdb/archivelog/1_171167_766064650.dbf thread=1 sequence=171167
unable to find archive log
archive log thread=1 sequence=171168
released channel: c1
released channel: c2
released channel: c3
released channel: c4
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 09/02/2014 23:24:04
RMAN-06054: media recovery requesting unknown log: thread 1 seq 171168 lowscn 66130782491
Recovery Manager complete.
打開數(shù)據(jù)庫:
RMAN> alter database open resetlogs;
database opened
刪除thread 2的redo日志,只保留thread1日志組:
刪除thread 2 日志組:
alter database drop logfile group 4;
alter database drop logfile group 5;
alter database drop logfile group 6;
alter database drop logfile group 8;
添加日志組:
alter database add logfile group 4 ('+data','data1') size 200M;
注意:
如果刪除出現(xiàn)如下錯(cuò)誤:
SQL> alter database drop logfile group 8;
alter database drop logfile group 8
*
ERROR at line 1:
ORA-01567: dropping log 8 would leave less than 2 log files for instance gbdb2
(thread 2)
ORA-00312: online log 8 thread 2: '+DATA/gbdb/onlinelog/group_8.340.857294711'
ORA-00312: online log 8 thread 2: '+DATA1/gbdb/onlinelog/group_8.269.857294713'
先disable thread2 然后再刪除:
alter database disable thread 2;
最后redo日志修改如下(僅作參考):
SQL> select GROUP#,THREAD#,status,ARCHIVED from v$log;
GROUP# THREAD# STATUS ARC
---------- ---------- ---------------- ---
1 1 INACTIVE YES
2 1 INACTIVE YES
3 1 ACTIVE YES
4 1 ACTIVE YES
5 1 CURRENT NO
查看undo表空間:
SQL> select tablespace_name,contents from dba_tablespaces;
TABLESPACE_NAME CONTENTS
------------------------------ ---------
SYSTEM PERMANENT
UNDOTBS1 UNDO
SYSAUX PERMANENT
TEMP TEMPORARY
USERS PERMANENT
UNDOTBS2 UNDO
ZBWMSD PERMANENT
ZBWMSX PERMANENT
刪除UNDOTBS2,表空間:
drop tablespace UNDOTBS2;
SQL> drop tablespace UNDOTBS2;
Tablespace dropped.
確認(rèn)是否真實(shí)刪除:
SQL> select tablespace_name,contents from dba_tablespaces;
TABLESPACE_NAME CONTENTS
------------------------------ ---------
SYSTEM PERMANENT
UNDOTBS1 UNDO
SYSAUX PERMANENT
TEMP TEMPORARY
USERS PERMANENT
ZBWMSD PERMANENT
ZBWMSX PERMANENT
JXSWMSX PERMANENT
JXSWMSD PERMANENT
GROUPREPORT PERMANENT
ZBWMSTEST PERMANENT
最后確認(rèn)數(shù)據(jù)庫狀態(tài):
SQL> select open_mode from v$database;
OPEN_MODE
----------
READ WRITE
可參考《oracle單實(shí)例恢復(fù)到單實(shí)例》文檔;
###############################恢復(fù)20140902結(jié)束#######################
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。