You are on page 1of 311

Understanding Oracle

Fundamentals

Tulsi ocp

Database structure

Oracle database has both physical and logical


Structure
-physical structure is made of o/s files
-logical structure is made of one or more
tablespaces and schema objects

Tulsi ocp

Physical Structures

Data files
Redo log files
Control files

Tulsi ocp

Physical structures

Data files are used to store all the


database objects which are administered
by the oracle system.
z Redo log files contain records of all
database changes which are carried out
in the course of transactions
z Control files record information about
physical structure of database
z

Tulsi ocp

Physical structure and the


database

datfile1
datfile3

datfile4

datfile 2
A

The total size of this database is size(A)+size(B)+size(c)

Tulsi ocp

Overview
Instance

User
process

Shared pool
Library
cache
Data dict.
cache

Server
process

SGA
Data buffer
cache

Redo log
buffer

PGA
SMON DBW0 PMON CKPT

Parameter
file
Password
file

Data
files

Control
files

LGWR Others

Redo
log
files
Archived
log files

Database

Tulsi ocp

Logical structure

Database
Tablespace
Segment
Extent
datablock

Tulsi ocp

Tablespace(contd)

Oracle stores data logically in tablespaces


z logical storage unit
z SYSTEM tablespace is always present and is
always ONLINE. Contains the Data
Dictionary
z One or more user defined table spaces can be
present, which may be ONLINE or
OFFLINE
z

Tulsi ocp

Schema Objects
z
z
z
z
z
z
z
z

Tables
Indexes - for faster access
Synonyms - to mask owner(security)
Sequences -used to automatically generate
numbers
Views - virtual tables
Triggers
Stored Procedures and Functions
Clusters - faster access

Tulsi ocp

Tablespace containing object from multiple


schemas
User tablespace
user1.tab1

user2.tab2

user1.tab1.ind

user3.tab1

Tulsi ocp

Space Allocation
z
z

A tablespace can contain objects from


different schemas
When an object is created in a
tablespace storage is allocated in
logical units called extents
An extent is a logical unit of database
storage space allocation made up of a
contiguous number of data blocks

Tulsi ocp

ORACLE Database

user1.tbl1
Data Dictionary
usr3.tbl1

usr2.vw1

usr2.tbl1

SYSTEM tablespace
TRAINING tablespace
Data1.ora
4 MB

Data2.ora
1 MB

Tulsi ocp

Data3.ora
4 MB

Data Blocks and Extents

Data Block

At the finest level of granularity, data is stored in


Data blocks.
One block corresponds to a number of physical
bytes on the disk

Extents

Storage allocation is done in terms of extents


Set of contiguous data blocks
One extent cannot span files

Tulsi ocp

Data Blocks
z
z
z
z
z
z

Header: Block addr. & segment type


Table directory
Row directory
Row data
PCTFREE
PCTUSED

Tulsi ocp

Segments

Segment

Set of extents that have been allocated for a


specific data structure
All extents belonging to a segment are stored in
one tablespace

Tulsi ocp

Types of Segments

Data Segment

Every non-clustered table has its own data


segment
Every cluster has its own data segment

Index Segment

Every index has its own index segment

Tulsi ocp

Types of Segments(contd)

Rollback Segment

Created to store undo information

Temporary Segment

Used as temporary work areas to complete


execution of SQL statements

Tulsi ocp

Oracle Instance

ORACLE Instance consists of

SGA
ORACLE Background processes

Tulsi ocp

Oracle Instance
An Oracle instance:
Is a means to access an Oracle database
Always opens one and only one database
Instance
Shared pool

SGA
Data buffer
cache

Redo log
buffer

SMON DBW0 PMON CKPT LGWR Others

Tulsi ocp

Memory
structures

Background
processes

Memory Structures & Processes


z

Memory Structures:

SGA [System Global Area]


PGA [Program Global Area]

Processes

User Process
ORACLE Processes
z
z

Server Processes
Background Processes

Tulsi ocp

User

User

User

User

System Global Area

DBWR

LGWR

SMON

Tulsi ocp

PMON

RECO

Memory Structures
System Global Area

Library cache

Database
buffer
cache

Data dictionary
cache

shared
pool

Tulsi ocp

Redo log
buffer

Tulsi ocp

Tulsi ocp

Tulsi ocp

Processes
z

User processes

Created and maintained to execute code of an


application program

ORACLE Processes

Server processes
Background processes

Tulsi ocp

Server Process
Handle requests from Client Process
z Communicate to ORACLE to carry out
requests from Client Process
z Ex: Reading data from data file into SGA if
data is not present in the SGA database
buffer
z

Tulsi ocp

Tulsi ocp

Tulsi ocp

Background Processes

Database writer(DBWR)
z Log writer(LGWR)
z Archiver(ARCH)
z System Monitor(SMON)
z Process Monitor(PMON)
z Checkpoint(CKPT)
z

Tulsi ocp

DBWR
The database writer process writes the
modified data base buffer blocks on to
the database files on disk
z Keeps most frequently used blocks in
memory
z

Tulsi ocp

Tulsi ocp

DBWR(contd)

The database writer writes modified data


blocks when

the buffer is full and a data block which is not in


memory is required
at checkpoint time-all committed and
uncommitted data is written

Tulsi ocp

LGWR
z

The log writer is the process responsible for


emptying the contents of the redo log buffer
onto the redo log files.
The log writer writes when

the redo log buffer is 1/3 full


at commit time
whenever the database buffers are written
checkpoint time

Tulsi ocp

Tulsi ocp

SMON and PMON

SMON performs instance recovery at startup


, makes free blocks available and cleans up
temporary segments
z PMON performs process recovery when a
process fails, cleans up cache and resources
used by a process
z

Tulsi ocp

SMON
Detection of deadlocks and termination of
one of the transactions
z Free fragmented space
z Release temporary segments
z Automatic Instance recovery when an
instance failure has occurred(by using Redo
Log)
z

Tulsi ocp

PMON
z

PMON is the process responsible for freeing


resources and rolling back aborted
transactions if a user process terminates
abnormally due to some error

Tulsi ocp

CKPT
Optional process
z Signals DBWR to write at checkpoints
z DBWR writes contents of DB buffer to disk
z Updates headers of data files and control
files to reflect the most recent checkpoint
z

Tulsi ocp

Tulsi ocp

Tulsi ocp

Tulsi ocp

SGA Buffers
z

Database buffer cache is emptied onto


the data files using the LRU algorithm
Redo log buffers have the changes
made to the database
Redo log buffers-are emptied onto
redo log files

Tulsi ocp

SGA Buffers (contd)

The data blocks which have been requested


by a user program are placed in the database
buffer cache before they can be processed by
the user program.
z Once a data block has been placed in one of
the buffers then it can be used not only by
the process which first requested it, but by
any other user process
z

Tulsi ocp

SGA Shared Pool


The shared pool-Oracle uses this area of the
SGA to store parsed SQL statements,
compiled functions and procedures, data
dictionary information and database triggers.
z Can be accessed by multiple applications
z

Tulsi ocp

PGA
Data and control info for one single server
process
z Allocated only when user gets connected
z

Tulsi ocp

Tulsi ocp

Database and Instance Startup

Start database [reads Parameter file before this]

Mount database

allocate & create SGA, Background processes


Associate database with previously started instance
Find and open control file
Read Redo /data file names from this file and confirm
existence

Open database

Open online log files and data files


Automatically perform instance recovery(SMON)
Tulsi ocp
Acquire one/more
rollback segments

Database and Instance Shutdown

Close database

Dismount database

Write all buffer data to disk


Close Online redo files and data files
Close database
Close control files
Dissociate database from Instance

Shut down instance

Remove SGA
fromocp
memory
Tulsi
T
i t b k
d

Overview
User
process

Server
process
PGA

Instance
SGA

Shared pool

ALERT
file
Trace
files

Data
files

Control
files

Parameter
file
Password
file

Database

Tulsi ocp

Redo
log
files

Overview
Database

Tablespace

Logical

Data file

Physical

Segment

Extent

Oracle
block

OS block

Tulsi ocp

Block Space
Utilization Parameters
INITRANS
MAXTRANS

PCTFREE
PCTUSED

Tulsi ocp

Block Space Usage


PCTFREE=20

Inserts

PCTUSED=40

80%

Inserts

80%
Inserts
40%

Inserts

Tulsi ocp

Tulsi ocp

Row chaining
z

The data for a row in a table may be too large to


fit into a single data block. In the first case, the
row is too large to fit into one data block when it
is first inserted. In this case, Oracle stores the
data for the row in a chain of data blocks (one or
more) reserved for that segment.
Row chaining most often occurs with large rows,
such as rows that contain a column of datatype
LONG or LONG RAW. Row chaining in these
cases is unavoidable.

Tulsi ocp

Row Migration
z

a row that originally fit into one data block is


updated so that the overall row length
increases, and the block's free space is already
completely filled. In this case, Oracle migrates
the data for the entire row to a new data block,
assuming the entire row can fit in a new block.
Oracle preserves the original row piece of a
migrated row to point to the new block
containing the migrated row; the rowid of a
migrated row does not change

Tulsi ocp

Building a Database for Performance

Creating a database is the first step in


managing a
database system
A database may have been created
automatically
as part of Oracle9i Server installation, or you
can
create a new one later

Tulsi ocp

To create a new database, you must have the


following:
A privileged account authenticated in one of
the
following ways:
By the operating system
Using a password file
Sufficient memory to start the instance
Sufficient disk space
Tulsi for
ocpthe planned
database

Planning Database File Locations

