- •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 8.1: Duplicating a Database Using Active Database Duplication |
727 |
validation succeeded for archived log archived log file
name=C:\ORACLE\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2008_10_20\ O1_MF_1_26_4HR9MCQX_.ARC RECID=50 STAMP=668565264
validation succeeded for archived log
archived log file name=C:\ORACLE\PRODUCT\11.1.0\DB_1\RDBMS\ ARC00026_0667833490.001 RECID=49 STAMP=668565264 Crosschecked 5 objects
6.Run the list archivelog all command. Notice that the status column (so clearly named S) is now X (expired) instead of A (available):
RMAN> list archivelog all;
List of |
Archived Log |
Copies for database with db_unique_name ORCL |
|
===================================================================== |
|||
Key |
Thrd |
Seq |
S Low Time |
------- |
---- |
------- |
- --------- |
1773 |
1 |
23 |
A 18-OCT-08 |
|
Name: C:\ORACLE\PRODUCT\11.1.0\DB_1\RDBMS\ARC00023_0667833490.001 |
||
1779 |
1 |
24 |
A 19-OCT-08 |
|
Name: C:\ORACLE\PRODUCT\11.1.0\DB_1\RDBMS\ARC00024_0667833490.001 |
||
1787 |
1 |
25 |
X 19-OCT-08 |
|
Name: C:\ORACLE\PRODUCT\11.1.0\DB_1\RDBMS\ARC00025_0667833490.001 |
||
1898 |
1 |
26 |
A 19-OCT-08 |
|
Name: C:\ORACLE\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2008_10_20\ |
||
O1_MF_1_26_4HR9MCQX_.ARC |
|||
1897 |
1 |
26 |
A 19-OCT-08 |
|
Name: C:\ORACLE\PRODUCT\11.1.0\DB_1\RDBMS\ARC00026_0667833490.001 |
Lab 8.1: Duplicating a Database Using
Active Database Duplication
In this exercise, we will use backup-based duplication to create a database on the same system that the target database resides on. For this exercise, your database should be running in ARCHIVELOG mode and all networking to the target database should already be configured.
1.If you are running in Windows, create the service for the new database with oradim. In this example, we are creating a new database instance called neworcl.
C:\>oradim -new -sid neworcl Instance created.
728 Appendix A n Lab Exercises
If there are any other OS-specific operations required to create a database instance, complete those now.
2.Create the password file for the neworcl instance.
C:\>orapwd file=c:\oracle\product\11.1.0\db_1\database\pwdneworcl.ora Enter password for SYS:
3.Create a temporary pfile for the neworcl auxiliary instance using your editor of choice. The pfile should be contained in the ORACLE_HOME\database directory of the auxiliary instance and should be named initneworcl.ora. The pfile should have these parameters in it:
db_name=neworcl memory_target=300m
control_files=’c:\oracle\oradata\neworcl\control01.ctl’, ‘c:\oracle\oradata\neworcl\control02.ctl’
We will do the actual file-location conversions during the duplication.
4.Create the directory c:\oracle\oradata\neworcl mkdir c:\oracle\oradata\neworcl
5.Startup nomount the auxiliary instance.
C:\oracle\product\11.1.0\db_1\database>set oracle_sid=neworcl C:\oracle\product\11.1.0\db_1\database>sqlplus “/ as sysdba” SQL*Plus: Release 11.1.0.6.0 - Production on Sat Oct 4 23:09:52 2008 Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to |
an idle instance. |
|
|
SQL> startup |
nomount |
|
|
ORACLE instance started. |
|
|
|
Total System |
Global Area |
313860096 bytes |
|
Fixed Size |
|
1332892 |
bytes |
Variable Size |
|
192940388 |
bytes |
Database Buffers |
113246208 bytes |
||
Redo Buffers |
|
6340608 |
bytes |
6.Configure service name resolution for your new auxiliary database. The method of this configuration will vary based on your site. In our case, we created an entry in the tnsnames.ora file on our server that looked like this:
NEWORCL = (DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.2)(PORT = 1521)) (CONNECT_DATA =
Lab 8.1: Duplicating a Database Using Active Database Duplication |
729 |
(SERVER = DEDICATED) (SERVICE_NAME = neworcl)
))
7.Now you will need to hard-code the instance name into the listener.ora file until the duplication of the database has been completed. You will get network errors if you do not hard-code the auxiliary instance in the listener.ora file. Here’s an example of the entry in our listener.ora:
SID_LIST_LISTENER = (SID_LIST = (SID_DESC =
(ORACLE_HOME=C:\oracle\product\11.1.0\db_1\NETWORK\ADMIN) (SID_NAME=neworcl)
) )
LISTENER = (DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.2)(PORT = 1521)) (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
))
8.Test the network connectivity to the auxiliary instance.
C:\oracle\product\11.1.0\db_1\database>sqlplus sys/robert@neworcl as sysdba SQL*Plus: Release 11.1.0.6.0 - Production on Sat Oct 4 23:17:50 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> select instance_name from v$instance; INSTANCE_NAME
----------------
neworcl
If the connection fails, review the network configuration and ensure that the new auxiliary instance is running.
9.Start RMAN and connect to the target and the auxiliary databases.
C:\oracle\product\11.1.0\db_1\database>Set oracle_sid=orcl C:\oracle\product\11.1.0\db_1\database>Rman target=sys/robert
730 Appendix A n Lab Exercises
auxiliary=sys/Robert@neworcl
Recovery Manager: Release 11.1.0.6.0 - Production on Sat Oct 4 23:19:55 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved. connected to target database: ORCL (DBID=1194923408) connected to auxiliary database: NEWORCL (not mounted)
10.We are now ready to start the database duplication. Issue the duplicate database command, as shown here:
duplicate target database to neworcl from active database nofilenamecheck
spfile set control_files ‘c:\oracle\oradata\neworcl\control01.ctl’, ‘c:\oracle\oradata\neworcl\control02.ctl’
set db_file_name_convert ’c:\oracle\oradata\orcl’,’c:\oracle\oradata\neworcl’
set log_file_name_convert ’c:\oracle\oradata\orcl’,’c:\oracle\oradata\ neworcl’;
This command does the following:
NNIt starts the duplication process. We are using active database duplication, so no database backup is required.
NNThe SPFILE parameter will result in the target database spfile being copied over to the duplicate database. The duplicate database will use this spfile.
NNThe set commands (set control_files, set db_file_name_convert, and set log_file_name_convert) modify or add parameters to the spfile being copied to the duplicate database.
This duplicate command will result in a great deal of output, which we have decided not to include here as it seems a great waste of a perfectly good tree. Here is the output that you hopefully will see at the end of the database duplication:
database opened
Finished Duplicate Db at 04-OCT-08
There are several bugs in 11.1.0.6 that may cause a failure of active database duplications. We experienced one or two of these when writing this book. This exercise should work well on a new database that has just been created or a database with the latest patch sets installed.
11.Connect to the duplicated database to verify it is open.
C:\oracle\product\11.1.0\db_1\database>set oracle_sid=neworcl C:\oracle\product\11.1.0\db_1\database>sqlplus sys/Robert as sysdba