Physical and Logical Database Structures
Overview of Physical Database Structures:
The following sections explain
the physical database structures of an Oracle database, including datafiles,
redo log files, and control files.
Datafiles
Every Oracle database has one or
more physical datafiles. The datafiles contain all the
database data. The data of logical database structures, such as tables and
indexes, is physically stored in the datafiles allocated for a database.
The characteristics of datafiles are:
Modified or new data is not necessarily
written to a datafile immediately. To reduce the amount of disk access and to
increase performance, data is pooled in memory and written to the appropriate
datafiles all at once, as determined by the database
writer process (DBWn) background
process.
Control
Files
Every Oracle database has a control file. A control file contains entries that specify
the physical structure of the database. For example, it contains the following
information:
Every time an instance
of an Oracle database is started, its control file identifies the database and
redo log files that must be opened for database operation to proceed. If the
physical makeup of the database is altered (for example, if a new datafile or
redo log file is created), then the control file is automatically modified by
Oracle to reflect the change. A control file is also used in database recovery.
Redo Log Files
Every Oracle database has a set
of two or more redo log files. The set of redo log
files is collectively known as the redo log for the database. A redo log is made up of redo entries (also called redo records).
The primary function of the redo log is to record all changes made to data. If a failure prevents modified data from being permanently written to the datafiles, then the changes can be obtained from the redo log, so work is never lost.
To protect against a failure involving the redo log itself, Oracle allows a multiplexed redo log so that two or more copies of the redo log can be maintained on different disks.
The information in a redo log file is used only to recover the database from a system or media failure that prevents database data from being written to the datafiles. For example, if an unexpected power outage terminates database operation, then data in memory cannot be written to the datafiles, and the data is lost. However, lost data can be recovered when the database is opened, after power is restored. By applying the information in the most recent redo log files to the database datafiles, Oracle restores the database to the time at which the power failure occurred.
The process of applying the redo log during a
recovery operation is called rolling
forward.
Archive Log Files
You can enable
automatic archiving of the redo log. Oracle automatically archives log files
when the database is in
Parameter
Files
Parameter
files contain a list of configuration parameters for that instance and
database.
Oracle recommends that you create a server
parameter file (SPFILE) as a dynamic means of maintaining initialization
parameters. A server parameter file lets you store and manage your
initialization parameters persistently in a server-side disk file.
Alert and Trace Log Files
Each server and background
process can write to an associated trace file. When an
internal error is detected by a process, it dumps information about the error
to its trace file. Some of the information written to a trace file is intended
for the database administrator, while other information is for Oracle Support
Services. Trace file information is also used to tune applications and
instances.
The alert file, or alert log, is a special trace file. The alert log of a database is a chronological log of messages and errors.
Backup
Files
To restore a file is to replace
it with a backup file. Typically, you restore a file when a media failure or
user error has damaged or deleted the original file.
User-managed backup and recovery requires you to actually restore backup files before you can perform a trial recovery of the backups.
Server-managed backup and recovery manages the backup process, such as scheduling of backups, as well as the recovery process, such as applying the correct backup file when recovery is needed.
Overview of Logical Database Structures:
The logical
storage structures, including data blocks, extents, and segments, enable Oracle
to have fine-grained control of disk space use.
Tablespaces
A database
is divided into logical storage units called tablespaces,
which group related logical structures together. For example, tablespaces
commonly group together all application objects to simplify some administrative
operations.
Each database is logically divided into one or more tablespaces. One or more datafiles are explicitly created for each tablespace to physically store the data of all logical structures in a tablespace. The combined size of the datafiles in a tablespace is the total storage capacity of the tablespace.
Every Oracle database contains a
Oracle also lets you create bigfile tablespaces. This allows Oracle Database to contain tablespaces made up of single large files rather than numerous smaller ones. This lets Oracle Database utilize the ability of 64-bit systems to create and manage ultralarge files. The consequence of this is that Oracle Database can now scale up to 8 exabytes in size. With Oracle-managed files, bigfile tablespaces make datafiles completely transparent for users. In other words, you can perform operations on tablespaces, rather than the underlying datafiles.
Online and
Offline Tablespaces
A tablespace
can be online (accessible) or offline
(not accessible). A tablespace is generally online, so that users can access
the information in the tablespace. However, sometimes a tablespace is taken
offline to make a portion of the database unavailable while allowing normal
access to the remainder of the database. This makes many administrative tasks
easier to perform.
Oracle Data Blocks
At the finest level of
granularity, Oracle database data is stored in data blocks.
One data block corresponds to a specific number of bytes of physical database
space on disk. The standard block size is specified by the
Extents
The next level of logical
database space is an extent. An extent is a specific
number of contiguous data blocks, obtained in a single allocation, used to
store a specific type of information.
Segments
Above extents, the level of
logical database storage is a segment. A segment is a
set of extents allocated for a certain logical structure. The following table
describes the different types of segments. Oracle dynamically allocates space
when the existing extents of a segment become full. In other words, when the
extents of a segment are full, Oracle allocates another extent for that
segment. Because extents are allocated as needed, the extents of a segment may
or may not be contiguous on disk.
Overview of Physical Database Structures:
The following sections explain
the physical database structures of an Oracle database, including datafiles,
redo log files, and control files.
Datafiles
Every Oracle database has one or
more physical datafiles. The datafiles contain all the
database data. The data of logical database structures, such as tables and
indexes, is physically stored in the datafiles allocated for a database.The characteristics of datafiles are:
·
A
datafile can be associated with only one database.
·
Datafiles
can have certain characteristics set to let them automatically extend when the
database runs out of space.
·
One
or more datafiles form a logical unit of database storage called a tablespace.
Data in a datafile is read, as
needed, during normal database operation and stored in the memory cache of
Oracle. For example, assume that a user wants to access some data in a table of
a database. If the requested information is not already in the memory cache for
the database, then it is read from the appropriate datafiles and stored in
memory.
Modified or new data is not necessarily
written to a datafile immediately. To reduce the amount of disk access and to
increase performance, data is pooled in memory and written to the appropriate
datafiles all at once, as determined by the database
writer process (DBWn) background
process.
Control
Files
Every Oracle database has a control file. A control file contains entries that specify
the physical structure of the database. For example, it contains the following
information:
·
Database
name
·
Names
and locations of datafiles and redo log files
·
Time
stamp of database creation
Oracle can multiplex
the control file, that is, simultaneously maintain a number of identical
control file copies, to protect against a failure involving the control file.
Every time an instance
of an Oracle database is started, its control file identifies the database and
redo log files that must be opened for database operation to proceed. If the
physical makeup of the database is altered (for example, if a new datafile or
redo log file is created), then the control file is automatically modified by
Oracle to reflect the change. A control file is also used in database recovery.
Redo Log Files
Every Oracle database has a set
of two or more redo log files. The set of redo log
files is collectively known as the redo log for the database. A redo log is made up of redo entries (also called redo records).The primary function of the redo log is to record all changes made to data. If a failure prevents modified data from being permanently written to the datafiles, then the changes can be obtained from the redo log, so work is never lost.
To protect against a failure involving the redo log itself, Oracle allows a multiplexed redo log so that two or more copies of the redo log can be maintained on different disks.
The information in a redo log file is used only to recover the database from a system or media failure that prevents database data from being written to the datafiles. For example, if an unexpected power outage terminates database operation, then data in memory cannot be written to the datafiles, and the data is lost. However, lost data can be recovered when the database is opened, after power is restored. By applying the information in the most recent redo log files to the database datafiles, Oracle restores the database to the time at which the power failure occurred.
The process of applying the redo log during a
recovery operation is called rolling
forward.
Archive Log Files
You can enable
automatic archiving of the redo log. Oracle automatically archives log files
when the database is in ARCHIVELOG mode.
Parameter
Files
Parameter
files contain a list of configuration parameters for that instance and
database.
Oracle recommends that you create a server
parameter file (SPFILE) as a dynamic means of maintaining initialization
parameters. A server parameter file lets you store and manage your
initialization parameters persistently in a server-side disk file.
Alert and Trace Log Files
Each server and background
process can write to an associated trace file. When an
internal error is detected by a process, it dumps information about the error
to its trace file. Some of the information written to a trace file is intended
for the database administrator, while other information is for Oracle Support
Services. Trace file information is also used to tune applications and
instances.The alert file, or alert log, is a special trace file. The alert log of a database is a chronological log of messages and errors.
Backup
Files
To restore a file is to replace
it with a backup file. Typically, you restore a file when a media failure or
user error has damaged or deleted the original file.User-managed backup and recovery requires you to actually restore backup files before you can perform a trial recovery of the backups.
Server-managed backup and recovery manages the backup process, such as scheduling of backups, as well as the recovery process, such as applying the correct backup file when recovery is needed.
Overview of Logical Database Structures:
The logical
storage structures, including data blocks, extents, and segments, enable Oracle
to have fine-grained control of disk space use.
Tablespaces
A database
is divided into logical storage units called tablespaces,
which group related logical structures together. For example, tablespaces
commonly group together all application objects to simplify some administrative
operations.Each database is logically divided into one or more tablespaces. One or more datafiles are explicitly created for each tablespace to physically store the data of all logical structures in a tablespace. The combined size of the datafiles in a tablespace is the total storage capacity of the tablespace.
Every Oracle database contains a
SYSTEM tablespace and a SYSAUX tablespace. Oracle creates them automatically when
the database is created. The system default is to create a smallfile
tablespace, which is the traditional type of Oracle
tablespace. The SYSTEM and SYSAUX tablespaces are created as smallfile tablespaces.Oracle also lets you create bigfile tablespaces. This allows Oracle Database to contain tablespaces made up of single large files rather than numerous smaller ones. This lets Oracle Database utilize the ability of 64-bit systems to create and manage ultralarge files. The consequence of this is that Oracle Database can now scale up to 8 exabytes in size. With Oracle-managed files, bigfile tablespaces make datafiles completely transparent for users. In other words, you can perform operations on tablespaces, rather than the underlying datafiles.
Online and
Offline Tablespaces
A tablespace
can be online (accessible) or offline
(not accessible). A tablespace is generally online, so that users can access
the information in the tablespace. However, sometimes a tablespace is taken
offline to make a portion of the database unavailable while allowing normal
access to the remainder of the database. This makes many administrative tasks
easier to perform.
Oracle Data Blocks
At the finest level of
granularity, Oracle database data is stored in data blocks.
One data block corresponds to a specific number of bytes of physical database
space on disk. The standard block size is specified by the DB_BLOCK_SIZE initialization parameter. In addition, you can
specify up to five other block sizes. A database uses and allocates free
database space in Oracle data blocks.






0 comments:
Post a Comment