Keep at least two active copies of a database


control file on at least two different devices.
Multiplex the redo log files and put group
members on different disks.
Separate data files whose data:
Will participate in disk resource contention
across
different physical disk resources
Have different life
spans
Tulsi
ocp
Have different administrative characteristics

Creating a Database

An Oracle database can be created using:


Oracle Database Configuration Assistant
The CREATE DATABASE command

Tulsi ocp

Complete Database Creation

Complete database creation using the


following
options:
Create database
Save as a database template
Generate database creation scripts

Tulsi ocp

Creating a Database Manually

Decide on a unique instance and database


name
Choose a database character set
Set the operating system variables
Edit / Create the initialization parameter file
Start the instance (nomount)
Execute the CREATE DATABASE command
Run scripts to generate the data dictionary
and
Tulsi ocp
accomplish post creation steps

Tuning questions

who tunes?
z
application designers
z
application developers
z
database administrators
z
system administrators

Tulsi ocp

Why tune?
How much tuning ?
There are basically two forms of tuning
speed : short response time
high throughput scalability: higher load at a
comparable response time or throughput

Tulsi ocp

Tuning goals

z
z
z
z
z
z
z

Reducing or eliminating waits


Accessing the least number of blocks
Caching blocks in memory
Response time
Throughput
load
recovery time

Tulsi ocp

Examples of Measurable Tuning


Goals

z
z
z
z
z

Improved response time


Improved database availability
Improved database hit percentages
Improved memory utilization
fewer waits

Tulsi ocp

Common Tuning Problems

z
z
z

Bad session management


Bad cursor management
Bad relational designs

Tulsi ocp

proactive tuning considerations during


development

z
z
z
z
z
z

Tune the design


Tune the application
Tune the memory
Tune I/O
Tune contention
Tune the operating system

Tulsi ocp

Tuning steps during production

z
z
z
z

Locate the bottleneck by using tools


Determine the reason for the bottleneck
Resolve the cause
Check that the bottleneck has been resolved

Tulsi ocp

Performance versus safety


Trade-offs
Factors that affect performance
z
z
z
z
z
z
z

Multiple control files


Multiple redo log members in a group
frequent checkpointing
Backing up datafiles
Performing archiving
Block check number
Tulsi users
ocp and transactions
Number of concurrent

To enhance performance, you can use the


following data access methods:
z Indexes
1.
2.
3.

z
z

B-tree
Bitmap
Reverse key

Clusters
Histograms

Tulsi ocp

Tulsi ocp

Tulsi ocp

Bitmap indexes

z
z
z
z
z

used for low cardinality columns


good for multiple predicates
Minimal storage space used
Best for read-only systems
good for very large tables

Tulsi ocp

Creating bitmap indexes

Tulsi ocp

Comparison of B*tree and bitmap


indexes

Tulsi ocp

Reverse Key Index

Tulsi ocp

Creating reverse Key index

Tulsi ocp

clusters

Tulsi ocp

Cluster types

Tulsi ocp

Histograms
z
z

Describe data distribution


of a particular column
Allow the cost based
optimizer to estimate the
selectivity of a query

Tulsi ocp

Overview of SQL Processing


Architecture

The SQL processing architecture contains the


following main components:
z Parser
z Optimizer
z Row Source Generator
z SQL Execution Engine

Tulsi ocp

Tulsi ocp

parser
The parser performs two functions:
z Syntax analysis: This checks SQL statements
for correct syntax.
z Semantic analysis: This checks, for example,
that the current database objects and object
attributes referenced are correct.

Tulsi ocp

optimizer
The optimizer uses internal rules or costing
methods to determine the most efficient way of
producing the result of the query.
z The Oracle server provides two
z methods of optimization:
z cost-based optimizer (CBO)
z rule-based optimizer (RBO).

Tulsi ocp

Row Source Generator

z
z

The row source generator receives the optimal


plan from the optimizer.
It outputs the execution plan for the SQL
statement. The execution plan is a collection of
row sources structured in the form of a tree.
Each row source returns a set of rows for that
step.

Tulsi ocp

SQL Execution Engine

SQL execution is the component that operates


on the execution plan associated with a SQL
statement. It then produces the results of the
query.
Each row source produced by the row source
generator is executed by the SQL execution
engine.

Tulsi ocp

Steps in Optimizer Operations

z
z
z
z
z
z

Evaluation of expressions and conditions


Statement transformation
Choice of optimizer approaches
Choice of access paths
Choice of join orders
Choice of join methods

Tulsi ocp

Explain plan

Tulsi ocp

Tulsi ocp

Tulsi ocp

Optimization approaches
z
z

Cost based optimization


Rule based optimization

Tulsi ocp

CBO
z

z
z

Cost based (CBO)= Using the cost-based


approach, the optimizer determines which
execution plan is most efficient by considering
available access paths and factoring in
information based on statistics for the schema
objects
Chooses least cost path
statistics driven

Tulsi ocp

RBO
z
z
z

uses a ranking system


syntax driven
order of conditions does not matter

Tulsi ocp

z
z
z
z

Architecture of the CBO


Query Transformer
Estimator
Plan Generator

Tulsi ocp

Tulsi ocp

Query transformer

The main objective of the query transformer is to


determine if it is advantageous to change the form of
the query so that it enables generation of a better
query plan.

Tulsi ocp

Estimator

Selectivity
Cardinality
z
z
z
z

Effective cardinality
Group cardinality
Join cardinality
Distinct cardinality

Cost
z
z
z

Disk I/O
Cpu usage
Memory usage as units of work

Tulsi ocp

Understanding Access Paths for the CBO

z
z
z
z
z
z

Full Table Scans


Sample Table Scans
Rowid Scans
Index Scans
Cluster Scans
Hash Scans

Tulsi ocp

How the CBO Chooses the Join


Method

A nested loop join is inefficient when a join


returns a large number of rows (typically, more
than 10,000 rows is considered large), and the
optimizer might choose not to use it. The cost of
a nested loop join is calculated by the following
formula:

cost = access cost of A + (access cost of B *


number of rowsTulsi
from A)ocp

Hash join

cost = (access cost of A * number of hash


partitions of B) + access cost of B

Sort-merge join

cost = access cost of A + access cost of B +


(sort cost of A + sort cost of B)

Tulsi ocp

Use EXPLAIN PLAN


and TKPROF To Tune

Tulsi ocp

The Plan Table


z

A plan table holds execution plans generated by


the EXPLAIN PLAN statement.

The typical name for a plan table is plan_table,


but you may use any name you wish.

Create the plan table by running utlxplan.sql,


located in $ORACLE_HOME/rdbms/admin.

Tulsi ocp

Important Columns
in the Plan Table
statement_id
timestamp
operation
the
options
operation,
object name
optimizer
id
parent_id

Unique identifier for each execution plan


When the execution plan was generated
The operation performed in one step of
execution plan, such as table access
Additional information about the
such as by index ROWID
Name of table, index, view, etc. accessed
Optimizer goal used when creating
execution plan
Step number in execution plan
Step number of parent step

Tulsi ocp

EXPLAIN PLAN Prerequisites


z

INSERT privilege on a plan table

All necessary privileges to execute the


statement being explained

SELECT privileges on underlying tables of


views, if the statement being explained
involves views

Tulsi ocp

EXPLAIN PLAN Syntax


EXPLAIN PLAN
[SET STATEMENT_ID = <string in single quotes>]
[INTO <plan table name>]
FOR
<SQL statement>;

Tulsi ocp

Querying an Execution Plan from the


Plan Table
z

Use a CONNECT BY clause to trace the hierarchy

Use LPAD function to indent rows, making the hierarchy


easier to follow

Put statement_id in WHERE clause to retrieve only one


execution plan at a time

Sample script on next slide shows the most important


information

You can also try utlxpls.sql or utlxplp.sql in


$ORACLE_HOME/rdbms/admin

Tulsi ocp

Trace Files and TKPROF


z

The Oracle server process managing a database session


writes a verbose trace file when SQL trace is enabled for
the session.

TKPROF is a utility provided by Oracle that formats SQL


trace files into very helpful and readable reports.
TKPROF is installed automatically when the database
server software is installed. You invoke TKPROF from the
operating system command line; there is no graphical
interface for TKPROF.

Tulsi ocp

Enabling SQL Trace


At the instance level:
sql_trace = true
timed_statistics = true (optional)
In your own session:
ALTER SESSION SET sql_trace = TRUE;
ALTER SESSION SET timed_statistics = TRUE; (optional)

Tulsi ocp

Finding the Trace File


z

Look in the user dump destination. On OFA


compliant systems this will be
$ORACLE_BASE/admin/$ORACLE_SID/udu
mp
Check timestamps and file contents to see
which trace file is yours

Tulsi ocp

Formatting a Trace File


with TKPROF
Invoke TKPROF from the operating
system prompt like this:
tkprof <trace file> <output file> \
[explain=<username/password>] \
[sys=n] [sort=<keyword>]

Tulsi ocp

TKPROF Command-line Arguments


tkprof <trace file> <output file> \
[explain=<username/password>] \
[sys=n]

trace file
output file
explain=
sys=n

The SQL trace file to be formatted


The formatted output to be written by TKPROF
Database login to be used if you want the output to
include execution plans
Omit recursive SQL performed by the SYS user

Tulsi ocp

TKPROF Sample Output


SELECT a.customer_name, a.customer_number, b.invoice_number,
b.invoice_type, b.invoice_date, b.total_amount, c.line_number,
c.part_number, c.quantity, c.unit_cost
FROM
customers a, invoices b, invoice_items c
WHERE c.invoice_id = :b1
AND
c.line_number = :b2
AND
b.invoice_id = c.invoice_id
AND
a.customer_id = b.customer_id
call
count
------- -----Parse
1
Execute
1
Fetch
2
------- -----total
4

