當存在read only或者offline表空間時,重建控制檔案時要注意!
當存在read only或者offline表空間時,重建控制檔案分兩種情況:
1、重建controlfile的script中包含read only或者offline所對應的datafile;這種情況比較簡單,datafile不需要rename,如果是offline的表空間,那麼重建controlfile之後只需要online tbs即可;如果是read only tbs那麼重建controlfile之後需要對其對應的daafile進行恢復。
2、重建controlfile的script中不包含read only或者offline所對應的datafile;重建controlfile之後需要rename datafile到正確的位置,之後如果是offline的表空間,那麼重建controlfile之後只需要online tbs即可;如果是read only tbs那麼重建controlfile之後需要對其對應的daafile進行恢復。
[@more@]測試1:
SQL> alter database backup controlfile to trace;
資料庫已更改。
SQL> alter tablespace users read only;
表空間已更改。
SQL> connect /as sysdba
已連線。
SQL> shutdown immediate
資料庫已經關閉。
已經解除安裝資料庫。
ORACLE 例程已經關閉。
SQL> startup
ORACLE 例程已經啟動。
Total System Global Area 167772160 bytes
Fixed Size 1247900 bytes
Variable Size 58721636 bytes
Database Buffers 104857600 bytes
Redo Buffers 2945024 bytes
ORA-00205: ?????????, ??????, ???????
SQL> select status from v$instance;
STATUS
------------------------
STARTED
SQL> CREATE CONTROLFILE REUSE DATABASE "ORCL" NORESETLOGS NOARCHIVELOG
2 MAXLOGFILES 16
3 MAXLOGMEMBERS 3
4 MAXDATAFILES 100
5 MAXINSTANCES 8
6 MAXLOGHISTORY 226
7 LOGFILE
8 GROUP 1 (
9 'E:ORACLEPRODUCT10.2.0ORADATAORCLONLINELOGO1_MF_1_46MGCZHN_.LOG'
,
10 'E:ORACLEPRODUCT10.2.0FLASH_RECOVERY_AREAORCLONLINELOGO1_MF_1_46
MGD3VT_.LOG'
11 ) SIZE 50M,
12 GROUP 2 (
13 'E:ORACLEPRODUCT10.2.0ORADATAORCLONLINELOGO1_MF_2_46MGD7OZ_.LOG'
,
14 'E:ORACLEPRODUCT10.2.0FLASH_RECOVERY_AREAORCLONLINELOGO1_MF_2_46
MGDDKL_.LOG'
15 ) SIZE 50M,
16 GROUP 3 (
17 'E:ORACLEPRODUCT10.2.0ORADATAORCLONLINELOGO1_MF_3_46MGDJ3F_.LOG'
,
18 'E:ORACLEPRODUCT10.2.0FLASH_RECOVERY_AREAORCLONLINELOGO1_MF_3_46
MGDNX9_.LOG'
19 ) SIZE 50M
20 -- STANDBY LOGFILE
21 DATAFILE
22 'E:ORACLEPRODUCT10.2.0ORADATAORCLDATAFILEO1_MF_SYSTEM_46MGDYM1_.DB
F',
23 'E:ORACLEPRODUCT10.2.0ORADATAORCLDATAFILEO1_MF_UNDOTBS1_46MGFWLK_.
DBF',
24 'E:ORACLEPRODUCT10.2.0ORADATAORCLDATAFILEO1_MF_SYSAUX_46MGG4B8_.DB
F',
25 'E:ORACLEPRODUCT10.2.0ORADATAORCLDATAFILEO1_MF_USERS_46MGGRPG_.DBF
'
26 CHARACTER SET ZHS16GBK
27 ;
CREATE CONTROLFILE REUSE DATABASE "ORCL" NORESETLOGS NOARCHIVELOG
*
第 1 行出現錯誤:
ORA-01503: CREATE CONTROLFILE ??
ORA-01276: ??????
E:ORACLEPRODUCT10.2.0ORADATAORCLCONTROLFILEO1_MF_46MGCW6C_.CTL?????????
Oracle Managed Files ????
SQL> alter session set nls_language=american;
Session altered.
SQL> CREATE CONTROLFILE REUSE DATABASE "ORCL" NORESETLOGS NOARCHIVELOG
2 MAXLOGFILES 16
3 MAXLOGMEMBERS 3
4 MAXDATAFILES 100
5 MAXINSTANCES 8
6 MAXLOGHISTORY 226
7 LOGFILE
8 GROUP 1 (
9 'E:ORACLEPRODUCT10.2.0ORADATAORCLONLINELOGO1_MF_1_46MGCZHN_.LOG'
,
10 'E:ORACLEPRODUCT10.2.0FLASH_RECOVERY_AREAORCLONLINELOGO1_MF_1_46
MGD3VT_.LOG'
11 ) SIZE 50M,
12 GROUP 2 (
13 'E:ORACLEPRODUCT10.2.0ORADATAORCLONLINELOGO1_MF_2_46MGD7OZ_.LOG'
,
14 'E:ORACLEPRODUCT10.2.0FLASH_RECOVERY_AREAORCLONLINELOGO1_MF_2_46
MGDDKL_.LOG'
15 ) SIZE 50M,
16 GROUP 3 (
17 'E:ORACLEPRODUCT10.2.0ORADATAORCLONLINELOGO1_MF_3_46MGDJ3F_.LOG'
,
18 'E:ORACLEPRODUCT10.2.0FLASH_RECOVERY_AREAORCLONLINELOGO1_MF_3_46
MGDNX9_.LOG'
19 ) SIZE 50M
20 -- STANDBY LOGFILE
21 DATAFILE
22 'E:ORACLEPRODUCT10.2.0ORADATAORCLDATAFILEO1_MF_SYSTEM_46MGDYM1_.DB
F',
23 'E:ORACLEPRODUCT10.2.0ORADATAORCLDATAFILEO1_MF_UNDOTBS1_46MGFWLK_.
DBF',
24 'E:ORACLEPRODUCT10.2.0ORADATAORCLDATAFILEO1_MF_SYSAUX_46MGG4B8_.DB
F',
25 'E:ORACLEPRODUCT10.2.0ORADATAORCLDATAFILEO1_MF_USERS_46MGGRPG_.DBF
'
26 CHARACTER SET ZHS16GBK
27 ;
CREATE CONTROLFILE REUSE DATABASE "ORCL" NORESETLOGS NOARCHIVELOG
*
ERROR at line 1:
ORA-01503: CREATE CONTROLFILE failed
ORA-01276: Cannot add file
E:ORACLEPRODUCT10.2.0ORADATAORCLCONTROLFILEO1_MF_46MGCW6C_.CTL. File
has an Oracle Managed Files file name.
SQL> show parameter control_files
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_files string E:ORACLEPRODUCT10.2.0ORADA
TAORCLCONTROLFILEO1_MF_46MG
CW6C_.CTL, E:ORACLEPRODUCT1
0.2.0FLASH_RECOVERY_AREAORCL
CONTROLFILEO1_MF_46MGCX9R_.C
TL
SQL> alter system reset control_files scope=spfile sid='*';
System altered.
SQL> shutdown immediate
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 167772160 bytes
Fixed Size 1247900 bytes
Variable Size 58721636 bytes
Database Buffers 104857600 bytes
Redo Buffers 2945024 bytes
SQL> CREATE CONTROLFILE REUSE DATABASE "ORCL" NORESETLOGS NOARCHIVELOG
2 MAXLOGFILES 16
3 MAXLOGMEMBERS 3
4 MAXDATAFILES 100
5 MAXINSTANCES 8
6 MAXLOGHISTORY 226
7 LOGFILE
8 GROUP 1 (
9 'E:ORACLEPRODUCT10.2.0ORADATAORCLONLINELOGO1_MF_1_46MGCZHN_.LOG'
,
10 'E:ORACLEPRODUCT10.2.0FLASH_RECOVERY_AREAORCLONLINELOGO1_MF_1_46
MGD3VT_.LOG'
11 ) SIZE 50M,
12 GROUP 2 (
13 'E:ORACLEPRODUCT10.2.0ORADATAORCLONLINELOGO1_MF_2_46MGD7OZ_.LOG'
,
14 'E:ORACLEPRODUCT10.2.0FLASH_RECOVERY_AREAORCLONLINELOGO1_MF_2_46
MGDDKL_.LOG'
15 ) SIZE 50M,
16 GROUP 3 (
17 'E:ORACLEPRODUCT10.2.0ORADATAORCLONLINELOGO1_MF_3_46MGDJ3F_.LOG'
,
18 'E:ORACLEPRODUCT10.2.0FLASH_RECOVERY_AREAORCLONLINELOGO1_MF_3_46
MGDNX9_.LOG'
19 ) SIZE 50M
20 -- STANDBY LOGFILE
21 DATAFILE
22 'E:ORACLEPRODUCT10.2.0ORADATAORCLDATAFILEO1_MF_SYSTEM_46MGDYM1_.DB
F',
23 'E:ORACLEPRODUCT10.2.0ORADATAORCLDATAFILEO1_MF_UNDOTBS1_46MGFWLK_.
DBF',
24 'E:ORACLEPRODUCT10.2.0ORADATAORCLDATAFILEO1_MF_SYSAUX_46MGG4B8_.DB
F',
25 'E:ORACLEPRODUCT10.2.0ORADATAORCLDATAFILEO1_MF_USERS_46MGGRPG_.DBF
'
26 CHARACTER SET ZHS16GBK
27 ;
控制檔案已建立。
SQL> alter database open;
alter database open
*
第 1 行出現錯誤:
ORA-01113: ?? 4 ??????
ORA-01110: ???? 4:
'E:ORACLEPRODUCT10.2.0ORADATAORCLDATAFILEO1_MF_USERS_46MGGRPG_.DBF'
SQL> select status from v$instance;
STATUS
------------
MOUNTED
SQL> alter session set nls_language=american;
Session altered.
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01113: file 4 needs media recovery
ORA-01110: data file 4:
'E:ORACLEPRODUCT10.2.0ORADATAORCLDATAFILEO1_MF_USERS_46MGGRPG_.DBF'
SQL> recover datafile 4;
Media recovery complete.
SQL> alter database open;
Database altered.
SQL>
測試2:
SQL> connect as sysdba
已連線。
SQL> alter tablespace users read only;
表空間已更改。
SQL> alter database backup controlfile to trace;
資料庫已更改。
--====================================
CREATE CONTROLFILE REUSE DATABASE "TEST" NORESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 'E:ORACLEPRODUCT10.2.0ORADATATESTREDO01.LOG' SIZE 10M,
GROUP 2 'E:ORACLEPRODUCT10.2.0ORADATATESTREDO02.LOG' SIZE 10M,
GROUP 3 'E:ORACLEPRODUCT10.2.0ORADATATESTREDO03.LOG' SIZE 10M
-- STANDBY LOGFILE
DATAFILE
'E:ORACLEPRODUCT10.2.0ORADATATESTSYSTEM01.DBF',
'E:ORACLEPRODUCT10.2.0ORADATATESTUNDOTBS01.DBF',
'E:ORACLEPRODUCT10.2.0ORADATATESTSYSAUX01.DBF',
'E:ORACLEPRODUCT10.2.0ORADATATESTUNTOTBS02.DBF'
CHARACTER SET ZHS16GBK
;
--====================================
SQL> alter tablespace sysaux offline;
表空間已更改。
SQL> alter database backup controlfile to trace;
資料庫已更改。
--===================================
CREATE CONTROLFILE REUSE DATABASE "TEST" NORESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 'E:ORACLEPRODUCT10.2.0ORADATATESTREDO01.LOG' SIZE 10M,
GROUP 2 'E:ORACLEPRODUCT10.2.0ORADATATESTREDO02.LOG' SIZE 10M,
GROUP 3 'E:ORACLEPRODUCT10.2.0ORADATATESTREDO03.LOG' SIZE 10M
-- STANDBY LOGFILE
DATAFILE
'E:ORACLEPRODUCT10.2.0ORADATATESTSYSTEM01.DBF',
'E:ORACLEPRODUCT10.2.0ORADATATESTUNDOTBS01.DBF',
'E:ORACLEPRODUCT10.2.0ORADATATESTUNTOTBS02.DBF'
CHARACTER SET ZHS16GBK
;
--===================================
SQL> shutdown immediate
資料庫已經關閉。
已經解除安裝資料庫。
ORACLE 例程已經關閉。
SQL> startup nomount
ORACLE 例程已經啟動。
Total System Global Area 167772160 bytes
Fixed Size 1247900 bytes
Variable Size 67110244 bytes
Database Buffers 96468992 bytes
Redo Buffers 2945024 bytes
SQL> show parameter control_files
NAME TYPE
------------------------------------ ----------------------
VALUE
------------------------------
control_files string
E:ORACLEPRODUCT10.2.0FLASH
_RECOVERY_AREATESTCONTROLFIL
EO1_MF_46HB5K8S_.CTL
--由於使用了OMF管理的controlfile,因此在重建controlfile之前必須
執行下面命令把引數control_files清空,否則重建controlfile失敗
SQL> alter system reset control_files scope=spfile sid='*';
系統已更改。
SQL> shutdown immediate
ORA-01507: ??????
ORACLE 例程已經關閉。
SQL> startup nomount
ORACLE 例程已經啟動。
Total System Global Area 167772160 bytes
Fixed Size 1247900 bytes
Variable Size 67110244 bytes
Database Buffers 96468992 bytes
Redo Buffers 2945024 bytes
SQL> CREATE CONTROLFILE REUSE DATABASE "TEST" NORESETLOGS ARCHIVELOG
2 MAXLOGFILES 16
3 MAXLOGMEMBERS 3
4 MAXDATAFILES 100
5 MAXINSTANCES 8
6 MAXLOGHISTORY 292
7 LOGFILE
8 GROUP 1 'E:ORACLEPRODUCT10.2.0ORADATATESTREDO01.LOG' SIZE 10M,
9 GROUP 2 'E:ORACLEPRODUCT10.2.0ORADATATESTREDO02.LOG' SIZE 10M,
10 GROUP 3 'E:ORACLEPRODUCT10.2.0ORADATATESTREDO03.LOG' SIZE 10M
11 -- STANDBY LOGFILE
12 DATAFILE
13 'E:ORACLEPRODUCT10.2.0ORADATATESTSYSTEM01.DBF',
14 'E:ORACLEPRODUCT10.2.0ORADATATESTUNDOTBS01.DBF',
15 'E:ORACLEPRODUCT10.2.0ORADATATESTUNTOTBS02.DBF'
16 CHARACTER SET ZHS16GBK
17 ;
控制檔案已建立。
SQL> alter database open;
資料庫已更改。
SQL> select tablespace_name,status from dba_tablespaces;
TABLESPACE_NAME STATUS
------------------------------ ---------
SYSTEM ONLINE
UNDOTBS1 ONLINE
SYSAUX OFFLINE
TEMP ONLINE
USERS READ ONLY
UNDOTBS2 ONLINE
TEMP2 ONLINE
已選擇7行。
SQL> alter tablespace sysaux online;
alter tablespace sysaux online
*
第 1 行出現錯誤:
ORA-01157: ????????/???????????? 3 - ?????? DBWR ????????
ORA-01111: ???????? 3 ???????? - ??????????????????
ORA-01110: ???????? 3: 'E:ORACLEPRODUCT10.2.0DB_1DATABASEMISSING00003'
SQL> alter tablespace users read write;
alter tablespace users read write
*
第 1 行出現錯誤:
ORA-01135: DML/query ?????????? 4 ????????????
ORA-01111: ???????? 4 ???????? - ??????????????????
ORA-01110: ???????? 4: 'E:ORACLEPRODUCT10.2.0DB_1DATABASEMISSING00004'
SQL> select status from v$instance;
STATUS
------------
OPEN
SQL> col file_name format a60
SQL> col tablespace_name format a12
SQL> select file_name , tablespace_name from dba_data_files;
FILE_NAME TABLESPACE_N
------------------------------------------------------------ ------------
E:ORACLEPRODUCT10.2.0ORADATATESTUNTOTBS02.DBF UNDOTBS2
E:ORACLEPRODUCT10.2.0ORADATATESTUNDOTBS01.DBF UNDOTBS1
E:ORACLEPRODUCT10.2.0ORADATATESTSYSTEM01.DBF SYSTEM
E:ORACLEPRODUCT10.2.0DB_1DATABASEMISSING00003 SYSAUX
E:ORACLEPRODUCT10.2.0DB_1DATABASEMISSING00004 USERS
SQL> alter tablespace sysaux rename datafile 'E:ORACLEPRODUCT10.2.0DB_1DATA
BASEMISSING00003' to 'E:oracleproduct10.2.0oradatatestsysaux01.dbf';
表空間已更改。
SQL> alter tablespace users rename datafile 'E:ORACLEPRODUCT10.2.0DB_1DATAB
ASEMISSING00004' to 'E:oracleproduct10.2.0oradatatestusers01.dbf';
表空間已更改。
SQL> select file_name , tablespace_name from dba_data_files;
FILE_NAME TABLESPACE_N
------------------------------------------------------------ ------------
E:ORACLEPRODUCT10.2.0ORADATATESTUNTOTBS02.DBF UNDOTBS2
E:ORACLEPRODUCT10.2.0ORADATATESTUNDOTBS01.DBF UNDOTBS1
E:ORACLEPRODUCT10.2.0ORADATATESTSYSTEM01.DBF SYSTEM
E:ORACLEPRODUCT10.2.0ORADATATESTSYSAUX01.DBF SYSAUX
E:ORACLEPRODUCT10.2.0ORADATATESTUSERS01.DBF USERS
SQL> alter tablespace sysaux online;
表空間已更改。
SQL> alter tablespace users read write;
alter tablespace users read write
*
第 1 行出現錯誤:
ORA-01135: DML/query ?????????? 4 ????????????
ORA-01110: ???????? 4: 'E:ORACLEPRODUCT10.2.0ORADATATESTUSERS01.DBF'
SQL> alter session set nls_language=american;
Session altered.
SQL> alter tablespace users read write;
alter tablespace users read write
*
ERROR at line 1:
ORA-01135: file 4 accessed for DML/query is offline
ORA-01110: data file 4: 'E:ORACLEPRODUCT10.2.0ORADATATESTUSERS01.DBF'
SQL> select tablespace_name,status from dba_tablespaces;
TABLESPACE_N STATUS
------------ ---------
SYSTEM ONLINE
UNDOTBS1 ONLINE
SYSAUX ONLINE
TEMP ONLINE
USERS READ ONLY
UNDOTBS2 ONLINE
TEMP2 ONLINE
7 rows selected.
SQL> alter tablespace users read write;
alter tablespace users read write
*
ERROR at line 1:
ORA-01135: file 4 accessed for DML/query is offline
ORA-01110: data file 4: 'E:ORACLEPRODUCT10.2.0ORADATATESTUSERS01.DBF'
SQL> alter tablespace users online;
Tablespace altered.
SQL> alter tablespace users read write;
Tablespace altered.
SQL>
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/19602/viewspace-1006658/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 含read only表空間的資料庫的控制檔案重建資料庫
- 重建控制檔案與 datafile offline,tablespace read only
- 重建控制檔案後,對臨時表空間(temporary tablespace)進行重建
- oracle 表空間和表 read only遷移後不再read onlyOracle
- oracle 重建臨時表空間 tempfileOracle
- 批量處理時臨時增加回滾表空間臨時表空間檔案
- oracle清理和重建臨時表空間Oracle
- 【實驗】重建臨時表空間解決臨時表空間過大問題
- 移動資料檔案、系統表空間檔案、臨時表空間檔案
- Oracle臨時表空間檢視、新增臨時表空間資料檔案、修改預設臨時表空間 方法!Oracle
- 重建控制檔案之後,只讀表空間的狀態變化
- 【臨時表空間】11g中使用 SHRINK方法縮小臨時表空間和臨時檔案
- 【TABLESPACE】通過重建控制檔案調整表空間資料檔案位置及名稱
- 【臨時表空間】11g中使用 SHRINK方法縮小臨時表空間和臨時檔案(續)
- 表空間OFFLINE和資料檔案OFFLINE的區別
- 表空間offline,資料檔案offline 的區別(ZT)
- Oracle資料庫表空間READ ONLY、READ WRITE、ONLINE、OFFLINE狀態對應CHECKPOINT的變化Oracle資料庫
- Oracle9i重建和切換臨時表空間Oracle
- 表空間&資料檔案和控制檔案(zt)
- 當資料檔案表空間丟失的時候怎麼恢復該資料檔案
- 資料檔案、表空間offline用法及區別
- ORA-03206,當表空間不夠時,如何以新增資料檔案的方式擴充套件表空間套件
- Oracle 11g 表空間的誤刪除, 當前的控制檔案不識別該表空間Oracle
- oracle10g缺少tempfile(臨時表空間)_offline相關表空間測試筆記Oracle筆記
- 表空間read only和online的狀態轉換
- Data Guard 主端OFFLINE資料檔案和表空間
- oracle 臨時表間重建的方法Oracle
- oracle重建UNDO表空間Oracle
- 臨時表空間資料檔案損壞的解決
- 重建控制檔案
- 重建控制檔案--
- oracle 臨時表空間Oracle
- oracle臨時表空間Oracle
- INDEX表空間檔案丟失或者損壞的恢復Index
- 關於移動臨時表空間檔案位置的問題
- 【Oracle故障處理】-Oracle9i臨時表空間刪除重建Oracle
- Oracle9i中的臨時表空間的重建和切換Oracle
- 新建的表空間(或資料檔案)丟失以及控制檔案丟失,有新建表空間(或資料檔案)前的控制文