Move your mouse over this icon to show all screenshots.
You can also move your mouse over each individual icon to see only the screenshot
associated with it.
New Features to Support Backup and Recovery Operations
This lesson discusses new features that have been provided
to streamline backup and recovery tasks. It introduces features that unify related
recovery files within a specific area and simplify database administrator tasks.
In Oracle Database 10g, flashback functionality has
been extended. The Flashback Database feature provides a way for you to quickly
revert your entire Oracle database to the state it was in at a past point in
time. Flashback Database is discussed in detail in this lesson. In addition
to flashback operations at the database level, it is also possible to flash
back an entire table. You can also quickly recover a table that has been inadvertently
dropped. The existing flashback query capabilities have also been enhanced.
Refer to the Recovering from Human Error
lesson for information on these additional flashback capabilities.
The flash recovery area is a unified storage location for
all recovery related files and activities in an Oracle database. All files that
are needed to completely recover a database from a media failure are part of
the flash recovery area. The recovery related files that can be created in the
flash recovery area include: archived redo log files, control files, backups
created by Recovery Manager (RMAN), flashback logs, and the change tracking
file.
By allocating a storage location and unifying related recovery
files within a specific area, the Oracle database server relieves the database
administrator from having to manage the disk files created by these components.
Follow the steps below to verify that your database is in
ARCHIVELOG mode and configure the flash recovery area.
1.
Log in to Enterprise Manager Database Console by opening
your browser and entering the following URL:
http://<hostname>:5500/em
Enter sys/<password> as SYSDBA and
click Login.
2.
The Oracle Database Home page allows you to view
the current state of the database by displaying a series of metrics that
portray the overall health of the database. The Oracle Database Home page
provides a launch point for the database status and administration and
configuration of the database environment. It contains four pages via
subtabs with each page displaying subsections.
Scroll down to the Media Recovery and Flash
Recovery Area sections to observe the new settings. When the flash
recovery area and archiving are configured, the flash recovery area
(USE_DB_RECOVERY_FILE_DEST) is configured for archive log destination
10. Scroll up to the top of the page.
5.
Click Database: orcl.
6.
Click Configure Backup Settings in the Backup/Recovery
section.
7.
You will now test your configuration. Select Image
Copy under Disk Settings for Disk Backup Type. Scroll down to Host
Credentials.
8.
Enter your OS username and password and scroll up to
the top of the page.
9.
Click on Test Disk Backup. The location for the
backup test will be the location set for the flash recovery area.
10.
Whn you receive the successful notification click on
Database: orcl.
Follow the steps below to take a whole database backup.
1.
Click Schedule Backup in the Backup/Recovery
section.
2.
Choose Oracle-suggested for the Backup Strategy.
Choose Disk under Select your backup destination. Enter your OS
username and password. Then click Continue.
3.
Review the Setup page, then click Next.
4.
Review the Schedule page, then click Next.
5.
Review the Review page, then click Submit
Job.
6.
Your backup job has been submitted. Click OK.
7.
Click on Jobs in the Related Linkssection.
8.
You can view the status of your backup job on the Job
Activity page. Click on your Backup job.
9.
Then scroll down and click on the Backup log.
10.
Click on Show More.
11.
You see what is currently in the log. You may need
to click back and select the backup log again to see that the backup is
progressing. When the backup is complete, scroll up to the top of the
page.
You can easily recover a datafile or your entire database
through Enterprise Manager.
You can use the Flashback Database feature to quickly revert
an Oracle database to the state it was in at a previous time without restoring
datafiles and performing media recovery. You can use Enterprise Manager or the
FLASHBACK DATABASE command to flashback your database.
The Simplified Recovery Through Resetlogs feature is an enhancement
to recovery operations so that previous incarnation backups can be used for
recovery of the current database incarnation. You no longer need to take a whole
database backup after a RESETLOGS operation before you open the database for
production use.
In this section you will recover a datafile through Enterprise
Manager. You will simulate the loss of a datafile by deleting a datafile from
an open database. Perform the steps listed below to simulate the loss of a datafile
in your database and recover the datafile:
1.
Invoke SQL*Plus and connect as the HR
user. Query the EMPLOYEES
table as follows:
sqlplus /nolog
connect hr/hr@orcl
SELECT count(*) FROM hr.employees;
exit
2.
The EMPLOYEES
table is stored in the EXAMPLE
tablespace. The EXAMPLE
tablespace is comprised of the example01.dbf
data file. Simulate the loss of the example01.dbf
data file by issuing the following command at the operating system prompt:
rm $ORACLE_BASE/oradata/orcl/example01.dbf
3.
Verify the loss of the example01.dbf
data file. Connect to your database using SQL*Plus as the HR user. Issue
the following query against the DEPARTMENTS
table:
sqlplus /nolog
connect hr/hr@orcl
SELECT count(*) FROM hr.departments;
exit
4.
You will now use Enterprise Manager
to recover your datafile. Switch back to Enterprise Manager. Click on
the Maintenance tab.
5.
Click on Perform Recovery in the Backup/Recoverysection.
6.
Notice the indication that one datafile needs recovery
in the Current Database Information section. Select Restore and Recover.
In the Host Credentials section enter oracle/URin2 and click Continue.
7.
Select the
/oracle/oradata/orcl/example01.dbf datafile
checkbox and click Next.
8.
Restore the datafile to its original location by selecting:
No. Restore the files to the default location. Click Next.
9.
Review the recovery job you are about to submit. Click
Submit.
10.
View the Operation Succeeded page. Click OK.
11.
You will now verify the recovery. Invoke SQL*Plus in
your terminal window. Connect as the HR
user to the orcl database.
Query the DEPARTMENTS table
again.
sqlplus /nolog
connect hr/hr@orcl
SELECT count(*) FROM hr.departments;
exit
The Flashback Database feature provides a way for you to quickly
revert your entire Oracle database to the state it was in at a past point in
time. You can use Flashback Database to back out changes that have resulted
in logical data corruption or are a result of user error. Flashback Database
is faster than traditional point-in-time recovery using backups and redo log
files. The time to restore a database is now proportional to the number of changes
that need to be backed out, not the size of the database.
Flashback Database is implemented using a new type of log
file called a Flashback Database log. Flashback Database logs contain data block
images for changed blocks and other information that enables the operation.
The data block images are used to quickly back out changes to the database during
the Flashback Database operation.
When you request a flashback of the database, the Oracle database server uses
the Flashback Database logs to back out changes. Perform the following steps:
1.
Open a terminal window. Log in to SQL*Plus as SYSDBA.
Create the HR.JOBS_HIST
table by executing the CREATE_JOBS_HIST
script as follows:
cd wkdir
sqlplus /nolog
connect / as sysdba
@CREATE_JOBS_HIST
SELECT count(*) FROM hr.jobs_hist;
2.
Determine the current System Change Number (SCN)
by issuing the following query. Write down this
number.
SELECT current_scn FROM v$database;
3.
Truncate the HR.JOBS_HIST table to simulate user error.
TRUNCATE TABLE hr.jobs_hist;
SELECT count(*) FROM hr.jobs_hist;
4.
In preparation for Flashback Database, shut down your
instance with the IMMEDIATE
option:
SHUTDOWN IMMEDIATE
5.
In preparation for Flashback Database, start your instance
and mount the database:
STARTUP MOUNT
6.
Exit from SQL*Plus. Invoke Recovery Manager and connect
to your target database:
rman
connect target
7.
Use Recovery Manager to flashback the database to the
SCN you found previously.
FLASHBACK DATABASE TO SCN <scn>;
8.
Open your database with the RESETLOGS option.
ALTER DATABASE OPEN RESETLOGS;
9.
Verify that you have restored the rows in the HR.JOBS_HIST
table.
In previous releases of the Oracle database when you backed
up the database using incremental backups, RMAN had to examine the entire data
file to determine which blocks had changed. Therefore, the time that RMAN took
to perform an incremental backup was proportional to the size of the data files
involved in the backup.
In Oracle Database 10g, you can create a block change
tracking file that records the blocks modified since the last backup. RMAN uses
the tracking file to determine which blocks to include in the incremental backup.
The change tracking file enables RMAN to make the incremental backup time proportional
to the amount of content modified since the last backup.
When you enable change tracking, Oracle automatically tracks
which datafile blocks have changed in change tracking files. When you execute
BACKUP INCREMENTAL, RMAN uses
the change tracking file to more quickly identify the blocks changed since the
previous incremental backup. As a result, RMAN creates incremental backups much
faster than in releases prior to Oracle Database 10g.
By default, the change tracking file is created as an Oracle
managed file in the location specified by the DB_CREATE_FILE_DEST
or DB_RECOVERY_FILE_DEST initialization
parameters.
1.
From the Maintainance tab in Enterprise Manager,
select Configure Backup Settings in the Backup/Recovery section.
2.
Click on the Policy tab.
3.
Check "Enable block change tracking for faster
incremental backups". Specify the following as the name of the
change tracking file: /oracle/oradata/orcl/chg_trk.dbf. Scroll
to the Host Credentials section.
4.
Enter your OS username and password and click OK.
Move your mouse over this icon to hide all screenshots