如果在create controlfile漏掉datafile会怎样呢?
2024-07-21 02:32:40
供稿:网友
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination D:Oraclearchive
Oldest online log sequence 10
Next log sequence to archive 12
Current log sequence 12
SQL> alter database backup controlfile to trace;Database altered.SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup nomount
ORACLE instance started.Total System Global Area 135340020 bytes
Fixed Size 454644 bytes
Variable Size 109051904 bytes
Database Buffers 25165824 bytes
Redo Buffers 667648 bytes--delete control,在create controlfile时故意漏掉一个文件'D:ORACLEORADATATESTTOOLS01.DBF'
SQL> CREATE CONTROLFILE REUSE DATABASE "TEST" NORESETLOGS ARCHIVELOG
2 -- SET STANDBY TO MAXIMIZE PERFORMANCE
3 MAXLOGFILES 5
4 MAXLOGMEMBERS 3
5 MAXDATAFILES 100
6 MAXINSTANCES 1
7 MAXLOGHISTORY 226
8 LOGFILE
9 GROUP 1 'D:ORACLEORADATATESTREDO01.LOG' SIZE 30M,
10 GROUP 2 'D:ORACLEORADATATESTREDO02.LOG' SIZE 30M,
11 GROUP 3 'D:ORACLEORADATATESTREDO03.LOG' SIZE 30M
12 -- STANDBY LOGFILE
13 DATAFILE
14 'D:ORACLEORADATATESTSYSTEM01.DBF',
15 'D:ORACLEORADATATESTUNDOTBS01.DBF',
16 'D:ORACLEORADATATESTEXAMPLE01.DBF',
17 'D:ORACLEORADATATESTINDX01.DBF'
18 CHARACTER SET ZHS16GBK
19 /Control file created.SQL> alter database open;Database altered.SQL> alter system switch logfile;System altered.
--会在数据字典中发现漏掉的datafile
Select file_name , file_id, tablespace_name,status From dba_data_filesD:ORACLEORADATATESTSYSTEM01.DBF 1 SYSTEM AVAILABLE
D:ORACLEORADATATESTUNDOTBS01.DBF 2 UNDOTBS1 AVAILABLE
D:ORACLEORADATATESTEXAMPLE01.DBF 3 EXAMPLE AVAILABLE
D:ORACLEORADATATESTINDX01.DBF 4 INDX AVAILABLE
D:ORACLEORA92DATABASEMISSING00005 5 TOOLS AVAILABLESQL> alter tablespace tools rename datafile 'D:ORACLEORA92DATABASEMISSING000
05' to 'D:ORACLEORADATATESTTOOLS01.DBF';Tablespace altered.SQL> alter tablespace tools online;
alter tablespace tools online
*
ERROR at line 1:
ORA-01113: file 5 needs media recovery
ORA-01110: data file 5: 'D:ORACLEORADATATESTTOOLS01.DBF'
SQL> recover datafile 5;
Media recovery complete.
SQL> alter tablespace tools online;Tablespace altered.Select file_name , file_id, tablespace_name,status From dba_data_filesD:ORACLEORADATAZHANGYESYSTEM01.DBF 1 SYSTEM AVAILABLE
D:ORACLEORADATAZHANGYEUNDOTBS01.DBF 2 UNDOTBS1 AVAILABLE
D:ORACLEORADATAZHANGYEEXAMPLE01.DBF 3 EXAMPLE AVAILABLE
D:ORACLEORADATAZHANGYEINDX01.DBF 4 INDX AVAILABLE
D:ORACLEORADATAZHANGYETOOLS01.DBF 5 TOOLS AVAILABLE
检查表空间TOOLS上的object都没问题。 Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1479516