Oracle Server 8i Quick Reference Card
Copyright 2000-2002 Dr. Lars Ditzel Database Management – http://www.ditzel-dbm.com
25-Jan-2002 Page 1
INSTANCE
v$fixed_table, v$fixed_view_definition, v$indexed_fixed_column, v$instance,
v$sga v$sgastat,, v$session, v$process, v$bgprocess, v$version,
v$product_component_version, v$license, v$option, v$access, v$timer,
v$parameter, v$parameter2, v$system_parameter, v$system_parameter2,
v$obsolete_parameter, v$sql, v$sqlarea, v$sqltext, v$sqltext_with_newlines,
v$sql_cursor, v$sql_bind_data, v$sql_bind_metadata,
v$sql_shared_memory, v$librarycache, v$rowcache, v$rowcache_parent,
v$object_dependency, v$rowcache_subordinate, v$open_cursor,
v$db_object_cache, v$shared_pool_reserved, v$bh, v$cache, v$subcache,
v$buffer_pool, v$buffer_pool_statistics, v$filestat, v$sysstat, v$sesstat,
v$mystat, v$statname, v$waitstat, v$latch, v$latchname, v$latchholder,
v$latch_parent, v$latch_children, v$event_name, v$system_event,
v$session_event, v$session_wait, v$mts, v$circuit, v$shared_server,
v$dispatcher, v$dispatcher_rate, v$reqdist, v$queue, v$lock,
v$enqueue_lock, v$locked_object, v$global_blocked_locks,
v$session_connect_info, v$session_longops, v$system_cursor_cache,
v$session_cursor_cache, v$session_object_cache, v$sess_io, v$bsp,
v$px_session, v$px_sesstat, v$px_process, v$px_process_sysstat,
v$pq_sesstat, v$pq_slave, v$pq_sysstat, v$pq_tqstat, v$execution,
v$mls_parameters, deptree, session_context
'instance_name', 'service_names', 'db_block_size', 'db_block_buffers', 'buffer_pool_keep',
'buffer_pool_recycle', 'db_block_lru_latches', 'shared_pool_size', 'log_buffer',
'large_pool_size', 'java_pool_size', 'shared_pool_reserved_size', 'pre_page_sga', 'sessions',
'processes', 'user_dump_dest', 'background_dump_dest', 'max_dump_file_size',
'local_listener', 'mts_service', 'mts_dispatchers', 'mts_max_dispatchers', 'mts_servers',
'mts_max_servers', 'dbwr_io_slaves', 'remote_os_authent', 'os_authent_prefix', 'dml_locks',
'enqueue_resources', 'parallel_automatic_tuning', 'parallel_min_servers',
'parallel_max_servers', 'parallel_min_percent', 'parallel_adaptive_multi_user',
'parallel_threads_per_cpu', 'parallel_execution_message_size',
'parallel_broadcast_enabled', 'oracle_trace_enable', 'oracle_trace_collection_{name | path |
size}', 'oracle_trace_facility_{name | path}', 'java_soft_sessionspace_limit',
'java_max_sessionspace_size', 'lock_sga', 'shared_memory_address',
'hi_shared_memory_address', 'object_cache_optimal_size',
'object_cache_max_size_percent', 'serial_reuse', 'session_max_open_files',
'timed_os_statistics', 'use_indirect_data_buffers'
[obsolete: v$recent_bucket, v$current_bucket, 'db_block_lru_extended_statistics',
'db_block_lru_statistics', 'lock_sga_areas', 'shared_pool_reserved_min_alloc',
'parallel_server_idle_time', 'parallel_transaction_resource_timeout',
'parallel_min_message_pool', 'mts_rate_log_size', 'mts_rate_scale' ]
init<sid>.ora
Background: SMON, PMON, DBW<n>, CKPT, LGWR, ARC<n>, SNP<n>, RECO,
D<nnn>, S<nnn>, P<nnn>, RFS<n>, LCK<n>, QMN<n>, EMN<n>
Failure of LGWR (Err 470), CKPT (470), DBW<n> (471), ARC<n> (473), SMON (474) or RECO (476)
lead to termination of instance by PMON. Failure of PMON leads to termination of instance by DBW<n>
(Err 472). Failed SNP<n> processes are restarted by PMON.
Packages DBMS_SYSTEM (set_sql_trace_in_session), DBMS_SESSION (set_sql_trace),
DBMS_SHARED_POOL (keep, unkeep, sizes), DBMS_APPLICATION_INFO
(set_module, set_action, set_client_info, read_module, read_client_info)
dbmspool.sql, prvtpool.plb, utlbstat.sql, utlestat.sql, catparr.sql, utldtree.sql
Tuning/Contention
Buffer cache: 'Cache Hit Ratio' (v$sysstat) or per pool (v$buffer_pool_statistics)
1 – ('physical reads' / ('db block gets' + 'consistent gets')) < 90–95%
-> increase 'db_block_buffers'
or 'buffer_pool_keep', 'buffer_pool_recycle'
Shared pool: 'Shar. Cursors' (v$librarycache) gethitratio for SQL AREA < 99%
Library cache: sum(reloads) / sum(pins) > 1% (v$librarycache)
Dict. cache: sum(getmisses) / sum(gets) > 15% (v$rowcache)
-> increase 'shared_pool_size'
LRU latch: "cache buffers lru chain" (v$latch) sleeps / gets > 1%
-> increase 'db_block_lru_latches' (max. CPU * 6 or BUFFERS / 50)
show parameter <string>
alter system set <param> = <value> [deferred];
mts_dispatchers = "{ (protocol = <prot>) | (description = (address =...) ) | (address =
(protocol = <prot>) (host = <node>) (port = <port>) )} (connections = <X>) (dispatchers
= <1>) (listener = <list>) ( {pool | multiplex} = <X>) (ticks = <15>) (service = <serv>)
(presentation = {ttc | oracle.aurora.server.{SGiopServer | GiopServer} } ) ", mts_servers
= <X>, resource_limit = {true | false}, global_names = {true | false}, scan_instances =
<X>, cache_instances = <X>, license_max_sessions = <X>, license_sessions_warning
= <X>, license_max_users = <X>, remote_dependencies_mode = {timestamp |
signature}, resource_manager_plan
alter session set <param> = <value>;
optimizer_goal = {all_rows | first_rows | rule | choose}, sql_trace = {true | false},
global_names = {true | false}, skip_unusable_indexes = {true | false}, label = {'<str>' |
dbhigh | dblow | oslabel}, mls_label_format = <fm>, flagger = {entry | immediate | full |
off}, session_cached_cursors = <X>, close_cached_open_cursors = {true | false},
instance = <X>, parallel_instance_group = '<gr>', hash_area_size = <X>,
hash_multiblock_io_count = <X>, remote_dependencies_mode = {timestamp |
signature}, isolation_level = {serializable | read committed}, constraints = {immediate |
deferred | default}, <NLS_PARAMs>, events ‘{10015 | 10046 | 10049 | 10210 | 10211 |
10212 | 10231 | 10235 | 10520} trace name context {forever, level <X> | off}’, events
‘immediate trace name {heapdump | controlf} level <X>’
startup [force] [restrict] [pfile=<par>]
[ { nomount | {mount | open [recover] } [<db>]
[ exclusive | parallel [retry] | shared [retry] ] } ]
shutdown [ normal | transactional | immediate | abort ]
alter database [<db>]
{ mount [ {standby | clone} database]
[exclusive | parallel] << obsolete
| dismount
| open [read only | [read write] [resetlogs | noresetlogs] ]
| close [normal | immediate] };
alter system flush shared_pool;
alter system {enable | disable} restricted session;
alter system kill session ‘<SID>,<Serial#>’;
alter system disconnect session ‘<SID>,<Serial#>’ post_transaction;
orapwd file=<file> password=<pwd> entries=<X>
oradim –{new | edit | delete | startup | shutdown}
–{sid <SID> | srvc <serv>} –newsid <SID>
–usrpwd <pwd> –intpwd <pwd> –maxusers <X>
–startmode {a | m} –shutmode {a | i | n}
–{starttype | shuttype} {srvc | inst | srvc, inst}
–pfile <par> –timeout <X>
tkprof <trc> <out> [explain=<user>/<pwd>@<netserv>] [table=<tab>]
[print=<X>] [sys=no] [insert=<file>] [record=<file>] [aggregate=<N>]
[sort=<opt>]
otrcfmt
oemctrl {start | stop} oms, oemapp console, vppcntl –start, vtm
DATABASE
v$database, v$controlfile, v$controlfile_record_section, v$deleted_object,
v$compatibility, v$compatseg, dictionary, dict_columns, dba_catalog,
dba_objects, dba_object_size, dba_analyze_objects, props$,
database_compatible_level
'control_files', 'db_name', 'db_domain', 'db_files', 'compatible', 'read_only_open_delayed'
catalog.sql, catproc.sql, u0703040.sql, r0703040.sql, u080<X>0<X>0.sql, r08000<X>0.sql,
d080<X>0<X>.sql, utlrp.sql, utlip.sql, utlirp.sql, utlconst.sql, utlincmpt.sql, utldst.sql,
catlg803.sql
Tuning/Contention
phyrds, phywrts (v$filestat)
create database [<db>]
[datafile ‘<file>’ [,...] size <X> [reuse]
[autoextend {on | off} [next <X> maxsize {<X> | unlimited} ] ] ]
[logfile [group <X>] (‘<log>’ [,...] ) size <X> [reuse]
[, [group <X>] (‘<log>’ [,...] ) size <X> [reuse] ] ... ]
[controlfile reuse] [maxdatafiles <X>] [maxinstances <X>]
[maxlogfiles <X>] [maxlogmembers <X>] [maxloghistory <X>]
[character set <char>] [national character set <char>]
[archivelog | noarchivelog] [exclusive];
alter database [<db>] rename global_name to <db>;
alter database [<db>] convert;
alter database [<db>] reset compatibility;
alter database [<db>] [national] character set <new_char>;
alter database [<db>] set
{dblow = <str> | dbhigh = <str> | dbmac {on | off} };
create controlfile ['<ctrl>'] [reuse] set database <db>
[datafile...] [logfile...] ... [ [no]resetlogs];
alter database [<db>] backup controlfile to
{'<file>' [reuse] | trace [resetlogs | noresetlogs] };
alter database [<db>] create standby controlfile as '<ctrl>' [reuse];
alter database [<db>] activate standby database;
dbassist
TABLESPACES, DATAFILES & SEGMENTS
v$tablespace, v$datafile, v$datafile_copy, v$datafile_header, v$dbfile,
v$offline_range, v$tempfile, v$tempstat, v$temp_extent_map,
v$temp_extent_pool, v$temp_space_header, v$temp_ping, v$backup,
v$recover_file, v$recovery_file_status, v$recovery_log,
v$recovery_progress, v$recovery_status, v$recovery_transactions,
v$instance_recovery, v$fast_start_servers, v$fast_start_transactions,
dba_tablespaces, dba_ts_quotas, dba_data_files, filext$,
dba_temp_files, dba_segments, dba_extents, dba_free_space,
dba_free_space_coalesced, dba_free_space_coalesced_tmp[1-3],
ts_pitr_objects_to_be_dropped, ts_pitr_check, transport_set_violations,
dba_dmt_free_space, dba_dmt_used_extents, dba_lmt_free_space,
dba_lmt_used_extents, pluggable_set_check, uni_pluggable_set_check,
straddling_ts_objects
'db_block_checking', 'db_block_checksum', 'recovery_parallelism', 'fast_start_io_target',
'fast_start_parallel_rollback', 'db_file_name_convert', 'log_checkpoint_interval',
'log_checkpoint_timeout', 'log_checkpoints_to_alert', 'db_writer_processes',
'db_file_simultaneous_waits', 'read_only_open_delayed', 'db_block_max_dirty_target'
[obsolete: 'db_file_simultaneous_writes', 'db_block_checkpoint_batch',
'parallel_transaction_recovery' ]
Packages DBMS_REPAIR (check_object, {skip | fix}_corrupt_blocks, dump_orphan_keys,
rebuild_freelists, admin_tables)
DBMS_SPACE_ADMIN (tablespace_verify, tablespace_{rebuild|fix}_bitmaps,
tablespace_migrate_{from | to}_bitmap, segment_{verify | corrupt | dump},
segment_drop_corrupt, segment_extent_map_dump)
DBMS_TTS (transport_set_check, downgrade)
create [temporary] tablespace <ts>
{datafile | tempfile} ‘<file>’ [size <X>] [reuse]
[autoextend {off | on [next <X>] [maxsize {<X> | unlimited} ] } ]
[,’<file>’... [autoextend...] ] [minimum extent <X>]
[ default storage ( [initial <5xBS>] [next <5xBS >] [pctincrease <50>]
[minextents <1>] [maxextents {<X> | unlimited} ]
[freelists <1>] [freelist groups <1>]
[buffer_pool {default | keep | recycle} ] ) ]
[logging | nologging] [permanent | temporary] [online | offline]
[extent management { dictionary
| local [autoallocate | uniform [size <1M>] ] } ];
drop tablespace <ts> [including contents [cascade constraints] ];
alter tablespace <ts> add {datafile | tempfile}
‘<file>’ size <X> [reuse] [autoextend...];
alter tablespace <ts> rename datafile ‘<file>’ [,...] to ‘<new>’ [,...];
alter tablespace <ts> { online | offline [ normal | temporary
| immediate | for recover ] };
alter tablespace <ts> { read {write | only} | permanent | temporary };
alter tablespace <ts> [minimum extent <X>] default storage (...);
alter tablespace <ts> coalesce;
alter tablespace <ts> {begin | end} backup;
alter system {suspend | resume};
alter database [<db>] datafile [,...] <X> end backup;
alter system checkpoint [global | local];
alter system check datafiles [global | local];
alter database [<db>] {datafile | tempfile} ‘<file>’ [,...] resize <X>;
alter database [<db>] {datafile | tempfile} ‘<file>’ [,...] autoextend...;
alter database [<db>] datafile ‘<file>’ [,...] {online | offline };
alter database [<db>] tempfile ‘<file>’ [,...] {online | offline [drop] };
alter database [<db>] rename file ‘<file>’ [,...] to ‘<new_file>’ [,...];
alter database [<db>] create datafile '<file>' [,...] [as '<new>' [,...] ];
alter database [<db>] recover [automatic] [from '<log_path>']
{ database [until { cancel | change <scn>
| time '<YYYY-MM-DD:HH24:MI:SS>' } ]
[using backup controlfile]
| [managed] standby database [timeout <X> | cancel [immediate] ]
| [standby] tablespace '<ts>' [,...] [until [consistent with] controlfile]
| [standby] datafile {'<file>' | <X>} [,...]
[until [consistent with] controlfile]
| logfile '<log>' | continue [default] | cancel }
[noparallel | parallel [<X>] ];
set autorecovery {on | off}
set logsource <dir>
recover [automatic] [from '<log_path>']
{ database [until { cancel | change <scn>
| time '<YYYY-MM-DD:HH24:MI:SS>' } ]
[using backup controlfile]
| [managed] standby database [timeout <X> | cancel [immediate] ]
| [standby] tablespace '<ts>' [,...] [until [consistent with] controlfile]
| [standby] datafile {'<file>' | <X>} [,...]
[until [consistent with] controlfile]
| logfile <log> | continue [default] | cancel}
[ { noparallel | parallel (degree {<X> | default}
[instances <1> | default] ) } ]
dbv file=<file> start=<X> end=<X> logfile=<log> blocksize=<2048>
feedback=<0>
BLOCKS
v$type_size
Header: static(61B), row directory(2B*rec), transaction headers
(23B*TX) [Cluster: table directory]
ROWID
Logical: hex string of variable length
Extend(10B): DataObj#{32b} - RelFile#{10b} - Block#{22b} - Row#{16b}
Base64 OOOOOO – FFF – BBBBBB – RRR
Restrict(6B): Block#{Xb} - Row#{Xb} - File#{Xb}
Package DBMS_ROWID
(rowid_create, rowid_object, rowid_relative_fno, rowid_block_number,
rowid_row_number, rowid_to_absolute_fno, rowid_to_extended,
rowid_to_restricted)
LOGFILES
v$log, v$logfile, v$thread, v$loghist, v$log_history, v$database, v$archive,
v$archive_dest, v$archived_log, v$archive_processes, v$logmnr_dictionary,
v$logmnr_parameters, v$logmnr_logs, v$logmnr_contents, v$targetrba
'thread', 'log_buffer', 'log_archive_max_processes', 'log_archive_start', 'log_archive_dest',
'standby_archive_dest', 'log_archive_dest_[1-5]' = '{ location = <path> | service = <serv>}
[optional | mandatory] [reopen [=<300>] ]', 'log_archive_dest_state_[1-5]' = {enable | defer},
'log_archive_duplex_dest', 'log_archive_min_succeed_dest', 'log_archive_format',
'log_file_name_convert', 'arch_io_slaves', 'utl_file_dir',
‘_allow_resetlogs_corruption’ (undocumented & unsupported)
[obsolete: 'log_archive_buffers', 'log_archive_buffer_size', 'log_block_checksum',
'log_simultaneous_copies', 'log_small_entry_max_size', 'lgwr_io_slaves']
Packages DBMS_LOGMNR_D (build), DBMS_LOGMNR (add_logfile, start_logmnr,
end_logmnr)
dbmslogmnrd.sql
Tuning/Contention
v$system_event, v$sysstat
Redo latch: "redo allocation", "redo copy" (v$latch) misses / gets > 1% or
immediate_misses / (immediate_gets + immediate_misses) > 1%
-> decrease 'log_small_entry_max_size'
-> increase 'log_simultaneous_copies' (max. CPU * 2)
archive log { list | stop | {start | next | all | <X>} } [to <dest>]
alter database [<db>] {archivelog | noarchivelog};
alter system archive log [thread <X>]
{ start [to '<log_path>'] | stop | current | next | all
| sequence <X> | group <X> | change <X> | logfile '<file>' };
alter system switch logfile;
alter database [<db>] add logfile
[thread <X>] [group <X>] (‘<log>’,...) size <X>;
alter database [<db>] {enable [public] | disable} thread <X>;
alter database [<db>] add logfile member ‘<log>’ [reuse] to group <X>;
alter database [<db>] rename file ‘<log>’ [,...] to ‘<new_log>’ [,...];
alter database [<db>] drop logfile group <X>;
alter database [<db>] drop logfile member ‘<log>’;
alter database [<db>] clear [unarchived] logfile { group <X> | ‘<log>’ }
[unrecoverable datafile];
TABLES & CONSTRAINTS & TRIGGERS
dba_tables, dba_all_tables, dba_object_tables, dba_tab_comments,
dba_tab_columns, col, dba_tab_col_statistics, dba_associations,
dba_ustats, dba_col_comments, dba_updatable_columns,
dba_unused_col_tabs, dba_tab_modifications, dba_nested_tables,
dba_part_tables, dba_tab_partitions, dba_tab_subpartitions,
dba_part_col_statistics, dba_part_key_columns, dba_partial_drop_tabs,
dba_subpart_col_statistics, dba_subpart_key_columns, dba_constraints,
dba_cons_columns, dba_triggers, dba_trigger_cols, dba_internal_triggers,
dba_tab_histograms, dba_part_histograms, dba_subpart_histograms,
hist_head$
'_system_trig_enabled'
[obsolete: dba_histograms, 'cache_size_threshhold']
Packages DBMS_UTILITY (analyze_database, analyze_schema, analyze_part_object)
DBMS_SPACE (unused_space, free_blocks) [dbmsutil.sql, utlvalid.sql]
DBMS_STATS (gather_{database | schema | table | index}_stats, {export |
import}_schema_stats)
utlexcpt.sql, utlexcpt1.sql, dbmsstdx.sql
Tuning/Contention
pctfree = UPD/AVG, pctused = 1 – pctfree – AVG/nBLK
scans: "table scans%" (v$sysstat)
-> adjust 'db_file_multiblock_read_count'
row migr.: table_name, head_rowid (chained_rows <- utlchain.sql, utlchain1.sql) or
"table fetch continued row" (v$sysstat)
-> increase pctfree
-> recreate table (create as, delete from, insert into select, commit, drop)
freelists: "segment header" (v$waitstat), "buffer busy waits" (v$system_event)
-> alter pctfree/pctused, inittrans, or
-> increase freelist/freelist groups
(v$session_wait -> dba_extents -> dba_segments -> recreate object)
full & partial partition-wise joins
create [global temporary] table <tab> (max. 1000 col)
[of <object_type>]
[object identifier is {primary key | system generated
[oidindex <ind> ( [tablespace <ts>...] [storage (...) ] ) ] } ]
( <col> <type> [ {default | := } <value>]
[with rowid] [scope is <tab>]
[constraint <col_constr>]
[ { [not] null
| primary key [using index...]
| unique [using index...]
| check (<expr>)
| references <tab> [ (<col>) ] [on delete {cascade | set null} ] }
[ [not] deferrable [initially {immediate | deferred} ] ]
[ {disable | enable} [validate | novalidate] [exceptions into <tab>] ]
[,<col>... [constraint <col_constr>]...] [,...]
[, constraint <tab_constr>...]
[ref (<col>) with rowid] [scope for (<col>) is <tab>] )
[tablespace <ts>] [organization {heap | index} ] [storage (...) ]
[pctfree <10>] [pctused <40>] [initrans <1>] [maxtrans <X>]
[logging | nologging] [recoverable | unrecoverable] <- obsolete
[cache | nocache] [monitoring | nomonitoring]
[noparallel | parallel [<X>] ]
[ partition by range (<col> [,...] )
[ subpartition by hash (<col> [,...] )
[subpartitions <X> [store in (<ts> [,...] ) ] ]
( partition <partX> values less than ( {<value> [,...] | maxvalue} )
[storage (...) ] [tablespace <ts>]
[ ( subpartition <subpartX> [tablespace <ts>]
[, subpartition...] ) ]
[, partition... [ ( subpartition...) ] ] ) ]
[ partition by hash (<col> [,...] )
{ ( partition <partX> [tablespace <ts>] [, partition...] )