- •About the Authors
- •Contents at a Glance
- •Contents
- •Table of Exercises
- •Introduction
- •Assessment Test
- •Answers to Assessment Test
- •What Is ASM?
- •Working with the ASM Instance
- •Overview of ASM Data Dictionary Views
- •Using ASM Storage
- •Using RMAN with ASM
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Understanding the Oracle Database as It Relates to Backup and Recovery
- •Performing Oracle Offline Backups
- •Performing Oracle Online Backups
- •Backing Up the Control File
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Performing Incomplete Recoveries
- •Performing Other Types of Recoveries
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Why Use RMAN?
- •Exploring the RMAN Architecture
- •Connecting to RMAN
- •Configuring RMAN for Use
- •Backing Up Your Database with RMAN
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Introducing the Recovery Catalog
- •Creating the Recovery Catalog User and Schema Objects
- •Using a Recovery Catalog
- •Maintaining the Recovery Catalog
- •Using the RMAN Virtual Private Catalog
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •RMAN Database-Recovery Basics
- •Using Image Copies to Recover Your Database
- •Other Basic Recovery Topics
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Switching Between RMAN Incarnations
- •Overview of RMAN Database Duplication
- •Performing an RMAN Tablespace Point-in-Time Recovery
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Overview of Flashback Technology
- •Using Automatic Undo Management
- •Using Flashback Technologies
- •Using Additional Flashback Operations
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Diagnosing the Database
- •Managing Database Performance
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Managing Memory
- •Managing Space
- •Managing Resources
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Automating Tasks with the Scheduler
- •Exploring the Scheduler Architecture
- •Exploring Common Administration Tools
- •Using Scheduler Jobs
- •Using Scheduler Programs
- •Using Schedules
- •Creating Lightweight Jobs
- •Using Job Chains
- •Using Scheduler Windows
- •Creating and Using Job Classes
- •Using Advanced Scheduler Concepts to Prioritize Jobs
- •Using Scheduler Views
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •An Overview of Globalization Support
- •Using NLS Parameters
- •Using Datetime Datatypes
- •Using Linguistic Sorts and Searches
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Lab 1.1: Creating an ASM Instance
- •Lab 1.2: Creating ASM Disk Groups
- •Lab 1.3: Using ASM Disk Groups from a Database
- •Lab 2.2: Putting the Database in ARCHIVELOG Mode
- •Lab 2.3: Executing a Manual Online (Hot) Backup
- •Lab 3.1: Executing a Time-Based Point-in-Time Recovery
- •Lab 3.2: Recovering from Control-File Loss with a Backup Control File
- •Lab 3.3: Recovering from Loss of the Current Online Redo Log
- •Lab 4.1: Creating an RMAN Offline Backup
- •Lab 4.2: Creating an RMAN Incremental Backup
- •Lab 4.3: Creating an Image-Copy Backup
- •Lab 5.1: Implementing RVPC
- •Lab 6.1: Restoring a Datafile Online
- •Lab 6.2: Performing a Change-Based Recovery with RMAN
- •Lab 6.3: Restoring a Control File from an Autobackup
- •Lab 7.1: Monitoring RMAN Backups
- •Lab 7.2: One of My Backups Is Missing!
- •Lab 8.1: Duplicating a Database Using Active Database Duplication
- •Lab 8.2: Duplicating a Database Using Backup-Based Duplication to a Different Point in Time
- •Lab 9.1: Using the Recycle Bin
- •Lab 9.3: Using Flashback Data Archive
- •Lab 10.1: Using Support Workbench to Report a Problem to Oracle Support
- •Lab 11.1: Exporting a Transportable Tablespace
- •Lab 11.2: Testing Resumable Space Allocation
- •Lab 11.3: Manually Configuring the SGA
- •Lab 12.1: Creating a Local External Job
- •Lab 12.2: Creating a Job Window
- •Lab 13.1: Using the Locale Builder to Create a New Linguistic Sort
- •Lab 13.2: Setting NLS Parameters
- •Lab 13.3: Performing Linguistic Sorts
- •What You’ll Find on the CD
- •System Requirements
- •Using the CD
- •Troubleshooting
- •Glossary
- •Index
Backing Up the Control File |
91 |
Backing Up the Control File
Finally, we need to talk about control-file backups. We introduced you to the control file in Chapter 1. In Oracle there are three ways to manually back up a control file (again, RMAN methods will be covered in Chapter 4):
NN |
Backing up the original control file during a cold backup |
NN |
Creating a backup control file |
NN |
Creating a trace file with the create control file command in it |
We have really already covered the first method in this chapter. Let’s look at the remaining two methods in some more detail. We will address recovering from a lost control file in Chapter 3.
Creating a Backup Control File
The backup control file is almost the same as a regular control file. It has some areas in it that are marked such that Oracle recognizes that it’s a backup control file. When a backup control file is used, some form of recovery will be required (typically just involving the use of the archived and online redo logs if the database is otherwise intact).
To create the backup control file simply issue the alter database backup controlfile to command, indicating at the end of the command where you want the control file to be created.
For example, if you wanted to create a backup control file after the online backup you performed in Exercise 2.4, you would simply need to issue the following command:
SQL> alter database backup controlfile to ‘c:\backup\orcl\backup2\backup_control.ctl’; Database altered.
The result is the creation of a backup control file called backup_control.ctl found in the c:\backup\orcl\backup2 directory, as you can see here:
SQL> host dir c:\backup\orcl\backup2\backup_control.ctl
Volume in drive |
C has no label. |
|
Volume Serial Number is 08DE-E1AB |
||
Directory of c:\backup\orcl\backup2 |
||
08/02/2008 03:24 PM |
10,174,464 BACKUP_CONTROL.CTL |
|
1 |
File(s) |
10,174,464 bytes |
0 |
Dir(s) |
9,930,571,776 bytes free |
We will cover recovering from control-file loss using a backup control file in Chapter 3.
92 Chapter 2 n Performing Oracle User-Managed Backups
Creating a Trace File with the Create Control File Command in It
If all else fails and you do not have a backup control file, don’t worry; you have another option, the create controlfile command. Normally, manually executing the command can be challenging because you need to know a lot of information about your database (like the names and locations of all the database datafiles). However, you can prepare for the possibility of having to use the create controlfile command by creating one in advance. The alter database backup controlfile to trace command will create a trace file with the create controlfile command in it for you. The trace file is stored in the new diagnostic directory structure in Oracle Database 11g.
The diagnostic directory structure is a new standard introduced in Oracle Database 11g that defines where Oracle stores files related to database troubleshooting and diagnostics. The base directory of this structure is defined by the parameter DIAGNOSTIC_DEST. Here is an example of the setting of DIAGNOSTIC_DEST on an Oracle database:
SQL> show parameter diag |
|
|
NAME |
TYPE |
VALUE |
------------------------------------ |
----------- |
--------- |
diagnostic_dest |
string |
C:\ORACLE |
A whole book could be written on the new 11g diagnostic capabilities, but what we are interested in is where user-generated trace files get created, because when we issue the
alter database backup controlfile to trace command, the resulting file will be a usergenerated trace file.
In this case, the trace file will be created in $DIAGNOSTIC_BASE\diag\rdbms\orcl\orcl\ trace as shown in this code example:
SQL> alter database backup controlfile to trace;
Database altered.
C:\oracle\diag\rdbms\orcl\orcl\trace>dir
Volume in drive C has no label.
Volume Serial Number is 08DE-E1AB
Directory of C:\oracle\diag\rdbms\orcl\orcl\trace
08/02/2008 |
03:38 PM |
<DIR> |
. |
|
|
08/02/2008 |
03:38 PM |
<DIR> |
.. |
||
08/02/2008 |
03:38 PM |
1,027,520 |
alert_orcl.log |
||
08/02/2008 |
03:38 PM |
9,572 |
orcl_ora_12120.trc |
||
08/02/2008 |
03:38 PM |
91 |
orcl_ora_12120.trm |
||
|
4 |
File(s) |
1,037,183 |
bytes |
|
|
4 |
Dir(s) |
9,964,507,136 |
bytes free |
Backing Up the Control File |
93 |
The trace file is called orcl_ora_12120.trc (it’s easy to tell since there are no other trace files in the directory). Another option with the alter database backup controlfile to trace command is to define an alternate location for the trace file. The syntax for this command is as follows:
alter database backup controlfile to trace as ’/tmp/my_control_trace.trc’;
If you look in the file, you will find a trace-file header in it first. Later down the trace file you will find two different versions of the create controlfile command. Here is an example of the create control file command that you might find in this file:
CREATE CONTROLFILE REUSE DATABASE “ORCL” NORESETLOGS ARCHIVELOG MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8 MAXLOGHISTORY 292
LOGFILE
GROUP 1 ‘C:\ORACLE\ORADATA\ORCL\REDO01.LOG’ SIZE 50M, GROUP 2 ‘C:\ORACLE\ORADATA\ORCL\REDO02.LOG’ SIZE 50M, GROUP 3 (
‘C:\ORACLE\ORADATA\ORCL\REDO03A.LOG’,
‘C:\ORACLE\ORADATA\ORCL\REDO03B.LOG’
)SIZE 100M
--STANDBY LOGFILE DATAFILE
‘C:\ORACLE\ORADATA\ORCL\SYSTEM01.DBF’,
‘C:\ORACLE\ORADATA\ORCL\SYSAUX01.DBF’,
‘C:\ORACLE\ORADATA\ORCL\UNDOTBS01.DBF’,
‘C:\ORACLE\ORADATA\ORCL\USERS01.DBF’, ‘C:\ORACLE\ORADATA\ORCL\REVEAL_DATA_01.DBF’, ‘C:\ORACLE\ORADATA\ORCL\REVEAL_INDEX_01.DBF’, ‘C:\ORACLE\ORADATA\ORCL\USERS02.DBF’
CHARACTER SET WE8MSWIN1252;
You will notice that this output includes the datafile names, the location and names of the online redo logs, and other information needed by the create controlfile command. The trace file contains other output that will be required to complete the recovery process, so you should back up the trace file as it is. In Chapter 3 we will address the process of recovering from a control-file loss using the output contained in the trace files.
94 Chapter 2 n Performing Oracle User-Managed Backups
Summary
In this chapter, we covered all aspects of user-managed Oracle database backups. We started with a quick review of the Oracle architecture related to backup and recovery so you could have a good foundation on which to build your knowledge. In that review, we discussed processes and memory in Oracle. We discussed ARCHIVELOG and NOARCHIVELOG mode. We also discussed startup and shutdown of the database, the different modes the database is in while starting up or shutting down, and why those modes are important during a recovery exercise.
We then reviewed configuring your database for backup and recovery, which mostly pertained to backups in ARCHIVELOG mode. We talked about archive logs, and the archivelog destination parameters. We talked about how an archive log is named when its created. We provided you with a list of parameters that are commonly used when configuring Oracle online backups, and we also provided you with a list of data dictionary views you might need to use to manage archived redo logs.
We then moved on to the topic of offline (cold) backups. We demonstrated how you could do an offline backup of your database. We proceeded to the topic of online backups, demonstrating that they are almost as simple as offline backups. Finally, we discussed backup control files and how they could be created.
Exam Essentials
Be able to configure a database of user-initiated online backups. Understand the different parameters that need to be configured when you are going to back up a database with user-based online backups. You will need to understand parameters such as LOG_ARCHIVE_ DEST_1 and how to configure them. You will need to understand what happens if you have two archive-log destination directories defined.
Be able to back up your database with an offline backup. Understand the steps that need to be performed to do an offline backup. Understand the difference between an offline backup and an online backup and how these differences can be used to decide the optimal backup strategy.
Be able to back up your database with an online backup. Know how to configure your database for an online backup. Understand how to put the database in ARCHIVELOG mode so you can do online backups. Understand how to determine which archived redo logs you will need to back up when doing an online backup.
Be able to back up your database control file. Understand why it is important to back up your control file. Understand the different methods of backing up your control file. Understand what a backup control file is.