Download Jerry Held - SQLQuery.com

Document related concepts

Extensible Storage Engine wikipedia , lookup

Concurrency control wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Relational model wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Database wikipedia , lookup

Oracle Database wikipedia , lookup

Clusterpoint wikipedia , lookup

ContactPoint wikipedia , lookup

Database model wikipedia , lookup

Transcript
Donna C. Hamby
Sr. Principal
Instructor
Oracle University
Oracle Corporation
Oracle9i
Real
Application
Clusters
What Is a Cluster?
–
–
–
Interconnected
nodes
Cluster
software
hides the
structure
Disks available
for read and
write by node
or nodes
requiring the
data they
contain
Disks
Interconnect
Node
What Is Oracle9i Real
Application Clusters?
–
–
–
Database with
instances on
separate nodes
Physical or
logical access
to each
database file
Software
controls access
to
data
Database files
Instance on
each node
Cluster Hardware
Components
–
–
–
Nodes
Interconnect
Shared disk subsystem
Interprocess Communication
Software
–
OSD
Clusterware
Cluster
Manager
OSD
Clusterware
Cluster
Manager
Node
monitor
IPC
Node
monitor
IPC
–
–
Is the second main
subcomponent of
the OSD
clusterware
Controls
messages across
the interconnect
Transfers
messages and
data blocks for
Real Application
Clusters
Disk Access
 Shared disk access is
required for
Instance
–
–
–
OSD
Clusterware
Connections
to other
nodes
–
–
–
Control files
Data files
Online redo log files
A quorum (or voting)
disk on some
systems
Configuration data
Optionally, a server
parameter file
(SPFILE)
Disk Access
Instance
 Optional features
requiring shared disk
access include:
–
OSD
Clusterware
Connections
to other
nodes
–
–
Configuration
information for
management tools
Server parameter
file
Separate undo
tablespace for each
instance if using
automatic undo
management
Global Services Daemon
–
Instance
GSD
OSD
Clusterware
–
–
Coordinates with
other utilities and
tools to manage
Real Application
Clusters databases
and instances
One GSD supports
all databases on a
node
Requires no
configuration
Background Processes
Instance
LMON
LMD
LCK
DIAG
OSD
Clusterware
LMS0
 Additional
background
processes for a Real
Application Clusters
database consist of
–
–
–
–
–
LMON
LMD
LMSn
LCK
DIAG
Global Enqueue Service
Monitor
–
Instance
LMON
LMD
LCK
LMS0
DIAG
OSD
Clusterware
–
Monitors global
enqueues and
resources across
the cluster
Performs
recovery
operations for
cluster enqueues
Global Enqueue Service
Daemon
–
Instance
LMON
LMD
LCK
LMS0
DIAG
OSD
Clusterware
–
Manages access
to global
enqueues and
resources
Handles resource
requests from
other instances
Global Cache Service
Processes
–
Instance
LMON
LMD
LCK
LMS0
DIAG
OSD
Clusterware
–
Manage access
to data blocks
across the
cluster
Ship block
images between
the buffer
caches of
different
instances
(Cache Fusion)
LCK Process
–
Instance
LMON
LMD
LCK
LMS0
DIAG
OSD
Clusterware
–
Assists LMSn
processes with
requests for
resources
between
instances
Handles cache
resource
request that do
not involve
Cache Fusion:
dictionary and
Diagnosability Daemon
–
Instance
LMON
LMD
LCK
LMS0
DIAG
OSD
Clusterware
–
–
Captures diagnostic
information related to
instance process
failures
Logs information to
the directory specified
by
BACKGROUND_DUMP_
DEST
Process cannot be
configured and should
not be stopped
GSD Management
–
Windows
gsdservice -install
gsdservice -start
gsdservice -remove
UNIX
gsd
Successfully started
the daemon on the local
node.
–
Start a GSD on all the
nodes in your Real
Applications Clusters
database for use by the
management tools
including
 SRVCTL
 the DBCA
 OEM
Run only one GSD on
each node
Server Control Utility
 The Server Control Utility
