OMF, full name: Oracle_ManagedFiles, that is, Oracle file management. Using OMF can simplify administrator management without specifying the file name and size.
OMF, full name: Oracle_Managed Files, that is, Oracle file management. Using OMF can simplify administrator management without specifying the file name and size.
OMF, full name: Oracle_Managed Files, that is, Oracle file management. Using OMF can simplify the Administrator's management work, without specifying the file name, size, path, name, size, the path is automatically allocated by oracle. When deleting logs, data, and control files that are no longer in use, OMF can also automatically delete their corresponding OS files.
OMF supports automatic management of the following files:
Tablespace
Log Files (online)
Control File
Prerequisites: You must set parameters for these types of files.
1. OMF management of data files
Data file management parameters: db_create_file_dest
Db_create_file_dest: the default path when the path is not explicitly specified when Oracle creates data files and temporary files. If db_create_online_log_dest_n is not specified,
It is also the default path for online log files and control files.
Assume that the tablespace s and data files need to be created.
SQL> CREATE TABLESPACE s;/* error message received */
Create tablespace s
*
ERROR at line 1:
ORA-02199: missing DATAFILE/TEMPFILE clause
SQL> show parameter db_create_file/* view the db_create_file_dest parameter */
NAME TYPE VALUE
-----------------------------------------------------------------------------
Db_create_file_dest string
-- Set the db_create_file_dest Parameter
SQL> ALTER SYSTEM SET db_create_file_dest = '/u01/app/oracle/oradata/orcl ';
System altered.
-- The parameter is created successfully.
SQL> CREATE TABLESPACE s;
Tablespace created.
SQL> SELECT NAME FROM v $ datafile;/* You can see ORCL/datafile/o1_mf_s_5vrl1t7h _. dbf is a data file automatically created by Oralce */
NAME
--------------------------------------------------------------------------------
/U01/app/oracle/oradata/orcl/system01.dbf
/U01/app/oracle/oradata/orcl/undotbs01.dbf
/U01/app/oracle/oradata/orcl/sysaux01.dbf
/U01/app/oracle/oradata/orcl/users01.dbf
/U01/app/oracle/oradata/orcl/example01.dbf
/U01/app/oracle/oradata/orcl/Test. dbf
/U01/app/oracle/oradata/orcl/ORCL/datafile/o1_mf_s_5vrl1t7h _. dbf
/* View the physical file. The default value is MB */
SQL> ho ls-lh/u01/app/oracle/oradata/orcl/ORCL/datafile/o1_mf_s_5vrl1t7h _. dbf
-Rw ------- 1 oracle oinstall 101 M Apr 7/u01/app/oracle/oradata/orcl/ORCL/datafile/o1_mf_s_5vrl1t7h _. dbf
SQL> CREATE TABLESPACE t DATAFILE SIZE 10 m;/* You can also specify the SIZE of the data file as MB */
Tablespace created.
SQL> SELECT NAME FROM v $ datafile;
NAME
--------------------------------------------------------------------------------
/U01/app/oracle/oradata/orcl/system01.dbf
/U01/app/oracle/oradata/orcl/undotbs01.dbf
/U01/app/oracle/oradata/orcl/sysaux01.dbf
/U01/app/oracle/oradata/orcl/users01.dbf
/U01/app/oracle/oradata/orcl/example01.dbf
/U01/app/oracle/oradata/orcl/Test. dbf
/U01/app/oracle/oradata/orcl/ORCL/datafile/o1_mf_s_5vrl1t7h _. dbf
/U01/app/oracle/oradata/orcl/ORCL/datafile/o1_mf_t_5vrlg11_. dbf
SQL> ho ls-lh/u01/app/oracle/oradata/orcl/ORCL/datafile/o1_mf_t_5vrlg11_. dbf
-Rw ------- 1 oracle oinstall 11 M Apr 7/u01/app/oracle/oradata/orcl/ORCL/datafile/o1_mf_t_5vrlg11_. dbf
-- When a tablespace is deleted, data files generated using OMF will be deleted along with the deletion of the tablespace.
SQL> DROP TABLESPACE t;
Tablespace dropped.
-- Check that the physical file does not exist.
SQL> ho ls-lh/u01/app/oracle/oradata/orcl/ORCL/datafile/o1_mf_t_5vrlg11_. dbf
Ls:/u01/app/oracle/oradata/orcl/ORCL/datafile/o1_mf_t_5vrlg11_. dbf: No such file or directory
-- For tablespaces that are not created using OMF, their data files are not deleted after the tablespace is deleted, but are deleted in the v $ datafile view.
-- The following figure shows the x tablespace and data files created without OMF.
SQL> CREATE TABLESPACE x DATAFILE '/u01/app/oracle/oradata/orcl/x. dbf' SIZE 10 m;
Tablespace created.
SQL> SELECT NAME FROM v $ datafile;
NAME
--------------------------------------------------------------------------------
/U01/app/oracle/oradata/orcl/system01.dbf
/U01/app/oracle/oradata/orcl/undotbs01.dbf
/U01/app/oracle/oradata/orcl/sysaux01.dbf
/U01/app/oracle/oradata/orcl/users01.dbf
/U01/app/oracle/oradata/orcl/example01.dbf
/U01/app/oracle/oradata/orcl/Test. dbf
/U01/app/oracle/oradata/orcl/ORCL/datafile/o1_mf_s_5vrl1t7h _. dbf
/U01/app/oracle/oradata/orcl/x. dbf
SQL> DROP TABLESPACE x;
Tablespace dropped.
SQL> SELECT NAME FROM v $ datafile;/* the data file of x. dbf does not exist in the view */
NAME
--------------------------------------------------------------------------------
/U01/app/oracle/oradata/orcl/system01.dbf
/U01/app/oracle/oradata/orcl/undotbs01.dbf
/U01/app/oracle/oradata/orcl/sysaux01.dbf
/U01/app/oracle/oradata/orcl/users01.dbf
/U01/app/oracle/oradata/orcl/example01.dbf
/U01/app/oracle/oradata/orcl/Test. dbf
/U01/app/oracle/oradata/orcl/ORCL/datafile/o1_mf_s_5vrl1t7h _. dbf
SQL> ho ls/u01/app/oracle/oradata/orcl/x. dbf/* the operating system still exists */
/U01/app/oracle/oradata/orcl/x. dbf
-- Note: When OMF is used, physical files are deleted.
-- Use the following method to recreate the x tablespace, and then use including contents and datafiles to completely delete the tablespace and physical files
SQL> CREATE TABLESPACE X DATAFILE '/u01/app/oracle/oradata/orcl/x. dbf' REUSE;
Tablespace created.
SQL> DROP TABLESPACE x INCLUDING CONTENTS AND DATAFILES;
Tablespace dropped.
SQL> ho ls/u01/app/oracle/oradata/orcl/x. dbf
Ls:/u01/app/oracle/oradata/orcl/x. dbf: No such file or directory
Summary: How to Use OMF to manage files
1. Use alter system set db_create_file_dest =' 'Set the path
2. view the settings of show parameter db_create_file_dest;
3. CREATE Table space and data file create tablespace tablespace_name
4. create tablespace separately <> DATAFILE' 'Size <>;
5. You can also create undo and temporary tablespace. Create undo tablespace tablespace_name; create temporary tablespace tablespace_name;
6. Delete the tablespace drop tablespace tablespace_name; In OMF case, delete the physical file. This is equivalent to deleting the physical file without OMF, AND using including contents and datafiles.
For more details, please continue to read the highlights on the next page:
Related reading:
Oracle tablespace creation and deletion, OMF, partition table Creation