rac恢復到單例項
1、將使用rman備份的rac的備份檔案傳輸到異地單節點上
[oracle@ora0 ~]$ ls /data_back/racbk/
20120514_3snav1p2_1_1.bk 40nav1sh_1_1_20120514.arc 43nav1sh_1_1_20120514.arc 48nav1vu_1_1_20120514.ctl
20120514_3tnav1p2_1_1.bk 41nav1sh_1_1_20120514.arc 44nav1t7_1_1_20120514.arc
20120514_3unav1pa_1_1.bk 42nav1sh_1_1_20120514.arc 46nav1uq_1_1_20120514.spfil
2、解決pfile
[oracle@ora0 ~]$ rman target /
RMAN> startup
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/oracle/product/10.2.0/dbs/initora10g.ora'
starting Oracle instance without parameter file for retrival of spfile
Oracle instance started
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of startup command at 05/14/2012 13:17:11
ORA-00205: error in identifying control file, check alert log for more info
#############報錯,不用理會############################
恢復spfile
RMAN> restore spfile from '/data_back/racbk/46nav1uq_1_1_20120514.spfil';
連入sql介面
SQL> conn /as sysdba
Connected.
SQL> select status from v$instance;
STATUS
------------
STARTED
SQL> create pfile from spfile;
File created.
刪除spfile 修改pfile
從RAC資料庫中建立引數檔案,如果RAC使用PFILE,可以直接COPY後修改。
修改的引數有: audit_file_dest, background_dump_dest, core_dump_dest,user_dump_dest, log_archive_dest_1等,
與路徑有關的引數,修改為你單例項環境的對應路徑。如:
background_dump_dest=/u01/oracle/ora/9.2.0/admin/DEV_dbtest/bdump
重要的: 移除cluster_database_instances,cluster_database引數,因為恢復到的是單例項環境。
移除一個UNDO_TABLESPACE設定,這裡假設保留的是APPS_UNDOTBS1
#############################
*.audit_file_dest='/u01/oracle/admin/db/adump'
*.background_dump_dest='/u01/oracle/admin/db/bdump'
*.compatible='10.2.0.1.0'
*.control_files='/u01/oracle/product/10.2.0/dbs/control_01.ctl'
*.core_dump_dest='/u01/oracle/admin/db/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='db'
*.job_queue_processes=10
*.log_archive_dest_1='LOCATION=/home/oracle/arc'
*.open_cursors=300
*.pga_aggregate_target=94371840
*.processes=150
*.remote_login_passwordfile='exclusive'
*.sga_target=283115520
*.undo_management='AUTO'
undo_tablespace='UNDOTBS1'
*.user_dump_dest='/u01/oracle/admin/db/udump'
################################################
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 285212672 bytes
Fixed Size 2020224 bytes
Variable Size 92277888 bytes
Database Buffers 188743680 bytes
Redo Buffers 2170880 bytes
SQL>
3、恢復控制檔案,啟動資料庫到mount狀態
RMAN> restore controlfile from '/data_back/racbk/48nav1vu_1_1_20120514.ctl';
RMAN> alter database mount;
database mounted
released channel: ORA_DISK
4、修改資料檔案和日誌檔案路徑
select 'set newname for datafile '||chr(39)||name||chr(39)||' to '||chr(39)||replace(name,'+DG0/db/datafile/','/home/oracle/data2/')||chr(39)||';' from v$datafile;
#######################
SQL> select 'set newname for datafile '||chr(39)||name||chr(39)||' to '||chr(39)||replace(name,'+DG0/db/datafile/','/home/oracle/data2/')||chr(39)||';' from v$datafile;
'SETNEWNAMEFORDATAFILE'||CHR(39)||NAME||CHR(39)||'TO'||CHR(39)||REPLACE(NAME,'+DG0/DB/DATAFILE/','/HOME/ORACLE/DATA2/')||CHR(39)||';'
------------------------------------------------------------------------------------------------------------------------------------------------------
set newname for datafile '+DG0/db/datafile/sysaux.257.780159407' to '/home/oracle/data2/sysaux.257.780159407';
set newname for datafile '+DG0/db/datafile/system.256.780159407' to '/home/oracle/data2/system.256.780159407';
set newname for datafile '+DG0/db/datafile/timelineweb01.dbf' to '/home/oracle/data2/timelineweb01.dbf';
set newname for datafile '+DG0/db/datafile/undotbs1.258.780159409' to '/home/oracle/data2/undotbs1.258.780159409';
set newname for datafile '+DG0/db/datafile/undotbs2.264.780159511' to '/home/oracle/data2/undotbs2.264.780159511';
set newname for datafile '+DG0/db/datafile/users.259.780159409' to '/home/oracle/data2/users.259.780159409';
6 rows selected.
######################
5. 恢復資料庫到新的目錄(我的環境是原來是RAW恢復到檔案系統)
select 'alter database rename file '||chr(39)||member||chr(39)||' to '||chr(39)||replace(member,'+DG0/db/onlinelog/','/home/oracle/data2/')||chr(39)||';' from v$logfile;
SQL> select 'alter database rename file '||chr(39)||member||chr(39)||' to '||chr(39)||replace(member,'+DG0/db/onlinelog/','/home/oracle/data2/')||chr(39)||';' from v$logfile;
'ALTERDATABASERENAMEFILE'||CHR(39)||MEMBER||CHR(39)||'TO'||CHR(39)||REPLACE(MEMBER,'+DG0/DB/ONLINELOG/','/HOME/ORACLE/DATA2/')||CHR(39)||';'
------------------------------------------------------------------------------------------------------------------------------------------------------
alter database rename file '+DG0/db/onlinelog/group_2.262.780159469' to '/home/oracle/data2/group_2.262.780159469';
alter database rename file '+DG0/db/onlinelog/group_1.261.780159467' to '/home/oracle/data2/group_1.261.780159467';
alter database rename file '+DG0/db/onlinelog/group_3.265.780159539' to '/home/oracle/data2/group_3.265.780159539';
alter database rename file '+DG0/db/onlinelog/group_4.266.780159539' to '/home/oracle/data2/group_4.266.780159539';
在sql介面執行與日誌檔案有關的語句:
alter database rename file '+DG0/db/onlinelog/group_2.262.780159469' to '/home/oracle/data2/group_2.262.780159469';
alter database rename file '+DG0/db/onlinelog/group_1.261.780159467' to '/home/oracle/data2/group_1.261.780159467';
alter database rename file '+DG0/db/onlinelog/group_3.265.780159539' to '/home/oracle/data2/group_3.265.780159539';
alter database rename file '+DG0/db/onlinelog/group_4.266.780159539' to '/home/oracle/data2/group_4.266.780159539';
在rman介面執行如下指令碼:
RMAN> catalog start with '/data_back/racbk/';
查出catalog的scn號
Rman > list backup #找出最大的scn
然後執行如下指令碼
run {
set newname for datafile '+DG0/db/datafile/sysaux.257.780159407' to '/home/oracle/data2/sysaux.257.780159407';
set newname for datafile '+DG0/db/datafile/system.256.780159407' to '/home/oracle/data2/system.256.780159407';
set newname for datafile '+DG0/db/datafile/timelineweb01.dbf' to '/home/oracle/data2/timelineweb01.dbf';
set newname for datafile '+DG0/db/datafile/undotbs1.258.780159409' to '/home/oracle/data2/undotbs1.258.780159409';
set newname for datafile '+DG0/db/datafile/undotbs2.264.780159511' to '/home/oracle/data2/undotbs2.264.780159511';
set newname for datafile '+DG0/db/datafile/users.259.780159409' to '/home/oracle/data2/users.259.780159409';
set until scn 1385018;
restore database ;
switch datafile all;
recover database;
}
6,開啟資料庫
SQL> alter database open resetlogs;
Database altered.
7、
處理臨時檔案:
先建立一個臨時表空間temp1
SQL> create temporary tablespace temp1 tempfile '/home/oracle/data2/temp2.dbf' size 512m autoextend on next 1m maxsize unlimited;
Tablespace created.
SQL> alter database default temporary tablespace temp1;
Database altered.
刪掉不用的undo表空間及檔案
SQL> select tablespace_name,status from dba_data_files;
TABLESPACE_NAME STATUS
------------------------------ ---------
USERS AVAILABLE
SYSAUX AVAILABLE
UNDOTBS1 AVAILABLE
SYSTEM AVAILABLE
UNDOTBS2 AVAILABLE
TIMELINEWEB AVAILABLE
6 rows selected.
SQL> show parameter undo
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
undo_management string AUTO
undo_retention integer 900
undo_tablespace string UNDOTBS1
SQL> drop tablespace undotbs2 including contents and datafiles;
Tablespace dropped.
SQL>
刪除透過RMAN回覆過來的臨時檔案。完成臨時檔案的整個處理過程。
SQL> drop tablespace temp including contents and datafiles;
Tablespace dropped.
刪除不用的日誌
select thread#,status,enabled from v$thread; --查詢thread,那個可以刪除
SQL> select thread#,status,enabled from v$thread;
THREAD# STATUS ENABLED
---------- ------ --------
1 OPEN PUBLIC
2 CLOSED PUBLIC
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
1 1 0 52428800 1 YES UNUSED 0
2 1 1 52428800 1 NO CURRENT 1385019 14-MAY-12
3 2 0 52428800 1 YES UNUSED 0
4 2 1 52428800 1 NO CURRENT 1385019 14-MAY-12
SQL> select * from v$logfile;
GROUP# STATUS TYPE MEMBER IS_
---------- ------- ------- --------------------------------------------- ---
2 ONLINE /home/oracle/data2/group_2.262.780159469 NO
1 ONLINE /home/oracle/data2/group_1.261.780159467 NO
3 ONLINE /home/oracle/data2/group_3.265.780159539 NO
4 ONLINE /home/oracle/data2/group_4.266.780159539 NO
SQL> ALTER DATABASE DISABLE THREAD 2;
Database altered.
SQL> alter database drop logfile group 3
2 ;
Database altered.
SQL> alter database drop logfile group 4;
alter database drop logfile group 4
*
ERROR at line 1:
ORA-00350: log 4 of instance db2 (thread 2) needs to be archived
ORA-00312: online log 4 thread 2: '/home/oracle/data2/group_4.266.780159539'
SQL> alter database clear unarchived logfile group 4;
Database altered.
SQL> alter database drop logfile group 4;
Database altered.
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
1 1 0 52428800 1 YES UNUSED 0
2 1 1 52428800 1 NO CURRENT 1385019 14-MAY-12
SQL> select * from v$logfile;
GROUP# STATUS TYPE MEMBER IS_
---------- ------- ------- --------------------------------------------- ---
2 ONLINE /home/oracle/data2/group_2.262.780159469 NO
1 ONLINE /home/oracle/data2/group_1.261.780159467 NO
SQL>
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/196700/viewspace-2220927/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 記錄一次Oracle 11.2.0.4 RAC異地恢復到單例項Oracle單例
- 從nub備份恢復(同平臺)恢復RAC至單例項單例
- RAC恢復到單機
- 將RAC備份集恢復為單例項資料庫單例資料庫
- Networker恢復oracle rac到單機Oracle
- Oracle 11g RAC到單例項OGG同步Oracle單例
- oracle資料庫跨平臺(AIX)從RAC恢復至(linux)下的單例項Oracle資料庫AILinux單例
- RAC+DG(asm單例項)ASM單例
- RAC+單例項DG的切換單例
- 將RAC軟體轉換為單例項軟體單例
- ORACLE事務和例項恢復過程梳理Oracle
- RAC備份恢復之Voting備份與恢復
- rac二節點例項redo故障無法啟動修復
- oracle rac 單個例項不能生成awr報告的問題Oracle
- 單例項Primary快速搭建Standby RAC參考手冊(19.16 ADG)單例
- ORA-29702複製RAC Oracle軟體啟動單例項Oracle單例
- 【資料庫資料恢復】Oracle ASM例項無法掛載的資料恢復案例資料庫資料恢復OracleASM
- DM7 RAC資料庫恢復成單機資料庫資料庫
- DG:11.2.0.4 RAC線上duplicate恢復DG
- 【資料庫資料恢復】ASM例項不能掛載的Oracle資料庫資料恢復案例資料庫資料恢復ASMOracle
- Oracle 資料庫巡檢指令碼 單例項 RAC 輸出HTML格式Oracle資料庫指令碼單例HTML
- RAC控制檔案恢復(三種不同情況)
- RAC安裝目錄許可權快速恢復
- ibbackup恢復報錯一例
- 【轉載】TortoiseSVN怎麼恢復到以前版本-恢復到以前版本的方法
- 恢復備份例項時出現ORA-01659的解決方法UA
- ORACLE 11.2.0.4 RAC RMAN異機恢復之ORA-15001Oracle
- Oracle搭建rac到單庫的adgOracle
- PHP 完整表單例項PHP單例
- Redis單例項安裝Redis單例
- mysql資料庫恢復一例MySql資料庫
- DM7使用DMRMAN執行RAC資料庫恢復資料庫
- 資料庫startup啟動時前滾回滾進行例項恢復的理解資料庫
- 3.1.5.7 啟動例項、掛載資料庫並啟動完整的媒體恢復資料庫
- 單例項mysql.yaml kubernetes單例MySqlYAML
- opengl簡單入門例項
- Spark 簡單例項(基本操作)Spark單例
- 2.4.7 Step 6: 連線到例項