Oracle Managed Files (OMF) directly manages file creation and deletion at the operating system level. Operations are specified in terms of database objects rather than filenames. Oracle internally uses standard file system interfaces to create and delete files as needed for the database structures such as tablespaces, online redo log files, and control files.
Administrators need to specify the file system directory to be used for a particular type of file. Thereafter, Oracle manages to create unique files when needed and also deletes files that are not needed. The advantages include:
- Automatic cleanup of the filesystem when database objects are dropped.
- Standardized naming of database files.
- Increased portability since file specifications are not needed.
- Simplified creation of test systems on differing operating systems.
- No unused files wasting disk space.
The location of database files is defined using the DB_CREATE_FILE_DEST parameter. It is default file system directory location where Oracle creates data files or temp files when no file specification is given in the object creation statement.
For online redo log files and control files the default location of the file system directory is defined by db_create_online_log_dest_n. This initialization parameter can be used multiple times where n specifies a multiplexed copy of the online redo log or control file.
Note that the file system directory specified by either of these parameters must already exist. Oracle does not create it. The directory must also have permissions to allow Oracle to create the files in it. The default location is used whenever a location is not explicitly specified for the operation of creating a file. Oracle creates the filename, and a file thus created is an Oracle-managed file. The following example sets default directory to use when creating Oracle-managed files:
DB_CREATE_FILE_DEST = '/p1/oracle/oradata/LSH'
By default, this location would be applicable for data files, temp files, Online redo log files, and control files. However, the db_create_online_log_dest_n initialization parameter can be included in the initialization parameter file to identify the default location for the database server to create online redoes log files and control files. For example:
DB_CREATE_ONLINE_LOG_DEST_1 = '/p2/oracle/redo1/lsh1'
DB_CREATE_ONLINE_LOG_DEST_2 = '/u04/oracle/redo2/lsh2'
After the initialization parameters are set, the database can be created using the CREATE DATABASE command. If the command fails, any OMF files created are removed. The internally generated file names can be seen when the user selects from DBA_DATAFILES and V$LOGFILE.
Both DB_CREATE_FILE_DEST and DB_CREATE_ONLINE_LOG_DEST_N can be modified dynamically with the ALTER SYSTEM SET command.