Professional Documents
Culture Documents
D78846GC20 - sg2 Trang 10 11,19 44
D78846GC20 - sg2 Trang 10 11,19 44
Oracle University and Error : You are not a Valid Partner use only
Administering the Roles Required for Auditing 11-9
Database Auditing: Overview 11-10
Understanding the Audit Architecture 11-11
Enabling Unified Auditing 11-12
Configuring Auditing 11-13
Using Enterprise Manager Cloud Control 11-14
Creating a Unified Audit Policy 11-15
Creating an Audit Policy: System-Wide Audit Options 11-16
Creating an Audit Policy: Object-Specific Actions 11-17
Creating an Audit Policy: Specifying Conditions 11-18
Enabling and Disabling Audit Policies 11-19
Altering a Unified Audit Policy 11-20
Viewing Audit Policy Information 11-21
Setting the Write Mode for Audit Trail Records 11-22
Value-Based Auditing 11-23
Fine-Grained Auditing 11-25
FGA Policy 11-26
Audited DML Statement: Considerations 11-28
FGA Guidelines 11-29
Archiving and Purging the Audit Trail 11-30
Purging Audit Trail Records 11-31
Quiz 11-32
Summary 11-33
Practice: Overview 11-34
x
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED
Oracle University and Error : You are not a Valid Partner use only
Media Failure 12-19
Comparing Complete and Incomplete Recovery 12-20
Complete Recovery Process 12-21
Point-in-Time Recovery Process 12-22
Oracle Data Protection Solutions 12-24
Quiz 12-25
Summary 12-26
xi
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED
Oracle University and Error : You are not a Valid Partner use only
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED
Objectives
After completing this lesson, you should be able to:
• Identify the types of failure that can occur in an Oracle
database
Desc be ns ance ecove y Oracle University and Error : You are not a Valid Partner use only
•
r
t
ri
DBA Responsibilities
Oracle University and Error : You are not a Valid Partner use only
• Decrease the mean time to recover (MTTR)
• Minimize the loss of data
The database administrator (DBA) is typically responsible for ensuring that the database is
open and available when users need it. To achieve that goal, the DBA (working with the
system administrator):
• Anticipates and works to avoid common causes of failure
• Works to increase the mean time between failures (MTBF) that negatively
affect availability
• Ensures that hardware is as reliable as possible, that critical components are
protected by redundancy, and that operating system maintenance is performed in a
timely manner. Oracle Database provides advanced configuration options to increase
MTBF, including:
- Real Application Clusters
- Oracle Data Guard
• Decreases the mean time to recover (MTTR) by practicing recovery procedures
in advance and configuring backups so that they are readily available when
needed
Oracle University and Error : You are not a Valid Partner use only
Categories of Failure
Oracle University and Error : You are not a Valid Partner use only
• Network failure
• User error
• Instance failure
• Media failure
• Statement failure: A single database operation (select, insert, update, or delete) fails.
• User process failure: A single database session fails.
• Network failure: Connectivity to the database is lost.
• User error: A user successfully completes an operation, but the operation (dropping
a table or entering bad data) is incorrect.
• Instance failure: The database instance shuts down unexpectedly.
• Media failure: A loss of any file that is needed for database operation (that is, the
files have been deleted or the disk has failed).
Statement Failure
Oracle University and Error : You are not a Valid Partner use only
table correct data.
Attempts to perform operations with Provide appropriate object or system
insufficient privileges privileges.
When a single database operation fails, DBA involvement may be necessary to correct errors
with user privileges or database space allocation. DBAs may also need to assist in
troubleshooting, even for problems that are not directly in their task area. This can vary
greatly from one organization to another. For example, in organizations that use off-the-shelf
applications (that is, organizations that have no software developers), the DBA is the only
point of contact and must examine logic errors in applications.
To understand logic errors in applications, you should work with developers to understand the
scope of the problem. Oracle Database tools may provide assistance by helping to examine
audit trails or previous transactions.
Note: In many cases, statement failures are by design and desired. For example, security
policies and quota rules are often decided upon in advance. If a user gets an error while
trying to exceed his or her limits, it may be desired for the operation to fail and no resolution
may be necessary.
Oracle University and Error : You are not a Valid Partner use only
failures.
A user’s session is abnormally Instance background processes roll
terminated. back uncommitted changes and
release locks.
A user experiences a program error
that terminates the session.
Watch for trends.
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY.
User processes that abnormally disconnect from the instance may have uncommitted work
in progress that needs to be rolled back. The Process Monitor (PMON) background process
periodically polls server processes to ensure that their sessions are still connected. If PMON
finds a server process whose user is no longer connected, PMON recovers from any
ongoing transactions; it also rolls back uncommitted changes and releases any locks that
are held by the failed session.
A DBA’s intervention should not be required to recover from user process failure, but the
administrator must watch for trends. One or two users disconnecting abnormally is not a
cause for concern. A small percentage of user process failures may occur from time to time.
But consistent and systemic failures indicate other problems. A large percentage of abnormal
disconnects may indicate a need for user training (which includes teaching users to log out
rather than just terminate their programs). It may also be indicative of network or application
problems.
Network Failure
Oracle University and Error : You are not a Valid Partner use only
connect-time failover.
Network Interface Card (NIC) fails. Configure multiple network cards.
The best solution to network failure is to provide redundant paths for network connections.
Backup listeners, network connections, and network interface cards reduce the chance that
network failures will affect system availability.
User Error
Oracle University and Error : You are not a Valid Partner use only
modifies data. dependent transactions or rewind
table.
User drops a table. Recover table from recycle bin.
Recover table from a backup.
Oracle LogMiner
Users may inadvertently delete or modify data. If they have not yet committed or exited their
program, they can simply roll back.
You can use Oracle LogMiner to query your online redo logs and archived redo logs through
an Enterprise Manager or SQL interface. Transaction data may persist in online redo logs
longer than it persists in undo segments; if you have configured archiving of redo
information, redo persists until you delete the archived files. Oracle LogMiner is discussed in
the Oracle Database Utilities reference.
Users who drop a table can recover it from the recycle bin by flashing back the table to
before the drop.
If the recycle bin has already been purged, or if the user dropped the table with the PURGE
option, the dropped table can still be recovered by using point-in-time recovery (PITR) if the
database has been properly configured.
In Oracle Database 12c, RMAN enables you to recover one or more tables or table partitions
to a specified point in time without affecting the remaining database objects.
Note: Flashback technologies, PITR, and table recovery are discussed in the Oracle
Database 12c: Backup and Recovery Workshop course and in the Oracle Database Backup
and Recovery User’s Guide.
Flashback Technology
Oracle University and Error : You are not a Valid Partner use only
Assisting users in error analysis and recovery
Oracle Database includes Oracle Flashback technology: a group of features that support
viewing past states of data—and winding data back and forth in time—without requiring
restoring the database from backup. With this technology, you help users analyze and
recover from errors. For users who have committed erroneous changes, use the following to
analyze the errors:
• Flashback Query: View committed data as it existed at some point in the past. The
SELECT command with the AS OF clause references a time in the past through a
time stamp or system change number (SCN).
• Flashback Version Query: View committed historical data for a specific time interval.
Use the VERSIONS BETWEEN clause of the SELECT command (for performance
reasons with existing indexes).
• Flashback Transaction Query: View all database changes made at the
transaction level.
Possible solutions to recover from user error:
• Flashback Transaction Backout: Rolls back a specific transaction and
dependent transactions
• Flashback Table: Rewinds one or more tables to their contents at a previous
time without affecting other database objects
• Flashback Drop: Reverses the effects of dropping a table by returning the dropped
table from the recycle bin to the database along with dependent objects such as indexes
and triggers
• Flashback Database: Returns the database to a past time or SCN
Oracle University and Error : You are not a Valid Partner use only
Oracle Database 12c: Administration Workshop 12 - 11
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED
Instance Failure
Oracle University and Error : You are not a Valid Partner use only
STARTUP command. Recovering
from instance failure is automatic,
Hardware failure including rolling forward changes in
the redo logs and then rolling back
any uncommitted transactions.
Failure of one of the critical
background processes
Investigate the causes of failure by
Emergency shutdown procedures using the alert log, trace files, and
Enterprise Manager.
Instance failure occurs when the database instance is shut down before synchronizing all
database files. An instance failure can occur because of hardware or software failure or
through the use of the emergency SHUTDOWN ABORT and STARTUP FORCE shutdown
commands.
Administrator involvement in recovering from instance failure is rarely required if Oracle
Restart is enabled and is monitoring your database. Oracle Restart attempts to restart your
database instance as soon as it fails. If manual intervention is required, then there may be a
more serious problem that prevents the instance from restarting, such as a memory CPU
failure.
Oracle University and Error : You are not a Valid Partner use only
• Updating control files with Database
checkpoint information buffer
cache
• Signaling DBWn at
full checkpoints
DBWn
Database Writer
process
Control
files
CKPT Data files
Checkpoint process
Oracle University and Error : You are not a Valid Partner use only
Should be multiplexed to protect against los
Redo log buffer
LGWR
Log Writer (LGWR) writes:
Log Writer
At commit
When one-third full
Every three seconds
Before DBWn writes
Redo log group 1Redo log group 2Redo log group 3
Before clean shutdowns
Redo log files record changes to the database as a result of transactions and internal Oracle
server actions. (A transaction is a logical unit of work consisting of one or more SQL
statements run by a user.) Redo log files protect the database from loss of integrity because
of system failures caused by power outages, disk failures, and so on. Redo log files should
be multiplexed to ensure that the information stored in them is not lost in the event of a disk
failure.
The redo log consists of 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 that group, and each
group is identified by a number. The Log Writer (LGWR) process writes redo records from
the redo log buffer to all members of a redo log group until the files are filled or a log switch
operation is requested.
It then switches and writes to the files in the next group. Redo log groups are used in a
circular fashion.
Best practice tip: If possible, multiplexed redo log files should reside on different disks.
Oracle University and Error : You are not a Valid Partner use only
• Uses information stored in redo log groups to synchronize files
Involves two distinct operations:
• –Rolling forward: Redo log changes (both committed and uncommitted) are appli
Rolling back: Changes that are made but not committed are returned to their orig
The Oracle database automatically recovers from instance failure. All that needs to happen
is for the instance to be started normally. If Oracle Restart is enabled and configured to
monitor this database, then this happens automatically. The instance mounts the control files
and then attempts to open the data files. When it discovers that the data files have not been
synchronized during shutdown, the instance uses information contained in the redo log
groups to roll the data files forward to the time of shutdown. Then the database is opened
and any uncommitted transactions are rolled back.
Instance
Instance startup (data files are out of sync)
Roll forward (redo) SGA
Committed and uncommitted data in files
Oracle University and Error : You are not a Valid Partner use only
Background
processes
4. Database opened
Database
5. Roll back (undo)
6.
Committed data in files SCN: 74-101
SCN:140 SCN:143
SCN: 102-143
SCN:129SCN:143
Undo
SCN: 99
Data files Control files Redo log group
For an instance to open a data file, the system change number (SCN) contained in the data
file’s header must match the current SCN that is stored in the database’s control files.
If the numbers do not match, the instance applies redo data from the online redo logs,
sequentially “redoing” transactions until the data files are up-to-date. After all data files have
been synchronized with the control files, the database is opened and users can log in.
When redo logs are applied, all transactions are applied to bring the database up to the state
as of the time of failure. This usually includes transactions that are in progress but have not
yet been committed. After the database has been opened, those uncommitted transactions
are rolled back.
At the end of the rollback phase of instance recovery, the data files contain only committed
data.
Oracle University and Error : You are not a Valid Partner use only
• You tune instance recovery by controlling the difference between the che
Transactions
Transaction information is recorded in the redo log groups before the instance returns
commit complete for a transaction. The information in the redo log groups guarantees
that the transaction can be recovered in case of a failure. The transaction information must
also be written to the data file. The data file write usually happens at some time after the
information is recorded in redo log groups because the data file write process is much slower
than the redo writes. (Random writes for data files are slower than serial writes for redo log
files.)
Every three seconds, the checkpoint process records information in the control file about the
checkpoint position in the redo log. Therefore, the Oracle Database server knows that all
redo log entries recorded before this point are not necessary for database recovery. In the
graphic in the slide, the striped blocks have not yet been written to the disk.
The time required for instance recovery is the time required to bring data files from their last
checkpoint to the latest SCN recorded in the control file. The administrator controls that
time by setting an MTTR target (in seconds) and through the sizing of redo log groups. For
example, for two redo groups, the distance between the checkpoint position and the end of
the redo log group cannot be more than 90% of the smallest redo log group.
Oracle University and Error : You are not a Valid Partner use only
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Media Failure
Oracle University and Error : You are not a Valid Partner use only
from backup.
Failure of disk controller 2. Inform the database about a
new file location (if necessary).
3. Recover the file by applying
Deletion or corruption of a file redo information (if necessary).
needed for database operation
Oracle Corporation defines media failure as any failure that results in the loss or corruption of
one or more database files (data, control, or redo log file).
Recovering from media failure requires that you restore and recover the missing files.
Oracle University and Error : You are not a Valid Partner use only
to the point in time when the recovery was requested
• Incomplete or point-in-time recovery (PITR): Brings the database or table
Time of
Complete recovery crash
Point-in-time recovery
Missing transactions after point-in-time recovery
Recovery task started at this time
Restore from this backup
When you perform complete recovery, you bring the database to the state where it is fully
up- to-date, including all committed data modifications to the present time.
Incomplete recovery, however, brings the database or tablespace to some point of time in
the past. This is also known as “point-in-time recovery (PITR).” It means there are missing
transactions; any data modifications done between the recovery destination time and the
present are lost. In many cases, this is the desirable goal because there may have been
some changes made to the database that need to be undone. Recovering to a point in the
past is a way to remove the unwanted changes.
Arc hived
log Arc hived
log
Online Redo log
Oracle University and Error : You are not a Valid Partner use only
Changes applied Undo applied
4
2
1 3 5
Data
Restored data files containing committed and uncommitted transactions
files
Recovered data files
The following steps describe what takes place during complete recovery:
1. Damaged or missing files are restored from a backup.
2. Changes from incremental backups, archived redo log files, and online redo log files
are applied as necessary. The redo log changes are applied to the data files until the
current online log is reached and the most recent transactions have been re-entered.
Undo blocks are generated during this entire process. This is referred to as rolling
forward or cache recovery.
3. The restored data files may now contain committed and uncommitted changes.
4. The undo blocks are used to roll back any uncommitted changes. This is
sometimes referred to as transaction recovery.
5. The data files are now in a recovered state and are consistent with the other data files
in the database.
Arc hived
log
A Xhived
log rc Online
X
Oracle University and Error : You are not a Valid Partner use only
Red o log
1 3 6
Datafrom
Restored data files filesas
containing committed
far back as and uncommitted transactions up to PIT
necessary
PIT-recovered data files
Oracle University and Error : You are not a Valid Partner use only
Oracle University and Error : You are not a Valid Partner use only
Physical data protection Hours/Days Recovery Manager
Oracle Secure Backup
Logical data protection Minutes/Hours Flashback Technologies
Oracle provides an appropriate data protection solution depending on your backup and
recovery objective and RTO:
• Oracle Recovery Manager (RMAN) is the core Oracle Database software
component that manages database backup, restore, and recovery processes.
• Oracle Secure Backup (OSB) is Oracle’s enterprise-grade tape backup
management solution for both database and file system data.
• Oracle Database Flashback technologies are a set of data recovery solutions that
enable human errors to be reversed by selectively and efficiently undoing the effects
of a mistake.
• The Data Recovery Advisor provides intelligent database problem identification
and recovery capabilities.
• Data Guard and Active Data Guard enable physical standby databases to be open for
read access while being kept synchronized with the production database through
media recovery.
Quiz
Statement failure is never by design and always requires the
DBA to address the issue.
a. True
b. Fa se Oracle University and Error : You are not a Valid Partner use only
l
Answer: b
Oracle Database 12c: Administration Workshop 12 - 25
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED
Summary
In this lesson, you should have learned how to:
• Identify the types of failure that can occur in an Oracle
database
Desc be ns ance ecove y Oracle University and Error : You are not a Valid Partner use only
•
r
t
ri