Академический Документы
Профессиональный Документы
Культура Документы
Logical backups are used to copy the data from the Oracle
database in terms of the tables, indexes, sequences, and
other database objects that logically occupy an Oracle
database.
The EXPORT and IMPORT tools are used for logical database
object export and import.
Physical backups are used to copy Oracle database files that
are present from the perspective of the operating system.
This includes datafiles, redo log files, control files, the
password file, and the parameter file.
To know what datafiles are present in the database, use the
V$DATAFILE or the DBA_DATA_FILES dictionary views.
To know what control files are present in the database, use the
show parameters control_files command from Server Manager
or look in the V$CONTROLFILE view.
To know what redo log files are available in the database, use
the V$LOGFILE dictionary view.
There are two types of physical backups: offline backups and
online backups.
Offline backups are complete backups of the database taken
when the database is closed. In order to close the database,
use the shutdown normal or shutdown immediate commands.
Online or "hot" backups are backups of tablespaces taken
while the database is running. This option requires that Oracle
be archiving its redo logs. To start an online backup, the DBA
must issue the alter tablespace name begin backup statement
from Server Manager. When complete, the DBA must issue the
alter tablespace name end backup statement.
Archiving redo logs is crucial for providing complete data
recovery to the point in time that the database failure occurs.
Logical Backups 2 mins Drill : The types of database failure are user error, statement failure,
process failure, instance failure, and media failure.
User error comes when the user permanently changes or
removes data from a database in error. Rollback segments give
supplemental ability to correct uncommitted user errors.
Statement failure occurs when there is something syntactically
wrong with SQL statements issued by users in the database.
Oracle rolls back these statements automatically.
Process failure occurs when a statement running against the
database is terminated either by Oracle or by the user.
Statement rollback, release of locks, and other process cleanup
actions occur automatically by PMON.
Instance failure occurs when there is some problem with the host
system running Oracle that forces the database to shut down.
Recovery from this problem occurs when the instance is
restarted. Instance recovery is handled automatically by the
SMON process.
Media failure occurs when there is some problem with the disks
that store Oracle data that renders the data unavailable. The
DBA must manually intervene in these situations to restore lost
data using backups.
Logical backup and recovery with EXPORT and IMPORT is one
means by which the DBA can support backup and recovery.
EXPORT and IMPORT both accept certain parameters that will
determine how the processes run.
These parameters are divided according to function.
There are parameters that handle the logistics of the database
export. These parameters are USERID, FILE, CONSISTENT, and
BUFFER.
There are parameters that limit the database objects that will be
exported. These parameters are INDEXES, CONSTRAINTS,
TRIGGERS, and GRANTS.
There are parameters that determine what mode the export will
run in. These parameters are OWNER, TABLES, FULL, and
INCTYPE.
Database export can happen with the EXPORT tool in three
modestable, user, and full.
In table mode, the DBA specifies a list of tables that will be
exported by EXPORT.
In user mode, the DBA specifies a list of users whose database
objects will be exported.
In full mode, the DBA will export all database objects, depending
on certain factors.
There are three types of full exports. They are complete,
cumulative, and incremental.
The type of export depends on the value specified for the
INCTYPE parameter. Values are complete, cumulative, and
incremental.
Complete exports save all database objects in the export file.
Incremental exports save all database objects that have been
altered or added since the last export of any type was taken.
Cumulative exports save all database objects that have been
altered or added since the last complete or cumulative export
was taken.
There are parameters that handle the logistics of the database
import. These parameters are USERID, FILE, CONSISTENT, and
BUFFER.
There are parameters that limit the database objects that will be
imported. These parameters are INDEXES, CONSTRAINTS,
TRIGGERS, and GRANTS.
There are parameters that determine what mode import will run
in. These parameters are FROMUSER and TOUSER for user mode,
TABLES for table mode, and FULL and INCTYPE for full mode.
Database export can happen with the IMPORT tool in three
modestable, user, and full.
In table mode, the DBA specifies a list of tables that will be
imported by IMPORT.
In user mode, the DBA specifies a list of users whose database
objects will be imported.
In full mode, the DBA will import all database objects, depending
on certain factors.
There are two types of full imports. They are system imports and
restore imports.
The type of export executed depends on the value specified for
the INCTYPE parameter mentioned. Values are system and
restore.
Imports with FULL=y and INCTYPE=system restore database
objects in the export file for the data dictionary. This complete
import should always be the first performed in the event of a
database recovery. The most recent export should be used.
Imports with FULL=y and INCTYPE=restore restore all other
database objects in the export file to the damaged database.
There is a particular order required for database import.
First, the last export taken should be applied using the SYSTEM
import.
Next, the most recent complete export should be applied using
the RESTORE import.
Then, all cumulative exports taken since the complete export,
starting from least to most recent, should be applied using the
RESTORE import.
Finally, all incremental exports taken after the most recent
cumulative export should be applied, from least to most recent
incremental export, using the RESTORE import.
There are three dictionary tables used to track exported data.
INCEXP lists all exported database objects and the exports that
contain them.
INCFIL lists all database exports by export ID number.
INCVID lists the most recent export ID number for the purpose of
generating a new export ID number.
Read consistency is established when data doesnt change for
the life of a statement or transaction.
:-
The all option specifies archival of all redo logs that are currently
in need of being archived.
Backup and Recovery with Archiving :
Offline backups usually are full backups taken with the database
offline. They are required for complete database recovery using
the recover database option and for incomplete recovery.
Online backups are usually tablespace backups taken with the
database online. They are required for complete recovery using
the recover tablespace option. Tablespace recovery is not an
option for incomplete recovery.
Online backups of tablespaces are taken in the following way:
Prepare the database for backup using the alter tablespace begin
backup statement.
Make backups of the tablespace datafiles using operating system
commands.
End the tablespace backup using the alter tablespace end
backup statement.
Due to the increased archive redo information taken during
online backups, and to the increased damage caused by
database failure during a backup, it is recommended that online
backups are taken one tablespace at a time, rather than doing
them in parallel.
A control file can be backed up in two ways. The first creates an
actual usable control file for the DBA to incorporate. This backup
is created with the alter database backup controlfile to filename
statement. The second creates a script that can be run to create
the control file. This backup is created with the same statement,
replacing filename with the keyword trace.
The reason the database will start quickly after a system failure
is due to the fast transaction rollback feature of the Oracle
database.
There are two general parts to database recovery: roll forward
and rollback. Fast transaction recovery allows Oracle to open the
database after roll forward is complete, executing the rollback
while users access the database.