- •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 11.3: Manually Configuring the SGA |
761 |
SESSION_ID
----------
SQL_TEXT
---------------------------
ERROR_MSG
---------------------------
125
insert into resumable select * from resumable ORA-01653: unable to extend table SCOTT.RESUMABLE_TEST by 128 in tablespace USER_DATA
SQL>
4.Remedy the resumable condition.
SQL> alter database datafile ‘c:\oracle\oradata\orcl\user_data01.dbf’ resize 100 m;
5.Verify the resumable condition.
SQL> select session_id, sql_text, error_msg from dba_resumable; no rows selected
SQL>
Lab 11.3: Manually Configuring the SGA
In this lab, you will modify initialization parameters and configure the SGA. You will start with an instance that uses Automatic Memory Management, then you’ll step through modifying the parameters to utilize Automatic Shared Memory Management, and finally you’ll manually configure each of the SGA components. This is the basic procedure:
Here’s an example:
1.Configure the instance for Automatic Memory Management.
SQL> show parameter memory
762 |
Appendix A n Lab Exercises |
|
|
NAME |
|
TYPE |
VALUE |
------------------------------------ |
----------- |
----- |
|
hi_shared_memory_address |
integer |
0 |
|
memory_max_target |
big integer |
1000M |
|
memory_target |
big integer |
0 |
|
shared_memory_address |
integer |
0 |
|
SQL> |
|
|
|
SQL>alter system set memory_target=1000m scope=both;
System altered. |
|
|
SQL>show parameter memory |
|
|
NAME |
TYPE |
VALUE |
------------------------------------ |
----------- |
----- |
hi_shared_memory_address |
integer |
0 |
memory_max_target |
big integer |
1000M |
memory_target |
big integer |
1000M |
shared_memory_address |
integer |
0 |
SQL> |
|
|
Since both memory_target and memory_max_target are set to a nonzero value, the instance is running in Automatic Memory Management mode.
2.Modify the configuration to use Automatic Shared Memory Management.
SQL> show parameter sga
NAME |
TYPE |
VALUE |
------------------------------------ |
----------- |
----- |
lock_sga |
boolean |
FALSE |
pre_page_sga |
boolean |
FALSE |
sga_max_size |
big integer |
700M |
sga_target |
big integer |
0 |
SQL> |
|
|
SQL>alter system set sga_target=700m |
scope=both; |
|
System altered. |
|
|
SQL>alter system set memory_target=0 |
scope=both; |
|
Lab 12.1: Creating a Local External Job |
763 |
System altered.
SQL>
Since SGA_TARGET and SGA_MAX_SIZE are set to a nonzero value and MEMORY_TARGET is set to zero, you’re now running the instance in Automatic Shared Memory Management mode.
3.Manually configure each of the SGA components.
SQL> show parameter pool
NAME |
TYPE |
VALUE |
------------------------------------ |
----------- |
-------- |
_shared_io_pool_size |
big integer |
0 |
buffer_pool_keep |
string |
|
buffer_pool_recycle |
string |
|
global_context_pool_size |
string |
|
java_pool_size |
big integer |
12M |
large_pool_size |
big integer |
0 |
olap_page_pool_size |
big integer |
0 |
shared_pool_reserved_size |
big integer |
14050918 |
shared_pool_size |
big integer |
0 |
streams_pool_size |
big integer |
32M |
SQL> |
|
|
SQL>alter system set large_pool_size=4m scope=both;
SQL>alter system set shared_pool_size=268m scope=both;
SQL>alter system set sga_target=0 scope=both;
By setting the value of SGA_TARGET to zero, you effectively begin managing the SGA manually. You’ll need to set the individual pool sizes to nonzero values, as shown earlier.
Lab 12.1: Creating a Local External Job
This lab was created using Windows XP. However, it should also work using Unix (and in fact was tested using Linux).
This lab shows you how to create a local external job that is also a detached job. A detached job starts another process and then exits. Use a detached job when it is
impractical or impossible to wait for the job to complete. A detached job must point to
764 Appendix A n Lab Exercises
a program that has its detached attribute set to TRUE. These are the overall steps: create the external shell script that invokes an RMAN script, create the RMAN script that performs an archive log backup, and create the job and use a detached local external program.
1.Create the shell script that executes the RMAN script.
$ORACLE_HOME/scripts/archivelogbackup.sh #!/bin/sh
export ORACLE_HOME=/ora01/oracle/product/11.1.0 export ORACLE_SID=orcl
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib $ORACLE_HOME/bin/rman TARGET / @$ORACLE_HOME/scripts/archivelogbackup.rman trace /ora01/oracle/orcl/backup/logs/archivelogbackup.out &
exit 0
2.Next, create the RMAN script that runs the archive log backup.
$ORACLE_HOME/scripts/archivelogbackup.rman run {
BACKUP DEVICE TYPE sbt
ARCHIVELOG LIKE ‘/oraarc01/orcl%arc%‘ DELETE ALL INPUT;
# Let the scheduler know that the detached job completed
sql “ BEGIN DBMS_SCHEDULER.END_DETACHED_JOB_RUN(‘’sys.archivelog_backup’‘, 0,null); END; “;
}
3.Finally, return to SQL*Plus and execute the following PL/SQL block. Note that the ? embedded in the program_action field is a shortcut value for ORACLE_HOME:
BEGIN DBMS_SCHEDULER.CREATE_PROGRAM(
program_name => ‘sys.archivelog_backup’, program_type => ‘executable’,
program_action => ‘?/scripts/archivelogbackup.sh’, enabled => TRUE);
DBMS_SCHEDULER.SET_ATTRIBUTE(‘sys.archivelog_backup’, ‘detached’, TRUE); DBMS_SCHEDULER.CREATE_JOB(
job_name => ‘sys.archivelog_backup’, program_name => ‘sys.archivelog_backup’,