cpu
elapsed
disk
query
current
-------- ---------- ---------- ---------- ---------0.05
0.02
0
0
0
0.00
0.00
0
0
0
0.00
0.00
8
8
0
-------- ---------- ---------- ---------- ---------0.05
0.02
8
8
0

Misses in library cache during parse: 1


Optimizer goal: CHOOSE
Parsing user id: 34 (RSCHRAG)

Tulsi ocp

rows
---------0
0
1
---------1

Execution Plan Operations


TABLE ACCESS FULL
Perform a full table scan of the indicated table and
retrieve all rows that meet criteria from the WHERE
clause. Input: no subordinate operations. Output: the
necessary columns from the rows meeting all criteria.
SORT ORDER BY
Sort the input rows for the purpose of satisfying an
ORDER BY clause. Input: the rows to be sorted.
Output: the rows in sorted order.

Tulsi ocp

Execution Plan Operations


INDEX UNIQUE SCAN

Look up a complete key in a unique index. Input:


usually no subordinate operations. (Key values
typically come from the original query or a parent
operation.) Output: zero or one ROWIDs from the
index.
INDEX RANGE SCAN
Look up a key in a non-unique index, or an
incomplete key in a unique index. Input: usually
no subordinate operations. Output: zero or more
ROWIDs from the index.

Tulsi ocp

Execution Plan Operations


TABLE ACCESS BY INDEX ROWID
Look up rows in a table by their ROWIDs. Input: a
list of ROWIDs to look up. Output: the necessary
columns from the rows with the given ROWIDs.
NESTED LOOPS
Perform a join between two sets of row data using
the nested loops algorithm. Inputs: two separate
sets of row data. Output: the results of the join.
For each row Oracle reads from the first input, the
operations that make up the second input are
executed once and matching rows generate
Tulsi ocp
output.

Execution Plan Operations


HASH JOIN
Perform a join between two sets of row data
using the hash join algorithm. Inputs: two
separate sets of row data. Output: the results of
the join.
Oracle reads all rows from the second input and
builds a hash structure, before reading each
row from the first input one at a time. For each
row from the first input, the hash structure is
probed and matching rows generate output.

Tulsi ocp

Execution Plan Operations


NESTED LOOPS OUTER
Same as the NESTED LOOPS operation,
except that an outer join is performed.
SORT GROUP BY
Same as the SORT ORDER BY operation,
except that the rows are sorted and
grouped to satisfy a GROUP BY clause.

Tulsi ocp

Elements of a TKPROF Report


z

Report heading
TKPROF version, date run, sort option, trace file
One entry for each distinct SQL statement in trace file
Listing of SQL statement
OCI call statistics: count of parse, execute, and fetch
calls, rows processed, and time and I/O used
Parse information: parsing user, recursive depth,
library cache misses, and optimizer mode
Row source operation listing
Execution plan listing (optional)
Wait event listing (optional)

Tulsi ocp

Sample TKPROF Report Heading


TKPROF: Release 8.1.6.1.0 - Production on Wed Aug 9 19:06:36 2000
(c) Copyright 1999 Oracle Corporation.

All rights reserved.

Trace file: example.trc


Sort options: default
************************************************************************
count
= number of times OCI procedure was executed
cpu
= cpu time in seconds executing
elapsed = elapsed time in seconds executing
disk
= number of physical reads of buffers from disk
query
= number of buffers gotten for consistent read
current = number of buffers gotten in current mode (usually for update)
rows
= number of rows processed by the fetch or execute call

Tulsi ocp

Sample Call Statistics


SELECT
table_name
FROM
user_tables
ORDER BY table_name
call
count
------- -----Parse
1
Execute
1
Fetch
14
------- -----total
16

cpu
elapsed
disk
query
current
-------- ---------- --------- --------- --------0.01
0.02
0
0
0
0.00
0.00
0
0
0
0.59
0.99
0
33633
0
-------- ---------- --------- --------- --------0.60
1.01
0
33633
0

Misses in library cache during parse: 1


Optimizer goal: CHOOSE
Parsing user id: RSCHRAG [recursive depth: 0]

Tulsi ocp

rows
--------0
0
194
--------194

What the TKPROF Sample on the


Previous Slide Tells Us
z
z
z
z
z
z
z

The application called on Oracle to parse this statement once


while SQL trace was enabled.
The parse took 0.01 CPU seconds, 0.02 elapsed seconds.
No disk I/Os or buffer gets took place during the parse,
suggesting that no misses in the dictionary cache.
Oracle was called on to execute this statement once.
The execution took under 0.01 CPU seconds.
No disk I/Os or buffer gets took place during the execution.
(Queries often defer the work to the fetch phase.)
Oracle was called on 14 times to perform a fetch, and a total of
194 rows were returned.

Tulsi ocp

What the TKPROF Sample Tells


Us (continued)
z
z
z
z
z
z

Fetching took 0.59 CPU seconds, 0.99 elapsed seconds.


Fetching required 33,633 buffer gets in consistent mode, but no
physical reads were required.
The statement was not in the library cache (shared pool) when
the parse call came in.
The cost-based optimizer and a goal of choose were used to
parse the statement.
The RSCHRAG user was connected to the database when the
parse occurred.
This statement was executed directly by the application; it was
not invoked recursively by the SYS user or a database trigger.

Tulsi ocp

Sample Row Source Operation


Listing
Rows
------194
194
195
195
195
11146
11146
11339
12665
33
193
387
194
388

Row Source Operation


--------------------------------------------------SORT ORDER BY
NESTED LOOPS
NESTED LOOPS OUTER
NESTED LOOPS OUTER
NESTED LOOPS
TABLE ACCESS BY INDEX ROWID OBJ$
INDEX RANGE SCAN (object id 34)
TABLE ACCESS CLUSTER TAB$
INDEX UNIQUE SCAN (object id 3)
INDEX UNIQUE SCAN (object id 33)
TABLE ACCESS CLUSTER SEG$
INDEX UNIQUE SCAN (object id 9)
TABLE ACCESS CLUSTER TS$
INDEX UNIQUE SCAN (object id 7)

Tulsi ocp

Sample Execution Plan Listing


Rows
------0
194
194
195
195
195
11146
11146
11339
12665
33
193
387
194
388

Execution Plan
--------------------------------------------------SELECT STATEMENT
GOAL: CHOOSE
SORT (ORDER BY)
NESTED LOOPS
NESTED LOOPS (OUTER)
NESTED LOOPS (OUTER)
NESTED LOOPS
TABLE ACCESS (BY INDEX ROWID) OF 'OBJ$'
INDEX (RANGE SCAN) OF 'I_OBJ2' (UNIQUE)
TABLE ACCESS (CLUSTER) OF 'TAB$'
INDEX (UNIQUE SCAN) OF 'I_OBJ#' (NON-UNIQUE)
INDEX (UNIQUE SCAN) OF 'I_OBJ1' (UNIQUE)
TABLE ACCESS (CLUSTER) OF 'SEG$'
INDEX (UNIQUE SCAN) OF 'I_FILE#_BLOCK#' (NON-UNIQUE)
TABLE ACCESS (CLUSTER) OF 'TS$'
INDEX (UNIQUE SCAN) OF 'I_TS#' (NON-UNIQUE)

Tulsi ocp

TKPROF Reports: More Than Just


Execution Plans
z

z
z
z

Listing of SQL statements and library cache miss information


helps you determine if applications are using Oracles shared
SQL facility effectively.
Parse, execute, and fetch call counts help you determine if
applications are using Oracle APIs effectively.
CPU and I/O statistics help you zero in on resource-intensive
SQL statements.
Row counts on individual steps of the execution plans help
you rework inefficient execution plans.

Tulsi ocp

STATSPACK
Installing of statspack
C:/ORACLE/ORA92/RDBMS/ADMIN/SPCREATE.SQL
z Collection of statistics
EXECUTE STATSPACK.SNAP
z Automatic collection of statistics
C:/ORACLE/ORA92/RDBMS/ADMIN/SPAUTO.SQL
z Produce a report
C:/ORACLE/ORA92/RDBMS/ADMIN/SPREPORT.SQL
To collect timing information
set timed_statistics=TRUE
z

Tulsi ocp

Statspack output
zInformation

found on the first page:


zDatabase and instance name
zTime at which the snapshots were taken
zCurrent size of the caches
zLoad profile

Tulsi ocp

UTLBSTAT AND
UTLESTAT
zTHESE

UTILITIES
zGATHER PERFORMANCE FIGUES OVER
A DEFINED PERIOD
zRun the scripts form sql*plus as sysdba
zStatspack provide clearer statistics

Tulsi ocp

Sql*plus autotrace
zCreate

the plan_table table


zCreate and grant the plustrace role
zSql> c:/../sqlplus/admin/plustrce.sql
zGrant plustrce to scott;
zSet

autotrace on

Tulsi ocp

Getting Started With the Oracle


Server

-by tulsi ocp

Database Administration
Tools: Examples
Tool

Description

SQL*Plus Line Mode

A utility used for administrative


tasks such as starting up,
shutting down, or recovering a
database

Oracle Enterprise Manager

Graphical user interface to


administer, monitor, and tune one
or more databases

SQL*Loader

Utility for loading data from


external files into Oracle tables

Export or Import utility

Utility for exporting or importing


data in Oracle format

Password File utility

Utility for creating database


password file

