操作步骤如下
1:建立表空间test
2:备份控制文件(操作系统直接copy)
3: 删除表空间test
4:shutdown abort
5:startup 发现 数据文件本应该删除了,但是仍然存在
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
SQL> create tablespace test datafile 'd:\test' size 10M;
表空间已创建。
SQL> select file#,checkpoint_change#,creation_change# from v$datafile;
FILE# CHECKPOINT_CHANGE# CREATION_CHANGE#
---------- ------------------ ----------------
1 766013 9
2 766013 532340
3 766013 6100
4 766013 9769
5 766013 559795
6 766241 766240
已选择6行。
SQL> select checkpoint_change#,fuzzy,recover ,status from v$datafile_header;
CHECKPOINT_CHANGE# FUZ REC STATUS
------------------ --- --- -------
766013 YES NO ONLINE
766013 YES NO ONLINE
766013 YES NO ONLINE
766013 YES NO ONLINE
766013 YES NO ONLINE
766241 YES NO ONLINE
已选择6行。
SQL> alter database backup controlfile to 'd:\ctlctl';
数据库已更改。
SQL> drop tablespace test;
表空间已删除。
SQL> select checkpoint_change#,fuzzy,recover ,status from v$datafile_header;
CHECKPOINT_CHANGE# FUZ REC STATUS
------------------ --- --- -------
766013 YES NO ONLINE
766013 YES NO ONLINE
766013 YES NO ONLINE
766013 YES NO ONLINE
766013 YES NO ONLINE
SQL> select file#,checkpoint_change#,creation_change# from v$datafile;
FILE# CHECKPOINT_CHANGE# CREATION_CHANGE#
---------- ------------------ ----------------
1 766013 9
2 766013 532340
3 766013 6100
4 766013 9769
5 766013 559795
SQL> shutdown abort;
ORACLE 例程已经关闭。
用备份的controlfile 替换现在的controlfile
SQL> startup
ORACLE 例程已经启动。
Total System Global Area 289406976 bytes
Fixed Size 1248600 bytes
Variable Size 121635496 bytes
Database Buffers 163577856 bytes
Redo Buffers 2945024 bytes
数据库装载完毕。
数据库已经打开。
SQL> select file#,checkpoint_change#,creation_change# from v$datafile;
FILE# CHECKPOINT_CHANGE# CREATION_CHANGE#
---------- ------------------ ----------------
1 786326 9
2 786326 532340
3 786326 6100
4 786326 9769
5 786326 559795
6 786326 766240
已选择6行。
SQL> select a.name ,b.file# from v$datafile b ,v$tablespace a where a.ts#=b.ts#;
NAME FILE#
------------------------------ ----------
SYSTEM 1
UNDOTBS1 2
SYSAUX 3
USERS 4
EXAMPLE 5
TEST 6
已选择6行。
SQL> create table test (x int) tablespace test;
create table test (x int) tablespace test
*
第 1 行出现错误:
ORA-00959: 表空间 'TEST' 不存在
SQL> create tablespace test datafile 'd:\test2.dbf' size 10M;
create tablespace test datafile 'd:\test2.dbf' size 10M
*
第 1 行出现错误:
ORA-00603: ORACLE 服务器会话因致命错误而终止
SQL>
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/13095129/viewspace-666766/ ,如需转载,请注明出处,否则将追究法律责任。