Physical Storage Structures(oracle官方文档整理&翻译)

oracle官方文档链接:http://docs.oracle.com/cd/E11882_01/server.112/e40540/physical.htm#CNCPT003

自己翻译的,能力有限,可能有翻译不对的地方,仅供参考。如发现不正确,希望大家留言指出。

This chapter contains the following sections:

1、Introduction to Physical Storage Strucures

1.1 Oracle Instance and database files:

1.1.1 Oracle 数据库文件:

An Oracle database is a set of files that store Oracle data in persistent disk storage. This section discusses the database files generated when you issue a CREATE DATABASE statement:

  • Data files and temp files

    A data file is a physical file on disk that was created by Oracle Database and contains data structures such as tables and indexes. 

    数据文件是oracle database创建的存储在磁盘上的物理文件,数据文件可以存储表和索引。

    A temp file is a data file that belongs to a temporary tablespace. The data is written to these files in an Oracle proprietary format that cannot be read by other programs.The temporary temp files in temporary tablespaces cannot contain permanent database objects.

    临时文件是存放在临时表空间的数据文件,被写进临时文件的数据具有oracle权限,不能被其它programs访问。存放在临时表空间的临时文件不存储永久数据库对象。

  • Control files

    A control file is a root file that tracks the physical components of the database.A binary file that records the physical structure of a database and contains the names and locations of redo log files, the time stamp of the database creation, the current log sequence number,checkpoint information, and so on.

    控制文件是根文件,tracks 数据库的物理组件。控制文件是一个二进制文件,记录数据库的物理结构、重做日志文件的文件名和文件路径、数据库创建时间、当前日志的序列号和checkpoint等信息。

  • Online redo log files

    The online redo log is a set of files containing records of changes made to data.The set of two or more online redo log files that record all changes made to Oracle Database data files and control file. When a change is made to the database, Oracle Database generates a redo record in the redo buffer.log writer(LGWR) writes the contents of the redo buffer to the online redo log.

    联机重做日志文件是记录对数据库数据更改信息的一组文件。这组联机重做日志文件记录数据库对数据文件和控制文件的所有更改。When a change is made to the database,oracle数据库就会在重做缓冲区产生一条记录。由log writer(LGWR)把重做缓冲区中的记录写入联机重做日志文件。

1.1.2 Oracle 数据库实例:

A database instance  is a set of memory structures that manage database files.The combination of the system global area(SGA) and background processes. An instance is associated with one and only one database. In an Oracle Real Application Clusters configuration, multiple instances access a single database simultaneously.

数据库实例是管理数据库文件的一系列内存结构。又系统全局区(SGA)和后台进程组成。一个实例只能和一个数据库相关联。在Oracle Real Application Clusters配置下,多个实例可以同时和一个数据库相关联。

1.2 Mechanisms for Storing Database Files(存储数据库文件的机制)

Several mechanisms are available for allocating and managing the storage of these files. The most common mechanisms include:

