当前位置:操作系统 > Unix/Linux >>

OMF管理的文件会自动删除

OMF管理的文件会自动删除
 
有一点经验的DBA都会记得,drop tablespace的时候,如果没有带including contents and datafiles的字句,数据文件是不会被删除的,上周周日演示,drop tablespace时,数据文件被自动删除了,当时我给的解释是,文件是空的,没有使用过,才会出现这种情况,翻回文档才发现,其实是因为,该文件是OMF的。
 
01
[oracle@nobody admin]$ rlwrap sqlplus / as sysdba
02
 
03
SQL*Plus: Release 11.2.0.1.0 Production on Mon Jun 24 05:44:20 2013
04
 
05
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
06
 
07
 
08
Connected to:
09
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
10
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
11
Data Mining and Real Application Testing options
12
 
13
nobody@TESTDB>show parameter create;
14
 
15
NAME                                 TYPE        VALUE
16
------------------------------------ ----------- ------------------------------
17
create_bitmap_area_size              integer     8388608
18
create_stored_outlines               string
19
db_create_file_dest                  string      +DATA
20
db_create_online_log_dest_1          string
21
db_create_online_log_dest_2          string
22
db_create_online_log_dest_3          string
23
db_create_online_log_dest_4          string
24
db_create_online_log_dest_5          string
25
nobody@TESTDB>alter system set db_create_file_dest='/u01/app/oracle/oradata/testdb';
26
 
27
System altered.
28
 
29
nobody@TESTDB>create tablespace omf_tbs datafile size 10m;
30
 
31
Tablespace created.
32
 
33
nobody@TESTDB>create tablespace no_omf_tbs datafile '/u01/app/oracle/oradata/testdb/no_omf_tbs01.dbf' size 10m;
34
 
35
Tablespace created.
36
 
37
nobody@TESTDB>select d.name from v$datafile d, v$tablespace t where d.ts# = t.ts# and t.name in ('OMF_TBS','NO_OMF_TBS');
38
 
39
NAME
40
--------------------------------------------------------------------------------------------------------------------------------------------
41
/u01/app/oracle/oradata/testdb/HUA01/datafile/o1_mf_omf_tbs_8wgv3shj_.dbf
42
/u01/app/oracle/oradata/testdb/no_omf_tbs01.dbf
43
 
44
nobody@TESTDB>host ls -l /u01/app/oracle/oradata/testdb/HUA01/datafile/o1_mf_omf_tbs_8wgv3shj_.dbf
45
-rw-r----- 1 oracle asmadmin 10493952 Jun 24 05:45 /u01/app/oracle/oradata/testdb/HUA01/datafile/o1_mf_omf_tbs_8wgv3shj_.dbf
46
 
47
nobody@TESTDB>host ls -l /u01/app/oracle/oradata/testdb/no_omf_tbs01.dbf
48
-rw-r----- 1 oracle asmadmin 10493952 Jun 24 05:45 /u01/app/oracle/oradata/testdb/no_omf_tbs01.dbf
49
 
50
nobody@TESTDB>drop tablespace omf_tbs;
51
 
52
Tablespace dropped.
53
 
54
nobody@TESTDB>host ls -l /u01/app/oracle/oradata/testdb/HUA01/datafile/o1_mf_omf_tbs_8wgv3shj_.dbf
55
ls: /u01/app/oracle/oradata/testdb/HUA01/datafile/o1_mf_omf_tbs_8wgv3shj_.dbf: No such file or directory
56
 
57
nobody@TESTDB>drop tablespace no_omf_tbs;
58
 
59
Tablespace dropped.
60
 
61
nobody@TESTDB>host ls -l /u01/app/oracle/oradata/testdb/no_omf_tbs01.dbf
62
-rw-r----- 1 oracle asmadmin 10493952 Jun 24 06:14 /u01/app/oracle/oradata/testdb/no_omf_tbs01.dbf
Performance Tuning Guide 中对于 OMF 的描述中对此有解析。
When file systems can contain all Oracle Database data, database administration is simplified by using Oracle Managed Files. Oracle Database internally uses standard file system interfaces to create and delete files as needed for tablespaces, temp files, online logs, and control files. Administrators only specify the file system directory to be used for a particular type of file. You can specify one default location for data files and up to five multiplexed locations for the control and online redo log files. Oracle Database ensures that a unique file is created and then deleted when it is no longer needed. This reduces corruption caused by administrators specifying the wrong file, reduces wasted disk space consumed by obsolete files, and simplifies creation of test and development databases.
 
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,