Tulsi ocp

Database Administrator Users


The two default database administrator users
SYS
and SYSTEM are:
z
z

Created automatically
Granted the DBA role

Tulsi ocp

Users SYS and SYSTEM


SYS
z

Password:
change_on_instalSYSTEM
l
z Password:
manager
Owner of the
database data
z Owner of additional
dictionary
internal tables and views
used by Oracle tools

Tulsi ocp

Operating System Authentication


z
z
z

Set up the user to be authenticated by the


operating system.
Set REMOTE_LOGIN_PASSWORDFILE
to NONE.
Use the following commands to connect to
CONNECT
CONNECT // AS
AS SYSDBA
SYSDBA
aCONNECT
database:
/ AS SYSOPER
CONNECT / AS SYSOPER

Tulsi ocp

What Is Oracle Enterprise


Manager?
z
z
z
z
z
z

The Oracle unified system management


enterprise framework
Central view of complete managed system
Set of underlying services
Free-of-charge DBA Management Pack
Performance, tuning, diagnostics, and
change management packs
Application Management Pack

Tulsi ocp

Configuration Assistant

Tulsi ocp

Enterprise Manager
Console
1

Tulsi ocp

DBA Management Pack


z
z
z
z
z
z

Instance Manager
Security Manager
Storage Manager
Schema Manager
SQL*Plus Worksheet
Tools and wizards for data management
and backup

Tulsi ocp

Managing an Oracle Instance

-by tulsi ocp

Overview
User
process

Server
process
PGA

Instance
SGA

Shared pool

ALERT
file
Trace
files

Data
files

Control
files

Parameter
file
Password
file

Database

Tulsi ocp

Redo
log
files

The Initialization Parameter File


Instance
SGA
Data buffer
cache

Redo log
buffer

Shared pool
Library
cache
Data dict.
cache

SMON DBWR PMON CKPT LGWR ARCH

initU15.ora

SQL>
SQL>
SQL>
SQL>

CONNECT
CONNECT
STARTUP
STARTUP

// AS
AS SYSDBA
SYSDBA
PFILE=/DISK1/initU15.ora
PFILE=/DISK1/initU15.ora

Tulsi ocp

Uses of Parameters
z
z
z
z
z

Size the System Global Area (SGA).


Set database and instance defaults.
Set user or process limits.
Set limits on database resources.
Define various physical attributes of the
database, such as the database block
size.
Specify control files, archived log files, the
ALERT file, and trace file locations.

Tulsi ocp

Parameter File Example


# Initialization Parameter File: initU15.ora
db_name
= U15
control_files
= (/DISK1/control01.con,
/DISK2/control02.con)
db_block_size
= 8192
db_block_buffers
= 2048
shared_pool_size
= 52428800
log_buffer
= 64K
processes
= 50
db_files
= 1024
log_files
= 10
max_dump_file_size
= 10240
background_dump_dest = (/home/disk3/user15/BDUMP)
user_dump_dest
= (/home/disk3/user15/UDUMP)
core_dump_dest
= (/home/disk3/user15/CDUMP)
rollback segments
=

Tulsi ocp

STARTUP Command

Start up the instance and open the database:


STARTUP
STARTUP PFILE=/DISK1/initU15.ora
PFILE=/DISK1/initU15.ora

Tulsi ocp

ALTER DATABASE
Command

Change the state of the database from


NOMOUNT
todatabase
MOUNT:
ALTER
MOUNT;
ALTER DATABASE
DATABASE database
MOUNT;

Open the database as a read-only database:


ALTER
ALTER DATABASE
DATABASE database
database OPEN
OPEN READ
READ ONLY;
ONLY;

Tulsi ocp

Opening a Database in
Read-Only Mode
z
z

Any database can be opened as a readonly database


A read-only database can be used to:

Execute queries
Execute disk sorts using locally managed
tablespaces
Take data files offline and online, not
tablespaces
Perform recovery of offline data files and
tablespaces

Tulsi ocp

Shutdown Options
Shutdown Mode

Allow new connections

Wait until current sessions end

Wait until current transactions end

Force a checkpoint and close files

Shutdown mode:
A Abort

I Immediate

NO

T Transactional

N Normal

YES

Tulsi ocp

Example
V$PARAMETER
V$SGA
V$OPTION
V$PROCESS
V$SESSION
V$VERSION
V$INSTANCE

SGA

V$THREAD
V$CONTROLFILE
V$DATABASE
V$DATAFILE
V$DATAFILE_HEADER
V$LOGFILE

Control file

Tulsi ocp

Displaying Current
Parameter Values
z

Use the command:


SHOW
SHOW PARAMETER
PARAMETER control
control

Query the V$PARAMETER dynamic


performance
SELECT
name
v$parameter
SELECT
name FROM
FROMview:
v$parameter
WHERE
WHERE name
name LIKE
LIKE %control%;
%control%;

Tulsi ocp

Dynamic Initialization
Parameters
z

Some initialization parameters can be


modified while an instance is running.

ALTER
ALTER SESSION
SESSION SET
SET SQL_TRACE=true;
SQL_TRACE=true;

ALTER
ALTER SYSTEM
SYSTEM SET
SET TIMED_STATISTICS=true;
TIMED_STATISTICS=true;

ALTER
ALTER SYSTEM
SYSTEM SET
SET SORT_AREA_SIZE=131072
SORT_AREA_SIZE=131072 DEFERRED;
DEFERRED;

Tulsi ocp

Creating a Database

-by tulsi ocp

Overview
User
process

Server
process
PGA

Instance
SGA

Shared pool

ALERT
file
Trace
files

Data
files

Control
files

Parameter
file
Password
file

Database

Tulsi ocp

Redo
log
files

Creation Prerequisites
z

A privileged account authenticated in one


of the following ways:

z
z

By the operating system


Using a password file

Memory to start the instance


Sufficient disk space for the planned
database

Tulsi ocp

Planning Database File Locations


z

z
z

Keep at least two active copies of a


database control file on at least two
different devices.
Multiplex the redo log files and put group
members on different disks.
Separate data files whose data:

Will participate in disk resource contention


across different physical disk resources
Have different life spans
Have different administrative characteristics

Tulsi ocp

Oracle Software Locations


On UNIX

On Windows NT

/oracle_base

\oracle_base

/product

\oracle_home

/release_number
/bin
/dbs
/orainst
/sqlplus
...
/8.1.5
/admin
/local

Tulsi ocp

\admin\db_name
\admin\v815
\oradata\db_name

\bin
\database

Oracle Database Files


/u02/
oradata/
db01/
system01.dbf
control01.ctl
redo0101.rdo
...
db02/
system01.dbf
control01.ctl
redo0101.rdo
...

/u03/
oradata/
db01/
tools01.dbf
control02.ctl
redo0102.rdo
...

Tulsi ocp

db02/
users01.dbf
control02.ctl
redo0102.rdo
...

Creating a Database
z
z

Created using the Database Configuration


Assistant
Created manually using the CREATE
DATABASE command

Tulsi ocp

Using the Database


Configuration Assistant

Tulsi ocp

Pretuned Databases

Tulsi ocp

Predefined Sample Schemas

Tulsi ocp

Finishing Create Database

Tulsi ocp

Creating a Database Manually


1. Decide on a unique instance and database
name and database character set.
2. Set the operating system variables.
3. Prepare the parameter file.
4. Create a password file (recommended).
5. Start the instance.
6. Create the database.
7. Run scripts to generate the data dictionary
and accomplish postcreation steps.

Tulsi ocp

Operating System Environment


On Windows NT:
z Set the variable ORACLE_SID to use
SQL*Plus.
z Create the service and the password
file with ORADIM.
C:\>
C:\> ORADIM
ORADIM -NEW
-NEW -SID
-SID u16
u16 -INTPWD
-INTPWD password
password
-STARTMODE
-STARTMODE auto
auto
-PFILE
-PFILE ORACLE_HOME\DATABASE\initU16.ora
ORACLE_HOME\DATABASE\initU16.ora

Tulsi ocp

Starting the Instance

1.
1. Connect
Connect as
as SYSDBA.
SYSDBA.
2.
Start
the
in
2.SQL>
Start
the instance
instance
in NOMOUNT
NOMOUNT stage.
stage.
STARTUP
NOMOUNT
SQL>
STARTUP
NOMOUNT PFILE=initU16.ora
PFILE=initU16.ora
ORACLE
ORACLE instance
instance started.
started.

Tulsi ocp

Creating the Database


SPOOL
SPOOL creU16.log
creU16.log
STARTUP
STARTUP NOMOUNT
NOMOUNT PFILE=initU16.ora
PFILE=initU16.ora
CREATE
CREATE DATABASE
DATABASE U16
U16
MAXLOGFILES
MAXLOGFILES 55
MAXLOGMEMBERS
MAXLOGMEMBERS 55
MAXDATAFILES
MAXDATAFILES 100
100
MAXLOGHISTORY
MAXLOGHISTORY 100
100
LOGFILE
LOGFILE
GROUP
GROUP 11 ('/DISK3/log1a.rdo',/DISK4/log1b.rdo)
('/DISK3/log1a.rdo',/DISK4/log1b.rdo) SIZE
SIZE 11 M,
M,
GROUP
GROUP 22 ('/DISK3/log2a.rdo',/DISK4/log2b.rdo)
('/DISK3/log2a.rdo',/DISK4/log2b.rdo) SIZE
SIZE 11 MM
DATAFILE
DATAFILE
'/DISK1/system01.dbf'
'/DISK1/system01.dbf' size
size 50M
50M autoextend
autoextend on
on
CHARACTER
CHARACTER SET
SET WE8ISO8859P1;
WE8ISO8859P1;

