Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Oracle Database 11g.pdf
Скачиваний:
78
Добавлен:
10.06.2015
Размер:
12.69 Mб
Скачать

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’,

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]