(SRVCTL)
–
Agent
Agent
–
SRVCTL
SRVCTL
–
GSD
GSD
Node 1
Node 2
–
Is the preferred tool to
administer your Real
Application Clusters database
environment
Manages cluster database
configuration information used
by several Oracle tools
Provides cluster database
management commands
Requires the GSD to be
running
SRVCTL Command Syntax
srvctl
Usage: srvctl
{start|stop|status|config|add|delete|rename|
move|get|set|unset} [options]
srvctl config -h
Usage: srvctl config [-p <db_name>
[-n <node>]][-D <dbglvl>] [-h] [-V]
-p <db_name>
Show configuration for
specified cluster database . . .
-n <node> Only show services on named node
-D <debuglvl>
Debug level
-h
Print usage
-V
Show version
SRVCTL Cluster Database
Configuration Tasks
 Modify database configuration information
–
–
–
–
–
–
Add and delete cluster databases
Add instances to and delete instances from a
cluster database
Rename instances
Move instances
Set and unset the environment for an entire
cluster database
Set and unset instance environments
Add and Delete Databases
 Add database configuration information
srvctl add db –p T2 –o $ORACLE_HOME
 Remove database configuration information
srvctl delete db –p T1
Add and Delete Instances
 Add instance configuration information
srvctl add instance –p T2 –i T2N3 –n raclust3
 Remove instance configuration information
srvctl delete instance –p T2 –i T2N1
Move and Rename Instances
 Move instance to new node in the static
configuration
srvctl move instance -p T2 -i T2N2 -n raclust1
 Rename instance in the repository
srvctl rename instance -p T2 -i T2N2 -e T2N1
Store and Remove
Environment Data
 Store database-wide environment setting
srvctl set env -p T2 -t LANG=us
 Store instance-specific environment setting
srvctl set env -p T2 -t LANG=gb -i T2N1
 Remove environment setting from single instance
srvctl unset env -p T2 -t LANG -i T2N3
SRVCTL Cluster Database
Tasks
 Manage cluster database components
–
–
–
–
–
Start cluster databases and instances
Stop cluster databases and instances
Start and stop listeners associated with a cluster
database
Start and stop listeners associated with a cluster
database instance
Obtain the status of a cluster database instance
Starting Databases and
Instances
 Start all instances and listeners
srvctl start -p T2
 Start two named instances with their listeners
srvctl start -p T2 –i T2N1,T2N2
 Start listener only on one node
srvctl start –p T2 –n raclust3 –s lsnr
Starting Databases and
Instances
 Start all instances with nondefault connect
string start -p T2 –c 'admin/adm1n as sysdba'
srvctl
 Start listeners and open instances with special
parameter file on two nodes
srvctl start -p T2 –n raclust1,raclust2 \
–o pfile=/ora/admin/initADMIN.ora
Stopping Databases and
Instances
 Stop an instance only, not the listener
srvctl stop –p T2 –i T2N3 –x lsnr
 Shut down instances and listeners on three
nodes using a nondefault connect string
srvctl stop -p T2 \
–n raclust2,raclust3,raclust4 \
–c admin/adm1n as sysdba
SRVCTL Cluster Database
Tasks
 Manage cluster database components
–
–
–
–
–
Start cluster databases and instances
Stop cluster databases and instances
Start and stop listeners associated with a cluster
database
Start and stop listeners associated with a cluster
database instance
Obtain the status of a cluster database instance
Starting Databases and
Instances
 Start all instances and listeners
srvctl start -p T2
 Start two named instances with their
listeners
srvctl start -p T2 –i T2N1,T2N2
 Start listener only on one node
srvctl start –p T2 –n raclust3 –s lsnr
Starting Databases and
Instances
 Start all instances with nondefault connect
string start -p T2 –c 'admin/adm1n as sysdba'
srvctl
 Start listeners and open instances with special
parameter file on two nodes
srvctl start -p T2 –n raclust1,raclust2 \
–o pfile=/ora/admin/initADMIN.ora
Stopping Databases and
Instances
 Stop an instance only, not the listener
srvctl stop –p T2 –i T2N3 –x lsnr
 Shut down instances and listeners on three
nodes using a nondefault connect string
srvctl stop -p T2 \
–n raclust2,raclust3,raclust4 \
–c admin/adm1n as sysdba
Inspect Status of Cluster
Database
 List the active instances
srvctl status -p T2
 Show the status of two instances
srvctl status -p T2 –i T2N1,T2N4 –s inst
 Display the status of the listener on one
node
srvctl status –p T2 –n raclust2 –s lsnr
Inspect Database
Configuration Information
 List the instances defined for a database
srvctl config -p T2
 List environment information for a
database
srvctl get env -p T2
 List environment information for an