Tulsi ocp

After the Database Is Created


The database contains:
z Data files that make up the SYSTEM
tablespace
z Control files and redo log files
z The user SYS with the password
CHANGE_ON_INSTALL
z

The user SYSTEM with the password


MANAGER

The rollback segment SYSTEM


Internal tables Tulsi
(but no ocp
data dictionary
views)

Creating Data Dictionary Views


and Standard Packages

-by tulsi ocp

Overview
Other objects created with the
database:
z Data dictionary

Base tables
Views

Dynamic performance tables


z Built-in PL/SQL packages
Database event triggers fire
automatically during a specific
event,
such as a server Tulsi
error. ocp
z

System
tablespace

Other
database
files
Database

Data Dictionary
z
z
z
z

Central to every Oracle


database
Describes the database and
its objects
Contains read-only tables
and views
Updated by SQL
commands:

z
z

DDL
Some DML

Owned by the user SYS


Tulsi
ocp
Stored in the SYSTEM

System
tablespace

Other
database
files
Database

Data Dictionary Contents


The data dictionary provides information
about:
z Logical and physical database structure
z Definitions and space allocations of
objects
z Integrity constraints
z Users
z Roles
z Privileges
Tulsi ocp
z Auditing

Base Tables and Data Dictionary


Views
The data dictionary contains two parts:
z Base tables:

Normalized
Created with database using sql.bsq script

Data dictionary views:

Used to simplify the base table information


Accessed through public synonyms
Created with the catalog.sql script

Tulsi ocp

How the Data Dictionary Is Used


The data dictionary has three primary uses:
z The Oracle server uses it to find
information about:

z
z

Users
Schema objects
Storage structures

The Oracle server modifies it when a DDL


statement is executed.
Users and DBAs can use it as a read-only
reference for information about the
Tulsi ocp
database.

Data Dictionary View Categories

DBA_xxx
All of the objects in the database
ALL_xxx
Objects accessible by the current user
USER_xxx
Objects owned by the current user

Tulsi ocp

Data Dictionary Examples


z

General overview

Schema objects

DBA_TABLES
DBA_OBJECTS

Space allocation

DICTIONARY

DBA_ SEGMENTS
DBA_FREE_SPACE

DICT_COLUMNS
DBA_TAB_COLUMNS
DBA_CONSTRAINTS
DBA_EXTENTS

Database structure

DBA_DATA_FILES
DBA_ROLLBACK_SEGS
DBA_TABLESPACES
Tulsi ocp

Dynamic Performance Tables


z
z

Virtual tables
Information accessed from:

z
z
z
z

Memory
Control file

Synonyms begin with V$


DBA uses to monitor and tune the
database
Listed in V$FIXED_TABLE
Example: V$DATAFILE for data file
information
Tulsi ocp

Stored Program Units


z

PL/SQL

Java

Oracles procedural language extension to


SQL
Stored in the data dictionary
Stored in the data dictionary
To execute, publish its call specification

External procedures

Written in C
Stored in a shared library
To execute, publish the call specification

Tulsi ocp

Stored PL/SQL Program Units


z
z
z
z
z
z

A procedure, function, package, or trigger


Can accept and return parameters
Functions can be called from SQL
A set of SQL and PL/SQL commands
Stored in the data dictionary
Loaded into the shared pool

Tulsi ocp

Stored PL/SQL Packages


A package:
z Groups logically related PL/SQL types,
items, and subprograms
z Has two parts:

A specification describes its components


A body implements the logic

Example: DBMS_SESSION.SET_ROLE

Package: DBMS_SESSION
Procedure: SET_ROLE

Tulsi ocp

Creating Data Dictionary Views


Script

Purpose

catalog.sql

Creates commonly used data dictionary


views and synonyms

catproc.sql

Runs scripts required for server-side


PL/SQL

Tulsi ocp

Maintaining the Control File

-by tulsi ocp

The Use of the Control File

Data
files

Control
files

Redo log
files

z
z

Small, binary file


Required:

Database
z
z
z

At mount
To operate

Linked to a single
database
Should be multiplexed
Loss may require recovery

Tulsi ocp

Control File Contents


z
z
z
z
z
z
z
z

Database name and identifier


Database creation date
Data file and redo log locations
Tablespace names
Log history
Backup information
Current log sequence number
Checkpoint information

Tulsi ocp

Multiplexing the Control File


control_files=(/DISK1/control01.con,/DISK2/control02.con)

Disk 1

Disk 2

control01.con

control02.con

Tulsi ocp

Maintaining Redo Log Files

-by tulsi ocp

Using Redo Log Files

Data
files

Control
files

Redo log
files

Database

Tulsi ocp

Redo Log Groups and Members

Group 1

Group 2

Group 3
Disk 1

Member

Member

Member

Member

Member

Member

Tulsi ocp

Disk 2

Oracle Architecture
SGA
Instance
Data buffer
cache

DBWR

Redo log
buffer

CKPT

ARCH

Control
files

Parameter
file
Password
file

LGWR

Redo
log
files

Data
files
Database

Tulsi ocp

Archived
log files

Without Archiving

Backup

Data files

Disk failure

Control
files

51

50

t1

100

t2

Tulsi ocp

101

With Archiving

Backup

Data files

Archived redo logs

Control
files

Disk failure

50

99
100

51

50

t1

t2

Tulsi ocp

101

Obtaining Information
About Archiving
z

SQL command:
ARCHIVE
ARCHIVE LOG
LOG LIST;
LIST;

V$DATABASE:

NAME
LOG_MODE

V$INSTANCE:
ARCHIVER

Tulsi ocp

Obtaining Information
About Groups
V$THREAD:
z GROUPS
z CURRENT_GROUP#
z SEQUENCE#

Tulsi ocp

Obtaining Information About


Groups and Members
V$LOG:
z GROUP#
z MEMBERS
z STATUS
z SEQUENCE#
z BYTES

Tulsi ocp

Obtaining Information About


Groups and Members
V$LOGFILE:
z GROUP#
z STATUS
z MEMBER

Tulsi ocp

Log Switches and Checkpoints


z

Force log switches with the command:


ALTER
ALTER SYSTEM
SYSTEM SWITCH
SWITCH LOGFILE;
LOGFILE;

Control checkpoints with the initialization


parameters:

LOG_CHECKPOINT_INTERVAL
LOG_CHECKPOINT_TIMEOUT
FAST_START_IO_TARGET

Tulsi ocp

Adding Online Redo Log Groups

ALTER
ALTER DATABASE
DATABASE ADD
ADD LOGFILE
LOGFILE
(/DISK3/log3a.rdo,
(/DISK3/log3a.rdo,
/DISK4/log3b.rdo)
/DISK4/log3b.rdo) size
size 1M;
1M;

log1b.rdo

log2b.rdo

Group 1

Group 2

Tulsi ocp

log3b.rdo

Group 3

Adding Online Redo Log Members

ALTER
ALTER DATABASE
DATABASE ADD
ADD
/DISK4/log1b.rdo
/DISK4/log1b.rdo
/DISK4/log2b.rdo
/DISK4/log2b.rdo

log1a.rdo

LOGFILE
LOGFILE MEMBER
MEMBER
TO
TO GROUP
GROUP 1,
1,
TO
TO GROUP
GROUP 2;
2;

log1b.rdo

log2a.rdo

Group 1

log2b.rdo

Group 2

Tulsi ocp

How to Relocate or Rename


Online Redo Log Files
1. Copy the online redo log files to the new
location.
2. Execute the ALTER DATABASE RENAME
FILE command.

Tulsi ocp

Dropping Online Redo


Log Groups

ALTER
ALTER DATABASE
DATABASE DROP
DROP LOGFILE
LOGFILE GROUP
GROUP 3;
3;

log3a.rdo
log1b.rdo

log1b.rdo

log1b.rdo

log2b.rdo

Group 1

Group 2

Tulsi ocp

log3b.rdo
Group 3

Dropping Online Redo


Log Members

ALTER
ALTER DATABASE
DATABASE DROP
DROP LOGFILE
LOGFILE MEMBER
MEMBER
/DISK4/log2b.dbf;
/DISK4/log2b.dbf;

log1b.rdo
log1b.rdo

log1b.rdo
log2b.rdo

Group 1

Group 2

Tulsi ocp

Clearing Online Redo Log Files

Example:
Example:
ALTER DATABASE

ALTER DATABASE CLEAR


CLEAR LOGFILE
LOGFILE
/DISK3/log2a.rdo;
/DISK3/log2a.rdo;

Tulsi ocp

Online Redo Log Configuration

Group 1

Group 2

Group 3

Member

Member

Member

Member
Member

Disk 1

Disk 2

Tulsi ocp

Disk 3

Possible LGWR Errors


z
z
z

One member of a group of two or more is


not available.
All members of the next group are not
available.
All members of the current group are not
available.

Tulsi ocp

Managing Tablespaces and Data


Files

-by tulsi ocp

Overview

Control
files

Data files

Redo log
files

Database

Tulsi ocp

Database Storage Hierarchy


Database

Tablespace

Logical

Data file

Physical

Segment

Extent

Oracle
block

OS block

Tulsi ocp

SYSTEM and Non-SYSTEM


Tablespaces
z

SYSTEM tablespace:

Created with the database


Contains the data dictionary
Contains the SYSTEM rollback segment

Non-SYSTEM tablespaces:

Separate segments
Ease space administration
Control amount of space allocated to a user

Tulsi ocp

