- •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
Lab 4.2: Creating an RMAN Incremental Backup |
709 |
piece handle=C:\ORACLE\FLASH_RECOVERY_AREA\ORCL \AUTOBACKUP\2008_09_11\O1_MF_S_665181628_4DMP5C9P_.BKP comment=NONE Finished Control File and SPFILE Autobackup at 11-SEP-08
4.Restart the database with the RMAN command alter database open.
RMAN> Alter database open; database opened
Lab 4.2: Creating an RMAN
Incremental Backup
In this lab, we will be creating an incremental backup. We will also be looking at the size of the resulting backup sets to compare the backup set sizes and the impacts of the level-0 and level-1 incremental backups.
1.Log into the database using SQL*Plus.
C:\oracle\admin\ORCL\wallet>set oracle_sid=orcl C:\oracle\admin\ORCL\wallet>sqlplus “/ as sysdba”
SQL*Plus: Release 11.1.0.6.0 - Production on Thu Sep 11 18:56:27 2008 Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production With the Partitioning, OLAP, Data Mining
and Real Application Testing options SQL>
2.Query the LOG_MODE column of the V$DATABASE view to confirm that the database is in ARCHIVELOG mode. If the database is not in ARCHIVELOG mode, refer to Chapter 2 for information on how to put the database in ARCHIVELOG mode.
SQL> Select log_mode from v$database; LOG_MODE
------------
ARCHIVELOG
3.Exit SQL*Plus and start RMAN.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition
710 Appendix A n Lab Exercises
Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options C:\oracle\admin\ORCL\wallet>rman target=/
Recovery Manager: Release 11.1.0.6.0 - Production on Thu Sep 11 18:58:55 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved. connected to target database: ORCL (DBID=1190537904)
4.Execute the RMAN backup using the backup database command. Include the incremental level 0 option. You will back up the archived redo logs at the same time with the plus archivelog option. Remove the archived redo logs after they are backed up using the delete input option.
RMAN> Backup incremental level 0 database plus archivelog delete input;
5.Exit RMAN and log into SQL*Plus.
6.Query the V$BACKUP_DATAFILE and V$BACKUP_SET views to determine the size of the backup image (found in the BLOCKS column).
SQL> select a.set_count, a.start_time, a.completion_time, sum(b.blocks) 2 from v$backup_set a, v$backup_datafile b
3where a.set_count=b.set_count
4and to_char(a.start_time, ‘mm/dd/yyyy hh24:mi:ss’)=
5 (select to_char(max(start_time), ‘mm/dd/yyyy hh24:mi:ss’)
6from v$backup_set
7where incremental_level=0)
8 group |
by a.set_count, a.start_time, a.completion_time ; |
||
SET_COUNT |
START_TIM COMPLETIO SUM(B.BLOCKS) |
||
---------- |
--------- |
--------- ------------- |
|
155 |
11-SEP-08 |
11-SEP-08 |
144318 |
7.Exit RMAN. Sign into the database using SQL*Plus. Add a table to the scott (or any other) schema. Insert and commit records into that table.
RMAN> Exit
Recovery Manager complete.
C:\Documents and Settings\Robert>Sqlplus scott/tiger SQL*Plus: Release 11.1.0.6.0 - Production on
Thu Sep 11 20:37:39 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved. Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
Lab 4.3: Creating an Image-Copy Backup |
711 |
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> Create table my_new_table (id number); Table created.
SQL> Insert into my_new_table values (1); 1 row created.
SQL> Commit; Commit complete. SQL> Exit
8.Sign into RMAN. Perform a level-1 incremental backup.
RMAN> Backup incremental level 1 database plus archivelog delete input;
9.Query the V$BACKUP_DATAFILE and V$BACKUP_SET views again to determine the size of the backup image (found in the BLOCKS column). Since we are not doing an outer join here, the query will not return any rows until the backup in step 8 has completed. Note that the level-1 incremental backup is much smaller in the output than that in step 6.
SQL> select a.set_count, a.start_time, a.completion_time, sum(b.blocks) 2 from v$backup_set a, v$backup_datafile b
3where a.set_count=b.set_count
4and to_char(a.start_time, ‘mm/dd/yyyy hh24:mi:ss’)=
5 (select to_char(max(start_time), ‘mm/dd/yyyy hh24:mi:ss’)
6from v$backup_set
7where incremental_level=1)
8 |
group by a.set_count, a.start_time, a.completion_time ; |
||
SET_COUNT START_TIM |
COMPLETIO SUM(B.BLOCKS) |
||
---------- --------- |
--------- ------------- |
||
|
159 11-SEP-08 |
11-SEP-08 |
45 |
Lab 4.3: Creating an Image-Copy Backup
In this lab, you will create an image-copy backup of your database. We assume your database is in ARCHIVELOG mode for this backup.
1.Log into the database using SQL*Plus.
C:\oracle\admin\ORCL\wallet>set oracle_sid=orcl C:\oracle\admin\ORCL\wallet>sqlplus “/ as sysdba”
SQL*Plus: Release 11.1.0.6.0 - Production on Thu Sep 11 18:56:27 2008 Copyright (c) 1982, 2007, Oracle. All rights reserved.
712 Appendix A n Lab Exercises
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production With the Partitioning, OLAP, Data Mining
and Real Application Testing options SQL>
2.Using the backup as copy command, create an image copy of the database.
RMAN> Backup as copy database; Starting backup at 11-SEP-08 using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=C:\ORACLE\ORADATA\ORCL\SYSAUX01.DBF output file name=C:\ORACLE\FLASH_RECOVERY_AREA\ORCL \DATAFILE\O1_MF_SYSAUX_4DMQJBMK_.DBF tag=TAG20080911T211158
RECID=23 STAMP=665183712
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:03:16 channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=C:\ORACLE\ORADATA\ORCL\SYSTEM01.DBF output file name=C:\ORACLE\FLASH_RECOVERY_AREA\ORCL \DATAFILE\O1_MF_SYSTEM_4DMQPMC7_.DBF tag=TAG20080911T211158
RECID=24 STAMP=665184016
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:04:56 channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=C:\ORACLE\ORADATA\ORCL\UNDOTBS02.DBF output file name=C:\ORACLE\FLASH_RECOVERY_AREA\ORCL \DATAFILE\O1_MF_UNDOTBS2_4DMR03BY_.DBF tag=TAG20080911T211158
RECID=25 STAMP=665184046
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15 channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=C:\ORACLE\ORADATA\ORCL\USERS01.DBF output file name=C:\ORACLE\FLASH_RECOVERY_AREA\ORCL \DATAFILE\O1_MF_USERS_4DMR0S6S_.DBF tag=TAG20080911T211158
RECID=26 STAMP=665184058
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03 Finished backup at 11-SEP-08
Starting Control File and SPFILE Autobackup at 11-SEP-08 piece handle=C:\ORACLE\FLASH_RECOVERY_AREA\ORCL
\AUTOBACKUP\2008_09_11\O1_MF_S_665184060_4DMR163F_.BKP comment=NONE Finished Control File and SPFILE Autobackup at 11-SEP-083.