重建Oracle資料庫控制檔案
宣告:本例請不要在生產庫上試驗,否則,後果自負
讀了官方文件, 嘗試著重建了一下控制檔案:
SQL> startup nomount
ORACLE instance started.
Total System Global Area 2488635392 bytes
Fixed Size 2798928 bytes
Variable Size 721423024 bytes
Database Buffers 1744830464 bytes
Redo Buffers 19582976 bytes
SQL> create controlfile set database orcl
2 logfile group 1 ('C:\ORACLE\ORADATA\ORCL\REDO01_1.LOG')
3 logfile group 2 ('C:\ORACLE\ORADATA\ORCL\REDO02_1.LOG')
4 logfile group 3 ('C:\ORACLE\ORADATA\ORCL\REDO03_1.LOG')
5 resetlogs
6 datafile 'C:\ORACLE\ORADATA\ORCL\SYSTEM01.DBF',
7 'C:\ORACLE\ORADATA\ORCL\SYSAUX01.DBF',
8 'C:\ORACLE\ORADATA\ORCL\UNDOTBS01.DBF',
9 'C:\ORACLE\ORADATA\ORCL\USERS01.DBF',
10 'C:\ORACLE\ORADATA\ORCL\EXAMPLE01.DBF',
11 'F:\H2DATA\H2DB.DBF',
12 'F:\H2DATA\H2DB_INDEX.DBF',
13 'F:\H2DATA\H2_BUSI.DBF',
14 'F:\H2DATA\H2_BUSI_INDX.DBF',
15 'F:\H2DATA\H2_TEST.DBF',
16 'F:\H2DATA\H2_TEST_INDX.DBF',
17 'F:\H2DATA\H2_LOG.DBF',
18 'F:\H2DATA\H2_LOG_INDX.DBF',
19 'F:\H2DATA\H2_IMAGE.DBF',
20 'F:\H2DATA\H2_IMAGE_INDX.DBF',
21 'F:\H2DATA\WMS_DATA.DBF',
22 'F:\H2DATA\WMS_INDX.DBF',
23 'C:\ORACLE\ORADATA\ORCL\TEMP01.DBF'
24 archivelog
25 /
logfile group 2 ('C:\ORACLE\ORADATA\ORCL\REDO02_1.LOG')
*
ERROR at line 3:
ORA-02167: LOGFILE clause specified more than once
SQL> create controlfile set database orcl
2 logfile group 1 ('C:\ORACLE\ORADATA\ORCL\REDO01_1.LOG'),
3 group 2 ('C:\ORACLE\ORADATA\ORCL\REDO02_1.LOG'),
4 group 3 ('C:\ORACLE\ORADATA\ORCL\REDO03_1.LOG')
5 resetlogs
6 datafile 'C:\ORACLE\ORADATA\ORCL\SYSTEM01.DBF',
7 'C:\ORACLE\ORADATA\ORCL\SYSAUX01.DBF',
8 'C:\ORACLE\ORADATA\ORCL\UNDOTBS01.DBF',
9 'C:\ORACLE\ORADATA\ORCL\USERS01.DBF',
10 'C:\ORACLE\ORADATA\ORCL\EXAMPLE01.DBF',
11 'F:\H2DATA\H2DB.DBF',
12 'F:\H2DATA\H2DB_INDEX.DBF',
13 'F:\H2DATA\H2_BUSI.DBF',
14 'F:\H2DATA\H2_BUSI_INDX.DBF',
15 'F:\H2DATA\H2_TEST.DBF',
16 'F:\H2DATA\H2_TEST_INDX.DBF',
17 'F:\H2DATA\H2_LOG.DBF',
18 'F:\H2DATA\H2_LOG_INDX.DBF',
19 'F:\H2DATA\H2_IMAGE.DBF',
20 'F:\H2DATA\H2_IMAGE_INDX.DBF',
21 'F:\H2DATA\WMS_DATA.DBF',
22 'F:\H2DATA\WMS_INDX.DBF',
23 'C:\ORACLE\ORADATA\ORCL\TEMP01.DBF'
24 archivelog
25 /
create controlfile set database orcl
*
ERROR at line 1:
ORA-01503: CREATE CONTROLFILE failed
ORA-01160: file is not a data file
ORA-01110: data file : 'C:\ORACLE\ORADATA\ORCL\TEMP01.DBF'
SQL> create controlfile set database orcl
2 logfile group 1 ('C:\ORACLE\ORADATA\ORCL\REDO01_1.LOG'),
3 group 2 ('C:\ORACLE\ORADATA\ORCL\REDO02_1.LOG'),
4 group 3 ('C:\ORACLE\ORADATA\ORCL\REDO03_1.LOG')
5 resetlogs
6 datafile 'C:\ORACLE\ORADATA\ORCL\SYSTEM01.DBF',
7 'C:\ORACLE\ORADATA\ORCL\SYSAUX01.DBF',
8 'C:\ORACLE\ORADATA\ORCL\UNDOTBS01.DBF',
9 'C:\ORACLE\ORADATA\ORCL\USERS01.DBF',
10 'C:\ORACLE\ORADATA\ORCL\EXAMPLE01.DBF',
11 'F:\H2DATA\H2DB.DBF',
12 'F:\H2DATA\H2DB_INDEX.DBF',
13 'F:\H2DATA\H2_BUSI.DBF',
14 'F:\H2DATA\H2_BUSI_INDX.DBF',
15 'F:\H2DATA\H2_TEST.DBF',
16 'F:\H2DATA\H2_TEST_INDX.DBF',
17 'F:\H2DATA\H2_LOG.DBF',
18 'F:\H2DATA\H2_LOG_INDX.DBF',
19 'F:\H2DATA\H2_IMAGE.DBF',
20 'F:\H2DATA\H2_IMAGE_INDX.DBF',
21 'F:\H2DATA\WMS_DATA.DBF',
22 'F:\H2DATA\WMS_INDX.DBF'
23 archivelog
24 /
create controlfile set database orcl
*
ERROR at line 1:
ORA-01503: CREATE CONTROLFILE failed
ORA-01198: must specify size for log file if RESETLOGS
ORA-01517: log member: 'C:\ORACLE\ORADATA\ORCL\REDO01_1.LOG'
SQL> create controlfile set database orcl
2 logfile group 1 ('C:\ORACLE\ORADATA\ORCL\REDO01_1.LOG'),
3 group 2 ('C:\ORACLE\ORADATA\ORCL\REDO02_1.LOG'),
4 group 3 ('C:\ORACLE\ORADATA\ORCL\REDO03_1.LOG')
5 noresetlogs
6 datafile 'C:\ORACLE\ORADATA\ORCL\SYSTEM01.DBF',
7 'C:\ORACLE\ORADATA\ORCL\SYSAUX01.DBF',
8 'C:\ORACLE\ORADATA\ORCL\UNDOTBS01.DBF',
9 'C:\ORACLE\ORADATA\ORCL\USERS01.DBF',
10 'C:\ORACLE\ORADATA\ORCL\EXAMPLE01.DBF',
11 'F:\H2DATA\H2DB.DBF',
12 'F:\H2DATA\H2DB_INDEX.DBF',
13 'F:\H2DATA\H2_BUSI.DBF',
14 'F:\H2DATA\H2_BUSI_INDX.DBF',
15 'F:\H2DATA\H2_TEST.DBF',
16 'F:\H2DATA\H2_TEST_INDX.DBF',
17 'F:\H2DATA\H2_LOG.DBF',
18 'F:\H2DATA\H2_LOG_INDX.DBF',
19 'F:\H2DATA\H2_IMAGE.DBF',
20 'F:\H2DATA\H2_IMAGE_INDX.DBF',
21 'F:\H2DATA\WMS_DATA.DBF',
22 'F:\H2DATA\WMS_INDX.DBF'
23 archivelog
24 /
create controlfile set database orcl
*
ERROR at line 1:
ORA-01503: CREATE CONTROLFILE failed
ORA-01223: RESETLOGS must be specified to set a new database name
SQL> create controlfile --set database orcl
2 logfile group 1 ('C:\ORACLE\ORADATA\ORCL\REDO01_1.LOG'),
3 group 2 ('C:\ORACLE\ORADATA\ORCL\REDO02_1.LOG'),
4 group 3 ('C:\ORACLE\ORADATA\ORCL\REDO03_1.LOG')
5 noresetlogs
6 datafile 'C:\ORACLE\ORADATA\ORCL\SYSTEM01.DBF',
7 'C:\ORACLE\ORADATA\ORCL\SYSAUX01.DBF',
8 'C:\ORACLE\ORADATA\ORCL\UNDOTBS01.DBF',
9 'C:\ORACLE\ORADATA\ORCL\USERS01.DBF',
10 'C:\ORACLE\ORADATA\ORCL\EXAMPLE01.DBF',
11 'F:\H2DATA\H2DB.DBF',
12 'F:\H2DATA\H2DB_INDEX.DBF',
13 'F:\H2DATA\H2_BUSI.DBF',
14 'F:\H2DATA\H2_BUSI_INDX.DBF',
15 'F:\H2DATA\H2_TEST.DBF',
16 'F:\H2DATA\H2_TEST_INDX.DBF',
17 'F:\H2DATA\H2_LOG.DBF',
18 'F:\H2DATA\H2_LOG_INDX.DBF',
19 'F:\H2DATA\H2_IMAGE.DBF',
20 'F:\H2DATA\H2_IMAGE_INDX.DBF',
21 'F:\H2DATA\WMS_DATA.DBF',
22 'F:\H2DATA\WMS_INDX.DBF'
23 archivelog
24 /
archivelog
*
ERROR at line 23:
ORA-01970: You must specify a database name for CREATE CONTROLFILE
SQL> create controlfile set database orcl
2 logfile group 1 ('C:\ORACLE\ORADATA\ORCL\REDO01_1.LOG') size 256M,
3 group 2 ('C:\ORACLE\ORADATA\ORCL\REDO02_1.LOG') size 256M,
4 group 3 ('C:\ORACLE\ORADATA\ORCL\REDO03_1.LOG') size 256M
5 resetlogs
6 datafile 'C:\ORACLE\ORADATA\ORCL\SYSTEM01.DBF',
7 'C:\ORACLE\ORADATA\ORCL\SYSAUX01.DBF',
8 'C:\ORACLE\ORADATA\ORCL\UNDOTBS01.DBF',
9 'C:\ORACLE\ORADATA\ORCL\USERS01.DBF',
10 'C:\ORACLE\ORADATA\ORCL\EXAMPLE01.DBF',
11 'F:\H2DATA\H2DB.DBF',
12 'F:\H2DATA\H2DB_INDEX.DBF',
13 'F:\H2DATA\H2_BUSI.DBF',
14 'F:\H2DATA\H2_BUSI_INDX.DBF',
15 'F:\H2DATA\H2_TEST.DBF',
16 'F:\H2DATA\H2_TEST_INDX.DBF',
17 'F:\H2DATA\H2_LOG.DBF',
18 'F:\H2DATA\H2_LOG_INDX.DBF',
19 'F:\H2DATA\H2_IMAGE.DBF',
20 'F:\H2DATA\H2_IMAGE_INDX.DBF',
21 'F:\H2DATA\WMS_DATA.DBF',
22 'F:\H2DATA\WMS_INDX.DBF'
23 archivelog
24 /
create controlfile set database orcl
*
ERROR at line 1:
ORA-01503: CREATE CONTROLFILE failed
ORA-00200: control file could not be created
ORA-00202: control file: 'C:\ORACLE\ORADATA\ORCL\CONTROL01.CTL'
ORA-27038: created file already exists
OSD-04010: ?????? <create> ????, ??????????????
SQL> /
create controlfile set database orcl
*
ERROR at line 1:
ORA-01503: CREATE CONTROLFILE failed
ORA-00200: control file could not be created
ORA-00202: control file: 'C:\ORACLE\FAST_RECOVERY_AREA\ORCL\CONTROL02.CTL'
ORA-27038: created file already exists
OSD-04010: ?????? <create> ????, ??????????????
SQL> /
Control file created.
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SQL> alter database open resetlogs;
Database altered.
SQL> select count(*) from h2.s_print_h;
COUNT(*)
----------
188
SQL> select count(*) from h2.t_intent_d;
COUNT(*)
----------
19615
SQL>
到這裡,控制檔案就已經重建成功了。
如果丟失了資料庫控制檔案,可以採用這種方式重建之後再開啟資料庫.
檢查alert日誌,日誌裡有錯誤:
PLS-00905: object H2.PROC_BATSALE_TRAN_WMS is invalid
ORA-06550: line 6, column 5:
PL/SQL: Statement ignored
ORA-06512: at "H2.PROC_EXEC_TRIGGER_EXT", line 18
ORA-06512: at "H2.TR_T_BATSALE_H_TABLE", line 13
ORA-04088: error during execution of trigger 'H2.TR_T_BATSALE_H_TABLE'
ORA-06512: at "H2.PROC_WANZHONG_BORI", line 214
Mon Sep 21 22:23:06 2015
Errors in file C:\ORACLE\diag\rdbms\orcl\orcl\trace\orcl_m003_12124.trc:
ORA-25153: 臨時表空間為空
增加臨時檔案:
alter tablespace temp add tempfile 'C:\oracle\oradata\orcl\temp01.dbf' size 256M autoextend on
create controlfile set database orcl
logfile group 1 ('C:\ORACLE\ORADATA\ORCL\REDO01_1.LOG') size 256M,
group 2 ('C:\ORACLE\ORADATA\ORCL\REDO02_1.LOG') size 256M,
group 3 ('C:\ORACLE\ORADATA\ORCL\REDO03_1.LOG') size 256M
resetlogs
datafile 'C:\ORACLE\ORADATA\ORCL\SYSTEM01.DBF',
'C:\ORACLE\ORADATA\ORCL\SYSAUX01.DBF',
'C:\ORACLE\ORADATA\ORCL\UNDOTBS01.DBF',
'C:\ORACLE\ORADATA\ORCL\USERS01.DBF',
'C:\ORACLE\ORADATA\ORCL\EXAMPLE01.DBF',
'F:\H2DATA\H2DB.DBF',
'F:\H2DATA\H2DB_INDEX.DBF',
'F:\H2DATA\H2_BUSI.DBF',
'F:\H2DATA\H2_BUSI_INDX.DBF',
'F:\H2DATA\H2_TEST.DBF',
'F:\H2DATA\H2_TEST_INDX.DBF',
'F:\H2DATA\H2_LOG.DBF',
'F:\H2DATA\H2_LOG_INDX.DBF',
'F:\H2DATA\H2_IMAGE.DBF',
'F:\H2DATA\H2_IMAGE_INDX.DBF',
'F:\H2DATA\WMS_DATA.DBF',
'F:\H2DATA\WMS_INDX.DBF'
archivelog
最後,重建控制檔案的步驟:
1. Make a list of all data files and redo log files of the database
2. Shut down the database
3. Back up all data files and redo log files of the database
4. Startup a new instance, but do not mount or open the database
startup nomount
5. Create a new control file for the database using the CREATE CONTROLFILE statement
6. Store a backup of the new control file on an offline storage device
7. Edit the CONTROL_FILES initialization parameter for the database to indicate all of the control files now part of your database as created in step 5(
not including the backup control file). If you are renaming the database, edit the DB_NAME parameter in your instance parameter file to specify the new name.
8. Recover the database if necessary. If you are not recovering the database, skip to step 9
9. Open the database using one of the following methods.
a. If you did not perform recovery, or you performed complete, closed database recovery in step 8, open the database normally:
ALTER DATABASE OPEN;
b. If you specified RESETLOGS when creating the contol file, use the ALTER DATABASE statement, indicating RESETLOGS:
ALTER DATABASE OPEN RESETLOGS;
The database is now open and available for use.
讀了官方文件, 嘗試著重建了一下控制檔案:
SQL> startup nomount
ORACLE instance started.
Total System Global Area 2488635392 bytes
Fixed Size 2798928 bytes
Variable Size 721423024 bytes
Database Buffers 1744830464 bytes
Redo Buffers 19582976 bytes
SQL> create controlfile set database orcl
2 logfile group 1 ('C:\ORACLE\ORADATA\ORCL\REDO01_1.LOG')
3 logfile group 2 ('C:\ORACLE\ORADATA\ORCL\REDO02_1.LOG')
4 logfile group 3 ('C:\ORACLE\ORADATA\ORCL\REDO03_1.LOG')
5 resetlogs
6 datafile 'C:\ORACLE\ORADATA\ORCL\SYSTEM01.DBF',
7 'C:\ORACLE\ORADATA\ORCL\SYSAUX01.DBF',
8 'C:\ORACLE\ORADATA\ORCL\UNDOTBS01.DBF',
9 'C:\ORACLE\ORADATA\ORCL\USERS01.DBF',
10 'C:\ORACLE\ORADATA\ORCL\EXAMPLE01.DBF',
11 'F:\H2DATA\H2DB.DBF',
12 'F:\H2DATA\H2DB_INDEX.DBF',
13 'F:\H2DATA\H2_BUSI.DBF',
14 'F:\H2DATA\H2_BUSI_INDX.DBF',
15 'F:\H2DATA\H2_TEST.DBF',
16 'F:\H2DATA\H2_TEST_INDX.DBF',
17 'F:\H2DATA\H2_LOG.DBF',
18 'F:\H2DATA\H2_LOG_INDX.DBF',
19 'F:\H2DATA\H2_IMAGE.DBF',
20 'F:\H2DATA\H2_IMAGE_INDX.DBF',
21 'F:\H2DATA\WMS_DATA.DBF',
22 'F:\H2DATA\WMS_INDX.DBF',
23 'C:\ORACLE\ORADATA\ORCL\TEMP01.DBF'
24 archivelog
25 /
logfile group 2 ('C:\ORACLE\ORADATA\ORCL\REDO02_1.LOG')
*
ERROR at line 3:
ORA-02167: LOGFILE clause specified more than once
SQL> create controlfile set database orcl
2 logfile group 1 ('C:\ORACLE\ORADATA\ORCL\REDO01_1.LOG'),
3 group 2 ('C:\ORACLE\ORADATA\ORCL\REDO02_1.LOG'),
4 group 3 ('C:\ORACLE\ORADATA\ORCL\REDO03_1.LOG')
5 resetlogs
6 datafile 'C:\ORACLE\ORADATA\ORCL\SYSTEM01.DBF',
7 'C:\ORACLE\ORADATA\ORCL\SYSAUX01.DBF',
8 'C:\ORACLE\ORADATA\ORCL\UNDOTBS01.DBF',
9 'C:\ORACLE\ORADATA\ORCL\USERS01.DBF',
10 'C:\ORACLE\ORADATA\ORCL\EXAMPLE01.DBF',
11 'F:\H2DATA\H2DB.DBF',
12 'F:\H2DATA\H2DB_INDEX.DBF',
13 'F:\H2DATA\H2_BUSI.DBF',
14 'F:\H2DATA\H2_BUSI_INDX.DBF',
15 'F:\H2DATA\H2_TEST.DBF',
16 'F:\H2DATA\H2_TEST_INDX.DBF',
17 'F:\H2DATA\H2_LOG.DBF',
18 'F:\H2DATA\H2_LOG_INDX.DBF',
19 'F:\H2DATA\H2_IMAGE.DBF',
20 'F:\H2DATA\H2_IMAGE_INDX.DBF',
21 'F:\H2DATA\WMS_DATA.DBF',
22 'F:\H2DATA\WMS_INDX.DBF',
23 'C:\ORACLE\ORADATA\ORCL\TEMP01.DBF'
24 archivelog
25 /
create controlfile set database orcl
*
ERROR at line 1:
ORA-01503: CREATE CONTROLFILE failed
ORA-01160: file is not a data file
ORA-01110: data file : 'C:\ORACLE\ORADATA\ORCL\TEMP01.DBF'
SQL> create controlfile set database orcl
2 logfile group 1 ('C:\ORACLE\ORADATA\ORCL\REDO01_1.LOG'),
3 group 2 ('C:\ORACLE\ORADATA\ORCL\REDO02_1.LOG'),
4 group 3 ('C:\ORACLE\ORADATA\ORCL\REDO03_1.LOG')
5 resetlogs
6 datafile 'C:\ORACLE\ORADATA\ORCL\SYSTEM01.DBF',
7 'C:\ORACLE\ORADATA\ORCL\SYSAUX01.DBF',
8 'C:\ORACLE\ORADATA\ORCL\UNDOTBS01.DBF',
9 'C:\ORACLE\ORADATA\ORCL\USERS01.DBF',
10 'C:\ORACLE\ORADATA\ORCL\EXAMPLE01.DBF',
11 'F:\H2DATA\H2DB.DBF',
12 'F:\H2DATA\H2DB_INDEX.DBF',
13 'F:\H2DATA\H2_BUSI.DBF',
14 'F:\H2DATA\H2_BUSI_INDX.DBF',
15 'F:\H2DATA\H2_TEST.DBF',
16 'F:\H2DATA\H2_TEST_INDX.DBF',
17 'F:\H2DATA\H2_LOG.DBF',
18 'F:\H2DATA\H2_LOG_INDX.DBF',
19 'F:\H2DATA\H2_IMAGE.DBF',
20 'F:\H2DATA\H2_IMAGE_INDX.DBF',
21 'F:\H2DATA\WMS_DATA.DBF',
22 'F:\H2DATA\WMS_INDX.DBF'
23 archivelog
24 /
create controlfile set database orcl
*
ERROR at line 1:
ORA-01503: CREATE CONTROLFILE failed
ORA-01198: must specify size for log file if RESETLOGS
ORA-01517: log member: 'C:\ORACLE\ORADATA\ORCL\REDO01_1.LOG'
SQL> create controlfile set database orcl
2 logfile group 1 ('C:\ORACLE\ORADATA\ORCL\REDO01_1.LOG'),
3 group 2 ('C:\ORACLE\ORADATA\ORCL\REDO02_1.LOG'),
4 group 3 ('C:\ORACLE\ORADATA\ORCL\REDO03_1.LOG')
5 noresetlogs
6 datafile 'C:\ORACLE\ORADATA\ORCL\SYSTEM01.DBF',
7 'C:\ORACLE\ORADATA\ORCL\SYSAUX01.DBF',
8 'C:\ORACLE\ORADATA\ORCL\UNDOTBS01.DBF',
9 'C:\ORACLE\ORADATA\ORCL\USERS01.DBF',
10 'C:\ORACLE\ORADATA\ORCL\EXAMPLE01.DBF',
11 'F:\H2DATA\H2DB.DBF',
12 'F:\H2DATA\H2DB_INDEX.DBF',
13 'F:\H2DATA\H2_BUSI.DBF',
14 'F:\H2DATA\H2_BUSI_INDX.DBF',
15 'F:\H2DATA\H2_TEST.DBF',
16 'F:\H2DATA\H2_TEST_INDX.DBF',
17 'F:\H2DATA\H2_LOG.DBF',
18 'F:\H2DATA\H2_LOG_INDX.DBF',
19 'F:\H2DATA\H2_IMAGE.DBF',
20 'F:\H2DATA\H2_IMAGE_INDX.DBF',
21 'F:\H2DATA\WMS_DATA.DBF',
22 'F:\H2DATA\WMS_INDX.DBF'
23 archivelog
24 /
create controlfile set database orcl
*
ERROR at line 1:
ORA-01503: CREATE CONTROLFILE failed
ORA-01223: RESETLOGS must be specified to set a new database name
SQL> create controlfile --set database orcl
2 logfile group 1 ('C:\ORACLE\ORADATA\ORCL\REDO01_1.LOG'),
3 group 2 ('C:\ORACLE\ORADATA\ORCL\REDO02_1.LOG'),
4 group 3 ('C:\ORACLE\ORADATA\ORCL\REDO03_1.LOG')
5 noresetlogs
6 datafile 'C:\ORACLE\ORADATA\ORCL\SYSTEM01.DBF',
7 'C:\ORACLE\ORADATA\ORCL\SYSAUX01.DBF',
8 'C:\ORACLE\ORADATA\ORCL\UNDOTBS01.DBF',
9 'C:\ORACLE\ORADATA\ORCL\USERS01.DBF',
10 'C:\ORACLE\ORADATA\ORCL\EXAMPLE01.DBF',
11 'F:\H2DATA\H2DB.DBF',
12 'F:\H2DATA\H2DB_INDEX.DBF',
13 'F:\H2DATA\H2_BUSI.DBF',
14 'F:\H2DATA\H2_BUSI_INDX.DBF',
15 'F:\H2DATA\H2_TEST.DBF',
16 'F:\H2DATA\H2_TEST_INDX.DBF',
17 'F:\H2DATA\H2_LOG.DBF',
18 'F:\H2DATA\H2_LOG_INDX.DBF',
19 'F:\H2DATA\H2_IMAGE.DBF',
20 'F:\H2DATA\H2_IMAGE_INDX.DBF',
21 'F:\H2DATA\WMS_DATA.DBF',
22 'F:\H2DATA\WMS_INDX.DBF'
23 archivelog
24 /
archivelog
*
ERROR at line 23:
ORA-01970: You must specify a database name for CREATE CONTROLFILE
SQL> create controlfile set database orcl
2 logfile group 1 ('C:\ORACLE\ORADATA\ORCL\REDO01_1.LOG') size 256M,
3 group 2 ('C:\ORACLE\ORADATA\ORCL\REDO02_1.LOG') size 256M,
4 group 3 ('C:\ORACLE\ORADATA\ORCL\REDO03_1.LOG') size 256M
5 resetlogs
6 datafile 'C:\ORACLE\ORADATA\ORCL\SYSTEM01.DBF',
7 'C:\ORACLE\ORADATA\ORCL\SYSAUX01.DBF',
8 'C:\ORACLE\ORADATA\ORCL\UNDOTBS01.DBF',
9 'C:\ORACLE\ORADATA\ORCL\USERS01.DBF',
10 'C:\ORACLE\ORADATA\ORCL\EXAMPLE01.DBF',
11 'F:\H2DATA\H2DB.DBF',
12 'F:\H2DATA\H2DB_INDEX.DBF',
13 'F:\H2DATA\H2_BUSI.DBF',
14 'F:\H2DATA\H2_BUSI_INDX.DBF',
15 'F:\H2DATA\H2_TEST.DBF',
16 'F:\H2DATA\H2_TEST_INDX.DBF',
17 'F:\H2DATA\H2_LOG.DBF',
18 'F:\H2DATA\H2_LOG_INDX.DBF',
19 'F:\H2DATA\H2_IMAGE.DBF',
20 'F:\H2DATA\H2_IMAGE_INDX.DBF',
21 'F:\H2DATA\WMS_DATA.DBF',
22 'F:\H2DATA\WMS_INDX.DBF'
23 archivelog
24 /
create controlfile set database orcl
*
ERROR at line 1:
ORA-01503: CREATE CONTROLFILE failed
ORA-00200: control file could not be created
ORA-00202: control file: 'C:\ORACLE\ORADATA\ORCL\CONTROL01.CTL'
ORA-27038: created file already exists
OSD-04010: ?????? <create> ????, ??????????????
SQL> /
create controlfile set database orcl
*
ERROR at line 1:
ORA-01503: CREATE CONTROLFILE failed
ORA-00200: control file could not be created
ORA-00202: control file: 'C:\ORACLE\FAST_RECOVERY_AREA\ORCL\CONTROL02.CTL'
ORA-27038: created file already exists
OSD-04010: ?????? <create> ????, ??????????????
SQL> /
Control file created.
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SQL> alter database open resetlogs;
Database altered.
SQL> select count(*) from h2.s_print_h;
COUNT(*)
----------
188
SQL> select count(*) from h2.t_intent_d;
COUNT(*)
----------
19615
SQL>
到這裡,控制檔案就已經重建成功了。
如果丟失了資料庫控制檔案,可以採用這種方式重建之後再開啟資料庫.
檢查alert日誌,日誌裡有錯誤:
PLS-00905: object H2.PROC_BATSALE_TRAN_WMS is invalid
ORA-06550: line 6, column 5:
PL/SQL: Statement ignored
ORA-06512: at "H2.PROC_EXEC_TRIGGER_EXT", line 18
ORA-06512: at "H2.TR_T_BATSALE_H_TABLE", line 13
ORA-04088: error during execution of trigger 'H2.TR_T_BATSALE_H_TABLE'
ORA-06512: at "H2.PROC_WANZHONG_BORI", line 214
Mon Sep 21 22:23:06 2015
Errors in file C:\ORACLE\diag\rdbms\orcl\orcl\trace\orcl_m003_12124.trc:
ORA-25153: 臨時表空間為空
增加臨時檔案:
alter tablespace temp add tempfile 'C:\oracle\oradata\orcl\temp01.dbf' size 256M autoextend on
create controlfile set database orcl
logfile group 1 ('C:\ORACLE\ORADATA\ORCL\REDO01_1.LOG') size 256M,
group 2 ('C:\ORACLE\ORADATA\ORCL\REDO02_1.LOG') size 256M,
group 3 ('C:\ORACLE\ORADATA\ORCL\REDO03_1.LOG') size 256M
resetlogs
datafile 'C:\ORACLE\ORADATA\ORCL\SYSTEM01.DBF',
'C:\ORACLE\ORADATA\ORCL\SYSAUX01.DBF',
'C:\ORACLE\ORADATA\ORCL\UNDOTBS01.DBF',
'C:\ORACLE\ORADATA\ORCL\USERS01.DBF',
'C:\ORACLE\ORADATA\ORCL\EXAMPLE01.DBF',
'F:\H2DATA\H2DB.DBF',
'F:\H2DATA\H2DB_INDEX.DBF',
'F:\H2DATA\H2_BUSI.DBF',
'F:\H2DATA\H2_BUSI_INDX.DBF',
'F:\H2DATA\H2_TEST.DBF',
'F:\H2DATA\H2_TEST_INDX.DBF',
'F:\H2DATA\H2_LOG.DBF',
'F:\H2DATA\H2_LOG_INDX.DBF',
'F:\H2DATA\H2_IMAGE.DBF',
'F:\H2DATA\H2_IMAGE_INDX.DBF',
'F:\H2DATA\WMS_DATA.DBF',
'F:\H2DATA\WMS_INDX.DBF'
archivelog
最後,重建控制檔案的步驟:
1. Make a list of all data files and redo log files of the database
2. Shut down the database
3. Back up all data files and redo log files of the database
4. Startup a new instance, but do not mount or open the database
startup nomount
5. Create a new control file for the database using the CREATE CONTROLFILE statement
6. Store a backup of the new control file on an offline storage device
7. Edit the CONTROL_FILES initialization parameter for the database to indicate all of the control files now part of your database as created in step 5(
not including the backup control file). If you are renaming the database, edit the DB_NAME parameter in your instance parameter file to specify the new name.
8. Recover the database if necessary. If you are not recovering the database, skip to step 9
9. Open the database using one of the following methods.
a. If you did not perform recovery, or you performed complete, closed database recovery in step 8, open the database normally:
ALTER DATABASE OPEN;
b. If you specified RESETLOGS when creating the contol file, use the ALTER DATABASE statement, indicating RESETLOGS:
ALTER DATABASE OPEN RESETLOGS;
The database is now open and available for use.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8520577/viewspace-1805287/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle重建控制檔案Oracle
- oracle 重建控制檔案Oracle
- Oracle 控制檔案的重建Oracle
- 使用NORESETLOGS重建控制檔案恢復資料庫資料庫
- 使用RESETLOGS重建控制檔案恢復資料庫資料庫
- 用重建控制檔案的方法修改oracle資料檔案路徑Oracle
- ORACLE控制檔案的重建 (轉)Oracle
- 使用RESETLOGS重建控制檔案恢復資料庫(二)資料庫
- RAC環境下單例項啟動Oracle資料庫重建控制檔案案例單例Oracle資料庫
- 重建控制檔案
- 重建控制檔案--
- oracle資料庫移動資料檔案、日誌檔案和控制檔案Oracle資料庫
- DataGuard重建控制檔案
- 重建控制檔案,並且不乾淨的關閉資料庫測試資料庫
- 含read only表空間的資料庫的控制檔案重建資料庫
- oracle之 利用 controlfile trace檔案重建控制檔案Oracle
- Oracle資料庫新增和移動控制檔案Oracle資料庫
- 【RAC】Oracle 10g RAC 重建控制檔案Oracle 10g
- 利用trace重建控制檔案
- Oracle 11g重建控制檔案——如何獲取建立控制檔案指令碼Oracle指令碼
- oracle10g_備份控制檔案_得到重建控制檔案的指令碼Oracle指令碼
- ORACLE 資料庫 ASM磁碟組上新增控制檔案Oracle資料庫ASM
- 重建控制檔案, 資料檔案檢查點SCN到底來自哪裡?
- Oracle 11g重建控制檔案——控制檔案全部丟失,從零開始Oracle
- 為資料庫新增控制檔案資料庫
- 如何重建RAC的控制檔案
- RAC環境重建控制檔案
- 控制檔案重建以及備份
- oracle控制檔案與資料庫啟動的關係Oracle資料庫
- 無處不在的Oracle資料庫控制檔案備份Oracle資料庫
- oracle快速拿到重建控制檔案語句的方法二Oracle
- oracle控制檔案重建、複用 ORA-00205Oracle
- Oracle 9+ Data Gard環境中重建控制檔案Oracle
- 恢復之重建資料檔案
- 重建控制檔案時,與資料檔案相關的Checkpoint資訊來自何處
- 備份與恢復--重建控制檔案後資料檔案損壞的恢復
- 叢集資料庫新增控制檔案資料庫
- 為rac資料庫增加控制檔案資料庫