Creating Tablespaces
CREATE
CREATE TABLESPACE
TABLESPACE app_data
app_data
DATAFILE
DATAFILE '/DISK4/app_data_01.dbf'
'/DISK4/app_data_01.dbf'
SIZE
SIZE 100M,
100M,
'/DISK5/app
'/DISK5/app data_
data_ 02.dbf'
02.dbf'
SIZE
SIZE 100M
100M
MINIMUM
MINIMUM EXTENT
EXTENT 500K
500K
DEFAULT
500K
DEFAULT STORAGE
STORAGE (( INITIAL
INITIAL
500K
NEXT
500K
NEXT
500K
MAXEXTENTS
500
MAXEXTENTS
500
PCTINCREASE
00 );
PCTINCREASE
);

Tulsi ocp

Space Management in Tablespaces


z

Dictionary-managed tablespaces:

Default technique
Free extents recorded in data dictionary tables

Locally managed tablespaces:

Free extents recorded in bitmap


Each bit corresponds to a block or group of
blocks
Bit value indicates free or used

Tulsi ocp

Locally Managed Tablespaces


CREATE
CREATE TABLESPACE
TABLESPACE user_data
user_data
DATAFILE
DATAFILE '/DISK2/user_data_01.dbf'
'/DISK2/user_data_01.dbf'
SIZE
SIZE 500M
500M
EXTENT
EXTENT MANAGEMENT
MANAGEMENT LOCAL
LOCAL
UNIFORM
UNIFORM SIZE
SIZE 10M;
10M;

z
z
z
z

Reduced recursive space management


Reduced contention on data dictionary
tables
No rollback generated
No coalescing required

Tulsi ocp

Temporary Tablespace
z
z
z
z

Used for sort operations


Cannot contain any permanent objects
Locally managed extents recommended
UNIFORM SIZE = SORT_AREA_SIZE * n
CREATE
CREATE TEMPORARY
TEMPORARY TABLESPACE
TABLESPACE temp
temp
TEMPFILE
TEMPFILE '/DISK2/temp_01.dbf'
'/DISK2/temp_01.dbf'
SIZE
SIZE 500M
500M
EXTENT
EXTENT MANAGEMENT
MANAGEMENT LOCAL
LOCAL
UNIFORM
UNIFORM SIZE
SIZE 10M;
10M;

Tulsi ocp

Changing the Storage Settings


ALTER
ALTER TABLESPACE
TABLESPACE
MINIMUM
MINIMUM EXTENT
EXTENT

app_data
app_data
2M;
2M;

ALTER
ALTER TABLESPACE
TABLESPACE app_data
app_data
DEFAULT
DEFAULT STORAGE
STORAGE ((
INITIAL
2M
INITIAL
2M
NEXT
2M
NEXT
2M
MAXEXTENTS
MAXEXTENTS 999
999 );
);

Tulsi ocp

Offline Status
z
z

Offline tablespace not available for data


access
Some tablespaces must be online:

SYSTEM
Tablespaces with active rollback segments

ALTER
ALTER TABLESPACE
TABLESPACE app_data
app_data OFFLINE;
OFFLINE;

To take a tablespace offline:

ALTER
ALTER TABLESPACE
TABLESPACE app_data
app_data ONLINE;
ONLINE;

To bring a tablespace online:

Tulsi ocp

Read-Only Tablespaces

ALTER
ALTER TABLESPACE
TABLESPACE app_data
app_data READ
READ ONLY;
ONLY;

z
z
z

Tablespace only available for read


operations
Objects can be dropped from tablespace
To create a read-only tablespace on a
WORM drive:

ALTER TABLESPACEREAD ONLY;


Move the data file to the WORM drive
ALTER TABLESPACERENAME
DATAFILE;Tulsi ocp

Making a Tablespace Read-Only


z
z
z
z
z

The tablespace must be online.


In releases prior to Oracle8i, no active
transactions are allowed.
Oracle8i onwards allows current
transactions to complete.
The tablespace must not contain active
rollback segments.
The tablespace must not currently be
involved in an online backup.

Tulsi ocp

Dropping Tablespaces

z
z
z

Tablespace removed from data dictionary


Optionally, contents removed from data
dictionary
OS TABLESPACE
files
not deleted
DROP
app_data
DROP
TABLESPACE
app_data INCLUDING
INCLUDING CONTENTS;
CONTENTS;

Tulsi ocp

Resizing a Tablespace
z

Change the size of a data file:

Automatically
Manually

Add a data file


Tablespace APP_DATA

app_data_01.dbf
100M

app_data_02.dbf
100M

100M

Tulsi ocp

app_data_03.dbf
200M

Enabling Automatic Extension


of Data Files
ALTER
ALTER TABLESPACE
TABLESPACE app_data
app_data
ADD
ADD DATAFILE
DATAFILE '/DISK6/app_data_04.dbf'
'/DISK6/app_data_04.dbf'
SIZE
SIZE 200M
200M
AUTOEXTEND
AUTOEXTEND ON
ON
NEXT
NEXT 10M
10M
MAXSIZE
MAXSIZE 500M;
500M;

Tablespace APP_DATA

app_data_01.dbf
100M

app_data_02.dbf
100M

app_data_03.dbf
200M

Tulsi ocp

app_data_04.dbf
200M

Changing the Size of Data Files Manually


ALTER
ALTER DATABASE
DATABASE
DATAFILE
DATAFILE
'/DISK5/app_data_02.dbf'
'/DISK5/app_data_02.dbf'
RESIZE
RESIZE 200M;
200M;
Tablespace APP_DATA

app_data_01.dbf
100M

app_data_02.dbf
100M

app_data_03.dbf
200M

100M

Tulsi ocp

app_data_04.dbf
200M

Adding Data Files to a Tablespace

ALTER
ALTER TABLESPACE
TABLESPACE app_data
app_data
ADD
ADD DATAFILE
DATAFILE '/DISK5/app_data_03.dbf'
'/DISK5/app_data_03.dbf'
SIZE
SIZE 200M;
200M;

Tablespace APP_DATA

app_data_01.dbf
100M

app_data_02.dbf
100M

app_data_03.dbf
200M

Tulsi ocp

Moving Data Files:


ALTER TABLESPACE

z
z

The tablespace must be offline.


The target data files must exist.
ALTER
ALTER TABLESPACE
TABLESPACE app_data
app_data
RENAME
RENAME
DATAFILE
DATAFILE '/DISK4/app_data_01.dbf'
'/DISK4/app_data_01.dbf'
TO
'/DISK5/app_data_01.dbf';
TO
'/DISK5/app_data_01.dbf';

Tulsi ocp

Obtaining Tablespace Information

Tablespace information:

Data file information:

DBA_TABLESPACES
V$TABLESPACE
DBA_DATA_FILES
V$DATAFILE

Tempfile information:

DBA_TEMP_FILES
V$TEMPFILE

Tulsi ocp

Storage Structure and


Relationships

-by tulsi ocp

Overview
Database

Tablespace

Logical

Data file

Physical

Segment

Extent

Oracle
block

OS block

Tulsi ocp

Types of Segments

Table

Table
partition

Cluster

Index

Tulsi ocp

Types of Segments

Index-organized
table

Index
partition

Rollback
segment

Temporary
segment

Tulsi ocp

Types of Segments

LOB
segment

LOB index

Nested table

Bootstrap
segment

Tulsi ocp

Storage Clause Precedence

Oracle default
Tablespace
Segment

Tulsi ocp

Extent Allocation and Deallocation


z

Allocated when the segment is:

Created
Extended
Altered

Deallocated when the segment is:

Dropped
Altered
Truncated
Automatically resized (rollback segments only)

Tulsi ocp

Used and Free Extents


Data file

File header

Used extent

Tulsi ocp

Free extent

Database Block: Review


z
z
z
z

Minimum unit of I/O


Consists of one or more OS blocks
Set by DB_BLOCK_SIZE
Set at database creation

Tulsi ocp

Database Block Contents

Header

Free space

Data

Tulsi ocp

Block Space
Utilization Parameters
INITRANS
MAXTRANS

PCTFREE
PCTUSED

Tulsi ocp

Block Space Usage


PCTFREE=20

Inserts

PCTUSED=40

80%

Inserts

80%
Inserts
40%

Inserts

Tulsi ocp

Data Dictionary Views


Used extents

Free extents

DBA_EXTENTS

DBA_FREE_SPACE

Segments

Data files

DBA_SEGMENTS

DBA_DATA_FILES

Tablespaces
DBA_TABLESPACES

Tulsi ocp

Querying DBA_SEGMENTS
z

General information

OWNER
SEGMENT_NAME z
SEGMENT_TYPE
TABLESPACE_NAME

Size

EXTENTS
BLOCKS
BYTES

Storage settings

INITIAL_EXTENT
NEXT_EXTENT
MIN_EXTENTS
MAX_EXTENTS
PCT_INCREASE

Other information

Location
Tuning

Tulsi ocp

Querying DBA_EXTENTS
z

Identification

OWNER
SEGMENT_NAME
EXTENT_ID

Size

BLOCKS
BYTES

Location

TABLESPACE_NAME
RELATIVE_FNO
FILE_ID
BLOCK_ID

Tulsi ocp

Querying
DBA_FREE_SPACE
z

Location

TABLESPACE_NAME
RELATIVE_FNO
FILE_ID
BLOCK_ID

Size

BYTES
BLOCKS

Tulsi ocp

Managing Rollback Segments

-by tulsi ocp

Undo/ Rollback Segment


Old image

New
image

Table
Rollback segment

Update transaction

Tulsi ocp