srvctl get env -p T2 –i T2N4
instance
Cache Fusion.
• Cache Fusion helps provide transparent
scalability in a Real Application Clusters
database
• The algorithms enable transportation of block
images between instances
• The algorithms enable transportation of block
images between instances
• Cache Fusion services track the current
location and status of resources
• Directory structures within the SGA of each
instance store the resource information
Cache Fusion Block Transfers:
Example Overview
Instance A
Instance B
Instance C
Resource
master
Instance D
1008
Example 1: Read with No
Transfer
Instance B
Instance A
Instance C
Request to
obtain a shared N
resource on C
1
Resource
master
Instance D
1008
Example 1: Read with No
Transfer
Instance B
Instance A
Instance C
N–>S
N
1
Resource
master
Instance D
2
The request is granted
and the requesting
instance is informed
1008
Example 1: Read with No
Transfer
Instance A
Instance B
Instance C
S
1
Resource
master
Instance D
2
Read
request
1008
3
Example 1: Read with No
Transfer
Instance A
Instance B
Instance C
S
1008
1
Resource
master
4
1008
2
3
Instance D
Block image
delivered
Example 2: Read to Write
Transfer
Instance A
Request to obtain an
exclusive resource on B
Instance B
N
1
Instance C
S
1008
Resource
master
Instance D
1008
Example 2: Read to Write
Transfer
Instance A
Instance B
N
1
Instance C
S
1008
Resource
master
Instance D
2
Instruction to transfer
the block to B for
exclusive access
1008
Example 2: Read to Write
Transfer
Instance A
Instance B
N
1008
1
Instance C
S–>N
1008
Resource
master
Instance D
2
3
Block and
resource status
(including C’s
plan to close
its resource)
1008
Example 2: Read to Write
Transfer Resource assumption
Instance A
and status message
4
Instance B
N–>X
1009
1
Instance C
N
1008
Resource
master
Instance D
2
3
1008
Example 3: Write to Write
Transfer
Instance A
Instance B
N
X
1009
1
Instance C
Request to obtain
resource in
exclusive mode
Resource
master
Instance D
1008
Example 3: Write to Write
Transfer
Instance A
Instance B
N
X
1009
1
Resource
master
Instance D
Instance C
2
Instruction to transfer
exclusive resource to B
1008
Example 3: Write to Write
Transfer
Instance A
N
Instance B
3
Exclusive-keep
copy of buffer
X–>N
1009
1009
1
Resource
master
Instance D
Instance C
2
1008
Example 3: Write to Write
Transfer
Instance A
N–>X
Instance B
N
3
1013
1
1009
4
Resource
master
Instance D
Instance C
2
1008
Example 4: Write to Read
Transfer
Instance A
Instance B
X
N
1013
1009
Instance C
Request to obtain
resource in
shared mode 1
Resource
master
Instance D
N
1008
Example 4: Write to Read
Transfer
Instance A
Instance B
X
N
1013
1009
2
Instruction
to transfer
shared
resource
to C
Resource
master
Instance D
Instance C
N
1
1008
Example 4: Write to Read Transfer
Instance A
X–>S
Instance B
Shared-keep
copy of buffer
3
1013
2
N
1009
Instance C
N
1
Resource
master
Instance D
1013
1008
Example 4: Write to Read
Transfer
Instance A
Instance B
S
N
3
1013
1009
2
Instance C
N–>S
1
Resource
master
Instance D
4
1013
Resource
assumption
information
1008
Block Transfers in Real
Application Clusters
Cache Fusion block transfer
Instance
A
Instance
B
Block transfer with forced disk write
Node 1
Node 2
Notes on Using Multiblock
Locks
 Use only for query intensive or alreadypartitioned databases
 GC_FILES_TO_LOCKS -Assign the same
value to for every instance in a cluster
database
 Leave no white space in the parameter
value between the double quotes: separate
the entries for each set of file IDs with a
colon
Notes on Using Multiblock
Locks
 Configure Cache Fusion, instead of
