Pca15E04 Database Administration Unit-2
Pca15E04 Database Administration Unit-2
A Control File is a small binary file that stores information needed to startup an Oracle database
and to operate the database .
Every Oracle Database has a control file, which is a small binary file that records the physical
structure of the database. The control file includes:
The database name
Names and locations of associated data files and redo log files
The timestamp of the database creation
The current log sequence number
Checkpoint information
The control file must be available for writing by the Oracle Database server whenever the
database is open. Without the control file, the database cannot be mounted and recovery is
difficult.
*****
Redo logs are disk resources that stores data changes made by users on Oracle.
A log switch is the point at which Oracle ends writing to one online redo log file and begins
writing to another. Normally, a log switch occurs when the current online redo log file is
completely filled and writing must continue to the next online redo log file.
Oracle assigns each online redo log file a new log sequence number every time that a log switch
occurs and LGWR begins writing to it. If Oracle archives online redo log files, the archived log
retains its log sequence number. The online redo log file that is cycled back for use is given the
next available log sequence number.
Each online or archived redo log file is uniquely identified by its log sequence number. During
crash, instance, or media recovery, Oracle properly applies redo log files in ascending order by
using the log sequence number of necessary archived and online redo log files.
To protect against a failure involving the redo log itself, Oracle Database allows a multiplexed
redo log, meaning that two or more identical copies of the redo log can be automatically
maintained in separate locations. For the most benefit, these locations should be on separate
disks. Even if all copies of the redo log are on the same disk, however, the redundancy can help
protect against I/O errors, file corruption, and so on. When redo log files are multiplexed, LGWR
concurrently writes the same redo log information to multiple identical redo log files, thereby
eliminating a single point of redo log failure.
Multiplexing is implemented by creating groups of redo log files. A group consists of a redo log
file and its multiplexed copies. Each identical copy is said to be a member of the group. Each
redo log group is defined by a number, such as group 1, group 2, and so on.
To create a new group of online redo log files, use the SQL statement ALTER DATABASE with
the ADD LOGFILE clause.
You can use operating system commands to relocate online redo logs, then use the ALTER
DATABASE statement to make their new names (locations) known to the database.
Managing Oracle managed redo log files is exactly the same as managing Oracle control files.
Both uses the same init.ora parameters. Redo logs are created when we create the database. We
can create new redo logs by alter database add logfile group command. The default size of
Oracle managed redo log file is 100 MB. This value can be overridden by specifying the size of
the redo log files ( during create database or alter database commands)
******
1. Table spaces
2. Segments
3. Extends
A tablespace is a logical database structure that is designed to store other logical database
structures. Oracle sees tablespace as a large area of space into which Oracle can place new
objects. Space in tables is allocated to segments
A segment is an allocation of space used to store data of a table, index and undo segments or
temporary objects. When the database object runs out of space in its segment and needs to add
more data, Oracle allocates more space from an extent.
Tablespaces
Database is logically divided into one or more tablespaces. Each tablespace creates one or more
datafiles to physically store data.
Schema objects
Schema objects are the structure that represents database's data. Schema objects include
structures such as tables, views, sequences, stored procedures, indexes, synonyms, clusters and
database links.
Data Blocks
Data block represents specific number of bytes of physical database space on disk.
Extents
An extent represents continuous data blocks that are used to store specific data information.
Segments
A segment is a set of extents allocated for a certain logical structure.
Datafiles
Datafiles contain database's data. The data of logical data structures such as tables and indexes is
stored in datafiles of the database. One or more datafiles form a logical unit of database storage
called a tablespace.
Tablespaces are the bridge between certain physical and logical components of the Oracle
database.Tablespaces are where you store Oracle database objects such as tables, indexes and
rollback segments. You can think of a tablespace like a shared disk drive in Windows.
The following tablespaces are to be created
SYSTEM: The SYSTEM tablespace is the first tablespace created at database creation. It is
managed as any other tablespace, but requires a higher level of privilege and is restricted in some
ways.
DATA: A DATA table space is used to house the table data
INDEX: used to house indexes separate from other type of objects.
Undo tablespace, which is specifically designed to contain undo records. These are records
generated by the database that are used to rollback, or undo, changes to the database for
recovery, read consistency, or as requested by a ROLLBACK statement
-----------------------
PART-A QUESTIONS
1. What are the three important units in logical Oracle disk resource?
The three important units in logical Oracle disk resources are
1. Table spaces
2. Segments
3. Extends
The key objective of UNDO segments is to support: Transaction rollback. When a ROLLBACK
statement is issued inside a transaction in order to cancel the changes done to the database, then
the UNDO data records are used to reverse those changes by writing them back to the underlying table
and index data blocks.
Oracle uses redo logs to track data changes users make to database. This entry is placed in redo
log buffer of SGA. The online redo log of a database consists of two or more online redo log
files. LGWR writes to online redo log files in a circular fashion. When the current online redo
log file fills, LGWR begins writing to the next available online redo log file. When the last
available online redo log file is filled, LGWR returns to the first online redo log file and writes to
it, starting the cycle again
PART-B QUESTIONS
1. What is a control file? Discuss about Managing Control Files and Multiplexing
Control Files.
2. Explain with a neat diagram the logical structure of the database.
3. Discuss in detail about maintaining redo log files
4. Discuss the importance of tablespaces in Oracle