分配和管理数据库文件存储的机制有好几种,常用的有:

  • Oracle Automatic Storage Management (Oracle ASM)(oracle自动存储管理)

    Oracle ASM includes a file system designed exclusively for use by Oracle Database. "Oracle Automatic Storage Management (Oracle ASM)" describes Oracle ASM.

    Oracle 自动存储管理包含一个专门为Oracle数据库设计的文件系统。

  • Operating system file system(操作系统文件系统)

    Most Oracle databases store files in a file system, which is a data structure built inside a contiguous disk address space. All operating systems have file managers that allocate and deallocate disk space into files within a file system.

    大多数Oracle数据库把文件存储在文件系统中,这个文件系统是包含连续磁盘地址空间的数据结构。所有的操作系统都有文件管理器,文件管理器把文件系统中的磁盘空间分配给文件或者从文件释放。

    A file system enables disk space to be allocated to many files. Each file has a name and is made to appear as a contiguous address space to applications such as Oracle Database. The database can create, read, write, resize, and delete files.

    文件系统让磁盘空间能够被分成许多文件。每一个文件有一个名字和连续的磁盘空间供应用程序使用,比如Oracle数据库。Oracle数据库可以create,read,resize,和delete文件。

    A file system is commonly built on top of a logical volume constructed by a software package called a logical volume manager(LVM). The LVM enables pieces of multiple physical disks to be combined into a single contiguous address space that appears as one disk to higher layers of software.

    A file system is commonly built on top of a logical volume constructed by a software package called a logical volume manager(LVM). 逻辑卷管理器可以把多个物理磁盘上的碎片合成一个地址连续的地址空间,对上层软件来说就好像是在一个磁盘上一样。

  • Raw device(原始设备)

    Raw devices are disk partitions or logical volumes not formatted with a file system. The primary benefit of raw devices is the ability to perform direct I/O and to write larger buffers. In direct I/O, applications write to and read from the storage device directly, bypassing the operating system buffer cache.

    Raw devices are disk partitions or logical volumes not formatted with a file system. 原始设备的主要优点是可以direct I/O和写大缓冲区。直接I/O,应用程序绕过操作系统缓冲区缓存直接从存储设备上读取信息。

    Note:

    Many file systems now support direct I/O for databases and other applications that manage their own caches. Historically, raw devices were the only means of implementing direct I/O.
    现在许多文件系统支持数据库和其它自己管理缓冲区的应用程序直接I/O。以前原始设备是实现直接I/O的唯一方法。
  • Cluster file system(集群文件系统)

    cluster file system is software that enables multiple computers to share file storage while maintaining consistent space allocation and file content. In an Oracle RAC environment, a cluster file system makes shared storage appears as a file system shared by many computers in a clustered environment. With a cluster file system, the failure of a computer in the cluster does not make the file system unavailable. In an operating system file system, however, if a computer sharing files through NFS or other means fails, then the file system is unavailable.

    集群文件系统是一个允许多台计算机在维持一致的空间分配和文件内容的情况下分享文件存储的软件。在Oracle RAC环境中,集群文件系统使共享存储表现为在集群环境中许多计算机共享的文件系统。在集群文件系统中,集群中的某台计算机的故障不会导致文件系统不可用。然而,在操作系统文件系统中,如果一台计算机通过NFS(Network File System,网络文件系统,允许一个系统在网络上与他人共享目录和文件)或其他方法共享文件失败,那么文件系统就不可用了。

A database employs a combination of the preceding storage mechanisms. For example, a database could store the control files and online redo log files in a traditional file system, some user data files on raw partitions, the remaining data files in Oracle ASM, and archived the redo log files to a cluster file system.

数据库使用前边几种存储机制的结合。例如,数据库可以把控制文件和联机重做日志文件存储在传统的文件系统,一些用户数据文件存储在原设备分区,剩下的数据文件存储在Oracle ASM,归档重做日志文件存储在集群文件系统。

1.3 Oracle Automatic Storage Management(Oracle ASM)(Oracle自动存储管理)

Oracle ASM is a high-performance, ease-of-management storage solution for Oracle Database files. Oracle ASM is a volume manager and provides a file system designed exclusively for use by the database. Oracle ASM is Oracle's recommended storage management solution, providing an alternative to conventional volume managers, file systems, and raw devices.

Oracle ASM是一个高性能的易管理的Oracle数据库文件存储方案。Oracle ASM是一个卷管理器,提供专门为数据库设计的文件系统。Oracle ASM是Oracle推荐的存储管理方法,提供传统卷管理器、文件系统、原始设备供选择。

Oracle ASM provides several advantages over conventional file systems and storage managers, including the following:

Oracle ASM比传统的文件系统和存储管理器有优势,包括:

  • Simplifies storage-related tasks such as creating and laying out databases and managing disk space

  • Distributes data across physical disks to eliminate hot spots and to provide uniform performance across the disks

  • Rebalances data automatically after storage configuration changes

To use Oracle ASM, you allocate partitioned disks for Oracle Database with preferences for striping and mirroring. Oracle ASM manages the disk space, distributing the I/O load across all available resources to optimize performance while removing the need for manual I/O tuning. For example, you can increase the size of the disk for the database or move parts of the database to new devices without having to shut down the database.

2、Overview of Data Files

2.1、use of Data Files

At the operating system level, Oracle Database stores database data in data files. Every database must have at least one data file.A physical file on disk that was created by Oracle Database and contains the data for a database. The data files can be located either in an operating system file system or Oracle ASM disk group.

在操作系统级别,Oracle数据库把数据存储在数据文件中。每一个数据库至少有一个数据文件。Oracle数据库在磁盘上创建的物理文件包含数据库的数据。数据文件在操作系统文件系统或者Oracle ASM磁盘组中。

schema object:A logical structure of data stored in a schema. Examples of  schema objects are tables, indexes, sequences, and database links.

模式对象:数据存储在模式中的逻辑结构。表,索引,序列,数据库链接都是模式对象。
segment:A set of extents allocated for a specific database object such as a table, index, or table cluster. User segments, undo segments, and temporary segments are all types of segments.