multiblock locks, for selected files by
–
–
Not including their IDs in
GC_FILES_TO_LOCKS
Setting their LOCK_COUNT to zero and not
assigning a grouping factor
Real Application Clusters
Guard Architecture
Vendor
CMS
Node
A
(Primary)
Node
B
(Secondary)
Vendor
CMS
Pack
Oracle instance
Listeners
IP addresses
Pack
Application or
middleware
IP (A)
IP (B)
Oracle instance
Listeners
IP addresses
Monitors
DGM
Monitors
DGM
Disk group manager, only
needed on some platforms
Real Application Clusters
Guard Failover
Vendor
CMS
Pack
Oracle instance
Listeners
IP addresses
Monitors
DGM
Node
A
Node
B
(New primary)
Failover
Pack
Application or
middleware
IP (A)
Vendor
CMS
IP (B)
Instance monitor
Listener monitor
Heartbeat monitor
Oracle instance
Listeners
IP addresses
Monitors
DGM
Listeners
 Multiple listeners
enable
–
–
–
Clients
Listeners
Cluster
nodes
Client load balancing
Connect-time failover
Transparent
Application Failover
(TAF)
TNS Connect Descriptors
rac1=
(DESCRIPTION=
(ADDRESS=
(PROTOCOL=tcp)
(HOST=aaacme1)
(PORT=1630))
(CONNECT_DATA=
(SERVICE_NAME=rac.us.aaacme.com)))
$ sqlplus qualassur1@rac1
SQL*Plus: – Production
(c) Copyright 2000 Oracle Corporation. All
rights reserved.
Enter password:
Host-Based Failover
 Detect failure by monitoring the heartbeat
 Reorganize cluster membership in the Cluster
Manager
 Transfer disk ownership from the primary
node to a secondary node
 Restart application and database binaries
 Perform application and database recovery
 Reestablish client connections to the failover
node
Real Application Clusters
Failover




Detect failure by monitoring the heartbeat
Reorganize instance membership
Perform instance recovery
Reestablish failed client connections
TAF in Real Application
Clusters
 Can be used with spare nodes or with
primary/secondary instance configurations
 Designed for this environment, but can be
used for
–
–
–
Real Application Clusters Guard
Replicated systems
Data Guard
TAF Failover Mode Options
 Must add failover options manually to TNS
configuration files
 They are part of the CONNECT_DATA section
of a connect descriptor
TAF Failover Mode Options
 Failover options include
–
–
–
–
–
TYPE: Identify the nature of TAF, if any
METHOD: Configure how quickly failover can
occur
BACKUP: Identify an alternate net service name
RETRIES: Limit the number of times a
reconnection will be attempted
DELAY: Specify how long to wait between
reconnection attempts
TAF Implementation
 The recommended configurations for TAF
include:
–
–
–
Connect-time failover with client load balancing
Retrying connections
Pre-establishing connections
Connect-Time Failover with
Client Load Balancing
rac.us.aaacme.com=
(DESCRIPTION=
(LOAD_BALANCE=on)
(FAILOVER=on)
(ADDRESS=
(PROTOCOL=tcp)
(HOST=aaacme1)
(PORT=1521))
(ADDRESS=
(PROTOCOL=tcp)
(HOST=aaacme2)
(PORT=1521))
(CONNECT_DATA=
(SERVICE_NAME=rac.us.aaacme.com)
(FAILOVER_MODE=
(TYPE=select)(METHOD=basic))))
Retrying Failover Connections
rac1=
(DESCRIPTION=
(ADDRESS=
(PROTOCOL=tcp)
(HOST=aaacme1)
(PORT=1521))
(CONNECT_DATA=
(SERVICE_NAME=rac1.us.aaacme.com)
(FAILOVER_MODE=
(TYPE=select)(METHOD=basic)
(BACKUP=rac2) (RETRIES=20)
(DELAY=15))))
rac2=
(DESCRIPTION=
. . .
Preestablishing a Connection
for TAF
rac1=
(DESCRIPTION=
(ADDRESS=
(PROTOCOL=tcp)
(HOST=aaacme1)
(PORT=1521))
(CONNECT_DATA=
(SERVICE_NAME=
rac.us.acme.com)
(INSTANCE_NAME=rac1)
(FAILOVER_MODE=
(BACKUP=rac2)
(TYPE=select)
(METHOD=preconnect)
)))
rac2=
(DESCRIPTION=
(ADDRESS=
(PROTOCOL=tcp)
(HOST=aaacme2)
(PORT=1521))
(CONNECT_DATA=
(SERVICE_NAME=
rac.us.acme.com)
(INSTANCE_NAME=rac2)
(FAILOVER_MODE=
(BACKUP=rac1)
(TYPE=select)
(METHOD=preconnect)
)))
Q U E S T I O N S
A N S W E R S