OMF,全称是Oracle_Managed Files,即Oracle文件管理,使用OMF可以简化管理员的管理工作,不用指定文件的名字、大
OMF,全称是Oracle_Managed Files,即Oracle文件管理,使用OMF可以简化管理员的管理工作,不用指定文件的名字、大小、路径,其名字,大小,路径由oracle 自动分配。在删除不再使用的日志、数据、控制文件时,OMF也可以自动删除其对应的OS文件。
OMF支持下列文件的自动管理:
表空间
日志文件(联机)
控制文件
前提条件:需要为这些类型文件设定相关参数。
一.数据文件的OMF管理
数据文件管理参数:db_create_file_dest
db_create_file_dest:Oracle创建数据文件、临时文件时,在未明确指定路径的情况下的缺省路径,当db_create_online_log_dest_n未指定时,
也作为联机日志文件和控制文件的缺省路径。
假定需要创建表空间s及数据文件
SQL> CREATE TABLESPACE s; /*收到了错误信息*/
create tablespace s
*
ERROR at line 1:
ORA-02199: missing DATAFILE/TEMPFILE clause
SQL> show parameter db_create_file /*查看db_create_file_dest参数*/
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_create_file_dest string
--设定db_create_file_dest参数
SQL> ALTER SYSTEM SET db_create_file_dest = '/u01/app/oracle/oradata/orcl';
System altered.
--设定参数后,创建成功
SQL> CREATE TABLESPACE s;
Tablespace created.
SQL> SELECT NAME FROM v$datafile; /*可以看到ORCL/datafile/o1_mf_s_5vrl1t7h_.dbf是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
/*查看物理文件,,缺省为MB*/
SQL> ho ls -lh /u01/app/oracle/oradata/orcl/ORCL/datafile/o1_mf_s_5vrl1t7h_.dbf
-rw------- 1 oracle oinstall 101M Apr 7 16:54 /u01/app/oracle/oradata/orcl/ORCL/datafile/o1_mf_s_5vrl1t7h_.dbf
SQL> CREATE TABLESPACE t DATAFILE SIZE 10m; /*也可指定数据文件的大小为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_5vrlgqtl_.dbf
SQL> ho ls -lh /u01/app/oracle/oradata/orcl/ORCL/datafile/o1_mf_t_5vrlgqtl_.dbf
-rw------- 1 oracle oinstall 11M Apr 7 17:01 /u01/app/oracle/oradata/orcl/ORCL/datafile/o1_mf_t_5vrlgqtl_.dbf
--删除表空间时,对于使用了OMF生成的数据文件将随着表空间的删除一起被删除
SQL> DROP TABLESPACE t;
Tablespace dropped.
--查看物理文件,已经不存在
SQL> ho ls -lh /u01/app/oracle/oradata/orcl/ORCL/datafile/o1_mf_t_5vrlgqtl_.dbf
ls: /u01/app/oracle/oradata/orcl/ORCL/datafile/o1_mf_t_5vrlgqtl_.dbf: No such file or directory
--对于未采用OMF来创建的表空间,在删除表空间之后,其数据文件并没有删除,v$datafile视图中被删除
--下面是未使用OMF创建的x表空间及数据文件
SQL> CREATE TABLESPACE x DATAFILE '/u01/app/oracle/oradata/orcl/x.dbf' SIZE 10m;
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; /*视图中已不存在x.dbf的数据文件*/
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 /*操作系统中依然存在*/
/u01/app/oracle/oradata/orcl/x.dbf
--注意:使用OMF的时候会将物理文件删除,应特别注意使用
--使用下面的方法重建x表空间,然后使用including contents and datafiles 彻底删除表空间及物理文件
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
总结:使用OMF管理文件的方法
1.使用ALTER SYSTEM SET db_create_file_dest = '
2.查看刚刚的设置SHOW PARAMETER db_create_file_dest;
3.创建表空间及数据文件CREATE TABLESPACE tablespace_name
4.单独创建表空间CREATE TABLESPACE DATAFILE '
5.也可以创建undo和temporary tablespace 。CREATE UNDO TABLESPACE tablespace_name ;CREATE TEMPORARY TABLESPACE tablespace_name;
6.删除表空间DROP TABLESPACE tablespace_name ;OMF情况下则删除物理文件,等效于未使用OMF创建,使用INCLUDING CONTENTS AND DATAFILES 删除方式
更多详情见请继续阅读下一页的精彩内容:
相关阅读:
Oracle表空间创建删除,OMF,分区表创建

InnoDBBufferPool reduces disk I/O by caching data and indexing pages, improving database performance. Its working principle includes: 1. Data reading: Read data from BufferPool; 2. Data writing: After modifying the data, write to BufferPool and refresh it to disk regularly; 3. Cache management: Use the LRU algorithm to manage cache pages; 4. Reading mechanism: Load adjacent data pages in advance. By sizing the BufferPool and using multiple instances, database performance can be optimized.

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

MySQL is worth learning because it is a powerful open source database management system suitable for data storage, management and analysis. 1) MySQL is a relational database that uses SQL to operate data and is suitable for structured data management. 2) The SQL language is the key to interacting with MySQL and supports CRUD operations. 3) The working principle of MySQL includes client/server architecture, storage engine and query optimizer. 4) Basic usage includes creating databases and tables, and advanced usage involves joining tables using JOIN. 5) Common errors include syntax errors and permission issues, and debugging skills include checking syntax and using EXPLAIN commands. 6) Performance optimization involves the use of indexes, optimization of SQL statements and regular maintenance of databases.

MySQL is suitable for beginners to learn database skills. 1. Install MySQL server and client tools. 2. Understand basic SQL queries, such as SELECT. 3. Master data operations: create tables, insert, update, and delete data. 4. Learn advanced skills: subquery and window functions. 5. Debugging and optimization: Check syntax, use indexes, avoid SELECT*, and use LIMIT.

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

MySQL is an open source relational database management system that is widely used in Web development. Its key features include: 1. Supports multiple storage engines, such as InnoDB and MyISAM, suitable for different scenarios; 2. Provides master-slave replication functions to facilitate load balancing and data backup; 3. Improve query efficiency through query optimization and index use.

SQL is used to interact with MySQL database to realize data addition, deletion, modification, inspection and database design. 1) SQL performs data operations through SELECT, INSERT, UPDATE, DELETE statements; 2) Use CREATE, ALTER, DROP statements for database design and management; 3) Complex queries and data analysis are implemented through SQL to improve business decision-making efficiency.

The basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

WebStorm Mac version
Useful JavaScript development tools

Atom editor mac version download
The most popular open source editor

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software