【RAC】Oracle 10g RAC 重建控制檔案
本文透過建立軟連結和重建控制檔案的方式,使裸裝置在資料庫中顯示為普通資料檔案常用的名稱。
重建控制檔案過程中,解決了在RAC環境下,重建控制檔案報錯問題:ORA-01503: CREATE CONTROLFILE failed ORA-12720: operation requires database is in EXCLUSIVE mode。
【實驗環境】
作業系統:AIX 5300-09
叢集軟體:CRS 10.2.0.1
資料庫: Oracle 10.2.0.1
【AIX-RAC結構資訊】
【實驗背景】
在AIX系統上搭建的雙節點RAC,使用hacmp實現卷組併發來建立共享儲存。DBCA建立資料庫時,儲存選項選擇裸裝置,裸裝置的對映檔案如下:直接對應的是共享邏輯卷
-
control1=/dev/rrac_control1
-
control2=/dev/rrac_control2
-
example=/dev/rrac_example
-
redo1_1=/dev/rrac_redo1_1
-
redo1_2=/dev/rrac_redo1_2
-
redo2_1=/dev/rrac_redo2_1
-
redo2_2=/dev/rrac_redo2_2
-
spfile=/dev/rrac_spfile
-
sysaux=/dev/rrac_sysaux
-
system=/dev/rrac_system
-
temp=/dev/rrac_temp
-
undotbs1=/dev/rrac_undotbs1
-
undotbs2=/dev/rrac_undotbs2
-
users=/dev/rrac_users
- pwdfile=/dev/rrac_pwdfile
select file_id,file_name,tablespace_name,bytes/1024/1024 from dba_data_files;
file_name 顯示的就是共享邏輯卷,並不是我們所熟悉的方式
想要在查詢資料檔案、日誌檔案時,按如下所示我們所熟悉的方式顯示,該如何來實現呢?
首先,建立目錄並建立軟連結,連結到對應邏輯卷
ln -s /dev/rrac_control1 /u01/app/oracle/oradata/prod/control01.ctl
ln -s /dev/rrac_control2 /u01/app/oracle/oradata/prod/control02.ctl
ln -s /dev/rrac_example /u01/app/oracle/oradata/prod/example01.dbf
ln -s /dev/rrac_redo1_1 /u01/app/oracle/oradata/prod/log11.log
ln -s /dev/rrac_redo1_2 /u01/app/oracle/oradata/prod/log12.log
ln -s /dev/rrac_redo2_1 /u01/app/oracle/oradata/prod/log21.log
ln -s /dev/rrac_redo2_2 /u01/app/oracle/oradata/prod/log22.log
ln -s /dev/rrac_spfile /u01/app/oracle/oradata/prod/spfile01
ln -s /dev/rrac_sysaux /u01/app/oracle/oradata/prod/sysaux01.dbf
ln -s /dev/rrac_system /u01/app/oracle/oradata/prod/system01.dbf
ln -s /dev/rrac_temp /u01/app/oracle/oradata/prod/temp01.dbf
ln -s /dev/rrac_undotbs1 /u01/app/oracle/oradata/prod/undotbs01.dbf
ln -s /dev/rrac_undotbs2 /u01/app/oracle/oradata/prod/undotbs02.dbf
ln -s /dev/rrac_users /u01/app/oracle/oradata/prod/users01.dbf
ln -s /dev/rrac_pwdfile /u01/app/oracle/oradata/prod/pwdfile01
然後,就需要修改控制檔案裡的資料檔案、日誌檔案資訊了。
可以透過重建控制檔案的方式,在重建時將資料檔案、日誌檔案資訊更改為上面建立的軟連結。
下面就是在RAC環境下重建控制檔案的具體實驗過程了
【實驗過程】
1、dump當前控制檔案到指定位置
檢視dump出來的控制檔案資訊
-
[root@aix227:/u01/app/oracle]#more controlbak.ctl
-
-- The following are current System-scope REDO Log Archival related
-
-- parameters and can be included in the database initialization file.
-
--
-
-- LOG_ARCHIVE_DEST=''
-
-- LOG_ARCHIVE_DUPLEX_DEST=''
-
--
-
-- LOG_ARCHIVE_FORMAT=%t_%s_%r.dbf
-
--
-
-- DB_UNIQUE_NAME="prod"
-
--
-
-- LOG_ARCHIVE_CONFIG='SEND, RECEIVE, NODG_CONFIG'
-
-- LOG_ARCHIVE_MAX_PROCESSES=2
-
-- STANDBY_FILE_MANAGEMENT=MANUAL
-
-- STANDBY_ARCHIVE_DEST=?/dbs/arch
-
-- FAL_CLIENT=''
-
-- FAL_SERVER=''
-
--
-
-- LOG_ARCHIVE_DEST_1='LOCATION=/u01/app/oracle/product/10.2.0/db_1/dbs/arch'
-
-- LOG_ARCHIVE_DEST_1='MANDATORY NOREOPEN NODELAY'
-
-- LOG_ARCHIVE_DEST_1='ARCH NOAFFIRM EXPEDITE NOVERIFY SYNC'
-
-- LOG_ARCHIVE_DEST_1='NOREGISTER NOALTERNATE NODEPENDENCY'
-
-- LOG_ARCHIVE_DEST_1='NOMAX_FAILURE NOQUOTA_SIZE NOQUOTA_USED NODB_UNIQUE_NAME'
-
-- LOG_ARCHIVE_DEST_1='VALID_FOR=(PRIMARY_ROLE,ONLINE_LOGFILES)'
-
-- LOG_ARCHIVE_DEST_STATE_1=ENABLE
-
-
--
-
-- Below are two sets of SQL statements, each of which creates a new
-
-- control file and uses it to open the database. The first set opens
-
-- the database with the NORESETLOGS option and should be used only if
-
-- the current versions of all online logs are available. The second
-
-- set opens the database with the RESETLOGS option and should be used
-
-- if online logs are unavailable.
-
-- The appropriate set of statements can be copied from the trace into
-
-- a script file, edited as necessary, and executed when there is a
-
-- need to re-create the control file.
-
--
-
-- Set #1. NORESETLOGS case
-
--
-
-- The following commands will create a new control file and use it
-
-- to open the database.
-
-- Data used by Recovery Manager will be lost.
-
-- Additional logs may be required for media recovery of offline
-
-- Use this only if the current versions of all online logs are
-
-- available.
-
-
-- After mounting the created controlfile, the following SQL
-
-- statement will place the database in the appropriate
-
-- protection mode:
-
-- ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE
-
-
STARTUP NOMOUNT
-
CREATE CONTROLFILE REUSE DATABASE "PROD" NORESETLOGS NOARCHIVELOG
-
MAXLOGFILES 192
-
MAXLOGMEMBERS 3
-
MAXDATAFILES 1024
-
MAXINSTANCES 32
-
MAXLOGHISTORY 292
-
LOGFILE
-
GROUP 1 '/dev/rrac_redo1_1' SIZE 50M,
-
GROUP 2 '/dev/rrac_redo1_2' SIZE 50M,
-
GROUP 3 '/dev/rrac_redo2_1' SIZE 50M,
-
GROUP 4 '/dev/rrac_redo2_2' SIZE 50M
-
-- STANDBY LOGFILE
-
-
DATAFILE
-
'/dev/rrac_system',
-
'/dev/rrac_undotbs1',
-
'/dev/rrac_sysaux',
-
'/dev/rrac_users',
-
'/dev/rrac_example',
-
'/dev/rrac_undotbs2'
-
CHARACTER SET ZHS16GBK
-
;
-
-
-- Commands to re-create incarnation table
-
-- Below log names MUST be changed to existing filenames on
-
-- disk. Any one log file from each branch can be used to
-
-- re-create incarnation records.
-
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/product/10.2.0/db_1/dbs/arch1_1_564280945.dbf';
-
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/product/10.2.0/db_1/dbs/arch1_1_854793143.dbf';
-
-- Recovery is required if any of the datafiles are restored backups,
-
-- or if the last shutdown was not normal or immediate.
-
RECOVER DATABASE
-
-
-- Database can now be opened normally.
-
ALTER DATABASE OPEN;
-
-
-- Commands to add tempfiles to temporary tablespaces.
-
-- Online tempfiles have complete space information.
-
-- Other tempfiles may require adjustment.
-
ALTER TABLESPACE TEMP ADD TEMPFILE '/dev/rrac_temp'
-
SIZE 20971520 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 536870912 ;
-
-- End of tempfile additions.
-
--
-
-- Set #2. RESETLOGS case
-
--
-
-- The following commands will create a new control file and use it
-
-- to open the database.
-
-- Data used by Recovery Manager will be lost.
-
-- The contents of online logs will be lost and all backups will
-
-- be invalidated. Use this only if online logs are damaged.
-
-
-- After mounting the created controlfile, the following SQL
-
-- statement will place the database in the appropriate
-
-- protection mode:
-
-- ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE
-
-
STARTUP NOMOUNT
-
CREATE CONTROLFILE REUSE DATABASE "PROD" RESETLOGS NOARCHIVELOG
-
MAXLOGFILES 192
-
MAXLOGMEMBERS 3
-
MAXDATAFILES 1024
-
MAXINSTANCES 32
-
MAXLOGHISTORY 292
-
LOGFILE
-
GROUP 1 '/dev/rrac_redo1_1' SIZE 50M,
-
GROUP 2 '/dev/rrac_redo1_2' SIZE 50M
-
-- STANDBY LOGFILE
-
-
DATAFILE
-
'/dev/rrac_system',
-
'/dev/rrac_undotbs1',
-
'/dev/rrac_sysaux',
-
'/dev/rrac_users',
-
'/dev/rrac_example',
-
'/dev/rrac_undotbs2'
-
CHARACTER SET ZHS16GBK
- ;
2、修改控制檔案重建語句
因為要在正常關庫的情況下,主動重建控制檔案,我們可以採用NORESETLOGS方式根據dump出來的資訊,修改其中logfile、datafile為前面建立的軟連結,得到重建控制檔案語句如下:
SQL> CREATE CONTROLFILE REUSE DATABASE "PROD" NORESETLOGS NOARCHIVELOG
2 MAXLOGFILES 192
3 MAXLOGMEMBERS 3
4 MAXDATAFILES 1024
5 MAXINSTANCES 32
6 MAXLOGHISTORY 292
7 LOGFILE
8 GROUP 1 '/u01/app/oracle/oradata/prod/log11.log' SIZE 50M,
9 GROUP 2 '/u01/app/oracle/oradata/prod/log12.log' SIZE 50M,
10 GROUP 3 '/u01/app/oracle/oradata/prod/log21.log' SIZE 50M,
11 GROUP 4 '/u01/app/oracle/oradata/prod/log22.log' SIZE 50M
12 DATAFILE
13 '/u01/app/oracle/oradata/prod/system01.dbf',
14 '/u01/app/oracle/oradata/prod/undotbs01.dbf',
15 '/u01/app/oracle/oradata/prod/sysaux01.dbf',
16 '/u01/app/oracle/oradata/prod/users01.dbf',
17 '/u01/app/oracle/oradata/prod/example01.dbf',
18 '/u01/app/oracle/oradata/prod/undotbs02.dbf'
19 CHARACTER SET ZHS16GBK
20 ;3、正常關閉資料庫,把一個例項啟動到nomount狀態
正常關閉整個資料庫(所有例項)
srvctl stop database -d prod
sqlplus登入其中一個例項:prod1,啟動到nomount狀態
4、直接重建控制檔案報錯:
-
SQL> CREATE CONTROLFILE REUSE DATABASE "PROD" NORESETLOGS NOARCHIVELOG
-
2 MAXLOGFILES 192
-
3 MAXLOGMEMBERS 3
-
4 MAXDATAFILES 1024
-
5 MAXINSTANCES 32
-
6 MAXLOGHISTORY 292
-
7 LOGFILE
-
8 GROUP 1 '/u01/app/oracle/oradata/prod/log11.log' SIZE 50M,
-
9 GROUP 2 '/u01/app/oracle/oradata/prod/log12.log' SIZE 50M,
-
10 GROUP 3 '/u01/app/oracle/oradata/prod/log21.log' SIZE 50M,
-
11 GROUP 4 '/u01/app/oracle/oradata/prod/log22.log' SIZE 50M
-
12 DATAFILE
-
13 '/u01/app/oracle/oradata/prod/system01.dbf',
-
14 '/u01/app/oracle/oradata/prod/undotbs01.dbf',
-
15 '/u01/app/oracle/oradata/prod/sysaux01.dbf',
-
16 '/u01/app/oracle/oradata/prod/users01.dbf',
-
17 '/u01/app/oracle/oradata/prod/example01.dbf',
-
18 '/u01/app/oracle/oradata/prod/undotbs02.dbf'
-
19 CHARACTER SET ZHS16GBK
-
20 ;
-
CREATE CONTROLFILE REUSE DATABASE "PROD" NORESETLOGS NOARCHIVELOG
-
*
-
ERROR at line 1:
-
ORA-01503: CREATE CONTROLFILE failed
-
ORA-12720: operation requires database is in EXCLUSIVE mode
-
-
- SQL>
5、使用EXCLUSIVE模式啟動到nomount狀態
作為一個oracle小白,根據前面報錯資訊
嘗試startup nomount exclusive;後重建控制檔案
再次重建控制檔案依然報相同錯誤
6、修改cluster_database引數值為false
檢視cluster_databse引數
設定cluster_databse值為false
7、正常關閉資料庫後,重啟到nomount狀態
8、再次重建控制檔案:成功
9、調整臨時表空間資料檔案
重建控制檔案成功後,還需要從dump出來的控制檔案資訊中,找出與臨時表空間相關的語句,調整為我們的軟連結位置
SQL> ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/oracle/oradata/prod/temp01.dbf'
2 SIZE 20971520 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 536870912 ;
10、恢復cluster_database引數為true
11、正常關閉資料庫,啟動資料庫所有例項查驗
檢視資料庫狀態,兩個例項都已經open
檢視資料檔案和日誌檔案,已經是我們想要的結果。^_^
【實驗總結】
一、裸裝置搭建的rac,修改資料檔案、日誌檔案顯示方式
首先建立軟連結,實現常規檔名連結到具體裝置;
然後透過重建控制檔案的方式,在重建時將資料檔案和日誌檔案的路徑改為新建的連結。
二、RAC重建控制檔案報錯常見原因
RAC環境重建控制檔案報錯,使用startup nomount exclusive;並不能真正實現非共享。在RAC叢集環境下,初始化引數檔案中有cluster_database引數,此引數值為true時,是叢集資料庫,資料檔案是所有例項共享的。如果要重建控制檔案,需要在EXCLUSIVE模式,必須先將cluster_database引數的值設定為false。
三、RAC環境重建控制檔案一般順序
1、使用dump出來的控制檔案資訊,選擇重建控制檔案語句
2、設定cluster_databse=false
3、正常關閉資料庫,將一個例項啟動到nomount狀態
4、重建控制檔案
5、恢復cluster_databse=true
6、recover databse (如果正常關庫、無資料損壞或丟失,使用noresetlog方式重建則不需要)
7、重啟資料庫查驗(所有例項)
呂星昊
2014.8.10
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8494287/viewspace-1349465/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle 10g RAC故障處理Oracle 10g
- Oracle RAC引數檔案管理Oracle
- 重建共享(db或asm)密碼檔案 in Oracle 19c RAC-20220209ASM密碼Oracle
- Oracle RAC修改引數檔案位置Oracle
- 10g RAC on AIXAI
- Oracle RAC NFS掛載檔案系統OracleNFS
- Oracle 10g RAC 資料儲存更換Oracle 10g
- Oracle 11.2 DataGuard RAC To RAC搭建Oracle
- AIX 5.3 Install Oracle 10g RAC 錯誤集錦AIOracle 10g
- oracle RACOracle
- Oracle RAC Cache Fusion 系列十七:Oracle RAC DRMOracle
- RAC控制檔案恢復(三種不同情況)
- Oracle RAC CacheFusion 系列十五:Oracle RAC CRServer Part TwoOracleServer
- ORACLE RAC clusterwareOracle
- 【RAC】Oracle RAC如何修改心跳網路Oracle
- Oracle RAC Cache Fusion系列十八:Oracle RAC Statisticsand Wait EventsOracleAI
- 【RAC】Oracle rac 如何修改公網及vipOracle
- Oracle RAC Cache Fusion 系列十四:Oracle RAC CR Server Part OneOracleServer
- Oracle RAC Cache Fusion 系列十:Oracle RAC Enqueues And Lock Part 1OracleENQ
- ORACLE11GR2 RAC檔案系統變更成ASM EXTEND RAC及高可用測試OracleASM
- Oracle RAC 環境 引數檔案的啟動順序Oracle
- oracle rac 增加磁碟Oracle
- Oracle RAC Wait EventsOracleAI
- oracle快速拿到重建控制檔案語句的方法二Oracle
- Oracle RAC Cache Fusion 系列九:Oracle RAC 分散式資源管理(二)Oracle分散式
- Oracle RAC Cache Fusion 系列八:Oracle RAC 分散式資源管理(一)Oracle分散式
- Solaris 10下遷移10G RAC (二)
- Solaris 10下遷移10G RAC (七)
- Solaris 10下遷移10G RAC (三)
- Solaris 10下遷移10G RAC (一)
- Solaris 10下遷移10G RAC (五)
- Solaris 10下遷移10G RAC (六)
- Solaris 10下遷移10G RAC (八)
- Solaris 10下遷移10G RAC (四)
- 【RAC】Oracle RAC上線測試場景介紹Oracle
- Oracle RAC一鍵部署004(RAC引數校驗)Oracle
- Oracle RAC 11gR2開啟歸檔Oracle
- Oracle RAC更新補丁Oracle
- Oracle RAC新增節點Oracle