段:由区组成。段类型:User segments,undo segments,temporary segments

For ease of administration, Oracle Database allocates space for user data in tablespaces, which like segments are logical storage structures. Each segment belongs to only one tablespace. For example, the data for a nonpartitioned table is stored in a single segment, which is turn is stored in one tablespace.

为了便于管理,oracle数据库在表空间(和段一样,也是一个逻辑的存储结构)里为用户数据分配空间,每一个段只能属于一个表空间。例如,一个没有分区的表数据存储在一个段中,那么就是存储在一个表空间中。

Oracle Database physically stores tablespace data in data files. Tablespaces and data files are closely related, but have important differences:

Oracle数据库物理上把数据存储在数据文件中。表空间和数据文件有非常紧密的联系,但也有重要的不同:

  • Each tablespace consists of one or more data files, which conform to the operating system in which Oracle Database is running.

  • The data for a database is collectively stored in the data files located in each tablespace of the database.

  • A segment can span one or more data files, but it cannot span multiple tablespaces.

  • A database must have the SYSTEM and SYSAUX tablespaces. Oracle Database automatically allocates the first data files of any database for theSYSTEM tablespace during database creation.

  • 每一个表空间包含一个或多个数据文件

  • Oracle数据被存储在位于数据库表空间中的数据文件中

  • 一个段可以跨越多个数据文件,但是不能跨越多个表空间

  • 数据库必须有SYSTEM和SYSAUX表空间。数据库创建的时候Oracle数据库自动的为SYSTEMP表空间分配第一个数据文件。

The SYSTEM tablespace contains the data dictionary, a set of tables that contains database metadata. Typically, a database also has an undo tablespace and a temporary tablespace (usually namedTEMP).

SYSTEM表空间包含数据字典(一系列包含数据库元数据的表)。数据库还有undo tablespace 和 temporary tablespace(usually namedTEMP)

2.2、Permanent and Temporary Data Files

A permanent tablespace contains persistent schema objects. Objects in permanent tablespaces are stored in data files.

Permanent tablespace存储持久的模式对象。

A temporary tablespace contains schema objects only for the duration of a session. Locally managed temporary tablespaces have temporary files which are special files designed to store data in hash, sort, and other operations. Temp files also store result set data when insufficient space exists in memory.The temp files in temporary tablespaces cannot contain permanent database objects.

Temporary tablespace 包含session持续期间的模式对象。临时表空间包含临时文件,临时文件用来存储hash,sort等操作中的数据。在内存不足的时候临时文件也用来存储结果集。临时文件不能用来存储永久数据库对象。

Temp files are similar to permanent data files, with the following exceptions:

  • Permanent database objects such as tables are never stored in temp files.

  • Temp files are always set to NOLOGGING mode, which means that they never have redo generated for them. Media recovery does not recognize temp files.

  • You cannot make a temp file read-only.

  • You cannot create a temp file with the ALTER DATABASE statement.

  • When you create or resize temp files, they are not always guaranteed allocation of disk space for the file size specified. On file systems such as Linux and UNIX, temp files are created assparse files. In this case, disk blocks are allocated not at file creation or resizing, but as the blocks are accessed for the first time.

    Caution:

    Sparse files enable fast temp file creation and resizing; however, the disk could run out of space later when the temp files are accessed.
  • Temp file information is shown in the data dictionary view DBA_TEMP_FILES and the dynamic performance viewV$TEMPFILE, but not in DBA_DATA_FILES or the V$DATAFILE view.

2.3 Online and Offline data files

Every data file is either online (available) oroffline (unavailable). You can alter the availability of individual data files or temp files by taking them offline or bringing them online. Offline data files cannot be accessed until they are brought back online.

Administrators may take data files offline for many reasons, including performing offline backups, renaming a data file, or block corruption. The database takes a data file offline automatically if the database cannot write to it.

Like a data file, a tablespace itself is offline or online. When you take a data file offline in an online tablespace, the tablespace itself remains online. You can make all data files of a tablespace temporarily unavailable by taking the tablespace itself offline

2.4 Data File Structure

Oracle Database creates a data file for a tablespace by allocating the specified amount of disk space plus the overhead for thedata file header. The operating system under which Oracle Database runs is responsible for clearing old information and authorizations from a file before allocating it to the database.

The data file header contains metadata about the data file such as its size and checkpoint SCN. Each header contains anabsolute file number and a relative file number. The absolute file number uniquely identifies the data file within the database. The relative file number uniquely identifies a data file within a tablespace.