Undo/Rollback Segments: Purpose

Transaction rollback

Transaction
recovery

Rollback segment

Tulsi ocp

Read consistency

Read Consistency

Table

SELECT *
FROM table

New image
Image at start of statement

Tulsi ocp

Types of Rollback
Segments
z
z

SYSTEM: Used for objects in the SYSTEM


tablespace
Non-SYSTEM: Used for objects in other
tablespaces
automode: requires undo tablespace
manual mode:

Private: Acquired by a single instance


Public: Acquired by any instance

Deferred: Used when tablespaces are


taken offline with the immediate option

Tulsi ocp

AUTOMATIC UNDO
MANAGEMENT

Configure two parameters in the initialization file

Undo_management (auto/manual)
Undo_tablespace (undotbs)

Create at least one undo tablespace

Tulsi ocp

Transactions and Rollback


Segments

Transaction 1 Transaction 2

Active extent

Inactive extent

Tulsi ocp

Growth of Rollback
Segments

1
4

2
5

3
4

Active extent

New extent

Inactive extent

Tulsi ocp

Shrinkage of Rollback Segments

5
4

3
Active extent

OPTIMAL

Inactive extent

Tulsi ocp

Managing Tables

-by tulsi ocp

Storing User Data

Regular
table

Partitioned
table

Index-organized
table

Cluster

Tulsi ocp

Structure of a Row

Row header
Column length

Database block

Column value

Tulsi ocp

Oracle Data Types


Data type
User-defined

Built-in

Scalar

Collection

CHAR(N), NCHAR(N)
VARCHAR2(N),
NVARCHAR2(N)
NUMBER(P,S)
DATE
RAW(N)
BLOB, CLOB,
NCLOB, BFILE
LONG, LONG RAW
ROWID, UROWID

VARRAY
TABLE

Tulsi ocp

Relationship
REF

Data Types for Storing


Large Objects
LONG, LONG RAW

LOB

Single column per table

Multiple columns per table

Up to 2 gigabytes

Up to 4 gigabytes

SELECT returns data

SELECT returns locator

Data stored in-line

Data stored in-line or out-of-line

No object type support

Supports object types

Sequential access to chunks Random access to chunks

Tulsi ocp

ROWID Data Type

z
z

Unique identifier for a row


Used to locate a row
ROWID Format
OOOOOO

FFF

BBBBBB

RRR

Data object
number

Relative file
number

Block number

Row number

Tulsi ocp

Restricted ROWID

z
z
z
z

Can
Can identify
identify rows
rows within
within aa segment
segment
Needs
Needs less
less space
space
BBBBBBBB
Block number

RRRR
Row number

Tulsi ocp

FFFF
File number

Collections
z
z
z

Collections are objects that contain


objects.
VARRAYs are ordered sets of elements
containing a count and a limit.
Nested tables are tables with a column or
variable of the TABLE data type.

VARRAY

Nested
table

Tulsi ocp

Creating a Table
CREATE
CREATE TABLE
TABLE employee(
employee(
id
NUMBER(7),
id
NUMBER(7),
last_name
last_name VARCHAR2(25),
VARCHAR2(25),
dept_id
NUMBER(7))
dept_id
NUMBER(7))
PCTFREE
PCTFREE 20
20 PCTUSED
PCTUSED 50
50
STORAGE(INITIAL
STORAGE(INITIAL 200K
200K NEXT
NEXT 200K
200K
PCTINCREASE
PCTINCREASE 00 MAXEXTENTS
MAXEXTENTS 50)
50)
TABLESPACE
TABLESPACE data;
data;

Tulsi ocp

Row Migration and Chaining


Before update

After update

Pointer

Tulsi ocp

Managing Indexes

-by tulsi ocp

Classification of Indexes
z

Logical

Single column or concatenated


Unique or nonunique
Function-based

Physical

Partitioned or nonpartitioned
B-tree
Normal or reverse key
Bitmap

Tulsi ocp

B-Tree Index
Index entry
Root

Branch

Index entry header


Key column length

Leaf

Key column value


ROWID

Tulsi ocp

Reverse Key Index


Index on EMPLOYEE (ID)

KEY
ID
----1257
2877
4567
6657
8967
9637
9947
...
...

EMPLOYEE table

