TSH User Guide v1.3
TSH User Guide v1.3
Session
History
Author:
Christian
A.
Craft,
Oracle
Corporation
Date:
June
9th,
2014
Version
1.3
Overview
Proving
performance
gains
of
Exadata
requires
statistical
analysis
of
the
total
session
history,
including
charting
active
as
well
as
idle
sessions.
This
paper
outlines
a
method
for
capturing
total
session
history
statistics
over
a
specific
time
period.
Total
Session
History
can
be
used
in
conjunction
with
the
SQL
Replay
feature
of
Real
Application
Testing
and
SQL
Tuning
sets
to
determine
exactly
how
Exadata
will
impact
performance
of
a
particular
system.
Installation
Overview
The
installation
package
include
the
following
database
objects
• Table
-‐
TOTAL_SESSION_HISTORY
• Table
–
TSH_STATUS
• PL/SQL
Package
–
TSH_ADMIN
• Login
Trigger
Sample
• Logoff
Trigger
Sample
These
objects
can
be
created
in
any
schema
using
the
installation
scripts
provided.
The
default
schema
is
TSH.
Administrative
Functions
The
administrative
capabilities
include
3
functions
as
follows:
• TSH_ADMIN.TSH_START
• TSH_ADMIN.TSH_SNAP
• TSH_ADMIN.TSH_STOP
• TSH_ADMIN.IS_ACTIVE
• TSH_ADMIN.SET_ALERT
• TSH_ADMIN.ALERT_STATUS
TSH_START
The
START
Function
is
called
at
the
beginning
of
a
capture
session.
TSH_SNAP
The
SNAP
function
can
be
called
at
any
desired
interval
between
START
and
STOP
to
capture
interim
statistics
for
all
active
sessions.
TSH_STOP
The
STOP
function
is
called
to
terminate
a
capture
session.
The
STOP
function
will
be
called
automatically
if
an
error
is
detected
by
the
LOGIN/LOGOFF
triggers.
IS_ACTIVE
The
IS_ACTIVE
function
returns
TRUE
if
TSH
is
currently
capturing
session
statistics
upon
LOGON/LOGOFF.
SET_ALERT
The
SET_ALERT
function
accepts
one
argument
with
3
valid
values
that
affect
behavior
of
the
LOGON
and
LOGOFF
triggers
as
follows:
• SILENT
-‐
suppresses
all
errors
from
TSH
• ALERT_LOG
-‐
propagates
TSH
errors
to
the
database
alert.log
• APP_ALERT
-‐
allows
error
messages
to
be
raised
to
the
application
ALERT_STATUS
The
ALERT_STATUS
function
returns
the
current
TSH
alert
setting.
Session
Alert
The
Session
Alert
option
will
allow
exceptions
in
TSH
to
propagate
to
the
application
upon
invocation
of
the
SESSION_LOGON
and
SESSION_LOGOFF
function
calls.
This
can
result
in
unhandled
exceptions
at
the
application
level,
and
may
cause
unwanted
disruption
to
the
application.
Alert
Log
The
Alert
Log
option
allows
propagation
of
TSH
errors
into
the
database
alert
log
for
capture
and
diagnosis.
Statistics
Collected
The
following
statistics
are
collected
for
each
session.
The
statistics
reference
underling
GV$
(or
V$)
statistics.
For
details
of
each
statistic,
please
refer
to
the
standard
Oracle
documentation.
The
V$
views
are
used
for
session-‐level
capture
(in
LOGIN/LOGOFF
triggers)
because
a
particular
session
only
resides
on
the
local
instance.
The
GV$
views
are
only
used
in
the
START/STOP
functions
calls
that
capture
for
all
instances
system-‐wide.
V$SESSION
The
following
values
are
collected
from
V$SESSION
for
each
session
that
is
active
when
the
START
and
STOP
functions
are
called,
as
well
• SID
• SERIAL#
• USERNAME
• SERVER
• OSUSER
• PROCESS
• MACHINE
• PROGRAM
• TYPE
• CLIENT_INFO
• LOGON_TIME
• SERVICE_NAME
All
identifying
session-‐level
information
is
collected
as
shown
above
to
facilitate
identifying
of
business
processes
in
the
system.
V$SESSTAT
statistics
The
following
statistics
are
collected
from
the
V$SESSTAT
view
for
each
active
session.
Statistic
Name
Column
Name
user
commits
user_commits
user
rollbacks
user_rollbacks
user
calls
user_calls
session
logical
reads
session_logical_reads
CPU
used
by
this
session
cpu_used_by_this_session
DB
Time
db_time
Application
wait
time
application_wait_time
User
I/O
wait
time
user_io_wait_time
session
connect
time
session_connect_time
Messages
sent
messages_sent
Messages
received
messages_received
Physical
read
total
IO
requests
physical_read_total_io_req
Physical
read
multi
block
requests
physical_read_multi_block_req
Physical
read
requests
optimized
physical_read_requests_optim
physical
read
bytes
physical_read_bytes
Physical
write
total
IO
requests
physical_write_total_io_req
Physical
write
total
multi
block
requests
physical_write_total_multi_blk
Physical
write
total
bytes
physical_write_total_bytes
db
block
gets
db_block_gets
consistent
gets
consistent_gets
Physical
reads
physical_reads
Physical
read
flash
cache
hits
physical_read_flash_cache_hits
Physical
reads
direct
physical_reads_direct
Physical
read
IO
requests
physical_read_IO_requests
Db
block
changes
db_block_changes
Physical
writes
physical_writes
Physical
writes
direct
physical_writes_direct
Physical
writes
from
cache
physical_writes_from_cache
Physical
write
IO
reqests
physical_write_IO_reqests
Flash
cache
inserts
flash_cache_inserts
Physical
write
bytes
physical_write_bytes
DML
statements
parallelized
dml_statements_parallelized
DDL
Statements
parallelized
ddl_statements_parallelized
queries
parallelized
queries_parallelized
parse
count
(hard)
parse_count_hard
parse
count
(total)
parse_count_total
execute
count
execute_count
bytes
sent
via
SQL*Net
to
client
bytes_sent_via_sqlnet_to_client
bytes
received
via
SQL*Net
from
client
bytes_rec_via_sqlnet_from_cli
SQL*Net
roundtrips
to/from
client
sqlnet_roundtrips_tofrom_client
bytes
sent
via
SQL*Net
to
dblink
bytes_sent_via_sqlnet_to_dblink
bytes
received
via
SQL*Net
from
dblink
bytes_rec_via_sqlnet_from_dblink
SQL*Net
roundtrips
to/from
dblink
sqlnet_roundtrips_tofrom_dblink
Sorts
(memory)
sorts_memory
Sorts
(disk)
sorts_disk
Sorts
(rows)
sorts_rows
OS
User
time
used
os_user_time_used
OS
system
time
used
os_system_time_used