When Oracle Database first creates a data file, the allocated disk space is formatted but contains no user data. However, the database reserves the space to hold the data for future segments of the associated tablespace. As the data grows in a tablespace, Oracle Database uses the free space in the data files to allocate extents for the segment.

Figure 11-5 illustrates the different types of space in a data file. Extents are either used, which means they contain segment data, or free, which means they are available for reuse. Over time, updates and deletions of objects within a tablespace can create pockets of empty space that individually are not large enough to be reused for new data. This type of empty space is referred to asfragmented free space.

3、Overview of Control Files

The database control file is a small binary file associated with only one database. Each database has one unique control file, although it may maintain identical copies of it.A binary file that records the physical structure of a database and contains the names and locations of redo log files, the time stamp of the database creation, the current log sequence number, checkpoint information, and so on.

3.1 、use of Control Files

The control file is the root file that Oracle Database uses to find database files and to manage the state of the database generally. A control file contains information such as the following:

  • The database name and database unique identifier (DBID)

  • The time stamp of database creation

  • Information about data files, online redo log files, and archived redo log files

  • Tablespace information

  • RMAN backups

The control file serves the following purposes:

  • It contains information about data files, online redo log files, and so on that are required to open the database.

    The control file tracks structural changes to the database. For example, when an administrator adds, renames, or drops a data file or online redo log file, the database updates the control file to reflect this change.

  • It contains metadata that must be accessible when the database is not open.

    For example, the control file contains information required to recover the database, including checkpoints. A checkpoint indicates the SCN in the redo stream where instance_recovery would be required to begin. Every committed change before a checkpoint SCN is guaranteed to be saved on disk in the data files. At least every three seconds the checkpoint process records information in the control file about the checkpoint position in the online redo log.

Oracle Database reads and writes to the control file continuously during database use and must be available for writing whenever the database is open. For example, recovering a database involves reading from the control file the names of all the data files contained in the database. Other operations, such as adding a data file, update the information stored in the control file.
3.2、Multiple Control Files

Oracle Database enables multiple, identical control files to be open concurrently and written for the same database. By multiplexing a control file on different disks, the database can achieve redundancy and thereby avoid a single point of failure.

Note:

Oracle recommends that you maintain multiple control file copies, each on a different disk.

If a control file becomes unusable, then the database instance fails when it attempts to access the damaged control file. When other current control file copies exist, the database can be remounted and opened without media recovery. Ifall control files of a database are lost, however, then the instance fails and media recovery is required. Media recovery is not straightforward if an older backup of a control file must be used because a current copy is not available.

 

3.3、Control File Structure

Information about the database is stored in different sections of the control file. Each section is a set ofrecords about an aspect of the database. For example, one section in the control file tracks data files and contains a set of records, one for each data file. Each section is stored in multiple logicalcontrol file blocks. Records can span blocks within a section.

The control file contains the following types of records:

  • Circular reuse records

    These records contain noncritical information that is eligible to be overwritten if needed. When all available record slots are full, the database either expands the control file to make room for a new record or overwrites the oldest record. Examples include records about archived redo log files and RMAN backups.

  • Noncircular reuse records

    These records contain critical information that does not change often and cannot be overwritten. Examples of information include tablespaces, data files, online redo log files, and redo threads. Oracle Database never reuses these records unless the corresponding object is dropped from the tablespace.

As explained in "Overview of the Dynamic Performance Views", you can query the dynamic performance views, also known asV$ views, to view the information stored in the control file. For example, you can queryV$DATABASE to obtain the database name and DBID. However, only the database can modify the information in the control file.

Reading and writing the control file blocks is different from reading and writing data blocks. For the control file, Oracle Database reads and writes directly from the disk to the program global area(PGA). Each process allocates a certain amount of its PGA memory for control file blocks.

4、Overview of the Online Redo Log

The most crucial structure for recovery is the online redo log, which consists of two or more preallocated files that store changes to the database as they occur. The online redo log records changes to the data files.

4.1 Use of the Online Redo Log

The database maintains online redo log files to protect against data loss. Specifically, after an instance failure the online redo log files enable Oracle Database to recover committed data not yet written to the data files.

Oracle Database writes every transaction synchronously to the redo log buffer, which is then written to the online redo logs. The contents of the log include uncommitted transactions, undo data, and schema and object management statements.

Oracle Database uses the online redo log only for recovery. However, administrators can query online redo log files through a SQL interface in the Oracle LogMiner utility (see"Oracle LogMiner"). Redo log files are a useful source of historical information about database activity.

 

 

 

 


 


  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值