ROWID
(BLOCK# ROW# FILE#)
------------------0000000F.0002.0001
0000000F.0006.0001
0000000F.0004.0001
0000000F.0003.0001
0000000F.0005.0001
0000000F.0001.0001
0000000F.0000.0001
...
...

ID
----7499
7369
7521
7566
7654
7698
7782

...

FIRST_NAME JOB
---------- -------ALLEN
SALESMAN
SMITH
CLERK
WARD
SALESMAN
JONES
MANAGER
MARTIN
SALESMAN
BLAKE
MANAGER
CLARK
MANAGER
...
...
...
...
...
...

Tulsi ocp

Creating Function-Based Indexes


z
z

Dramatically
Dramatically improves
improves query
query performance
performance

CREATE
CREATE INDEX
INDEX summit.item_quantity_to_deliver_idx
summit.item_quantity_to_deliver_idx
ON
ON summit.item(quantity
summit.item(quantity -- quantity_shipped);
quantity_shipped);

SELECT
ord_id,
item_id
z
expressions
SELECT
ord_id,using
item_id
z Queries
Queries
using
expressions can
can use
use the
the
FROM
ITEM
FROMindex
ITEM
index
WHERE
WHERE (quantity
(quantity -- quantity_shipped)
quantity_shipped) >> 0;
0;

Tulsi ocp

Bitmap Index
File 3
Block 10

Table

Block 11
Block 12

Index

start
end
key ROWID ROWID
<Blue,
<Green,
<Red,
<Yellow,

10.0.3,
10.0.3,
10.0.3,
10.0.3,

12.8.3,
12.8.3,
12.8.3,
12.8.3,

Tulsi ocp

bitmap
1000100100010010100>
0001010000100100000>
0100000011000001001>
0010001000001000010>

Comparing B-Tree and


Bitmap Indexes
B-tree

Bitmap

Suitable for high-cardinality Suitable for low-cardinality


columns
columns
Updates on keys relatively
inexpensive

Updates to key columns very


expensive

Inefficient for queries


using OR predicates

Efficient for queries


using OR predicates

Useful for OLTP

Useful for data warehousing

Tulsi ocp

Creating Normal B-Tree Indexes

CREATE
CREATE INDEX
INDEX summit.employee_last_name_idx
summit.employee_last_name_idx
ON
ON summit.employee(last_name)
summit.employee(last_name)
PCTFREE
PCTFREE 30
30
STORAGE(INITIAL
STORAGE(INITIAL 200K
200K NEXT
NEXT 200K
200K
PCTINCREASE
PCTINCREASE 00 MAXEXTENTS
MAXEXTENTS 50)
50)
TABLESPACE
TABLESPACE indx;
indx;

Tulsi ocp

Creating Reverse Key Indexes

CREATE
CREATE UNIQUE
UNIQUE INDEX
INDEX summit.orders_id_idx
summit.orders_id_idx
ON
ON summit.orders(id)
summit.orders(id) REVERSE
REVERSE
PCTFREE
PCTFREE 30
30
STORAGE(INITIAL
STORAGE(INITIAL 200K
200K NEXT
NEXT 200K
200K
PCTINCREASE
PCTINCREASE 00 MAXEXTENTS
MAXEXTENTS 50)
50)
TABLESPACE
TABLESPACE indx;
indx;

Tulsi ocp

Creating Bitmap Indexes


Use the parameter
CREATE_BITMAP_AREA_SIZE to specify
the amount of memory allocated for bitmap
CREATE
CREATE BITMAP
BITMAP INDEX
INDEX orders_region_id_idx
orders_region_id_idx
creation.
ON summit.orders(region_id)
ON summit.orders(region_id)
PCTFREE
PCTFREE 30
30
STORAGE(INITIAL
STORAGE(INITIAL 200K
200K NEXT
NEXT 200K
200K
PCTINCREASE
PCTINCREASE 00 MAXEXTENTS
MAXEXTENTS 50)
50)
TABLESPACE
TABLESPACE indx;
indx;

Tulsi ocp

Rebuilding Indexes
Use the ALTER INDEX command to:
z Move an index to a different tablespace
z Improve space utilization by removing
deleted entries
z Change a reverse key index to a normal
B-tree index and vice versa
ALTER
ALTER INDEX
INDEX summit.orders_region_id_idx
summit.orders_region_id_idx REBUILD
REBUILD
TABLESPACE
TABLESPACE indx02;
indx02;

Tulsi ocp

Dropping Indexes
Drop and re-create an index before bulk loads.
Drop indexes that are infrequently needed and build
them when necessary.
Drop and re-create invalid indexes.
DROP
DROP INDEX
INDEX summit.deptartment_name_idx;
summit.deptartment_name_idx;

Tulsi ocp

Using National Language


Support

-by tulsi ocp

NLS Features
Language support
Territory support
Character set support
Linguistic sorting
Message support
Date and time formats
Numeric formats
Monetary formats
Database

Tulsi ocp

Different Types
of Encoding Schemes
Oracle supports different classes of
character encoding schemes:
z Single-byte character sets

z
z
z

7-bit
8-bit

Varying-width multibyte character set


Fixed-width multibyte character set
Unicode (UTF8, AL24UTFFSS)

Tulsi ocp

Character Sets and National


Character Sets of a Database
Database Character Sets

National Character Sets

Defined at creation time


Cannot be changed without
re-creation
Store data columns of type
CHAR, VARCHAR2, CLOB,
LONG
Can store varying-width
character sets

Defined at creation time


Cannot be changed without
re-creation
Store data columns of type
NCHAR, NVARCHAR2 and
NCLOB
Can store fixed-width and
varying-width multibyte
character sets

Tulsi ocp

Specifying Language-Dependent
Behavior

Initialization parameter
Environment variable
ALTER SESSION
command

Tulsi ocp

Specifying Language-Dependent
Behavior for the Server
z

NLS_LANGUAGE specifies:
- The language for messages
- Day and month names
- Symbols for A.D, B.C, A.M, P.M.
- The default sorting mechanism
NLS_TERRITORY specifies:
- Day and week numbering
- Default date format, decimal character,
group separator, and the default ISO
and local currency symbols

Tulsi ocp

Dependent Language and Territory


Default Values
PARAMETER

VALUES

NLS_LANGUAGE

AMERICAN

NLS_DATE_LANGUAGE

AMERICAN

NLS_SORT

BINARY

AMERICA

NLS_TERRITORY
NLS_CURRENCY

NLS_ISO_CURRENCY
NLS_DATE_FORMAT
NLS_NUMERIC_CHARACTERS

AMERICA
DD-MON-YY
,.

Tulsi ocp

Specifying LanguageDependent Behavior for the


Session
z

Environment variable:
NLS_LANG=<language>_<territory>.<charse
t>
Additional environment variables:
z
z
z
z
z
z
z

NLS_DATE_FORMAT
NLS_DATE_LANGUAGE
NLS_SORT
NLS_NUMERIC_CHARACTERS
NLS_CURRENCY
NLS_ISO_CURRENCY
NLS_CALENDAR

Tulsi ocp

Character Sets
in Client-Server Architecture

NLS_LANG=<language>_<territory>.<charset>
NLS_LANG=<language>_<territory>.<charset>
NLS_NCHAR=<ncharset>
NLS_NCHAR=<ncharset>

CREATE
CREATE DATABASE
DATABASE ...
...
CHARACTER
CHARACTER SET
SET <charset>
<charset>
NATIONAL
NATIONAL CHARACTER
CHARACTER SET
SET
<ncharset>
<ncharset>
...
...

Tulsi ocp

Specifying LanguageDependent Behavior for the


Session
ALTER
ALTER SESSION
SESSION SET
SET
NLS_DATE_FORMAT=DD.MM.YYYY;
NLS_DATE_FORMAT=DD.MM.YYYY;
DBMS_SESSION.SET_NLS(NLS_DATE_FORMAT,
DBMS_SESSION.SET_NLS(NLS_DATE_FORMAT,
DD.MM.YYYY)
DD.MM.YYYY) ;;

Tulsi ocp

Obtaining Information
About Character Sets

NLS_DATABASE_PARAMETERS:
PARAMETER
(NLS_CHARACTERSET,
NLS_NCHAR_CHARACTERSET)
VALUE

Tulsi ocp

Managing Privileges

-by tulsi ocp

Managing Privileges
Two types of privileges:
z System: Enables users to perform
particular actions in the database
z Object: Enables users to access and
manipulate a specific object

Tulsi ocp

System Privileges
z
z

z
z

There are about 126 system privileges.


The ANY keyword in the privileges
signifies that users have the privilege in
every schema.
The GRANT command adds a privilege to
a user or a group of users.
The REVOKE command deletes the
privileges.

Tulsi ocp

System Privileges:
Examples
Category

Examples

INDEX

CREATE ANY INDEX


ALTER ANY INDEX
DROP ANY INDEX

TABLE

CREATE TABLE
CREATE ANY TABLE
ALTER ANY TABLE
DROP ANY TABLE
SELECT ANY TABLE
UPDATE ANY TABLE
DELETE ANY TABLE

SESSION

CREATE SESSION
ALTER SESSION
RESTRICTED SESSION

TABLESPACE

CREATE TABLESPACE
ALTER TABLESPACE
DROP TABLESPACE
UNLIMITED TABLESPACE

Tulsi ocp

Granting System Privileges

GRANT
GRANT CREATE
CREATE SESSION,
SESSION, CREATE
CREATE TABLE
TABLE TO
TO managers;
managers;

GRANT
GRANT CREATE
CREATE SESSION
SESSION TO
TO scott
scott
WITH
WITH ADMIN
ADMIN OPTION;
OPTION;

Tulsi ocp

SYSDBA and SYSOPER


Privileges
Category

Examples

SYSOPER

STARTUP
SHUTDOWN
ALTER DATABASE OPEN | MOUNT
ALTER DATABASE BACKUP CONTROLFILE
ALTER TABLESPACE BEGIN/END BACKUP
RECOVER DATABASE
ALTER DATABASE ARCHIVELOG
RESTRICTED SESSION

SYSDBA

SYSOPER privileges WITH ADMIN OPTION


CREATE DATABASE
RECOVER DATABASE UNTIL

Tulsi ocp

Displaying System Privileges

Database Level

Session Level

DBA_SYS_PRIVS

SESSION_PRIVS

GRANTEE

PRIVILEGE

PRIVILEGE
ADMIN OPTION

Tulsi ocp

Revoking System Privileges

REVOKE
REVOKE CREATE
CREATE TABLE
TABLE FROM
FROM karen;
karen;

REVOKE
REVOKE CREATE
CREATE SESSION
SESSION FROM
FROM scott;
scott;

Tulsi ocp

Revoking System Privileges


Using WITH ADMIN OPTION
DBA
DBA

KAREN
KAREN

SCOTT
SCOTT

DBA
DBA

KAREN
KAREN

SCOTT
SCOTT

GRANT
GRANT

REVOKE
REVOKE

Tulsi ocp

Revoking System Privileges


Using WITH ADMIN
OPTION
RESULT
DBA
DBA

KAREN
KAREN

Tulsi ocp

SCOTT
SCOTT

Object Privileges
Object priv.

Table View

ALTER

DELETE

Sequence

Procedure

EXECUTE
INDEX

INSERT

REFERENCES

SELECT

UPDATE

Tulsi ocp

Granting Object Privileges

GRANT
GRANT EXECUTE
EXECUTE ON
ON dbms_pipe
dbms_pipe TO
TO public;
public;

GRANT
GRANT UPDATE(first_name,
UPDATE(first_name, salary)
salary) ON
ON
employee
employee TO
TO karen
karen WITH
WITH GRANT
GRANT OPTION;
OPTION;

Tulsi ocp

Displaying Object Privileges

DBA_TAB_PRIVS

DBA_COL_PRIVS

GRANTEE
OWNER
TABLE_NAME
GRANTOR
PRIVILEGE
GRANTABLE

GRANTEE
OWNER
TABLE_NAME
COLUMN_NAME
GRANTOR
PRIVILEGE
GRANTABLE

Tulsi ocp

Revoking Object Privileges

REVOKE
REVOKE execute
execute ON
ON dbms_pipe
dbms_pipe FROM
FROM scott;
scott;

Tulsi ocp

Revoking Object Privileges


Using WITH GRANT OPTION
SCOTT
SCOTT

USER
USER 11

USER
USER 22

SCOTT
SCOTT

USER
USER 11

USER
USER 22

GRANT

REVOKE

Tulsi ocp

Revoking Object
Privileges
Using WITH GRANT
OPTION
RESULT
SCOTT
SCOTT

USER
USER 11

Tulsi ocp

USER
USER 22

Query optimization tips

Tulsi ocp

Tulsi ocp

Tulsi ocp

Tulsi ocp

Tulsi ocp

Tulsi ocp

Oracle NET CONFIGURATION


zORACLE

NET CONFIGURATION CLIENT

SIDE
zORCLE NET CONFIGURATION SERVER
SIDE

Tulsi ocp

ORACLE SERVER SIDE


CONFIGURATION
zSERVER

SIDE
z LISTENER PROCESS NEED TO EXIST
zLISTENER PROCESS: LISTENS FOR
INCOMING CONNECTIONS ON BEHALF
OF A DATABASE OR A NUMBER OF
DATASES

Tulsi ocp

LISTENER PROCESS
zA

listener process can listen for more than


one database
zMultiple listeners can listen on behalf of a
single database to perform load balancing
zThe listener can listen for multiple protocols
zThe default name of the listener in Oracle
Net is LISTENER
zThe name of the listener must be unique per
listener.ora file

Tulsi ocp

zWhen

oracle software is installed the


listener.ora file is created for the starter
database with the following default settings:
zListener name
Listener
zPort
1521
zProtocols
tcp/ip and ipc
zSid name
default instance
zHostname
default hostname

Tulsi ocp

zLISTENER

=
z (DESCRIPTION_LIST =
z (DESCRIPTION =
z
(ADDRESS_LIST =
z
(ADDRESS = (PROTOCOL = IPC)(KEY =
EXTPROC0))
z
)
z
(ADDRESS_LIST =
z
(ADDRESS = (PROTOCOL = TCP)(HOST =
sprinttechnolog)(PORT = 1521))
z
)
z )
z )

Tulsi ocp

Listener control utility


LSNRCTL
zC:>

lsnrctl
zPrompt syntax
zLsnrctl> set current_listener listener2

Tulsi ocp

LSNRCTL commands
zUse

the following commands to control to the


listener
zStart [lis name]
zStop [lis name]

Tulsi ocp

Client side configuration


zNaming

methods are used by a client application


to resolve a connect identifier to a connect
descriptor when attempting to connect to a
database service

Tulsi ocp

zFirst

configure the naming method using the


gui for oracle net configuration
zConfigure local naming method
zFollow the wizard to complete configuration

Tulsi ocp

You might also like