Using Accounting Setup Manager
Chapter 2
Managing Oracle Database
1
Objectives
After completing this lesson, you should be able to:
• Use Oracle Enterprise Manager
• Access a database with SQL*Plus
• Modify database initialization parameters
• Describe the stages of database startup
• Describe database shutdown options
• View the alert log
2
Oracle Enterprise Manager
3
Database Home Page
Property pages
4
Other Oracle Tools
• SQL*Plus provides an additional interface
to your database so that you can:
▪ Perform database management operations
▪ Execute SQL commands to query, insert, update, and delete data in your
database
• SQL Developer:
▪ Is a graphical user interface for accessing your instance of Oracle Database
▪ Supports development in both SQL and PL/SQL
▪ Is available in the default installation of Oracle Database
5
Initialization Parameter Files
spfileorcl.ora
or
initorcl.ora
6
Simplified Initialization Parameters
Basic Advanced
CONTROL_FILES DB_CACHE_SIZE
DB_BLOCK_SIZE DB_FILE_MULTIBLOCK
PROCESSES _READ_COUNT
UNDO_TABLESPACE SHARED_POOL_SIZE
… …
8
Initialization Parameters: Examples
Parameter Specifies
CONTROL_FILES One or more control file names
DB_FILES Maximum number of database files
PROCESSES Maximum number of OS user processes that can
simultaneously connect
DB_BLOCK_SIZE Standard database block size used by all
tablespaces
DB_CACHE_SIZE Size of the standard block buffer cache
9
Initialization Parameters: Examples
Stack User Stack User
Space Global Space Global
Area Area
PGA PGA
KEEP
Database buffer pool
Redo log
Shared pool buffer
buffer
cache RECYCLE
buffer pool
Java pool Streams nK buffer
Large pool pool cache
System Global Area (SGA)
SGA_TARGET (Total size of all SGA components)
MEMORY_TARGET (Total size of system-wide usable memory)
10
Initialization Parameters: Examples
Parameter Specifies
PGA_AGGREGATE_TARGET Amount of PGA memory allocated to all server
processes
SHARED_POOL_SIZE Size of shared pool (in bytes)
UNDO_MANAGEMENT Undo space management mode to be used
12
Using SQL*Plus to View Parameters
SQL> SELECT name , value FROM V$PARAMETER;
NAME VALUE
------------ ----------
lock_name_space 2
processes 150
sessions 247
timed_statistics TRUE
timed_os_statistics 0
…
SQL>SHOW PARAMETER SHARED_POOL_SIZE
NAME TYPE VALUE
------------------------------------ ----------- ---------------------
shared_pool_size big integer 0
SQL> show parameter para
NAME TYPE VALUE
------------------------------------ ----------- ---------------------
fast_start_parallel_rollback string LOW
parallel_adaptive_multi_user boolean TRUE
parallel_automatic_tuning boolean FALSE
parallel_execution_message_size integer 16384
parallel_instance_group string
…
13
Changing Initialization Parameter Values
• Static parameters:
▪ Can be changed only in the parameter file
▪ Require restarting the instance before taking effect
▪ Account for about 110 parameters
• Dynamic parameters:
▪ Can be changed while database is online
▪ Can be altered at:
⁃ Session level
⁃ System level
▪ Are valid for duration of session or based on SCOPE setting
▪ Are changed by using ALTER SESSION and ALTER SYSTEM commands
▪ Account for about 234 parameters
15
Changing Parameter Values: Examples
SQL> ALTER SESSION
SET NLS_DATE_FORMAT ='mon dd yyyy';
Session altered.
SQL> SELECT SYSDATE FROM dual;
SYSDATE
-----------
jun 18 2009
SQL> ALTER SYSTEM SET SEC_MAX_FAILED_LOGIN_ATTEMPTS=2
COMMENT='Reduce from 10 for tighter security.'
SCOPE=SPFILE;
System altered.
17
Quiz
Enterprise Manager Database Control can be used to
manage many databases concurrently.
1. True
2. False
18
Quiz
The majority of the database parameters are dynamic
and can be changed without having to shut down the
database instance.
1. True
2. False
19
Starting Up an Oracle Database Instance
2
1
5
4
20
Database Startup and Shutdown: Credentials
or 1
21
Starting Up an Oracle Database Instance: NOMOUNT
OPEN
STARTUP
MOUNT
NOMOUNT
Instance
started
SHUTDOWN
22
Starting Up an Oracle Database Instance:
MOUNT
OPEN
STARTUP
MOUNT
Control file
opened for this
NOMOUNT instance
Instance
started
SHUTDOWN
23
Starting Up an Oracle Database Instance:
OPEN
OPEN
STARTUP All files opened as
described by the control
MOUNT file for this instance
Control file
opened for this
NOMOUNT instance
Instance
started
SHUTDOWN
24
Startup Options: Examples
• Using the sqlplus utility:
SQL> startup 1
SQL> startup nomount 2
SQL> alter database mount; 3
SQL> alter database open; 4
$ srvctl start database –d orcl –o mount
• Using the srvctl utility with Oracle Restart
25
Shutting Down
an Oracle Database Instance
26
Shutdown Modes
Shutdown Modes A I T N
Allows new connections No No No No
Waits until current sessions end No No No Yes
Waits until current transactions end No No Yes Yes
Forces a checkpoint and closes files No Yes Yes Yes
Shutdown modes:
• A = ABORT
• I = IMMEDIATE
• T = TRANSACTIONAL
• N = NORMAL
27
Shutdown Options
On the way down: During: On the way up:
• Uncommitted SHUTDOWN • No instance
changes rolled NORMAL recovery
back, for or
IMMEDIATE SHUTDOWN
TRANSACTIONAL
• Database buffer or
SHUTDOWN
cache written to
IMMEDIATE
data files
• Resources
released
Consistent database
28
Shutdown Options
On the way down: During: On the way up:
• Modified buffers SHUTDOWN ABORT • Online redo
not written to or log files used
data files Instance failure to reapply
or changes
• Uncommitted STARTUP FORCE
changes not • Undo
rolled back segments
used to roll
back
uncommitted
changes
Inconsistent database • Resources
released
30
Shutdown Options: Examples
• Using SQL*Plus:
SQL> shutdown 1
SQL> shutdown transactional 2
SQL> shutdown immediate 3
SQL> shutdown abort 4
• Using the SRVCTL utility with Oracle Restart
$ srvctl stop database –d orcl –o abort
31
Viewing the Alert Log
Database Home page > Related Links region >
Alert Log Content
32
Summary
In this lesson, you should have learned how to:
• Start and stop the Oracle database and components
• Use Oracle Enterprise Manager
• Access a database with SQL*Plus
• Modify database initialization parameters
• Describe the stages of database startup
• Describe database shutdown options
• View the alert log
34
Practice 2 Overview:
Managing the Oracle Instance
This practice covers the following topics:
• Navigating in Enterprise Manager
• Viewing and modifying initialization parameters
• Stopping and starting the database instance
• Viewing the alert log
• Connecting to the database by using SQL*Plus
35