You are on page 1of 37

Copyright © 2000-2004 Dr.

Lars Ditzel Database Management

Oracle Server 9i
Quick Reference Guide
Disclaimer 2
Oracle Architecture 3
Instance 4
Database 8
Database Utilities 9
Tablespaces, Datafiles & Segments 10
Logfiles 11
Tables, Constraints & Triggers 12
Views, Synonyms & Sequences 14
Clusters 14
Index-organized Tables 15
Indexes 15
Undo Management 16
Temporary Segments 16
Users, Privileges, Resources & Policies 17
Auditing 18
Net Services 18
Recovery Manager 20
Distributed DB, Replication, Heterogenous Services,
Advanced Queuing & Data Warehousing 22
Real Application Clusters 24
Globalization Support 26
SQL*Plus 27
Data Types (PL/SQL & Database) 28
SQL, PL/SQL & Java 30
Embedded SQL 34
SQLJ 36
Label Security 37
Performance 37

www.larsditzel.de
2 Oracle Server 9i Quick Reference Guide

Disclaimer
This document is nothing official by Oracle online documentation. Optional parts are
Corporation. Oracle holds all rights on its enclosed in square brackets [], a list of items is
documentation. Certain terms are registered enclosed in curly braces {}, alternatives within
trademarks. brackets or braces are separated by a vertical
This quick reference guide is some kind bar |. Keywords appear in regular style and
of outgrown cheat-sheet for all of us with are not case-sensitive in most OS. Placehold-
limited supply of system memory. It enables ers for input data are enclosed in brackets <>
quick lookup of syntax for statements which with corresponding default values underlined.
one might need less frequently in daily A comma followed by an ellipsis inclosed in
work. So the major goal of this document is square brackets [, …] indicates that the pre-
compaction, not clarity. Some syntax options ceding syntactic element may be repeated. An
only work under certain circumstances, some ellipsis without preceding comma … indicates
options exclude each other. This behaviour that the corresponding syntactic elements have
is intentionally not reflected to avoid prolif- been specified beforehand.
eration of similar statements. Be aware of your Each section commonly starts with dynamic
actions! The author disclaims liability for errors performance views and static data dictionary
within this document and subsequent mistakes views (only DBA variants listed) and – oc-
that might harm your database. In case of casionally – tables. Initialization parameters
uncertainties please refer to Oracle’s excellent follow as well as database packages and im-
original documentation, which can be found portant files or processes. Then comes a list
online at the Oracle Technology Network of performance tuning measures and desup-
(otn.oracle.com) – comprising several hundred ported or deprecated features. The main part
megabytes meanwhile – or contact Oracle Cus- of each section is comprised of SQL statements
tomer Support. In any quick reference guide grouped by functionality. The final section may
there is also no room for discussing concepts state utilities if any exist.
and techniques. If you do not know where to Changes from Releases 8i to 9i are colored
start just read the Oracle Database Concepts blue for new features or red for obsolete
Guide which is very concise. Advanced discus- features. Some features of Server9i Release 2
sions can be found elsewhere, my favourite have been added without another special color
resource being asktom.oracle.com. Oracle highlighting than blue but I did not scan the
Guru Thomas Kyte has also written excellent whole Release 2 documentation yet. And prob-
books on techniques and best practices. Other ably it will not take too long until Server10i
invaluable repositories are the sites of Jonathan shows up…
Lewis (www.jlcomp.demon.co.uk) and of Steve Outdated syntax has not been removed most
Adams (www.ixora.com.au). Not to forget that of the time as one eventually comes across da-
lots of technical whitepapers can be found at tabases running older releases of Oracle Server.
Oracle’s Technet. – One of my customers still uses Server7.
This reference uses a modified Backus-Naur Any suggestions and corrections to improve
Form syntax which is adapted from the Oracle this guide are welcome.

Dr. Lars Ditzel Database Management • Ringstraße 23a • 65824 Schwalbach • Germany
Phone/Fax +49 (6196) 889739-0/5 • Mobile +49 (160) 94651446 • info@larsditzel.de

www.larsditzel.de Copyright © 2000-2004 Dr. Lars Ditzel Database Management


Oracle Server 9i Quick Reference Guide 3

������ ������ ������������


���� �
�������� ���� ���� ���� ����������� ���������� ���� ���� �������� � ������
������������
������ � ���� ���� ���� ���� ���� ���� ���� �� �����������
���� ��������� ����� � �����
���� ���� ���� ��� ������ �����
�� ������ ����� �������� � �������
����� � ����� � ����� � ������� �������� � ��������
���� ���� ���� ���� ���� ��� �� � �������� ��� ��� ����� ������
����������
������� ���� ���� ��������
��������� ���������
���� ���� ���� ����������� ���������� �������� � �������������
��������� ���� ����
���� ���� ���� ���� ���� ���� ���� ���� ���� ����
���� ��� ��������
������ � ������ ���� ���� ���������� ��� ���
����� ���� �������� ������� ������ ��������� �������������
���
�������� ���� ������ ����� ��� � �������� ����� �������
����� � ����� � ����� � ���� ������� ������� ���
� ���� �������������� ����
��������

�����������
�������

���������� ���� �� ������ �����


��������� � ������ ������ ���
�������� ������������ ������������ ���� ���� � ���� ���� ��������
����� ������� �������
����� ������� ��������
������ ���� ���������� �����
������ ����� ������� ����
� ����� ������� ������ � ���� ����� ��������� �������
������� ����� ����������
���� � ������ ����� ��������� ����� ������ �����
���� ��������
� ������ ��� �����
������ ������
����� ����� ������� � ������ � ������ ����������
� ��������� ��� ���� �������
����� ������������ ������ � � �� �������
����� ���� ����� � ������� � ����� ��������� ������
����� ����� ����� �������� ���������� � �����
����������
���� �����
�������� ���� ��������� ������
���� ������� ���� �������
�������� ������ ������ � �������� ����������� ������
�������� ����� ������� ����� ������� ��������
������� � ����
��� ���
����� ����� �����
��� ������ ��
���� � ���� ����
���� ������� ������� ������������ ���� ����� ������
� �������
������� ��������� ��������� ���� ����� ��� �� ��� � ������ ���� ���������� ���� � � ���
���� ��������� ���������

������ ����������
������� � ������ �������
��� ������
����������� ��� ��� �����������
������� ���� ���� ���� ���������� �������
����

��� �����
���� ����� ���������
��������� ���� ��������
������� ����
����
��� ���������� ��������
������� ��������
���������
����� �������� ��������� ��������
� ������ � ������
���������� ���������� ������������� ��������
� ����������
�� ����� ���� �������� �����������
� �������� �������
�� ������ ����� �������� �������
������� �������� ��������
������� ��������� ������� ����
��������� � ���� ��� ���� ������ �������� ���������� � �����������������

www.larsditzel.de
4 Oracle Server 9i Quick Reference Guide

Instance

Background Processes (v$bgprocess) Parameters (init<sid>.ora) Tuning/Contention


ARC<n>, CJQ0, J<nnn>, CKPT, DBW<n>, spfile, ifile, instance_name, service_names, Statistics classes:
DIAG, DMON, EMN0, LCK<n>*, LGWR, db_block_size, sga_max_size, db_cache_size, 1 User, 2 Redo, 4 Enqueue, 8 Cache, 16
LMD0*, LMON*, LMS<n>*, LNSV, LSP0, db_keep_cache_size, db_recycle_cache_size, OS, 32 RAC, 64 SQL, 128 Debug
MRP0, NSV0, PMON, QMN<n>, RECO, db_<n>k_cache_size, db_cache_advice, Buffer cache: «Cache Hit Ratio» (v$sysstat)
RLAP, RSM0, SMON, RFS<n> shared_pool_size, log_buffer, large_pool_size, or per pool (v$buffer_pool_statistics)
BSP<n>*, SNP<n> << obsolete java_pool_size, shared_pool_reserved_size, 1 – («physical reads» / («db block gets» +
* RAC processes pre_page_sga, sessions, processes, user_dump_ «consistent gets»)) < 90–95% -> increase
Failure of LGWR (Err 470), CKPT (470), DBW<n> dest, background_dump_dest, max_dump_
(471), ARC<n> (473), SMON (474) or RECO (476) «db_block_buffers» or «buffer_pool_keep»,
lead to termination of instance by PMON. Failure of file_size, local_listener, remote_listener, «buffer_pool_recycle»
PMON leads to termination of instance by DBW<n> mts_service, circuits, dispatchers, max_dis-
(Err 472). Shared pool: «Shar. Cursors»
patchers, shared_servers, max_shared_servers, (v$librarycache) gethitratio for SQL AREA
Failed SNP<n> processes are restarted by PMON.
shared_server_sessions, dbwr_io_slaves, < 99%
remote_os_authent, os_authent_prefix, Library cache: sum(reloads) / sum(pins) > 1%
Foreground Processes dml_locks, enqueue_resources, parallel_auto- (v$librarycache)
D<nnn>, S<nnn>, P<nnn> matic_tuning, parallel_min_servers, paral-
Dict. cache: sum(getmisses) / sum(gets) >
lel_max_servers, parallel_min_percent, paral-
15% (v$rowcache) -> increase «shared_
Views & Tables lel_adaptive_multi_user, parallel_threads_
pool_size»
v$fixed_table, v$fixed_view_definition, per_cpu, parallel_execution_message_size, par-
allel_broadcast_enabled, oracle_trace_enable, LRU latch: «cache buffers lru chain»
v$indexed_fixed_column, v$instance, v$sga, (v$latch) misses / gets > 1% -> increase
v$sgastat, v$pgastat, v$session, v$process, oracle_trace_collection_{name | path | size},
oracle_trace_facility_{name | path}, java_ «db_block_lru_latches» (max. CPU * 2 or
v$bgprocess, v$version, product_component_ BUFFERS / 50)
version, v$license, v$option, v$access, v$timer, soft_sessionspace_limit, java_max_sessions-
pace_size, lock_sga, shared_memory_address, Redo buffer: «redo%retries» (v$sysstat)
v$parameter, v$parameter2, v$spparameter,
hi_shared_memory_address, object_cache_op- PGA: «%ga memory%» (v$sysstat), «sorts%»
v$system_parameter, v$system_parameter2,
timal_size, object_cache_max_size_percent, (v$sysstat), sorts (v$sqlarea), «work-
v$obsolete_parameter, v$sql, v$sqlarea,
serial_reuse, session_max_open_files, timed_ area%» (v$sysstat, v$sesstat), v$pgastat,
v$sqltext, v$sqltext_with_newlines, v$sql_cur-
os_statistics, cursor_sharing, drs_start v$sql_workarea, v$sql_workarea_active,
sor, v$sql_bind_data, v$sql_bind_meta-
pga_%_mem (v$process)
data, v$sql_shared_memory, v$sql_plan,
v$sql_workarea, v$sql_workarea_active, Packages
v$librarycache, v$rowcache, v$rowcache_par- Deprecated Features
DBMS_SYSTEM
ent, v$rowcache_subordinate, v$open_cursor, set_sql_trace_in_session v$mts
v$object_dependency, v$db_object_cache, DBMS_SUPPORT db_block_buffers, buffer_pool_keep, buf-
v$shared_pool_reserved, v$bh, x$bh, v$cache, mysid, {start | stop}_trace, {start | stop}_ fer_pool_recycle, mts_circuits, mts_dispatch-
v$subcache, v$buffer_pool, v$buffer_pool_ trace_in_session ers, mts_max_dispatchers, mts_servers,
statistics, v$db_cache_advice, v$statistics_lev- DBMS_SESSION mts_sessions
el, v$filestat, v$tempstat, v$sysstat, v$sesstat, set_sql_trace, {set | clear}_identi- utlbstat.sql, utlestat.sql
v$mystat, v$statname, v$waitstat, v$latch, fier, {set | list | clear}_context, set_role,
v$latchname, v$latchholder, v$latch_parent, set_nls, is_role_enabled, is_session_alive, Desupported Features
v$latch_children, v$event_name, v$system_ unique_session_id, close_database_link,
event, v$session_event, v$session_wait, v$recent_bucket, v$current_bucket, db_
reset_package, modify_package_state, block_lru_latches, use_indirect_data_buffers,
v$sess_io, v$segment_statistics, v$segstat, switch_current_consumer_group, free_un-
v$segstat_name, v$circuit, v$queue, v$shared_ db_block_lru_extended_statistics, db_block_
used_user_memory, set_close_cached_ lru_statistics, lock_sga_areas, shared_pool_re-
server, v$shared_server_monitor, v$dispatcher, open_cursors
v$dispatcher_rate, v$reqdist, v$queue, v$lock, served_min_alloc, parallel_server_idle_time,
DBMS_SHARED_POOL parallel_transaction_resource_timeout, paral-
v$enqueue_lock, v$enqueue_stat, v$locked_
keep, unkeep, sizes lel_min_message_pool, mts_rate_log_size,
object, v$global_blocked_locks, dba_locks,
DBMS_APPLICATION_INFO mts_rate_scale, mts_max_servers
dba_lock, dba_lock_internal, v$session_con-
set_module, set_action, set_client_info,
nect_info, v$session_longops, v$system_cur-
read_module, read_client_info
sor_cache, v$session_cursor_cache,
v$session_object_cache, v$bsp, v$px_session,
v$px_sesstat, v$px_process, v$px_process_sys- Files
stat, v$pq_sesstat, v$pq_slave, v$pq_sysstat, dbmspool.sql, dbmssupp.sql, catparr.sql,
v$pq_tqstat, v$execution, v$mls_parameters, utldtree.sql
deptree, session_context

www.larsditzel.de
Oracle Server 9i Quick Reference Guide 5

Instance (cont.)

Parameters | false}, remote_os_roles = {true | false}, repli- Session Scope Dynamic Init. Parameters
show parameter[s] <string> cation_dependency_tracking = {true | false}, alter session set <param> [=] <value>;
alter system set <param> [=] <value> rollback_segments = (<rbs> [, …]), row_lock- cursor_sharing = {similar | exact | force},
[comment ‘<text>’] [deferred] ing = {always | default | intent}, serial_reuse = db_block_checking, db_create_file_dest =
[scope = {memory | spfile | both} ] {disable | select | sml | plsql | all}, session_max_ ‘<dir>’, db_create_online_log_dest_<1-5> =
[sid = { ‘<sid>’ | ‘*’ } ]; open_files = <10>, sessions = <(1.1*proc)+5>, ‘<dir>’, db_file_multiblock_read_count = <8>,
sga_max_size = <n>, shadow_core_dump global_names = {true | false}, hash_area_size
alter system reset <param>
= {partial | full}, shared_memory_address = = <n>, hash_join_enabled = {true | false},
[scope = {memory | spfile | both} ]
<0>, shared_pool_reserved_size = <5%SP>, log_archive_dest_<1-10> = {location = <path>
[sid = { ‘<sid>’ | ‘*’ } ];
shared_server_sessions = <n>, spfile = <file>, | service = <serv>} [optional | mandatory]
sql92_security = {true | false}, sql_trace = {true [[no]reopen [=<300>]] [arch | lgwr] [synch |
Static Initialization Parameters | false}, tape_asynch_io = {true | false}, thread async = <n>] [[no]affirm] [[no]delay [= <30>]]
active_instance_count = <n>, audit_file_dest = <n>, transactions_per_rollback_segment = [[no]dependency] [[no]alternate [= <dest>]]
= <dir>, audit_trail = {none | false | db | true | <5>, undo_management = {manual | auto}, [[no]max_failure [= <n>] [[no]quota_size
os}, background_core_dump = {full | partial}, util_file_dir = <dir> [= <n>] [[no]quota_used] [[no]register [=
bitmap_merge_area_size = <1m>, blank_trim-
<loc>]], log_archive_dest_state_<1-10> = {en-
ming = {true | false}, buffer_pool_{keep | Dynamic Initialization Parameters able | defer | alternate}, log_archive_min_suc-
recycle} = {<n> | (buffers: <n>, lru_latches:
aq_tm_processes = <n>, archive_lag_target = ceed_dest = <1>, max_dump_file_size = {<n>
<n>} << deprecated, circuits = <n>, cluster_data-
<n>, background_dump_dest = ‘<dir>’, back- | unlimited}, nls_calendar = ‘<cal>’, nls_comp
base = {true | false}, cluster_database_instances
up_tape_io_slaves = {true | false}, control_file_ = {binary | ansi}, nls_currency = <curr>,
= <n>, cluster_interconnects = <ip>[:<ip>…],
record_keep_time = <7>, core_dump_dest = nls_date_format = ‘<fmt>’, nls_date_lan-
commit_point_strength = <n>, compatible
‘<dir>’, db_{2|4|8|16|32}k_cache_size = <0>, guage = <lang>, nls_dual_currency = <curr>,
= <x.x.x>, control_files = (“<file>” [, …]),
db_block_checking = {true | false}, db_block_ nls_iso_currency = <terr>, nls_language =
cpu_count = <n>, create_bitmap_area_size
checksum = {true | false}, db_cache_advice <lang>, nls_length_semantics = {byte | char},
= <8m>, cursor_space_for_time = {true |
= {on | ready | off }, db_cache_size = <48m>, nls_nchar_conv_excp = {true | false}, nls_nu-
false}, db_block_buffers = <n> << deprecated,
db_{keep | recycle}_cache_size = <0m>, meric_characters = <sep>, nls_sort = {binary |
db_block_size = <2048>, db_domain =
dispatchers = ‘{ (protocol = <prot>) | (descrip- <ling>}, nls_territory = <terr>, nls_time_for-
<str>, {db | log}_file_name_convert = (‘prim’,
tion = (address =…) ) | (address = (protocol mat = ‘<fmt>’, nls_timestamp_format =
‘stdby’ [, …]), db_files = <200>, db_name =
= <prot>) (host = <node>) (port = <port>) ‘<fmt>’, nls_timestamp_tz_format = ‘<fmt>’,
<str>, db_writer_processes = <1>, dblink_en-
)} (connections = <n>) (dispatchers = <1>) nls_time_tz_format = ‘<fmt>’, object_cache_
crypt_login = {true | false}, dbwr_io_slaves =
(index = <n>) (listener = <list>) ( {pool | max_size_percent = <10>, object_cache_op-
<0>, disk_asynch_io = {true | false}, distrib-
multiplex} = {1 | on | yes | true | both | ({in | timal_size = <n>, optimizer_index_caching
uted_transactions = <n>, gc_files_to_locks
out} = <n>) | 0 | off | no | false | <n>}) (ticks = = <0>, optimizer_index_cost_adj = <100>,
= ‘<f#>[-<f#>]=<n>[!<B>][r][each][: …]’ <<
<15>) (service = <serv>) (presentation = {ttc | optimizer_max_permutations = <80000>, op-
disables Cache Fusion, hi_shared_memory_ad-
oracle.aurora.server.{SGiopServer | GiopServ- timizer_mode = {first_rows_{1|10|100|1000}
dress = <0>, ifile = <file>, instance_groups
er} })’, drs_start = {true | false}, fal_client = | first_rows | all_rows | choose | rule},
= <gr> [, …], instance_name = <sid>,
<serv>, fal_server = <serv>, fast_start_io_target oracle_trace_enable = {true | false}, parallel_
instance_number = <n>, java_max_ses-
= <n> << deprecated, fast_start_mttr_target broadcast_enabled = {true | false}, parallel_in-
sionspace_size = <0>, java_pool_size =
= <0>, fast_start_parallel_rollback = {hi | stance_group = <gr>, parallel_min_percent =
<20k>, java_soft_sessionspace_limit = <0>,
lo | false}, fixed_date = <date>, global_con- <0>, partition_view_enabled = {true | false},
large_pool_size = <n>, local_listener = <serv>,
text_pool_size = <1m>, hs_autoregister = plsql_compiler_flags = {[debug | non_debug],
lock_name_space = <name>, lock_sga =
{true | false}, job_queue_processes = <0>, [interpreted | normal]}, plsql_v2_compat-
{true | false}, log_archive_format = <fmt>,
license_max_sessions = <0>, license_max_us- ibility = {true | false}, query_rewrite_enabled
log_archive_start = {true | false}, log_buffer =
ers = <0>, license_sessions_warning = <0>, = {true | false}, query_rewrite_integrity =
<n>, logmnr_max_persistent_sessions = <1>,
log_archive_dest = <dir>, log_archive_du- {stale_tolerated | trusted | enforced}, remote_
max_commit_propagation_delay = <700>,
plex_dest = <dir>, log_archive_max_processes dependencies_mode = {timestamp | signature},
max_dispatchers = <5>, max_enabled_roles =
= <1>, log_archive_trace = <0>, log_check- session_cached_cursors = <0>, sort_area_re-
<20>, max_shared_servers = <n>, o7_diction-
point_interval = <bl>, log_checkpoint_time- tained_size = <n>, sort_area_size = <65536>,
ary_accessibility = {true | false}, open_cursors
out = <sec>, log_checkpoints_to_alert = {true star_transformation_enabled = {temp_disable
= <50>, open_links = <4>, open_links_per_in-
| false}, parallel_adaptive_multi_user = {true | true | false}, statistics_level = {typical | basic |
stance = <4>, optimizer_features_enable
| false}, parallel_threads_per_cpu = <n>, all}, timed_os_statistics = <0>, timed_statistics
= <9.0.0>, oracle_trace_collection_name
pga_aggregate_target = <0>, plsql_native_c_ = {true | false}, tracefile_identifier = ‘<id>’,
= <name>, oracle_trace_collection_path =
compiler = <path>, plsql_native_library_dir undo_suppress_errors = {true | false}, work-
<dir>, oracle_trace_collection_size = <n>,
= <dir>, plsql_native_library_subdir_count = area_size_policy = {auto | manual}
oracle_trace_facility_name = {oracled, oraclee,
<0>, plsql_native_linker = <path>, plsql_na-
oraclesm, oraclec}, oracle_trace_facility_path =
tive_make_file_name = <path>, plsql_native_ Session Parameters Only
<dir>, os_authent_prefix = <OPS$>, os_roles
make_utility = <path>, resource_limit = {true constraint[s] = {immediate | deferred | default},
= {true, false}, parallel_automatic_tuning =
| false}, resource_manager_plan = <plan>, ser- create_stored_outlines = {true | false | ‘<cat>’}
{true | false}, parallel_execution_message_size
vice_names = <serv> [, …], shared_pool_size = [nooverride], current_schema = <schema>, er-
= <n>, parallel_max_servers = <n>, paral-
<16/64m>, shared_servers = <0/1>, standby_ ror_on_overlap_time = {true | false}, flagger =
lel_min_servers = <0>, pre_page_sga = {true
archive_dest = <path>, standby_file_manage- {entry | immediate | full | off }, instance = <n>,
| false}, processes = <n>, rdbms_server_dn =
ment = {manual | auto}, trace_enabled = {true isolation_level = {serializable | read commit-
<x.500>, read_only_open_delayed = {true |
| false}, transaction_auditing = {true | false}, ted}, plsql_debug = {true | false}, skip_unus-
false}, recovery_parallelism = <n>, remote_ar-
undo_retention = <900>, undo_tablespace = able_indexes = {true | false}, sql_trace = {true
chive_enable = {true | false}, remote_listener =
<ts>, user_dump_dest = <dir> | false}, time_zone = {‘<{+|-}hh:mi>’ | local |
<serv>, remote_login_passwordfile = {none |
shared | exclusive}, remote_os_authent = {true dbtimezone | ‘<tz_region>’}, use_{private |

www.larsditzel.de
6 Oracle Server 9i Quick Reference Guide

Instance (cont.)

stored}_outlines = {true | false | ‘<cat>’} Debug events | tracefile_name


10015 (rollback), 10046 (process), 10049, | lkdebug
Hidden Initialization Parameters 10051, 10053, 10210, 10211, 10212, 10231, | nsdbx
10232, 10235, 10248 (dispatcher), 10249 | -G {<inst> | def | all}
_system_trig_enabled, _log_simultane-
(shared server + dispatcher), 10257 (pmon), 10262, | -R {<inst> | def | all}
ous_copies, _log_io_size
10289 (hex dump), 10297 (oid caching), 10325 | setinst {“<inst> [, …]” | all}
(control), 10408 (block keywords), 10520 (avoid | sgatofile <”path”>
Deprecated Initialization Parameters invalidations), 10619 (compatibility), 19027 (ctxx- | dmpcowsga <”path”>
mts_dispatchers, mts_servers path), 29700 (v$ges_convert% views), 30441 | mapcowsga <”path”>
%_area%_size <<for dedicated server cofigurations | hanganalyze [level]
oradebug | ffbegin
Obsolete Initialization Parameters { help [cmd] | ffderegister
job_queue_interval, db_block_max_dirty_tar- | setmypid | ffterminst
get, hash_multiblock_io_count = <n> | setospid <ospid> | ffresumeinst
| setorapid <orapid> [‘force’] | ffstatus
| dump <dump> <lev> [addr] | core
Events
| dumpsga [bytes] | ipc
{ alter system set event = | dumplist | unlimit
| alter session set events [=] } | event <evt> | procstat
‘<dbg_evt> trace name context | session_event <evt> | call <func> [<arg> , …] }
{forever, level <n> | off }’ | dumpvar {p | s | uga} <var> [lev]
alter session set events [=] | setvar {p | s | uga} <var> <val>
{ ‘immediate trace name | peek <addr> <len> [lev]
{ heapdump | blockdump | treedump | poke <addr> <len> <val>
| controlf | systemstate | buffers } | wakeup <orapid>
level <n>’ | suspend
| ‘<oerr> trace name errorstack level <n> | resume
[; name processstate level <n>]’ } | flush
| close_trace

Instance Startup/Shutdown Utilities


startup orapwd
[force] [restrict] [pfile=<par>] [ nomount | file=<file> password=<pwd> entries=<n>
[exclusive | parallel [retry] | shared [retry]] oradim
{ mount [<db>] | open –{new | edit | delete | startup | shutdown}
[read {only | write [recover]} | recover] –{sid <SID> | srvc <serv>} –newsid <SID>
[<db>] } ] –usrpwd <pwd> –intpwd <pwd>
shutdown –maxusers <n> –startmode {a | m}
[ normal | transactional [local] –shutmode {a | i | n}
| immediate | abort ] –{starttype | shuttype}
alter database [<db>] {srvc | inst | srvc, inst}
{ mount [ {standby | clone} database] –pfile <par> –timeout <n>
[exclusive | parallel] << obsolete tkprof <trc> <out>
| dismount [explain=<user>/<pwd>@<netserv>]
| open [read only | [read write] [table=<tab>] [print=<n>] [sys=no]
[resetlogs | noresetlogs] ] [insert=<file>] [record=<file>]
| close [normal | immediate] }; [aggregate=<n>] [sort=<opt>]
otrcfmt
Instance Modification oemctl
alter system {enable | disable} restricted { {start | stop | status | ping}
session; oms [<user>/<pwd>] | {start | stop}
alter system {quiesce restricted | unquiesce}; paging [<host> <name>] | {enable | dis-
able | dump | export | import}
alter system {suspend | resume};
eventhandler [<file>]
alter system kill session ‘<SID>,<Serial#>’
| {import | export} registry [<file>]
[immediate];
<user>/<pwd>@<repalias>
alter system disconnect session | configure rws }
‘<SID>,<Serial#>’
oemapp {console | dataguard}
[post_transaction | immediate];
vppcntl –start
alter system shutdown [immediate] ‘D<nnn>’;
vtm
alter system register;
alter system flush shared_pool;

www.larsditzel.de
Oracle Server 9i Quick Reference Guide 7

Instance (cont.)

Database Locks (v$lock) CU cursor bind, DF data file, DL direct cache, RT redo thread, SC system commit
modes loader parallel index creation, DM data- number, SM smon, SN sequence number,
0 - none, 1 - null (NULL), 2 - row share base mount, DR distributed recovery, DX SQ sequence number enqueue, SS sort seg-
(SS), 3 - row exclusive (SX), 4 - share (S), distributed transaction, FS file set, HW ment, ST space transaction, SV sequence
5 - share row exclusive (SSX), 6 - exclu- space management operation, IN instance number value, TA generic enqueue, TS
sive (X) number, IR instance recovery, IS instance temporary segment (ID2=0) or new block
user types and names state, IV library cache invalidation, JQ allocation (ID2=1), TT temporary table,
TM dml enqueue, TX transaction job queue, KK redo thread kick, L[A-P] UN user name, US undo segment ddl,
enqueue, UL user-defined lock library cache lock, MM mount defini- WL being-written redo log, XA instance
tion, MR media recovery, N[A-Z] library registration attribute lock, XI instance
system types and names
cache pin, PF password file, PI/PS parallel registration lock
BL buffer hash table, CF control file trans-
operation, PR process startup, Q[A-Z] row
action, CI cross-instance call invocation,

Table Locks (TM)

SQL Statement Mode Acquired Additional Mode Allowed? Row Locks?


RS RX S SRX X
select none Y Y Y Y Y
select … for update RS Y* Y* Y* Y* N X
lock table … in row share mode RS Y Y Y Y N
insert RX Y Y N N N X
update RX Y* Y* N N N X
delete RX Y* Y* N N N X
lock table … in row exclusive mode RX Y Y N N N
lock table … in share mode S Y N Y N N
lock table … in share row exclusive mode SRX Y N N N N
lock table … in exclusive mode X N N N N N

RS = SS (subshare), RX = SX (subexclusive), SRX = SSX (share-subexclusive)


* waits occur for conflicting row locks of concurrent transactions

www.larsditzel.de
8 Oracle Server 9i Quick Reference Guide

Database

Views & Tables Files


v$database, v$controlfile, v$controlfile_re- catalog.sql, catproc.sql, utlrp.sql, utlip.sql,
cord_section, v$deleted_object, utlirp.sql, utlconst.sql, utlincmpt.sql,
v$compatibility, v$compatseg, v$timezone_ utldst.sql, timezone.dat, timezlrg.dat,
names, dictionary, dict_columns, dba_catalog, catlg803.sql, u0703040.sql, r0703040.sql,
dba_objects, dba_object_size, dba_keepsizes, u080<n>0<n>0.sql, r08000<n>0.sql,
dba_analyze_objects, props$, database_prop- d080<n>0<n>.sql
erties, database_compatible_level
Tuning/Contention
Parameters phyrds, phywrts (v$filestat)
db_create_file_dest, db_create_online_log_
dest_<n>, undo_tablespace, cluster_database,
control_files, db_name, db_domain, db_files,
compatible, read_only_open_delayed

DB Creation [national character set create controlfile [‘<ctrl>‘] [reuse]


create database [<db>] {<UTF8> | <AL16UTF16>} ] set database <db> [datafile…] [logfile…]
[datafile ‘<file>’ [, …] size <n> [reuse] [set time_zone = … [[no]resetlogs];
[autoextend {on | off } [next <1xBS> { ‘<{+|-}hh:mi>’ create spfile [= ‘<spfile>’] from
maxsize {<n> | unlimited}] ]] | ‘<time_zone_region>’ } ] pfile [= ‘<pfile>’];
[logfile [group <n>] [set standby database create pfile [= ‘<pfile>’] from
(‘<log>’ [, …] ) size <n> [reuse] {protected | unprotected} ] spfile [= ‘<spfile>’];
[, [group <n>] [archivelog | noarchivelog] [exclusive]; alter database [<db>] backup controlfile to
(‘<log>’ [, …] ) size <n> [reuse] ] … ] { ‘<file>’ [reuse]
[default temporary tablespace <ts> DB Modification | trace [resetlogs | noresetlogs] };
[tempfile ‘<file>’] alter database [<db>] rename global_name alter database [<db>] create standby controlfile
[extent management local] to <db>; as ‘<file>’ [reuse];
[uniform [size <1> [k | m]] ]] alter database [<db>] default temporary alter database [<db>] set standby database
[undo tablespace <SYS_UNDOTBS> tablespace <ts>; {protected | unprotected};
[datafile ‘<file>’ alter system set undo_tablespace = <new_ts>; alter database [<db>]
[autoextend…] [, …] ]]
alter database [<db>] convert; commit to switchover to [physical]
[controlfile reuse]
alter database [<db>] reset compatibility; {primary | standby} [wait | nowait];
[maxdatafiles <n>] [maxinstances <n>]
alter database [<db>] [national] character set alter database [<db>] activate [physical]
[maxlogfiles <n>] [maxlogmembers <n>]
<new_char>; standby database [skip [standby logfile]];
[maxloghistory <n>]
[character set {<charset> alter database [<db>] set {dblow = <str> |
| <UTF8> | <UTFE> | <AL32UTF8>} ] dbhigh = <str> | dbmac {on | off } };

Data Guard CLI alter Other Utilities


dgmgrl [-silent] [-xml] [-debug] [-echo] { configuration set state = dbassist
connect <user>/<pwd>@<service> ‘[online | offline]’ dbca
| site ‘<site>’ set { state = ‘[online | offline]’
startup [restrict] [force] [pfile=<file>]
| auto pfile = ‘<pfile>’ [off ] }
[nomount | mount [<db>]
| resource ‘<res>’ [on site ‘<site>’] set
| open [read {only | write} ] ]
{ state = ‘<state>’
shutdown {normal | immediate | abort} | property ‘<prop>’ = ‘<val>’ };
show { configuration [verbose] [‘<prop>’] create
| site [verbose] ‘<site>’ [‘<prop>’] { configuration ‘<conf>’
| resource [verbose] ‘<res>’ [‘<prop>’] as primary site is ‘<prim>’
[on site ‘<site>’] | site ‘<site>’ }
| dependency tree resource is ‘<res>’ hostname is ‘<host>’
| log [alert] [latest] on site ‘<site>’ }; instance name is ‘<inst>’
enable { configuration | site ‘<site>’ | resource service name is ‘<serv>’
‘<res>’ [on site ‘<site>’] }; site is maintained as physical;
disable { configuration | site ‘<site>’ | resource remove { configuration ‘<conf>’ | site ‘<site>’ };
‘<res>’ [on site ‘<site>’] };

www.larsditzel.de
Oracle Server 9i Quick Reference Guide 9

Database Utilities

Views & Tables Loads [[x]’<str>’] [and [x]’<str>’]


v$loadcstat, v$loadistat, v$loadpstat, sqlldr | terminated [by]
v$loadtstat, dba_exp_files, dba_exp_objects, userid = <user>/<pwd> data = <data> {whitespace | [x]’<str>’ | eof }
dba_exp_version, sys.incexp, sys.incfil, control = <ctrl> parfile = <par> log = [[optionally] enclosed…] }
sys.incvid <log> bad = <bad> discard = <discard> [trailing [nullcols] ]
discardmax = <n> skip = <n> load = [sorted indexes]
<n> errors = <n> rows = <n> bindsize [singlerow]
Files
= <65536> readsize = <65536> silent ( { <col> { <sqlfunc> | sysdate | recnum
catexp.sql, catexp7.sql, migrate.bsq | sequence [( { <n>[.<x>]
= ( {header | feedback | errors | discards
| partitions | all} [, …] ) direct = <n> | max | count } )] }
Export multithreading = <n> streamsize = <n> | <col> [filler]
exp columnarrayrows = <n> parallel = <n> [ position ( { <x> [ {: | -} <y>]
help = <n> userid = <user>/<pwd> parfile file = <file> skip_unusable_indexes = <n> | * [+<z>] } ) ]
= <par> file = <expdat.dmp> filesize skip_index_maintenance = <n> com- { char [(<n>)]
= <n> volsize = <n> log = <log> buf- mit_discontinued = <n> external_table | varchar [(<n>)]
fer = <n> silent = <n> recordlength = = {not_used | generate_only | execute} | varcharc
<n> direct = <n> rows = <y> indexes resumable = <n> resumable_name = <str> | date [“<fmt>”]
= <y> grants = <y> constraints = <y> resumable_timeout = <7200> datecache | time
triggers = <y> feedback = <0> statistics = <n> | timestamp
= {estimate | compute | none} record = bind array size = | time with time zone
(n rows) * ( SUM (fixed field lengths) + SUM(max. | timestamp with time zone
<y> compress = <y> consistent = <n> varying field lengths) + ( (number of varying length
object_consistent = <n> flashback_scn = fields) * (size of length indicator [2 or 3, system | interval year to month
<scn> flashback_time = <time> resumable dependent]) ) ) | interval day to second
= <n> resumable_name = <str> resum- | integer [external] [(<n>)]
able_timeout = <7200> template = <x> Controlfile | smallint
tablespaces = (<ts> [, …]) transport_ta- [ options ( | float [external]
blespace = <n> tts_full_check = <x> [, …] [bindsize = <n>] [columnsarrayrows = | double
point_in_time_recover = <n> <n>] [direct = {true | false}] [errors = <n>] | byteint
recovery_tablespaces = <ts> [, …] [load = <n>] [multithreading = {true | | zoned [external] (p [,<s>])
{ full = <n> | owner = <schema> false}] [parallel = {true | false}] [readsize | decimal [external] (p [,<s>])
| tables = (<tab>[:<part>] [, …] = <n>] [resumable] [resumable_name] | raw [(<n>)]
[query = <expr>] ) } [resumable_timeout] [rows = <n>] [silent | varraw
inctype = {complete | cumulative | incre- = ({feedback | errors | discards | all} [, …])] | long varraw
mental} << deprecated [skip = <n>] [skip_index_maintenance] | varrawc
Perform full exports as user System. [skip_unusable_indexes] [streamsize = | graphic [(<n>)]
buffer size =
<n>] ) ] | graphic external [(<n>)]
(n rows) * SUM(max. field length + size of length
indicator [2 or 3, system dependent]) | vargraphic [(<n>)] }
[recoverable | unrecoverable]
[terminated by
{load | continue_load} data
{“<str>” | whitespace} ]
Import [{infile | inddn} [‘<load.dat>’ | * ]
[ {nullif | defaultif } ({<col> | <pos>})
imp [“str [x]’<char>’”]
<op> { [x]‘<str>’ | blanks } [and…] ]
help = <n> userid = <user>/<pwd> parfile [“recsize <n> buffers <n>”]
[enclosed by ‘<chr>’ and ‘<chr>’]
= <par> file = <expdat.dmp> filesize = [badfile ‘<load.bad>’ | baddn]
[“<sql_stmt>(:<col>)”]
<n> volsize = <n> log = <log> buffer [{discardfile | discarddn} ‘<load.dsc>’]
[, <col> …] )
= <n> recordlength = <n> rows = <y> [{discards | discardmax} <n>]
[into table <tab> …]
grants = <y> indexes = <y> indexfile = [characterset <char>]
[begindata…]
<file> constraints = <y> commit = <n> [byteorder {big | little} [endian] ]
compile = <y> ignore = <n> inctype = [byteordermark {check | nocheck} ]
[length [semantics] Migration
{system | restore} feedback = <0> show
= <n> statistics = {always | none | safe | {byte | char | character} ] mig
recalculate} analyze = <y> recalculate_sta- [concatenate <n>] dbname = <db> new_dbname = <new>
tistics = <n> destroy = <n> skip_unus- [continueif pfile = <initfile> spool = <logfile> check_
able_indexes = <n> toid_novalidate = { [this | next] [preserve] only = <false> no_space_check = <false>
(<type> [, …] ) resumable = <n> resum- [(] <pos> multiplier = <15> nls_nchar = <char >
able_name = <str> resumable_timeout | last [preserve] [(] }
= <7200> streams_configuration = <y> <op> [x]’<str>’ [)] ]
streams_instatiation = <n> { full = <n> | into table <tab>
tables = (<tab>[:<part>] [, …])} fromuser [ ({partition | subpartition} <part>) ]
= <schema> [, …] touser = <schema> [, [skip <n>]
…] transport_tablespace = <n> datafiles = {insert | replace | truncate | append}
‘(<file> [, …] )‘ tablespaces = (<ts> [, …]) [options (file = <db_file>) ]
tts_owners = <owner> [, …] point_in_ [when ({<col> | <pos>})
time_recover = <false> <op> { [x]‘<str>’ | blanks } [and…] ]
Order: type defs – table defs – table data – indexes [fields
– constraints, views, procedures, triggers { enclosed [by]
– bitmap, functional, domain indexes

www.larsditzel.de
10 Oracle Server 9i Quick Reference Guide

Tablespaces, Datafiles & Segments

Views & Tables fet$, seg$ relocate | fix}_bitmaps, tablespace_rebuild_


v$tablespace, v$datafile, v$datafile_copy, quotas, tablespace_fix_segment_states,
v$datafile_header, v$dbfile, v$offline_ Parameters tablespace_migrate_{from | to}_local,
range, v$tempfile, v$temp_extent_map, segment_{verify | corrupt | dump |
db_block_checking, db_block_checksum,
v$temp_extent_pool, v$temp_space_header, moveblocks}, segment_drop_corrupt, seg-
recovery_parallelism, fast_start_parallel_roll-
v$temp_ping, v$backup, v$recover_file, ment_number_{blocks | extents},
back, db_file_name_convert, log_check-
v$recovery_file_status, v$recovery_log, point_timeout, log_checkpoints_to_alert, DBMS_TTS
v$recovery_progress, v$recovery_status, db_writer_processes, db_file_simultane- transport_set_check, downgrade
v$recovery_transactions, v$instance_recovery, ous_waits, standby_file_management,
v$fast_start_servers, v$fast_start_trans- read_only_open_delayed Deprecated Features
actions, v$managed_standby, dba_ta- fast_start_io_target, log_checkpoint_interval
blespaces, dba_ts_quotas, dba_data_files, Packages
dba_temp_files, dba_segments, dba_extents,
DBMS_REPAIR Desupported Features
dba_free_space, dba_free_space_coalesced,
dba_free_space_coalesced_tmp[1-3], check_object, {skip | fix}_corrupt_blocks, db_block_max_dirty_target, db_file_simul-
ts_pitr_objects_to_be_dropped, ts_pitr_check, dump_orphan_keys, rebuild_freelists, taneous_writes, db_block_checkpoint_batch,
transport_set_violations, dba_dmt_free_space, admin_tables, segment_fix_status parallel_transaction_recovery
dba_dmt_used_extents, dba_lmt_free_space, DBMS_SPACE
dba_lmt_used_extents, pluggable_set_check, unused_space, free_blocks, space_usage
uni_pluggable_set_check, straddling_ts_ob- DBMS_SPACE_ADMIN
jects, ext_to_obj_view, ts$, file$, filext$, uet$, tablespace_verify, tablespace_{rebuild |

TS Creation alter tablespace <ts> { online | offline [ next <n> | timeout <n> | delay <n>
create tablespace <ts> [ normal | temporary | immediate | nodelay | expire <n> | cancel
[datafile ‘<file>’] << only optional if | for recover ] }; << deprecated [immediate] [nowait] | disconnect
DB_CREATE_FILE_DEST is set alter tablespace <ts> { read {write | only} [from session] [finish [nowait]] ]
[size <n>] [reuse] | permanent | temporary }; | [standby] tablespace ‘<ts>’ [, …]
[autoextend {off | on [next <n>] alter tablespace <ts> [minimum extent <n>] [until [consistent with] controlfile]
[maxsize {<n> | unlimited} ] } ] default storage (…); | [standby] datafile {‘<file>’ | <n>} [, …]
[,’<file>’… [autoextend…] ] alter tablespace <ts> coalesce; [until [consistent with] controlfile]
[minimum extent <n>] | logfile ‘<log>’ }
alter tablespace <ts> {begin | end} backup;
[blocksize <n> [k]] [test [allow <x> corruption] ]
alter database [<db>] datafile <n> [, …] [noparallel | parallel [<n>] ]
[default storage ( [initial <5xBS>] end backup;
[next <5xBS>] [pctincrease <50>] | continue [default] | cancel };
[minextents <1>] recover [automatic] [from ‘<log_path>’]
Datafiles { database [until { cancel | change <scn>
[maxextents {<n> | unlimited} ]
[freelists <1>] [freelist groups <1>] alter system checkpoint [global | local]; | time ‘<YYYY-MM-DD:HH24:MI:SS>’ }]
[buffer_pool {default | keep | recycle} ] )] alter system check datafiles [global | local]; [using backup controlfile]
[logging | nologging] alter database [<db>] datafile ‘<file>’ [, …] | [managed] standby database
[permanent | temporary] [online | offline] { resize <n> | autoextend… | online [timeout <n> | cancel [immediate] ]
[extent management | offline [drop] | end backup }; | [standby] tablespace ‘<ts>’ [, …]
{ dictionary | local alter database [<db>] tempfile ‘<file>’ [, …] [until [consistent with] controlfile]
[autoallocate | uniform [size <1m>]] }] { resize <n> | autoextend… | online | [standby] datafile {‘<file>’ | <n>} [, …]
[segment space management | offline | drop [including datafiles] }; [until [consistent with] controlfile]
{manual | auto} ]; alter database [<db>] rename file | logfile <log>
create undo tablespace <ts> ‘<file>’ [, …] to ‘<new_file>’ [, …]; | continue [default]
[datafile ‘<file>’… [autoextend…] ] << s.a. | cancel }
alter database [<db>] create datafile
[extent management local] [noparallel | parallel (degree {<n> | default}
‘<file>‘ [, …] [as {new | ‘<file>‘ [, …]} ];
[uniform [size <1m>]]; [instances <1> | default] )]
alter system dump datafile ‘<file>’
create temporary tablespace <ts> block min <x> block max <y>;
[tempfile ‘<file>’… [autoextend…] ] << s.a.
[extent management local] Recovery
[uniform [size <1m>]];
set autorecovery {on | off }
drop tablespace <ts>
[including contents [and datafiles] set logsource <dir>
[cascade constraints] ]; alter database [<db>] recover
[automatic] [from ‘<log_path>‘]
TS Modification { { [standby] database
[until { cancel | change <scn>
alter tablespace <ts> add {datafile | tempfile} | time ‘<YYYY-MM-DD:HH24:MI:SS>’ }]
‘<file>’ size <n> [reuse] [autoextend…]; [using backup controlfile]
alter tablespace <ts> rename datafile | managed standby database
‘<file>’ [, …] to ‘<new>’ [, …];

www.larsditzel.de
Oracle Server 9i Quick Reference Guide 11

Tablespaces, Datafiles & Segments (cont.)

Utilities Row piece: Base64


dbv file=<file> overhead, no. of columns, cluster key ID, OOOOOO – FFF – BBBBBB – RRR
start=<n> end=<n> logfile=<log> rowids of chained row pieces, Restrict(6B):
blocksize=<2048> feedback=<0> col data (col length, col value, …) Block#{Xb} - Row#{Xb} - File#{Xb}
parfile=<fil> segment_id=<ts.fil.blck>
RowID Packages
Blocks Logical: DBMS_ROWID
v$type_size hex string of variable length (rowid_create, rowid_object, rowid_rela-
Block header: Extend(10B): tive_fno, rowid_block_number, ro-
static (61B), table directory, row direc- DataObj#{32b} - RelFile#{10b} - wid_row_number, rowid_to_absolute_fno,
tory (2B*rec), interested transaction list Block#{22b} - Row#{16b} rowid_to_extended, rowid_to_restricted)
(23B*tx)

Logfiles

Views & Tables (_allow_resetlogs_corruption Files


<< undocumented & unsupported)
v$log, v$logfile, v$thread, v$loghist, v$log_ dbmslm.sql, dbmslmd.sql, dbmslms.sql,
history, v$database, v$archive, v$archive_dest, dbmscdcp.sql, dbmscdcs.sql catcdc.sql,
Packages
v$archive_dest_status, v$archive_gap, initcdc.sql
v$standby_log, v$archived_log, v$archive_ DBMS_LOGMNR_D
processes, v$logmnr_dictionary, v$logmnr_pa- build
Tuning/Contention
rameters, v$logmnr_logs, v$logmnr_contents, DBMS_LOGMNR
v$system_event, v$sysstat
dba_source_tables, dba_source_tab_columns, add_logfile, start_logmnr, end_logmnr,
mine_value, column_present Redo latch:
dba_subscriptions, dba_subscribed_tables,
«redo allocation», «redo copy» (v$latch)
dba_subscribed_columns, change_sources, DBMS_LOGMNR_SESSION
«misses» / «gets» > 1% or
change_sets, change_tables {add | remove}_logfile, {create | attach |
«immediate_misses» / («immediate_gets» +
detach | destroy}_session, column_present,
«immediate_misses») > 1%
Parameters include_src_tbl, mine_value, {prepare |
-> decrease «log_small_entry_max_size»
release}_scn_range, set_dict_attr, set_ses-
db_create_online_log_dest_<1-5>, thread, -> increase «log_simultaneous_copies»
sion_params
log_buffer, log_archive_max_processes, (max. CPU * 2)
log_archive_start, log_archive_dest, log_ar- DBMS_[LOGMNR_]CDC_PUBLISH
chive_format, standby_archive_dest, log_ar- {create | alter | drop}_change_table, drop_
{subscription | subscriber_view}, purge Desupported Features
chive_duplex_dest, log_archive_dest_
DBMS_[LOGMNR_]CDC_SUBSCRIBE v$targetrba, log_archive_buffers, log_archive_
<1-10>, log_archive_dest_state_<1-10>,
get_subcription_handle, subscribe, buffer_size, log_block_checksum, log_simul-
remote_archive_enable, fal_client, fal_server,
{activate | drop}_subscription, {extend | taneous_copies, log_small_entry_max_size,
log_archive_trace, archive_lag_target,
purge}_window, {prepare | drop}_ sub- lgwr_io_slaves
log_archive_min_succeed_dest, log_file_
name_convert, arch_io_slaves, utl_file_dir, scriber_view
logmnr_max_persistent_sessions, _log_simul-
taneous_copies, _log_io_size

Archive Mode Logfiles alter database [<db>] drop


archive log { list | stop | {start | next | all | alter database [<db>] add [standby] logfile [standby] logfile member ‘<log>’;
<n>}} [thread <n>] [group <n>] (‘<log>’, …) alter database [<db>] clear
[to <dest>] << always applies to current instance size <n>; [unarchived] logfile {group <n> | ‘<log>’}
alter database [<db>] alter database [<db>] [unrecoverable datafile];
{archivelog | noarchivelog}; {enable [public] | disable} thread <n>; alter database add supplemental log data
alter system archive log [thread <n>] alter database [<db>] add [standby] logfile ( {primary key | unique index} [, …] )
{ start [to ‘<log_path>’] | stop member ‘<log>’ [reuse] to group <n>; columns;
| current << global log switch alter database [<db>] register [or replace] alter database drop supplemental log data;
| next | all | sequence <n> | group <n> [physical] logfile ‘<log>’ [, …]; alter table add supplemental log group <grp>
| change <n> | logfile ‘<file>’ }; alter database [<db>] rename file (<col> [, …] ) [always];
alter system switch logfile; ‘<log>’ [, …] to ‘<new_log>’ [, …]; alter table drop supplemental log group <grp>;
<< applies only to current instance alter database [<db>] drop
[standby] logfile group <n>;

www.larsditzel.de
12 Oracle Server 9i Quick Reference Guide

Tables, Constraints & Triggers

Views & Tables analyze_database, analyze_schema, pctused = 1 – pctfree – AVG/nBLK


dba_tables, dba_all_tables, dba_object_tables, analyze_part_object scans:
dba_external_tables, dba_external_locations, DBMS_STATS «table scans%» (v$sysstat) -> adjust
dba_tab_comments, dba_tab_columns, col, {set | get}_{column | index | system | «db_file_multiblock_read_count»
dba_tab_col_statistics, dba_associations, table}_stats, gather_{system | database | row migr.:
dba_ustats, dba_col_comments, dba_up- schema | table | index}_stats, delete_{sys- «table_name», «head_rowid» (chained_
datable_columns, dba_unused_col_tabs, tem | database | schema | table | index | rows << utlchain.sql, utlchain1.sql) or «table
dba_tab_modifications, dba_nested_tables, column}_stats, {export | import}_ {sys- fetch continued row» (v$sysstat)
dba_part_tables, dba_tab_partitions, tem | database | schema | table | index | -> increase pctfree
dba_tab_subpartitions, dba_part_col_sta- column}_stats, prepare_column_values, -> recreate table
tistics, dba_part_key_columns, dba_par- convert_raw_value, generate_stats, {create | freelists:
tial_drop_tabs, dba_subpart_col_statistics, drop}_stat_table, alter_{database | sche- «segment header» (v$waitstat), «buffer
dba_subpart_key_columns, dba_constraints, ma}_table_monitoring, flush_{database | busy waits» (v$system_event)
dba_cons_columns, dba_triggers, dba_trig- schema}_monitoring_info -> alter pctfree/pctused, inittrans or
ger_cols, dba_internal_triggers, dba_tab_his- DBMS_REDEFINITION -> increase freelist/freelist groups
tograms, dba_part_histograms, dba_sub- {can | start | finish | abort}_redef_table, (v$session_wait -> dba_extents -> dba_seg-
part_histograms, tab$, col$, con$, cdef$, sync_interim_table ments -> recreate object)
ccol$, trigger$, triggercol$, com$, hist_head$, full & partial partition-wise joins
tabpart$, tabsubpart$ Files
utlexcpt.sql, utlexcpt1.sql, dbmsstdx.sql, Desupported Features
Parameters dbmsutil.sql, utlvalid.sql, utlchain.sql, dba_histograms, cache_size_threshold
_system_trig_enabled utlchn1.sql

Packages Tuning/Contention
DBMS_UTILITY pctfree = UPD/AVG

Table Creation [pctfree <10>] [pctused <40>] [logging | nologging] ]


(max. 1000 col) [initrans <1>] [maxtrans <n>] [index <ind> << deprecated in 8i and 9i
create [global temporary] table <tab> [storage (…) ] [tablespace <ts>] ([tablespace <ts>]
[of <object_type> [logging | nologging] [storage (…)]) ]
[[not] substitutable at all levels] [recoverable | unrecoverable] << deprecated [tablespace <ts>… ] ) ]
[object identifier is [organization [XMLType [<col>] store as clob [<lobseg>]
{primary key | system generated} ] { heap [([tablespace <ts>]…)] ]
[oidindex <ind> ([tablespace <ts>…] | index << see index-organized table below [ partition by range (<col> [, …])
[storage (…)]) ] ] | external ( [type <oracle_loader>] [subpartition by hash (<col> [, …])
( <col> <type> [ {default | := } <value>] default directory <dir> [subpartitions <n>
[with rowid] [scope is <tab>] [access parameters [store in (<ts> [, …])] ]
[constraint <col_constr>] { (<opaque_format>) ( partition [<part>]
[ {[not] null | using clob <subquery> } ] values less than
| primary key [using index location ([<dir>:] ‘<loc>’ [, …]) ) ( {<val> [, …] | maxvalue} )
{ <ind>… [reject limit {<0> | unlimited}] } ] [storage (…)] [tablespace <ts>]
| (create unique index <ind> [cluster <clust> (<col> [, …])] [ (subpartition <subpart>
on <tab> (<col> [,…]) …) } ] [column <col> [tablespace <ts>]
| unique [using index { [element] is of [type] (only <type>) [, subpartition…] )
{ <ind>… | [not] substitutable at all levels } ] | subpartitions <n>
| (create unique index <ind> [nested table <col> store in (<ts> [, …]) ]
on <tab> (<col> [,…]) …) } ] [ [element] is of [type] (only <type>) [, partition…
| check (<expr>) | [not] substitutable at all levels ] [(subpartition…)] ] )
| references <tab> [(<col>)] store as <tab> | partition by list (<col>)
[on delete {cascade | set null}] } [( (<prop>) [storage (…)] )] (partition [<part>]
[ [not] deferrable [initially [return as {locator | value}] ] values ({<val> [, …] | null})
{immediate | deferred}] ] [varray <varr> [storage (…)] [tablespace <ts>]
[ {enable | disable} [ [element] is of [type] (only <type>) [ (subpartition <subpart>
[validate | novalidate] | [not] substitutable at all levels ] [tablespace <ts>]
[exceptions into <tab>] ] store as lob [<lobseg>] [, subpartition…] )
[,<col>… [constraint <col_constr>]…] [([tablespace <ts>]…)] ] | subpartitions <n>
[, …] [, constraint <tab_constr>…] [lob { (<col>) store as <lob_seg> store in (<ts> [, …]) ]
[ref (<col>) with rowid] | (<col> [, …]) store as } [, partition…
[scope for (<col>) is <tab>] ( [tablespace <ts>] [storage (…)] [(subpartition…)] ] )
[supplemental log group <grp> [{enable | disable} storage in row] | partition by hash (<col> [, …])
(<col> [, …]) [always] ] ) [pctversion <10>] [chunk <n>] { (partition <part>
[on commit {delete | preserve} rows] [cache | {nocache | cache reads} [tablespace <ts>]

www.larsditzel.de
Oracle Server 9i Quick Reference Guide 13

Tables, Constraints & Triggers (cont.)

[, partition…]) alter table <tab> add partition … [rely | norely];


| partitions <n> [<hash_part> [tablespace <ts>]] […]; alter table <tab> drop
store in (<ts> [, …]) } ] alter table <tab> drop partition <part> { constraint <constr> [cascade]
[{disable | enable} row movement] [, …] […]; | { primary key | unique (<col> [, …]) }
[cache | nocache] alter table <tab> coalesce partition […]; [cascade] [{keep | drop} index] };
[rowdependencies | norowdependencies] alter table <tab> truncate set constraint[s] {<constr> [, …] | all}
[monitoring | nomonitoring] {partition | subpartition} <part> {immediate | deferred};
[parallel [<n>] | noparallel] [{drop | reuse} storage] […];
[{enable | disable} [validate | novalidate]
alter table <tab> rename Triggers
{ primary key | unique (<col> [, …])
{partition | subpartition} <part> to <new>; alter table <tab> {enable | disable} all triggers;
| constraint <constr> } [using index…]
[exceptions into <tab>] [cascade] alter table <tab> modify create [or replace] trigger <trigg>
[{keep | drop} index] ] {partition | subpartition} <part> { before | after | instead of }
[as <subquery>]; [storage (…) ] [allocate extent…] { {delete | insert | update [of <col> [, …]] }
[logging | nologging] … [or…] on {<tab> | [nested table <col>
[[rebuild] unusable local indexes]; of ] <view>}
Table Modification
alter table <tab> modify | { { {associate | disassociate} statistics
alter table <tab> modify (<col> <type>…); partition <part> | analyze | audit | noaudit | comment
alter table <tab> add (<col> <type>…); {add subpartition | create | alter | rename | drop | grant
alter table <tab> set unused [<subpart> [tablespace <ts>]] | revoke | truncate | ddl } [or…]
{(<col> [, …]) | column <col>} | coalesce [subpartition] } […]; | { shutdown | startup | servererror
[cascade constraints] [invalidate]; alter table <tab> modify default attributes | logon | logoff | suspend } [or…] }
alter table <tab> drop [for partition <comp_part>] on {schema | database} }
{(<col> [, …]) | column <col>} [storage (…)] …; [referencing {old [as] <old> | new [as]
[cascade constraints] [invalidate] alter table <tab> modify <new> | parent [as] <parent>} [, …] ]
[checkpoint <512>]; partition <part> [for each row] [when (<expr>)]
alter table <tab> drop {add | drop} values (<val> [, …]); { begin <stat>; end;
{unused columns | columns continue} alter table <tab> move | call … ; }
[checkpoint <512>]; {partition | subpartition} <part> alter trigger <trigg>
drop table <tab> [cascade constraints]; tablespace <ts> {enable | disable | compile [debug]};
rename <tab> to <new_tab>; [logging | nologging] […]; drop trigger <trigg>;
alter table <tab> move alter table <tab> split
[tablespace <ts>] [storage (…)] partition <part1> at (<n>) Statistics
[logging | nologging] into (partition <part2>, deprecated (use DBMS_STATS) >>
[parallel [<n>] | noparallel]; partition <part3> [, …] ) […];
analyze table <tab>
truncate table <tab> alter table <tab> merge partitions <part1>, [partition (<n>) | subpartition (<n>)]
[[preserve | purge] snapshot log] <part2> [into partition <part3>] […]; { compute [system] statistics
[{drop | reuse} storage]; alter table <tab> exchange | estimate [system] statistics
alter table <tab> [storage (…)] {partition | subpartition} <part> [sample <1064> {rows | percent}] }
[noparallel | parallel [<n>] ] … with table <tab> [including indexes] [for table] [for all [local] indexes]
[{nominimize | minimize} [{with | without} validation] […]; [for all [indexed] columns [size <75>] ]
records_per_block]; [for columns [size <75>]
alter table <tab> Constraints <col> [size <75>] [<col>…] ];
{ allocate extent ( [size <n>] alter table <tab> add analyze table <tab> delete [system] statistics;
[datafile ‘<file>‘] [instance <n>] ) ( [constraint <tab_constr>] analyze table <tab> list chained rows
| deallocate unused [keep <n>] }; { primary key (<col> [, …]) [into <chained_rows>];
lock table <tab> in [using index…] analyze table <tab> validate
{ row share | share update | unique (<col> [, …]) [using index…] { structure [cascade] [into <invalid_rows>]
| row exclusive | foreign key (<col> [, …]) {online | offline}
| share references <tab> [(<col> [, …])] | ref update [set dangling to null] };
| share row exclusive [on delete {cascade | set null} ] associate statistics with
| exclusive } mode [nowait]; | check (<expr>) } { columns [<tab>.]<col> [, …]
alter table <tab> {enable | disable} table lock; [[not] deferrable | functions <func> [, …]
comment on {table <tab> | column [initially {immediate | deferred}] ] | packages <pack> [, …]
<tab>.<col>} is ‘<str>’; [{disable | enable} [validate | novalidate] | types <type> [, …]
alter table add supplemental log group <grp> [exceptions into <tab>]] ); | indexes <ind> [, …]
(<col> [, …] ) [always]; alter table <tab> | indextypes <indtype> [, …] }
alter table drop supplemental log group <grp>; {disable | enable} [validate | novalidate] [using <stat_func>]
{ constraint <constr> [default cost (<cpu>, <io>, <network>)]
| primary key [default selectivity <selec>];
Partitioning
| unique (<col> [, …]) } disassociate statistics from
alter table <tab> add partition <range_part> [using index…] { columns [<tab>.]<col> [, …]
values less than (<value> [, …] ) [exceptions into <tab>] [cascade] | functions <func> [, …]
[tablespace <ts>] [{keep | drop} index]; | packages <pack> [, …]
[{update | invalidate} global indexes]
alter table <tab> modify constraint <constr> | types <type> [, …]
[parallel [<n>] | noparallel];

www.larsditzel.de
14 Oracle Server 9i Quick Reference Guide

Tables, Constraints & Triggers (cont.)

| indexes <ind> [, …] | terminated by { whitespace | ‘<str>’} | interval { year_to_month


| indextypes <indtype> [, …] } [[optionally] enclosed by…] ] | day_to_second } } ]
[force]; [ltrim | rtrim | lrtrim | ldtrim | notrim] | { varchar | varraw | varcharc
[missing field values are null] | varrawc } ([<n>,] <max>) ]
External Table Opaque Format [(<field> [{defaultif | nullif } <expr>]
[ [position] ({ * | <start> | [+|-] [, <field> …] ) ]
record
<incr>} [:|-] {<end> | <len> }) ]
{ {fixed | variable} <n>
[ [unsigned] integer [external] <n>
| delimited by {newline | ‘<str>’} }
| {decimal | zoned} [external]
[characterset ‘<char>’]
(<p> [, <s>])
[data is {little | big} endian]
| oracle date
[string sizes are in {bytes | characters} ]
| oracle number [counted]
[load when <expr>]
| {double | float} [external]
[{badfile [<dir>:] ‘<file>’ | nobadfile]
| raw <n>
[discardfile [<dir>:] ‘<file>’ | nodiscardfile]
| char <n> [enclosed…] [ltrim…]
[logfile [<dir>:] ‘<file>’ | nologfile]
[dateformat
[skip <n>]
{ { date | {time | timestamp}
[fields
[with timezone] }
[ enclosed by ‘<str>’ [and ‘<str>’]
mask “<fmt>”

Views, Synonyms & Sequences

Views & Tables [with { read only | check option Sequences


dba_views, dba_synonyms, dba_sequences [constraint <constr>] } ]; create sequence <seq>
alter view <view> <constr>…; [start with <1>] [increment by <1>]
View constraints are declarative only. Only unique or [maxvalue <1027> | nomaxvalue]
Views prim./foreign key with mode disable novalidate.
[minvalue <1> | nominvalue]
create [or replace] [force | noforce] alter view <view> compile;
[cycle | nocycle] [nocache | cache <20>]
view <view> rename <view> to <new_view>; [order | noorder];
[ ( { <alias> [<col_constr>] drop view <view>; When an instance shuts down, cached sequence values
| <constr> } [, …] ) that have not been used in committed DML statements
| of <type> can be lost.
Synonyms Ordered sequences may not be cached with RAC.
{ with object identifier
[default | (<attr>, …)] create [public] synonym <syn> for <obj>; alter sequence <seq> …;
| under <superview> } rename <syn> to <new_syn>; << only private! rename <seq> to <new_seq>;
( { <attr> <col_constr> drop [public] synonym <syn>; drop sequence <seq>;
| <constr> } [, …] ) ]
as <query>

Clusters

Views & Tables [size <1xBS>] cluster <clust> (<col> [, …] );


dba_clusters, dba_clu_columns, all_tab_col- [tablespace <ts>] [storage (…)] alter cluster <clust>…;
umns, dba_cluster_hash_expressions [pctfree <10>] [pctused <40>] truncate cluster <clust>
[initrans <n>] [maxtrans <255>]; [ {drop | reuse} storage];
Creation & Modification create index <ind> drop cluster <clust>
on cluster <clust> [pctfree <n>] [including tables [cascade constraints]];
create cluster <clust> [tablespace <ts>] [storage (…)]
(<col> <type> [, …] ) analyze cluster <clust> …;
[initrans <n>] [maxtrans <n>];
[index | [single table] hashkeys <n>
create table <tab>
[hash is <expr>] ]
(<col> <type>… [constraint <constr>…] )

www.larsditzel.de
Oracle Server 9i Quick Reference Guide 15

Index-organized Tables

Views & Tables [overflow [tablespace <ts>] [pctfree <10>] [(partition <part>…) ];
all_tables (iot_type, iot_name), all_indexes [initrans <1>] [maxtrans <255>] alter table <iot> move [online]
[storage (…)] [compress [<n>] | nocompress]
[allocate…] [deallocate…] [tablespace <ts>] [overflow…] …
Creation & Modification
[logging | nologging] ] [noparallel | parallel [<n>] ];
create table <iot> [partition by range (<col> [, …]) alter table <iot> modify default attributes
(<col>… primary key…) (partition <partX> [for partition <part>] [storage (…)]
organization index values less than (<value> [, …]) [pctthreshold <50> [including <col>]]
[tablespace <ts>] [storage (…)] [storage (…)] [tablespace <ts>] [compress [<n>] | nocompress]
[pctfree <n>] [initrans <n>] [maxtrans [overflow tablespace <ts>…] [overflow tablespace <ts>…];
<n>] [, parti-
[mapping table | nomapping] alter table <iot> coalesce;
tion…] )];
[pctthreshold <50> [including <col>]] analyze table <iot> compute statistics;
alter table <iot> … [overflow…];
[compress [<n>] | nocompress]
alter table <iot> add overflow …

Indexes

Views & Tables icol$, icoldep$ Packages & Files


v$object_usage, dba_indexes, dba_indextypes, DBMS_PCLXUTIL
dba_indextype_operators, dba_ind_columns, Parameters build_part_index
dba_ind_expressions, index_stats, dba_part_ create_bitmap_area_size, bitmap_merge_
indexes, dba_ind_partitions, dba_ind_sub- area_size Tuning/Contention
partitions, dba_part_col_statistics, dba_sub-
index_stats:
part_col_statistics, index_histogram, ind$,
«del_lf_rows_len» / «lf_rows_len» > 20%

Index Creation values less than Index Modification


create [unique | bitmap] ({<value> [, …] | maxvalue}) alter index <ind> [storage (…)]
index <ind> on <tab> [storage (…)] [tablespace <ts>] [initrans <n>] [maxtrans <n>]
{ ([<expr>] <col> [asc | desc] [, …]) [logging | nologging] [compress [<n>] | nocompress];
| ([<tab>] <col> [asc | desc] [, [<tab>]…]) [, partition…] )] alter index <ind>
from <tab> [, <tab>…] where <expr> } [indextype is <type> { allocate extent ( [size <n>]
[tablespace {<ts> | default }] [parameters (‘<str>‘)] ]; [datafile ‘<file>‘] [instance <n>] )
[storage (…)] [pctfree <10>] drop index <ind>; | deallocate unused [keep <n>] };
[initrans <n>] [maxtrans <255>] alter index <ind> {enable | disable}; alter index <ind> rebuild
[logging | nologging] [nosort] [reverse] alter index <ind> unusable; [{partition | subpartition} <part>]
[online] [noparallel | parallel [<n>] ] alter index <ind> rename to <new>; [tablespace <ts>] [storage (…)]
[compress [<n>] | nocompress] [pctfree <10>]
[local Index Partitioning [initrans <n>] [maxtrans <255>]
[(partition [<partX>] [storage (…)] [logging | nologging]
[tablespace <ts>] alter index <ind> drop partition <part> [, …];
on range parti- [parallel [<n>] | noparallel]
tioned table [logging | nologging] alter index <ind> rename
[compress <n> | nocompress]
[, partition…] ) {partition | subpartition} <part> to <new>;
[compute statistics] [online]
| [store in ({<ts> [, …] | default}) alter index <ind> modify [reverse | noreverse]
| (partition [<partX>] {partition | subpartition} <part> [parameters (‘<par>‘) ];
on hash parti- [tablespace <ts>] [storage (…)] …
alter index <ind> coalesce;
tioned table [, partition…] )] [logging | nologging] [unusable]
| store in ({<ts> [, …] | default}) [rebuild unusable local indexes];
Statistics
[(partition [<partX>] alter index <ind> modify default attributes
[storage (…)] [for partition <part>] analyze index <ind>…;
on composite [tablespace <ts>] [storage (…)] [pctfree <n>] …; analyze index <ind> validate structure
partitioned
table [logging | nologging] alter index <ind> rebuild {online | offline};
[store in ({<ts> [, …] | default}) {partition | subpartition} <part> alter index <ind>
| ( subpartition [<subpartX>] [tablespace <ts>] [parallel [<n>]]; {monitoring | nomonitoring} usage;
[tablespace <ts>] alter index <ind> split partition <p1>
[, subpartition…] )] at values less than (<n>) into
[, partition…] )] ]] (partition <p2>, partition <p3> [, …]);
[global partition by range (<col>)
(partition <partX>

www.larsditzel.de
16 Oracle Server 9i Quick Reference Guide

Undo Management

Views & Tables Packages [storage ([initial <5xBS>] [next <5xBS>]


v$undostat, v$rollname, v$rollstat, DBMS_TRANSACTION [optimal <null>] [minextents <1>]
v$transaction, v$transaction_enqueue, use_rollback_segment [maxextents {<n> | unlimited}] )];
v$global_transaction, dba_undo_extents, drop rollback segment <rbs>;
dba_rollback_segs, dba_pending_transactions Tuning/Contention
RBS Modification
RBS Header:
Parameters «undo segment tx slot» (v$system_event) alter rollback segment <rbs> {online | offline};
undo_management, undo_tablespace, > 0 or (v$rollstat) sum(«waits») / alter rollback segment <rbs> storage (…);
undo_retention sum(«gets») > 5% -> add RBS alter rollback segment <rbs> shrink [to <n>];
RBS Segment: set transaction use rollback segment <rbs>;
Deprecated Features «%undo%» (v$waitstat) / «consistent gets»
rollback_segments, transactions, transac- (v$sysstat) (count/value) > 1% -> add RBS Undo Management
tions_per_rollback_segment create undo tablespace <ts>…;
(_corrupted_rollback_segments RBS Creation
alter system set undo_tablespace = <ts>;
<< undocumented & unsupported) create [public] rollback segment <rbs>
[tablespace <ts>]

Temporary Segments

Views & Tables Tuning/Contention


v$tempseg_usage, v$sort_segment, v$sort_us- Sorts:
age, dba_segments «sorts (disk)», «sorts (memory)», «sorts
(rows)» (v$sysstat) disk.value / mem.value
Parameters > 5% -> increase «sort_area_size»
(+ decrease «sort_area_retained_size»)
sort_area_size, sort_area_retained_size

Desupported Features
sort_multiblock_read_count, sort_direct_
writes, sort_write_buffers, sort_write_buf-
fer_size

www.larsditzel.de
Oracle Server 9i Quick Reference Guide 17

Users, Privileges, Resources & Policies

Views & Tables sumer_group_privs, dba_rsrc_manager_sys- mit | clear | validate}_pending_area, {create


v$enabledprivs, v$resource, v$resource_limit, tem_privs, user$, user_history$, sysauth$, | update | delete}_{plan | plan_directive |
v$pwfile_users, v$context, v$rsrc_plan, objauth$ consumer_group}, delete_plan_cascade,
v$rsrc_plan_cpu_mth, v$rsrc_consumer_ switch_consumer_group_for_{sess | user}
group, v$rsrc_consumer_group_cpu_mth, Parameters DBMS_RESOURCE_MANAGER_PRIVS
v$parallel_degree_limit_mth, v$max_ac- o7_dictionary_accessibility, remote_os_au- {grant | revoke}_system_privilege, {grant |
tive_sess_target_mth, v$vpd_policy, thent, os_roles, remote_os_roles, max_en- revoke}_switch_consumer_group
dba_users, dba_roles, dba_profiles, dba_us- abled_roles, resource_limit, resource_man- DBMS_SESSION
tats, dba_ts_quotas, dba_sys_privs, ager_plan, ent_domain_name switch_current_consumer_group
dba_tab_privs, dba_col_privs, dba_role_privs, DBMS_RLS
role_sys_privs, role_tab_privs, role_role_privs, Environment {add | drop | enable | refresh}_policy, {add |
user_tab_privs_made, user_tab_privs_recd, drop | enable | disable | refresh}_grouped_
user_col_privs_made, user_col_privs_recd, $ORA_ENCRYPT_LOGIN
policy, {add | drop}_policy_context, {create
user_password_limits, user_resource_limits, | delete}_policy_group
session_privs, session_roles, dba_context, Packages
dba_policies, proxy_users, resource_cost, DBMS_RESOURCE_MANAGER
dba_rsrc_plans, dba_rsrc_plan_directives, set_initial_consumer_group, {create | sub-
dba_rsrc_consumer_groups, dba_rsrc_con-

Users | none}; Profiles


create user <user> identified set role create profile <prof> limit
{ by <pwd> { <role> [identified by <pwd>] [ { sessions_per_user
| by values ‘<crypt_pw>‘ [, <role> [identified by <pwd>] …] | cpu_per_session
| externally | all [except <role> [, …] ] | cpu_per_call
| globally as ‘<user>’ } | none }; | connect_time
[default tablespace <ts>] | idle_time
[temporary tablespace <ts>] Privileges | logical_reads_per_session
[quota {<n> | unlimited} on <ts>] grant {<priv> [, …] | <role> [, …] | all | logical_reads_per_call
[quota…] [privileges]} to | composite_limit
[password expire] {<user> [, …] | <role> [, …] | public} | private_sga
[account {lock | unlock}] [identified by <pwd>] | failed_login_attempts
[profile {<prof> | default}]; [with admin option]; | password_lock_time
alter user <user>…; revoke {<priv> | <role>} from | password_life_time
drop user <user> [cascade]; {<user> | <role> | public}; | password_grace_time
| password_reuse_time
grant {<priv> [(<col> [, …])] [, …] | all }
| password_reuse_max }
Roles on <object>
{<n> | unlimited | default} [, …] ]
create role <role> to { <user> [, …] | <role> [, …] | public }
[password_verify_function
[ not identified [with grant option]
{<func> | null | default} ];
| identified [with hierachy option];
alter profile <prof> limit…;
{ by <pwd> | using <package> revoke {<priv> [(<col> [, …])] | all [privileges]}
on [directory] <object> drop profile <prof> [cascade];
| externally | globally } ];
from { <user> | <role> | public } alter resource cost
alter role <role>…;
[cascade constraints]; [connect_time <n>] [cpu_per_session <n>]
drop role <role>;
[logical_reads_per_session <n>]
alter user <user> default role [private_sga <n>];
{ <role> [, …]
| all [except <role> [, …]]

www.larsditzel.de
18 Oracle Server 9i Quick Reference Guide

Auditing

Views & Tables Packages SQL


all_def_audit_opts, dba_stmt_audit_opts, DBMS_FGA [no]audit
stmt_audit_option_map, dba_priv_au- {add | drop | enable | disable}_policy {<stat> [, …] | <priv> [, …] }
dit_opts, dba_obj_audit_opts, user_tab_au- [by <user> [, …]] [by {session | access}]
dit_opts, dba_audit_trail, dba_audit_session, Parameters [whenever [not] successful];
dba_audit_statement, dba_audit_object, [no]audit <stat> [, …] on {<object> | default}
audit_trail, transaction_auditing
dba_audit_exists, dba_audit_policies, [by {session | access} ]
dba_fga_audit_trail, audit_actions, sys.aud$, [whenever [not] successful];
sys.fga_log$ Files shortcuts: user, table, procedure, resource, connect,
cataudit.sql, catnoaud.sql dba, …

Net Services

Stack restart | status | ping <ns> | reorder_ns (sid_list = (sid_desc = (global_dbname =


Application, Server – OCI (UPI), OPI, NPI | start_client_cache | delegate_domain <n>) << disables TAF with RAC (oracle_home
– TTC – TNS (NI,NR,NN,NS,NA) – OPA | domain_hint | flush | flush_name = <path>) (sid_name = <SID>) (sdu =
(NT) [–Protocol] | load_tnsnames | dump_tnsnames <n>) (program = <prog>) (prespawn_max
| dump_ldap | log_stats | reset_stats | help = <n>) (prespawn_list = (prespawn_desc
| password | register | unregister | query = (protocol = <n>) (pool_size = <n>)
Service Name Resolution
| timed_query | repeat | set | show (timeout = <n>))))),
local naming, host naming, external naming, | version } >> Since release 8.1 sid_list_<LISTENER> only
centralized naming required with Enterprise Manager! <<
cmctl
{ start | stop | status | version } service_list_<LISTENER> = <n>
Utilities [cman | cm | adm] passwords_<LISTENER> = <n>
lsnrctl trcasst [-o{c|d}{u[q]|t} -e[0|1|2] -s -p …] <file> connect_timeout_<LISTENER> = <n>
{ start | stop | status | reload | set | show netasst, tnsping, trcroute, adapters use_plug_and_play_<LISTENER> = <n>
| help | version | change_password oerr <tns> <errno> save_config_on_stop_<LISTENER> = <n>
| services | save_config | trace ldapmodify trace_{level | file | directory}_
| dbsnmp_start | dbsnmp_stop <LISTENER>=<n>
| dbsnmp_status } logging_<LISTENER> = <n>
listener.ora
[<LISTENER>] log_{file | directory}_<LISTENER> = <n>
agentctl <LISTENER> =
(description_list = (description = (ad- startup_wait_time_<LISTENER> = <n>
{ { start | stop | status | restart } [<agent>]
dress_list = (address = (protocol = <tcp>) queuesize = <n>
| { start | stop | status} blackout [<target>]
(host = <node>) (port = <1521>) (key = ssl_client_authentication = <n>
[-d[uration] <[d] hh:mi>]
[-s[ubsystem] <subsys>] } <prog>))) (protocol_stack = (presentation ssl_version = undetermined
namesctl = {ttc | giop}) (session = {ns | raw}))))
{ startup | shutdown | start | stop | reload | sid_list_<LISTENER> =

www.larsditzel.de
Oracle Server 9i Quick Reference Guide 19

Net Services (cont.)

tnsnames.ora (Local Naming) namesctl.internal_encrypt_password = <n>, Environment


<net_serv> = namesctl.internal_use = <n>, namesctl.no_ini- $TNS_ADMIN
(description = tial_server = <n>, namesctl.noconfirm =
(address_list = <n>, namesctl.server_password = <n>,
(failover = {on | off }) namesctl.trace_{level | file | directory | unique}
(load_balance = {on | off }) = <n>
desupported: automatic_ipc
(source_route = {on | off })
(address =
(protocol = <n>) (port = <n>) names.ora << deprecated
(host = <node>)) […]) names.server_name = <n>, names.addresses
(connect_data = = <n>, names.region_checkpoint_file = <n>,
(service_name = <serv>) default_domain = <n>, forwarding_available =
(instance_name = <sid>) <n>, log_file_name = <n>, log_stats_interval =
(handler_name = <n>) (sdu = <n>) <n>, reset_stats_interval = <n>, cache_check-
(server = dedicated) (hs = ok) point_interval = <n>, requests_enabled = <n>,
(rdb_database = <rdbfile>) server = <n>, namesctl_trace_level = <n>,
(type_of_service = <n>) trace_file_name = <n>, trace_level = <n>,
(global_name = <rdb>) names.trace_{file | directory | unique} = <n>,
(failover_mode = names.log_{file | directory} = <n>, queuesize
(type = {select | session | none}) = <n>
(method = {basic | preconnect}) desupported:
names.use_plug_and_play, names.{domain | topol-
(retries = <5>) (delay = <1>) ogy}_checkpoint_file
(backup = <serv>)
(instance_role = protocol.ora << desupported
{primary | secondary | any}) ))
desupported: <prot>.{excluded | invited}_nodes = <node>,
(connect_data = (sid = <n>)) <prot>.validnode_checking = <n>, tcp.nodelay
>> Exception! Use of OEM and OPS on WinNT. = <n>
Create net service names ‘<SID>_startup’. <<

sqlnet.ora cman.ora
log_{file | directory}_{client | server} = <n>, cman =
use_cman = <n>, use_dedicated_server = <n>, (address = (protocol = <tcp>)
sqlnet.expire_time = <n>, sqlnet.{encryption (host = <node>) (port = <1630>))
| crypto_checksum}_{client | server} = cman_admin = (address = (protocol = <tcp>)
{accepted | rejected | requested | required}, (host = <node>) (port = <1830>))
sqlnet.{encryption | crypto_checksum}_types_ cman_profile =
{client | server} = <n>, sqlnet.crypto_seed = (maximum_relays = <n>, relay_statistics
<n>, trace_unique_client = <n>, trace_{level = <n>, log_level = <n>, tracing = <n>,
| file | directory | timestamp}_{client | server} trace_directory = <path>, show_tns_info
= <n>, tnsping.trace_{level | directory} = = <n>, use_async_call = <n>, authentica-
<n>, daemon.trace_{level | directory | mask} tion_level = <n>)
= <n>, sqlnet.authentication_services = cman_rules =
<n>, sqlnet.client_registration = <n>, be- (rule_list = (rule = (src = <src>)
queath_detach = <n>, disable_oob = <n>, (dst = <dst>) (srv = <serv>)
names.directory_path = ( {hostname | (act = accept | reject)))
tnsnames | onames | cds | nds | nis} , … ),
names.default_domain = <n>, name.default_ ldap.ora
zone = <n>, names.preferred_servers =
<n>, names.initial_retry_timeout = <n>,
Other Files
names.request_retries = <n>, names.max_
open_connections = <n>, names.message_ ckpcch.ora, sdns.ora, namesini.sql,
pool_start_size = <n>, names.dce.prefix namesupg.sql, snmp_ro.ora, snmp_rw.ora,
= <n>, names.nis.meta_map = <n>, services.ora

www.larsditzel.de
20 Oracle Server 9i Quick Reference Guide

Recovery Manager

Views & Tables v$backup_corruption, v$copy_corruption, Files


rc_database, rc_database_incarnation, rc_ v$backup_async_io, v$backup_sync_io, catrman.sql, prgrmanc.sql, dbmssbkrs.sql,
backup_set, rc_backup_piece, rc_checkpoint, v$session_longops, v$session_wait prvtbkrs.plb, dbmsrman.sql, prvtrmns.plb
rc_tablespace, rc_datafile, rc_backup_datafile,
rc_datafile_copy, rc_proxy_datafile, rc_of- Parameters Desupported Features
fline_range, rc_backup_controlfile, rc_control- backup_tape_io_slaves, disk_asynch_io, tape_ db_file_direct_io_count, arch_io_slaves,
file_copy, rc_proxy_controlfile, rc_redo_log, asynch_io, control_file_record_keep_time backup_disk_io_slaves, large_pool_min_alloc
rc_redo_thread, rc_backup_redolog, rc_ar-
chived_log , rc_log_history, rc_stored_script, Packages
rc_stored_script_line, rc_backup_cor-
ruption, rc_copy_corruption, rc_resync, DBMS_BACKUP_RESTORE
v$backup, v$backup_set, v$backup_piece, DBMS_RCVCAT
v$backup_datafile, v$datafile_copy, v$proxy_ DBMS_RCVMAN
datafile, v$offline_range, v$backup_redolog,
v$proxy_archivedlog, v$backup_device,

Environment { retention policy {backup | copy} [of


rman | [default] device type { {datafile | tablespace
[target ‘<user>/<pwd>@<target_db>’] | [auxiliary] channel | database [skip tablespace] } ‘<name>‘
[ catalog ‘<user>/<pwd>@<repos_db>’ [for device type <dev>] | controlfile | archivelog
| nocatalog ] | maxset size { all | like ‘<name>‘ | {from | until}
[auxiliary ‘<user>/<pwd>@<aux_db>’] | {datafile | archivlog} backup copies { time [=] ‘<date>‘ | scn [=] <n>
[{cmdfile [=] | @} <file>] | backup optimization | logseq [=] <n> [thread = <n>]} }]
[log [=] <file> [append]] [msgno] | snapshot controlfile name [ tag = ‘<tag>‘
[trace [=] ‘<file>’] [debug] | auxname | completed
[send [=] ‘<cmd>’] | exclude { {after | before} [=] ‘<date>‘
set dbid [=] <target_dbid>; | controlfile autobackup [format] | between ‘<date>‘ and ‘<date>‘ } ];
| all }; delete [noprompt]
connect {target | catalog | auxiliary}
<user>/<pwd>@<db> set snapshot controlfile name to ‘<file>‘; { [expired]
send [channel <chann> [, …] { {backup | copy} [of
startup [nomount | mount] [force] [dba]
| device type <dev> [, …]] { { datafile | tablespace | database
[pfile [=] <file>];
‘<media_man_cmd>‘ [skip tablespace] } ‘<name>‘
shutdown [normal | transactional | controlfile
[parms [=] ‘<par>‘];
| immediate | abort]; | archivelog { all | like ‘<name>‘ |
{create | replace} script <script> {<stat>;…}
{mount | open} database; {from | until} { time [=] ‘<date>‘
delete script <script>;
alter database {mount | open}; | scn [=] <n> | sequence [=] <n>
print script <script>;
host [‘<cmd>’]; [thread = <n>]} }]
run {<cmd>; …} [ tag = ‘<tag>‘ | completed
debug {on | off };
run {execute script <script>;} { {after | before} [=] ‘<date>‘
set echo {on | off };
sql ‘<stat> [‘ ‘ <file> ‘ ‘] ‘; | between ‘<date>‘ and ‘<date>‘ } ]
set command id to ‘<id>’;
| { {backuppiece | proxy} …
configure
Catalog | backupset …
{ snapshot controlfile name to ‘<file>‘
create catalog [tablespace <ts>]; | {controlfilecopy | datafilecopy} …
| controlfile autobackup
upgrade catalog [tablespace ‘<ts>’]; | archivelog … }
{ on | off | clear
| obsolete
| format for device type <dev> configure compatible = <n>;
[ redundancy [=] <x>
{to ‘<fmt>’ | clear} } drop catalog; | recovery window of <x> days
| {archivelog | datafile} backup copies register database; | orphan ] };
for device type <dev> {to <x> | clear} reset database [to incarnation <id>];
| default device type to <dev> set maxcorrupt for datafile {‘<file>‘ | <n>}
resync catalog [from controlfilecopy [‘<ctrl>’]]; to <n>;
| device type <dev> parallelism <n>
| channel <n> device type <dev> catalog {archivelog | datafilecopy
connect ‘<user/pwd@serv>’ | controlfilecopy} ‘<file>‘ [, …] Channels
| retention policy to [tag [=] ‘<tag>‘ | level [=] <n>];
allocate [auxiliary] channel <chann>
{ recovery window of <x> days change {archivelog | datafilecopy | backup- [for {delete | maintenance}]
| redundancy <1> | none | clear } piece | backupset | proxy | controlfilecopy} { type [=] {disk | ‘<dev>‘}
| backup optimization {on | off | clear} {‘<file>‘ | <n> | all | tag [=] ‘<tag>‘} | name [=] ‘<name>‘ }
| exclude tablespace <ts> [clear] { delete | available | unavailable | uncatalog [parms [=] “<par>”] [format [=] ‘<fm>‘]
| maxsetsize {to {<x>| unlimited} | clear} }; | validate | crosscheck }; [connect [=]
show crosscheck ‘<user>/<pwd>@<target_ops_inst>’]

www.larsditzel.de
Oracle Server 9i Quick Reference Guide 21

Recovery Manager (cont.)

[debug [=] <n>] [trace [=] <n>]; backup [ full | incremental | scn [=] <n>
set limit channel <chann> [read rate [=] <n>] level [=] { 0 | 1 | 2 | 3 } ] | logseq [=] <n> [thread [=] <n>] }]
[kbytes [=] <n>] [maxopenfiles [=] <n>]; [cumulative] [nochecksum] [skip [forever] tablespace <ts> [, …] ]
release channel [<chann>]; [check logical] [proxy [only]] [(] | tablespace ‘<ts>’ [, …]
{ datafile {‘<file>‘ | <n>} [, …] | datafile {‘<file>’ | <n>} [, …] }
| datafilecopy [delete archivelog] [check readonly]
Reporting
{‘<file>‘ | tag [=] <tag>} [, …] [check logical] [noredo];
report | tablespace ‘<ts>‘ [, …] blockrecover
{ { need backup { {incremental | days} | database { datafile <x> block <x> [, …]
| redundancy } [=] <n> | archivelog | tablespace <ts> dba <x> [, …]
| unrecoverable } { all | like ‘<log>‘ | {from | until} | corruption list }
{ datafile {‘<file>‘ | <n>} [, …] { time [=] ‘<date>‘ [from {backupset | datafilecopy} ]
| tablespace ‘<ts>‘ [, …] | scn [=] <n> [from tag [=] ‘<tag>’]
| database [skip tablespace ‘<ts>‘ | logseq [=] <n> [restore until
[, …]] } [thread = <n>] }} { time [=] ‘<date>‘
| obsolete { redundancy [=] <n> | current controlfile | scn [=] <n>
| recovery window of <x> days | controlfilecopy ‘<ctrl>’ } | sequence [=] <n> thread [=] <n> } ];
| orphan [not backed up [since time [=] ‘<date>’] ] set auxname for datafile {‘<file>‘ | <n>}
| until [plus archivelog] to {‘<new>‘ | null };
{ time [=] ‘<date>’ [include current controlfile]
| scn [=] <n> duplicate target database
[delete [all] input] to ‘<db>‘ [logfile
| logseq [=] <n> [tag [=] <tag>] [format [=] ‘<fm>’]
[thread [=] <n>] }} {‘<log>‘ [size <n>] [reuse]
[filesperset [=] <n>] [channel <chann>] | group <n> (‘<log>‘ [, …])
| schema [at [skip {offline | readonly | inaccessible}]
{ time [=] ‘<date>‘ [size <n>] [reuse] }]
[setsize [=] <n>] [diskratio [=] <n>] [nofilenamecheck] [skip readonly];
| scn [=] <n> [pool [=] <n>] [parms [=] ‘<par>‘] [)];
| logseq [=] <n> [thread [=] <n>] }] }
validate backupset <n> [, …] [check logical];
[device type {disk | ‘<dev>‘} ];
list [expired] {copy | backup} of
Restore & Recovery
{ datafile {‘<file>‘ | <n>} [, …]
| tablespace ‘<ts>‘ [, …] set autolocate {on | off };
| database [skip tablespace ‘<ts>‘ [, …]] set archivelog destination to ‘<path>’;
| controlfile set newname for datafile {‘<file>’ | <n>}
| archivelog to ‘<new>’;
{ all | like ‘<file>‘ | {from | until} restore [(]
{ time [=] ‘<date>‘ { database
| scn [=] <n> [skip [forever] tablespace <ts> [, …]]
| logseq [=] <n> | tablespace ‘<ts>’ [, …]
[thread = <n>]} }} | datafile {‘<file>’ | <n>} [, …]
[tag [=] <tag>] [like ‘<string>‘] | archivelog
[device type ‘<dev>‘] { all | like ‘<log>’ | {from | until}
[recoverable [until { time [=] ‘<date>’
{ time [=] ‘<date>‘ | scn [=] <n> | scn [=] <n>
| logseq [=] <n> [thread [=] <n>]} ]] | logseq [=] <n>
[completed { {after | before} [=] ‘<date>‘ [thread = <n>] }}
| between ‘<date>‘ and ‘<date>‘}] | controlfile [to ‘<ctrl>’] } [)]
[by backup [verbose] ] [channel <chann>] [from tag [=] ‘<tag>‘]
[by {backup summary | file} ] [parms ‘<par>‘]
[summary]; [from {backupset | datafilecopy} ] [validate]
list incarnation [of database [‘<id>‘]]; [check readonly] [check logical]
[ until { time [=] ‘<date>‘ | scn [=] <n>
Backup | logseq [=] <n> [thread [=] <n>] }];
copy replicate controlfile from ‘<ctrl>‘;
{ datafile {‘<file>‘ | <n>} switch datafile
| datafilecopy {‘<file>‘ | tag [=] <tag>} { {‘<file>‘ | <n>} [to datafilecopy
| archivelog ‘<log>‘ {‘<file>‘ | tag [=] <tag>} ]
| controlfilecopy {‘<ctrl>‘ | tag [=] <tag>} | all };
| current controlfile } set until { time [=] ‘<date>‘ | scn [=] <n> |
to ‘<dest>‘ [, …] logseq [=] <n> [thread [=] <n>] };
[tag [=] ‘<tag>‘] [level [=] <n>] recover
[nochecksum] [check logical]; { database
set duplex = { off | on | 1 | 2 | 3 | 4 }; [ until { time [=] ‘<date>‘

www.larsditzel.de
22 Oracle Server 9i Quick Reference Guide

Distributed DB, Replication, Heterogenous Services,


Advanced Queuing & Data Warehousing

Views & Tables Packages shot_from_log, purge_mview_from_log,


v$dblink, v$db_pipes, v$aq, v$hs_agent, DBMS_REPCAT {register | unregister}_snapshot, {register
v$hs_session, v$hs_parameter, dba_db_links, {create | drop}_master_repgroup, {suspend | unregister}_mview, set_i_am_a_refresh,
dba_2pc_pending, dba_2pc_neighbors, dba_ | resume}_master_activity, {create | drop}_ i_am_a_refresh, refresh, refresh_mv,
repcatlog, dba_repgroup, dba_repgroup_privi- master_repobject, set_columns, {add | refresh_all, refresh_all_mviews, refresh_de-
leges, dba_repcolumn, dba_repcolumn_group, remove}_master_database, alter_master_ pendent, get_log_age, get_mv_depende-
dba_repgenobjects, dba_repgrouped_column, propagation, relocate_masterdef, {make cies, {set | wrap}_up, testing, explain_
dba_repkey_columns, dba_repsites, dba_rep- | drop}_column_group, {add | drop}_ {mview | rewrite}, pmarker
sites_new, dba_repobject, dba_repprior- grouped_column, {add | drop}_update_ DBMS_OLAP
ity, dba_reppriority_group, dba_repprop, resolution, {define | drop}_priority_group, validate_dimension, estimate_space,
dba_repddl, dba_repconflict, dba_represolu- {add | alter | drop}_priority_<type>, {alter recommend_mv, estimate_summary_size,
tion, dba_represolution_method, dba_repre- | drop}_priority, {define | drop}_site_prior- evaluate_utilization, evaluate_utiliza-
sol_stats_control, dba_represolution_statistics, ity, {add | alter | drop}_site_priority_site, tion_w, set_logfile_name
dba_repparameter_column, dba_repcat_re- {add | drop}_unique_resolution, {add | DEMO_DIM
fresh_templates, dba_repcat_template_objects, drop}_delete_resolution, generate_{replica- print_dim, print_alldims
dba_repcat_template_parms, dba_repcat_tem- tion | snapshot}_support, create_snap- DEMO_SUMADV
plate_sites, user_repcat_temp_output, dba_ shot_repobject, switch_snapshot_master, DBMS_HS
repcat_user_authorizations, dba_repcat_user_ send_and_compare_old_values, {register | create_inst_init, drop_inst_init, cre-
parm_values, dba_jobs, dba_jobs_running, cancel | purge}_statistics, do_deferred_rep- ate_fds_inst, drop_fds_inst
deftran, dba_snapshots, snap$, dba_snapshot_ cat_admin, purge_master_log, repcat_im- DBMS_HS_PASSTHROUGH
refresh_times, dba_snapshot_logs, dba_snap- port_check, comment_on_{repgroup execute_immediate, open_cursor, bind_
shot_log_filter_cols, dba_registered_snapshots, | repobject | repsites | column_group | variable, execute_non_query, fetch_row,
dba_registered_snapshot_groups, dba_queues, priority_group | site_priority | unique_res- get_value, close_cursor
dba_queue_tables, dba_queue_schedules, olution | update_resolution | delete_reso-
DBMS_DISTRIBUTED_TRUST_ADMIN
queue_privileges, dba_refresh, dba_re- lution}, {specify | add}_new_masters,
deny_all, allow_all, deny_server, al-
fresh_children, all_refresh_dependencies, prepare_instantiated_master, resume_
low_server
dba_rchild, dba_rgroup, defcall, defcalldest, propagation_to_mdef
defdefaultdest, deferrcount, deferror, deflob, DBMS_REPCAT_ADMIN
defpropagator, defschedule, deftran, deftrand- Files
grant_admin_{schema | any_schema},
est, dba_mviews, dba_mview_aggregates, register_user_repgroup catrep.sql, catdefer.sql, catrepc.sql, smdim.sql,
dba_mview_joins, dba_mview_keys, dba_ DBMS_REPCAT_INSTANTIATE sadvdemo.sql, caths.sql
mview_analysis, dba_mview_detail_relations, DBMS_REPCAT_RGT
dba_summaries, dba_summary_aggregates, create_template_object Desupported Features
dba_summary_joins, dba_summary_keys, job_queue_interval, defcall, distributed_lock_
DBMS_REPUTIL
dba_summary_detail_tables, dba_dimen- timeout, snapshot_refresh_keep_connections,
replication_{on | off }
sions, dba_dim_levels, dba_dim_hierachies, snapshot_refresh_processes, snapshot_re-
dba_dim_child_of, dba_dim_attributes, DBMS_DEFER
transaction, call, <type>_arg fresh_interval, distributed_recovery_connec-
dba_dim_join_key, dba_dim_level_key, tion_hold_time, job_queue_keep_connections
mview$_exceptions, mviews$_recommenda- DBMS_DEFER_SYS
tions, mview$_evaluations, hs_all_caps, {add | delete}_default_destination, push,
hs_class_caps, hs_base_caps, hs_inst_caps, purge, delete_tran, execute_error, execute_
hs_all_dd, hs_class_dd, hs_base_dd, hs_inst_ error_as_user, delete_error, schedule_push,
dd, hs_all_inits, hs_class_init, hs_inst_init, unschedule_push, set_disabled, disabled,
hs_external_objects, hs_external_object_privi- schedule_purge, schedule_execution,
leges, hs_external_user_privileges, hs_fds_ register_propagator
class, hs_fds_inst, trusted_servers DBMS_DEFER_QUERY
DBMS_OFFLINE_OG
Parameters {begin | end}_instantiation, resume_sub-
set_of_masters, {begin | end}_load
global_names, open_links, open_links_per_in-
stance, distributed_transactions, com- DBMS_OFFLINE_SNAPSHOT
mit_point_strength, job_queue_processes, {begin | end}_load
aq_tm_processes, dblink_encrypt_login, DBMS_REFRESH
replication_dependency_tracking, query_re- refresh, change
write_enabled, query_rewrite_integrity, DBMS_JOB
hs_autoregister, hs_commit_point_strength, submit, remove, change, what, next_date,
hs_db_domain, hs_db_internal_name, hs_db_ interval, broken, run, instance
name, hs_describe_cache_hwm, hs_language, DBMS_RECTIFIER_DIFF
hs_nls_date_format, hs_nls_date_language, differences, rectify
hs_nls_nchar, hs_open_cursors, hs_ro- DBMS_AQ, DBMS_AQADM
wid_cache_size, hs_rpc_fetch_reblocking, DBMS_MVIEW (DBMS_SNAPSHOT)
hs_fds_fetch_rows, hs_rpc_fetch_size {begin | end}_table_reorganization, purge_
log, purge_direct_load_log, purge_snap-

www.larsditzel.de
Oracle Server 9i Quick Reference Guide 23

Distributed DB, Replication, Heterogenous Services,


Advanced Queuing & Data Warehousing (cont.)

Distributed DB [noparallel | parallel [<n>]]


create [shared] [public] [cluster <clust> (<col> [, …])]
database link <link[@qual]> [lob…] [partition…]
[connect to [build {immediate | deferred}]
{<user> identified by <pwd> [on prebuilt table
| current_user} ] [{with | without} reduced precision]]
[authenticated by <user> [using index…]
identified by <pwd>] [ refresh [fast | complete | force]
[using ‘<netserv>‘]; [on commit | on demand]
alter session close database link <link>; [start with ‘<date>’] [next ‘<date>’]
[with {primary key | rowid}]
drop [public] database link <link>;
[using [default] [master | local]
alter session advise rollback segment [<rbs>]] ]
{commit | rollback | nothing}; | never refresh ]
alter system {enable | disable} distributed [for update]
recovery; [{enable | disable} query rewrite]
commit comment ‘ORA-2PC-CRASH-TEST- as <query>;
<1-10>‘; alter {materialized view | snapshot} <mview>
… [compile];
Materialized Views drop {materialized view | snapshot} <mview>;
create {materialized view | snapshot} log
on <tab> [tablespace <ts>] [storage (…)] Dimensions
[pctfree <10>] [pctused <40>] create [force | noforce]
[initrans <1>] [maxtrans <n>] dimension <dim> level <lev> is [(]
[logging | nologging] [cache | nocache] <tab>.<col> [, …)] [level…]
[noparallel | parallel [<n>]] hierachy <hier>
[partition…] [lob…] [using index…] ( <child_lev> child of <parent_lev>
[with [primary key] [, rowid] [child of <parent_lev>…]
[(<col> [, …])] ] [join key (<child_col> [, …] )
[{including | excluding} new values]; references <parent_lev>]
alter {materialized view | snapshot} log [join…] )
on <tab> [attribute <lev> determines
[add [primary key] [, rowid] [(] <dep_col> [, …)] ] [attribute…];
[(<col> [, …])] ] […]; alter dimension <dim>
drop {materialized view | snapshot} log { add { level… | hierachy… | attribute… }
on <tab>; | drop
create {materialized view | snapshot} <mview> { level <lev> [restrict | cascade]
[tablespace <ts>] [storage (…)] | hierachy <hier>
[pctfree <10>] [pctused <40>] | attribute <lev> }
[initrans <1>] [maxtrans <n>] | compile };
[logging | nologging] [cache | nocache] drop dimension <dim>;

www.larsditzel.de
24 Oracle Server 9i Quick Reference Guide

Real Application Clusters

Processes thread, instance_name, instance_number, parallel_server, parallel_server_instances,


IDLM, PCM, OPQ, OPSM, OPSD instance_groups, parallel_instance_group, ops_interconnects, gc_defer_time, gc_releas-
vendor OSDs: service_names, dml_locks, gc_files_to_locks, able_locks, gc_rollback_locks, lm_locks,
CM, Start, IO, IPC gc_latches, max_commit_propagation_delay, lm_ress, gc_latches, gc_lck_procs, de-
(RegKeys: OSD, CMDLL, IODLL, IPCDLL, parallel_default_max_scans, lock_name_space, layed_logging_block_cleanouts, freeze_db_
STARTDLL) cpu_count, trace_enabled, sessions_per_ for_fast_instance_recovery, ogms_home,
user???? ops_admin_group, lm_procs
Views & Tables
gv$<dyn_perf_view>, v$active_instances, Package SQL
v$resource, v$resource_limit, v$ges_sta- DBMS_LIBCACHE alter session instance_number...??
tistics, v$ges_latch, v$ges_convert_local, compile_from_remote alter {table | cluster | index} <segm>
v$ges_convert_remote, v$ges_enqueue, allocate extent ( [size <n>]
v$ges_blocking_enqueue, v$ges_resource, Files [datafile ‘<file>‘] [instance <n>] );
v$ges_traffic_controller, v$gc_element, create {table | cluster | index} <segm>
init<db_name>.ora, <db_name>.conf,
v$cr_block_server, v$gc_elements_with_colli- … storage ( …
utlclust.sql, catclust.sql, clustdb.sql, catlibc.sql,
sions, v$cache_transfer, v$file_cache_transfer, [freelists <1>]
dbmslibc.sql
v$temp_cache_transfer, v$class_cache_trans- [freelist groups <1>] … ) …;
fer, v$false_ping, v$lock_activity, v$lock_ele-
ment, v$lock_class_ping, v$cache_lock, Desupported Features
v$latch_misses, v$hvmaster_info, v$dlm_misc, v$dlm_latch, v$dlm_convert_lo-
v$gcshvmaster_info, v$gcspfmaster_info, cal, v$dlm_covert_remote, v$dlm_locks,
file_lock, ext_to_obj, oraping_config v$dlm_ress, v$dlm_all_locks, v$dlm_traffic_
controller, v$lock_element, v$bsp, v$locks_
Parameters with_collisions, v$file_ping, v$temp_ping,
v$ping, v$class_ping
cluster_database, cluster_database_instances,
cluster_interconnects, active_instance_count, init_com.ora

Utilities –c <user>/<pwd> –n <db> [–i <sid> [, …]] | report [-f <file>]


srvctl [–f ] [–t] [–u] [–m] [–y | e] [–v] [–h] [-d yyyy/mm/ss-hh:mi:ss] [-s] }
{ <cmd> –h GUIOracleOBJManager, setlinks /f:<file> /d $ORACLE_SERVICE, pfssetup
| config [–p <db>] crtsrv.bat createpacks, deletepacks
| {start | stop} –p <db>
[–i <inst> | –s {<inst> | <lsnr>}] Fail Safe & RAC Guard
| status –p <db> [–s {<inst> | <lsnr>}] fscmd
| add { dumpcluster | movegroup
{ db –p <db> –o <oracle_home> | onlinegroup | offlinegroup
| instance –p <db> –i <inst> | onlineresource | offlineresource
–n <node> } | verifygroup | verifyallgroups }
| delete <resource> /cluster = <clust>
{ db –p <db> [/logfile = <log>] [/node = <node>]
| instance –p <db> –i <inst> } [/offline =
| rename instance –p <db> { abort | immediate
–i <old> –e <new> | transactional | normal } ]
| move instance –p <db> [/domain = <OSdomain>
–i <inst> –n <new_node> /user = <OSuser> /pwd = <pwd>]
| get env –p <db> [–i <inst>]
pfsctl
| set env –p <db> –t <var> = <val>
{ help | pfsboot | pfshalt
[–i <inst>]
| status | restore
| unset env –p <db> –t <var> [–i <inst>] }
| move_primary [<sec>]
srvconfig | stop_secondary [<sec>]
{ –init | bootone <pack> [-f ]
| {–exp | –imp} <file> | haltone <pack>
| –conv <db.conf> } | switchover [<sec>]
gsd, gsdservice { –start | –install | –remove } | call_home
opsctl [start | stop]

www.larsditzel.de
Oracle Server 9i Quick Reference Guide 25

Real Application Clusters (cont.)

Tuning/Contention (RAC) «global cache converts» statistics:


«buffer busy %», «cr request entry», «db
Global Cache Service (GCS) other statistics: file %», «enqueue», «global cache %»,
v$cache (forced_writes = 0, forced_reads), «KJC: wait %», «library cache pin», «log
«global cache %» (v$sysstat, class 40) file sync», «row cache lock»
v$cache_transfer, v$bh, v$class_cache_
contention: contention:
transfer, v$file_cache_transfer, v$rowcache
«global cache cr timeouts» = 0
(dc_sequences, dc_used_extents) «global cache busy», «buffer busy due to
«global cache convert timeouts» = 0
global cache»
cache fusion latency:
Global Enqueue Service (GES)
«global cache cr block receive time» /
«global lock %» (v$sysstat, class 32) Latches
«global cache cr blocks received»: ~ 15
ms (1 ms with user mode IPC, OPS8i: average global enqueue get time: ~ 20-30 ms v$latch:
~ 1-40 ms) «global lock get time» / («global lock sync gets / misses ~ 0.9-0.95
«global cache current block receive time» / gets» + «global lock async gets») v$latch_misses:
«global cache current blocks received» average global lock convert time: ~ 20 ms sleeps / misses
LMS service time (sum & individual): «global lock convert time» / («global
«global cache cr (queue + build + flush lock sync converts» + «global lock async Sequences
+ send) time» / «global cache cr blocks converts») use sequence number multipliers
served» cache sequence numbers
«global cache current (pin + flush + send) other statistics:
time» / «global cache current blocks v$lock_activity, v$ges_statistics, v$ges_
served» convert_local, v$ges_convert_remote,
average get time: ~ 20-30 ms v$rowcache, v$librarycache
«global cache get time» /
«global cache gets» Wait Events
average convert time: ~ 10-20 ms v$system_event
«global cache convert time» /

Tuning/Contention (OPS 8i) Locking PCM Locks


«releasable freelist waits» (v$sysstat) «lm_locks» = «lm_ress» =
Global cache 2 * (gc_files_to_locks + gc_rollback_locks
consistent-read requests: Lock conversion [fixed] + gc_releasable_locks),
«global cache cr block received» + v$resource_limit,
lock hit ratio: (v$sysstat)
«global cache cr blocks read from disk» consistent gets» – «global lock converts
(async)» / «consistent gets» > 95%, Enqu. Locks
Global locks «lock element cleanup» 20 + (10*sess) + db_files + 1 + (2*proc) +
IDLM non-PCM resources: (v$system_event, v$session_wait), (db_block_buffers/64)
v$librarycache, v$rowcache v$lock_activity, v$class_ping, v$ping
DML Locks
IDLM Pinging set «dml_locks» = 0 for all instances, or disable
lock statistics: ping write ratio: (v$sysstat) specific table locks
v$dlm_convert_local, v$dlm_convert_re- «DBWR cross instance writes» / «physical
mote writes», v$lock_activity Recovery
message statistics: (v$dlm_misc) «instance recovery database freeze count»
average receive queue length: < 10 Block contention (v$sysstat)
«dlm total incoming msg queue length» / v$bh, v$cache, v$ping
«dlm messages received» mult. copies of 2nd block of file -> freelist Inst. groups
contention (check v$waitstat)
«alter session set parallel_instance_group =
OPS I/O <grp>;»
«DBWR forced writes» / «physical writes» Partitioning
(v$sysstat) partition tables and indexes OR
(«remote instance undo header writes» + «re- configure process free lists and free list groups
mote instance undo block writes») / «DBWR + allocate extents for instances (free list group
forced writes» (v$sysstat) choice: «alter session set instance = <n>;»)

www.larsditzel.de
26 Oracle Server 9i Quick Reference Guide

Globalization Support

Views & Tables • nls_list_separator Utilities


v$nls_parameters, v$nls_valid_values, • nls_display csscan
v$timezone_names, nls_database_parameters, • nls_monetary help = <n> userid = <user>/<pwd> parfile
nls_instance_parameters, nls_session_parame- = <par> log = <scan.log> user = <schema>
ters, props$, csmv$columns, csmv$constraints, Session: table = (<tab> [, …) exclude = (<tab> [,
csmv$errors, csmv$indexes, csmv$tables alter session set nls_language = <lang> …) tochar = <new> fromchar = <old>
nls_territory = <territ>; tonchar = <new> fromnchar = <old> ar-
Packages alter session set time_zone = <x>; ray = <10240> process = <1> maxblocks
= <x> capture = <n> suppress = <x>
DBMS_SESSION
feedback = <x> boundaries = <x> lastrpt =
set_nls(<name>,<value>) NLS-Affected SQL-Functions
<n> preserve = <n>
to_char lbuilder
Files • nls_date_language
lxegen
<prod><lang>.msb, timezone.dat, • nls_numeric_characters
lxinst [oranls=<$ORA_NLS33>]
timezlrg.dat, csminst.sql • nls_currency
[sysdir=<path>] [destdir=<path>]
• nls_iso_currency
[help=<no>] [warning={0 | 1 | 2 | 3}]
Server: Init. Parameters • nls_calendar
lxbcnf [oranls=<$ORA_NLS33>]
to_date
nls_language [userbootdir=<path>] [destdir=<path>]
• nls_date_language
• nls_date_language [help=<no>]
• nls_calendar
• nls_sort
to_number
nls_territory Desupported Features
• nls_numeric_characters
• nls_date_format nls_monetary_characters, nls_list_separator,
• nls_currency
• nls_currency (fm L), • nls_iso_currency nls_credit, nls_debit, nls_union_currency
nls_iso_currency (fm C),
nls_upper
nls_dual_currency
• nls_sort
• nls_numeric_characters (fm DG)
nls_lower
• nls_calendar
• nls_sort
• nls_comp
• nls_length_semantics nls_initcap
• nls_sort
• nls_nchar_conv_excp
• nls_time_format nlssort
• nls_timestamp_format • nls_sort
• nls_timestamp_tz_format
• nls_time_tz_format Datetime Functions
$ORA_TZFILE
Character Set & Timezone
Client: Environment Variables create database …
nls_lang, nls_nchar [character set {<charset> << OS dependent
• nls_date_language | <UTF8> | <UTFE> | <AL32UTF8>} ]
• nls_sort [national character set << 9i: Unicode only
• nls_date_format {<UTF8> | <AL16UTF16>} ]
• nls_currency, [set time_zone =
nls_iso_currency, { ‘<{+|-}hh:mi>’
nls_dual_currency | ‘<time_zone_region>’ } ] …
• nls_numeric_characters alter database [<db>] [national] character set
• nls_comp <new_char>; << must be strict superset

• nls_calendar << AL24UTFFSS is desupported in 9i


• nls_credit, nls_debit

www.larsditzel.de
Oracle Server 9i Quick Reference Guide 27

SQL*Plus

sqlplus SQL Buffer Manipulation | view | trigger | type | type body


[ -h[elp] ed[it], a[ppend], c[hange] /<old> [/<new>], | dimension | java class } <name>]
| -v[ersion] cl[ear] buff[er], del [<n>] [<y>] [*] [last], l[ist] | lno | pno | user | tti[tle] | bti[tile]
| [-m[arkup] [<n>] [<y>] [*] [last], i[nput] | reph[eader] | repf[ooter] | spoo[l]
html [on | off ] [head “<txt>”] | sqlcode | sga | parameters | release }
[body “<txt>”] [table “<txt>”] timi[ng]
Data Types SQL*Plus
[entmap {on | off }] [spool {on | off }] [start <string> | show | stop]
[pre[format] {on | off }] var[iable] [<var>
exec[ute]
[-r[estrict] <1 | 2 | 3>] [ number | char | char (<n>) | nchar
{ <:var> := <func> (<par> [, …])
[-s[ilent]] ] | nchar (<n>) | varchar2 (<n>)
| <proc> (<par> [, …]) }
[ <user>[/<pwd>][@<serv>] | / ] | nvarchar2 (<n>) | clob | nclob
| refcursor] ] whenever {sqlerror | oserror}
[ as {sysoper | sysdba} | /nolog ] { exit…
char: max. 2.000B, varchar: max. 4000B
[ @<URI | file>[.<ext>] [<arg>, …]] | continue [commit | rollback | none] }
Commands {exit | quit}
Environment [success | failure | warning | <n>
/, r[un]
appi[nfo] {on|off|<text>}, array[size] [<15>], | <var> | <:var>] [commit | rollback]
auto[commit] {on|off|imm[ediate]|<n>}, @<file>, @@<file>, start <file>
copy [from <user>@<db>] [to <user>@<db>]
autop[rint] {on|off }, autorecovery [on|off ], sav[e] <file> [cre[ate] | rep[lace] | app[end] ] {create | replace | insert | append}
autot[race] {on|off|trace[only]} [exp[lain]] get <file> [ lis[t] | nol[ist] ] <tab> [(<col>, …)] using <query>;
[stat[istics]], blo[ckterminator] <.>, cmds[ep] spo[ol] {<file> | off | out}
{<;>|on|off }, colsep <_>, com[patibility] pri[nt] [<var>], help, rem[ark], set, show Formatting
{native|v8|v7}, con[cat] {<c>|on|off }, {ho[st] | ! | $} <cmd>
copyc[ommit] <0>, copytypecheck { tti[tle] | bti[tle] | reph[eader] | repf[ooter] }
store [set] <file> [ [page] [ le[ft] | ce[nter] | r[ight] ]
{on|off }, def[ine] {<&>|on|off }, describe [ cre[ate] | rep[lace] | app[end] ]
[depth {<1>|all} | indent {on|off } | line- [col <n>] [tab <n>] [bold] [s[kip] <n>]
def[ine] <var> = <value> [format <fm>] [‘<string>’] [<var>] […]
num {on|off }], echo {on|off }, editf[ile]
<file>[.<ext>], emb[edded] {on|off }, esc[ape] undef[ine] <var> | {on | off } ]
{<\>|on|off }, feed[back] {<6>|on|off }, flag- pro[mpt] [<string>] col[umn] [ <col>
ger {off|entry|intermed[iate]|full}, flu[sh] pau[se] [<string>] { [for[mat] <fm>]
{on|off }, hea[ding] {on|off }, heads[ep] conn[ect] [ wra[pped] | wor[d_wrapped]
{||on|off }, instance {<serv>|local}, lin[esize] { / | <user/pwd> | internal [<pwd>] } | tru[ncated] ]
<80>, lobof[fset] <1>, logsource [<path>], [as {sysdba | sysoper}] [hea[ding] <string>]
long <80>, longc[hunksize] <80>, m[arkup] << desupported [ali[as] <alias>] [nul[l] <string>]
html [on | off ] [head “<txt>”] [body “<txt>”] disc[onnect] [ fold_a[fter] | fold_b[efore]]
[table “<txt>”] [entmap {on | off }] [spool {on [like <alias>] [newl[ine]]
passw[ord] [<user>]
| off }] [pre[format] {on | off }], newp[age] [ {new_v[alue] | old_v[alue]} <var>]
startup, shutdown, recover [ jus[tify] { l[eft] | c[enter] | c[entre]
{<1>|none}, null <txt>, numf[ormat] <fmt>,
num[width] <10>, pages[ize] <24>, pau[se] | r[ight] }]
Data Access | {on | off } | {print | noprint} | cle[ar] }]
{on|off|<txt>}, recsep {wr[apped]|ea[ch]|off },
recsepchar <_>, serverout[put] {on|off } attribute <object_type>.<attr> bre[ak]
[size <2000>] [for[mat] {wra[pped]|wor[d_ [ali[as] <name>] [for[mat] <fm>] [on {<bcol> | row | report | <expr>}
wrapped|tru[ncated]}], shift[inout] [like <attr>] [cle[ar] ] [on |off ] [ski[p] <n> | page] [on…]
{vis[ible]|inv[isible]}, show[mode] {on|off }, acc[ept] <var> [nodup[licates] | dup[licates]] ]
sqlbl[anklines] {on|off }, sqlc[ase] {mix[ed]|lo[ [num[ber] | char | date] comp[ute]
wer]|up[per]}, sqlc[ontinue] <>>, sqln[umber] [for[mat] <fm>] [def[ault] <def>] [{ sum | min[imum] | max[imum] | avg
{on|off }, sqlpluscompat[ibility] <x.y[.z]>, [prompt <string> | nopr[ompt] ] [hide] | std | var[iance] | cou[nt] | num[ber] }
sqlpre[fix] <#>, sqlp[rompt] <SQL>>, desc[ribe] […] [la[bel] <lab>]
sqlt[erminator] {<;>|on|off>}, suf[fix] <SQL>, { <tab> | <view> | <pack> of <col> [<col>…]
tab {on|off }, term[out] {on|off }, ti[me] | <func> | <proc> | <syn> | <type> } on {<bcol> | row | report} ]
{on|off }, timi[ng] {on|off }, trim[out] {on|off }, sho[w] clear
trims[pool] {on|off }, und[erline] {<->|on|off }, { <var> | all { scr[een] | col[umns] | bre[aks]
ver[ify] {on|off }, wra[p] {on|off } | err[ors] | comp[utes] | sql | timi[ng] | buff[er] }
sql.pno, sql.lno, sql.release, sql.sqlcode, sql.user [{ package | package body
| function | procedure

www.larsditzel.de
28 Oracle Server 9i Quick Reference Guide

Data Types (PL/SQL & Database)

Views & Tables • long type 8 << deprecated <coll> {<varr_type> | <tab_type>};
v$type_size, v$temporary_lobs, {col: 231-1B=2G, pl: 32.760B} <coll>(<subscript>)[.<item>] := <expr>;
v$timezone_names, dba_types, dba_type_at- • long raw type 24 << deprecated <coll>.<method>
trs, dba_type_methods, dba_coll_types, {col: 231-1B=2G, pl: 32.760B} count, delete [ (<i> [,<j>] ) ], exists(<i>),
dba_lobs, dba_part_lobs, dba_lob_partitions, • internal: extend [(<n> [,<i>] )], limit, first, last,
dba_lob_subpartitions, dba_varrays, dba_refs, CLOB, NCLOB type 112 next(<i>), prior(<i>), trim [ (<i>) ]
dba_operators, dba_oparguments, dba_op- BLOB type 113
bindings, dba_opancillary, dba_method_ {col: 232-1B=4G, User-defined Types
params, dba_method_results, dba_directories, inline ~4000b, else out of line}
abstract types
dba_rulesets • external: initialized by constructor <type>(…)
BFILE {pointer} type 114
create [or replace] type <type>;
SQL-Functions {ext. LOB: 232-1B=4G}
create [or replace] directory <dir> as ‘<path>’; forward type definition / incomplete type
drop directory <dir>; create [or replace] type <type>
Parameters rowid [authid {current_user | definer}] {is | as}
• rowid type 69 { object ( <attr> <type> [, …]
{extented: 10B, [, {static | [map | order] member}
Scalar Types (Built-in Types)
restricted: 6B (block.row.file), {function | procedure} <func>
character physical rowid} [( {self | <par>} [in | out | in out]
• char (<1> [byte | char]) type 96 • urowid [(<4000B>)] type 208 <type> [, …] )] [return <type>]
{col: 2.000B, pl: 32.767B} col: 4.000B (IOT logical urowid or [ {is | as} language
(Subtype: character) foreign table foreign urowid) { java name ‘<func>‘
• varchar2 (<n> [byte | char]) type 1 boolean | C [name <func>] library <lib>
{col: 4.000B, • {pl: true | false | null} [with context]
pl: 32.767B (preallocated < 2000B)} [parameters (<par>) }]
(Subtypes: string, varchar) << deprec. [, pragma restrict_references
subtype <subtype> is <base_type> [not null];
• nchar (<1>) type 96 ( {<method> | default},
{col: 2.000B, pl: 32.767B, unicode only} {rnds | wnds | rnps | wnps | trust} )]
national character literal: ANSI Supported Types
[, …] ])
N’<string>’ character [varying] (<n>) | {varray | varying array} (<n>) of <type>
• nvarchar2 (<n>) type 1 {char | nchar} varying (<n>) | table of <type> };
{col: 4.000B, pl: 32.767B, unicode only} varchar (<n>) create [or replace] type body <type>
binary_integer national {character | char} [varying] (<n>) {is | as} {static | [map | order] member}
• {pl: -2.147.483.647 .. 2.147.483.647} {numeric | decimal | dec} [(<prec>[, <scal>])] {function | procedure} <func>
library arithmetic {integer | int | smallint} [( {self | <par>} [in | out | in out]
(Subtypes: natural {non-neg.}, naturaln <type> [, …] )] [return <type>]
float [(<n>)]
{not null} positive{pos.}, positiven {not [ {is | as}
null}, signtype{-1,0,1} ) double precision
{ begin <stat>; end [<func>];
pls_integer real | language
• {pl: -2.147.483.647 .. 2.147.483.647} { java name ‘<func>‘
machine arithmetic Relationship Types | C [name <func>]
number [(<prec>[, <scal>])] type 2 ref library <lib> [with context]
• {precision: 38 digits, scale: -84 to 127, • ref cursor, ref <otype> [parameters (<par>)] }}
21B (20B Mantisse, 1B Exponent)} {pointer} [, …] end;
(Subtypes: dec, decimal, double preci- alter type <type>
sion, float, int, integer, numeric, real, Record Types { compile [debug] [specification | body]
smallint) logical unit of dissimilar types | replace as object (<attr> <type> [, …]
datetime and interval record may not be DB col [, {static | [map | order] member}
• date type 12/13 type <rec_type> is record {function | procedure} <func>
{7B = CentYearMonDayHourMinSec, (<field> {<type> | <tab>.<col>%type} [( {self | <par>} [in | out | in out]
8B, -4.712 to 9.999} [[not null] {:= | default} <expr>] [, …]); <type> [, …] )] [return <type>]
ANSI date literal: [, pragma restrict_references
<record> {<rec_type> | <tab>%rowtype};
date ’<yyyy-mm-dd>’ ( {<method> | default},
<rec_var>.<field> := <expr>; {rnds | wnds | rnps | wnps | trust} )]
• timestamp [(<6>)] type 180
[ with time zone type 181/187/188 [, …]] )};
Collection drop type [body] <type> [force];
| with local time zone ] type 231
elements of same type [ref ] obj_type, type, varchar2(x), number[(p,s)], date,
{20B}
initialized by constructor <collect>(…) raw(x), char[acter](x), char varying(x), varchar(x),
timestamp literal:
varray may be DB col numeric[(p,s)], dec[imal] [(p,s)], int[eger], smallint,
timestamp ‘<yyyy-mm-dd ...>’ float[(x)], double precision, real, blob, clob, bfile
• interval year [(<2>)] to month type 182 nested table may be DB col
• interval day [(<2>)] to second [(<6>)] index-by table must not be DB col
Maximum Row Size
type 183 type <varr_type> is
{varray | varying array} (<size>) of <type> row header (min. 3B) + SUM(max. field
raw (<n>) type 23
[not null]; length + length indicator (<=250: 1B, >250:
• {col: 2.000B, pl: 32.767B}
type <tab_type> is table of <type> [not null] 3B))
large objects
[index by binary_integer];

www.larsditzel.de
Oracle Server 9i Quick Reference Guide 29

Data Types (PL/SQL & Database) (cont.)

Oracle Supplied Types Explicit Type Conversion (Cast Function)


SYS.AnyData cast ( { <expr> | (<subquery>) | multiset (<subquery>) } as <type> )
SYS.AnyType char, datetime, rowid, nchar,
number raw
SYS.AnyDataSet varchar2 interval urowid nvarchar2
SYS.XMLType char, varchar2 X X X X X
SYS.UriType number X X
SYS.UriFactoryType
date, timestamp,
MDSYS.SDO_Geometry X X
interval
ORDSYS.ORDAudio
raw X X
ORDSYS.ORDImage
rowid, urowid X X
ORDSYS.ORDVideo
nchar, nvarchar2 X X X X X

Explicit Type Conversion (SQL Conversion Functions)

char, varchar2, long,


number datetime/interval raw rowid clob, nclob, blob
nchar, nvarchar2 long raw
to_date,
to_timestamp,
char, varchar2, to_char (char), to_clob,
to_number to_timestamp_tz, hextoraw chartorowid
nchar, nvarchar2 to_nchar (char) to_nclob
to_yminterval,
to_dsinterval
to_date,
to_char (number),
number — to_yminterval,
to_nchar (number)
to_dsinterval
o_char (date),
datetime/interval —
to_nchar (datetime)
rawtohex,
raw — to_blob
rawtonhex
rowid rowidtochar —
long, long raw — to_lob
to_char, to_clob,
clob, nclob, blob
to_nchar to_nclob

Implicit Type Conversion

datetime/
char varchar2 date long number raw rowid clob blob nchar nvarchar2 nclob
interval
char — X X X X X X X X X
varchar2 X — X X X X X X X X X
date X X — X X
datetime/
X X — X X X X
interval
long X X X — X X X X X
number X X — X X
raw X X X — X X X
rowid X X — X X
clob X X X —
blob X —
nchar X X X X X X X X — X X
nvarchar2 X X X X X X X X X — X
nclob X X X —

www.larsditzel.de
30 Oracle Server 9i Quick Reference Guide

SQL, PL/SQL & Java

Views & Tables {pack | unpack}_message[_{raw | rowid} ], get_line_nchar, put_line, put_line_nchar,


v$reserved_words, v$resumable, dba_source, next_item_type, {send | receive}_message, put, put_nchar, putf, putf_nchar, fcopy,
dba_errors, dba_dependencies, deptree, unique_name_session, purge fgetattr, fgetpos, fremove, frename, fseek,
ideptree, dba_libraries, dba_outlines, DBMS_SQL get_raw, put_raw
dba_outline_hints, dba_resumable, {open | close}_cursor, parse, last_er- UTL_HTTP
outln.ol$, outln.ol$hints, java$options, ror_position, bind_{variable | array}, UTL_URL
java$class$md5$table, create$java$lob$table, define_{column | column_long | array}, UTL_TCP
dba_workspace_sessions, all_workspaces, all_ execute, describe_columns, fetch_rows, UTL_SMTP
workspace_privs, all_workspace_savepoints, execute_and_fetch, last_row_{count | id},
UTL_ENCODE
all_version_hview, all_wm_locked_tables, {column | variable}_value, column_value_
long, is_open, last_sql_function_code UTL_INADDR
all_wm_modified_tables, all_wm_ric_info,
DBMS_LDAP UTL_RAW
all_wm_tab_triggers, all_wm_versioned_
cast_{to | from}_{number | binary_integer}
tables, role_wm_privs, user_wm_privs, DBMS_TRANSACTION
<tab>_conf, <tab>_diff, <tab>_lock, <tab>_lt, advise_{commit | nothing | rollback}, OUTLN_PKG
<tab>_hist, <tab>_wm commit, commit_{comment | force}, drop_unused, {drop | update}_by_cat,
local_transaction_id, purge_lost_db_entry, drop_{collision | extras | unrefd_hints}[_
purge_mixed, read_{only | write}, rollback, expact], deptree_fill
Parameters
rollback_{force | savepoint}, savepoint, SQLJUTL
optimizer_mode, db_file_multiblock_ has_default
read_count, optimizer_features_enable, step_id, use_rollback_segment, begin_dis-
optimizer_index_caching, optimizer_in- crete_transaction
>> Discrete transactions do not generate undo Files
dex_cost_adj, optimizer_max_permutations, information! <<
complex_view_merging, partition_view_en- DBMS_WM tracetab.sql, utldtree.sql, initjvm.sql,
abled, hash_join_enabled, hash_area_size, {alter | goto}savepoint, {create | utljavarm.sql, sqljutl.sql, owminst.plb
star_transformation_enabled, row_locking, alter | merge | compress | freeze
sql_trace, timed_statistics, create_stored_out- | get | goto | refresh | remove | Desupported Features
lines, use_stored_outlines, utl_file_dir, rollback | unfreeze}workspace, hash_multiblock_io_count, opti-
plsql_v2_compatibility, remote_dependen- {begin | commit}resolve, {get | mizer_percent_parallel, always_anti_join,
cies_mode, undo_retention, plsql_compiler_ set}conflictworkspace, {remove | always_semi_join, fast_full_scan_enabled,
flags, cursor_sharing compress}workspacetree, {enable | push_join_predicate
disable}versioning, {get | set}diffversions,
Packages getlockmode, {get | set}multiworkspaces,
DBMS_STANDARD, getopcontext, {grant | revoke}{system
| workspace}priv, getprivs, gotodate,
DBMS_TRACE
copyforupdate, {create | delete}savepoint,
{set | pause | resume | clear | comment |
isworkspaceoccupied, {lock | unlock}rows,
limit}_plsql_trace, plsql_trace_version,
{merge | refresh | rollback}table,
get_plsql_trace_runnumber, internal_ver-
resolveconflicts, rollback{resolve |
sion_check
tosp}, set{locking | wooverwrite |
DBMS_LOCK
workspacelockmode}{on | off }
DBMS_DESCRIBE
DBMS_JAVA
DBMS_METADATA server_{startup | shutdown}, longname,
get_{ddl | xml | dependent_ddl | depen- shortname, {get | set | reset}_compiler_op-
dent_xml | granted_ddl | granted_xml | tion, set_{output | streams}, {start | end}_
query}, open, fetch_{ddl | ddl_text | xml | {import | export}, {start | stop}_debugging,
clob}, close, set_{filter | count | parse_item register_endpoint, notifiy_at_{startup
| debug}, add_transform, set_transform_ | shutdown}, remove_from_{startup |
param, free_context_entry shutdown}
DBMS_FLASHBACK DBMS_LOB
enable_at_{time | system_change_num- append, close, compare, converttoclob,
ber}, disable, get_system_change_number copy, {create | free}temporary, erase,
DBMS_RESUMABLE fileclose, filecloseall, fileexists, filegetname,
abort, {get | set}_timeout, {get | set}_ses- fileisopen, fileopen, getchunksize, get-
sion_timeout, space_error_info length, instr, isopen, istemporary, load-
DBMS_DDL fromfile, open, read, substr, trim, write,
DBMS_DEBUG writeappend
DBMS_PROFILER DBMS_OBFUSCATION_TOOLKIT
DBMS_ALERT desencrypt, desdecrypt, des3encrypt,
DBMS_OUTPUT des3decrypt, md5, desgetkey, des3getkey
put, {new | put | get}_line, get_lines, UTL_FILE
enable, disable fopen, fopen_nchar, is_open, fclose,
DBMS_PIPE fclose_all, fflush, new_line, get_line,

www.larsditzel.de
Oracle Server 9i Quick Reference Guide 31

SQL, PL/SQL & Java (cont.)

Number Functions nls_charset_name, nullif, nvl, nvl2, sys_con- order by <col> [, …] {rows | range}
abs, acos, asin, atan, atan2, bitand, ceil, nect_by_path, sys_context, sys_dburigen, [ { between <n> | unbounded
cos, cosh, exp, floor, ln, log, mod, power, sys_extract_utc, sys_guid, sys_typeid, sys_xm- | interval ‘<n>‘ day } preceding]
round, sign, sin, sinh, sqrt, tan, tanh, trunc, lagg, sys_xmlgen, uid, user, userenv, vsize [ { [and] <n> | unbounded
width_bucket | interval ‘<n>‘ day } following]
Aggregate Functions [current row]
[first_value()] [last_value()]
Character Functions avg, corr, count, covar_pop, covar_samp,
[asc | desc] [nulls {first | last}] )
chr, concat, initcap, lower, lpad, ltrim, cume_dist, dense_rank, first, group_id, group-
ing, grouping_id, last, max, min, percen- Reporting Aggregate:
nls_initcap, nls_lower, nlssort, nls_upper, {<WA-Func> | ratio_to_report}
replace, rpad, rtrim, soundex, substr[b|c|2|4], tile_cont, percentile_disc, percent_rank, rank,
regr, stddev, stddev_pop, stddev_samp, sum, (<col>) over (
translate, treat, trim, upper [partition by <col> [, …]]
ascii, instr[b|c|2|4], length[b|c|2|4] var_pop, var_samp, variance
[asc | desc] [nulls {first | last}] )
Object Reference Functions LAG/LEAD:
Datetime Functions {lag | lead} (<col>, <default>) over (
add_months, current_date, current_time- deref, make_ref, ref, reftohex, value order by <col> [, …] [asc | desc]
stamp, dbtimezone, extract, from_tz, last_day, [nulls {first | last}] )
localtimestamp, month_between, new_time, Format Models
next_day, numtodsinterval, numtoyminterval, <fm> = 9 0 $ B MI S PR D G C L , . V SQL Statement Types
round, sessiontimezone, sys_extract_utc, EEEE RN DATE A<n> DDL
systimestamp, sysdate, to_dsinterval, to_time- create, alter, drop, truncate, rename,
stamp, to_timestamp_tz, to_yminterval, Analytic Functions comment, grant, revoke, audit, noaudit,
trunc, tz_offset analyze, {associate | disassociate} statistics
Ranking:
{ rank() | dense_rank() | cume_dist() DML
Conversion Functions | percent_rank() | ntile(<n>) select, insert, update, delete, merge, lock
asciistr, bin_to_num, cast…[multiset], | row_number() } table, explain plan, call
chartorowid, compose, convert, decompose, over ([partition by <col> [, …]] order by TxCtl
hextoraw, numtodsinterval, numtoyminterval, <col> [, …] [asc | desc] [nulls {first | last}]) commit, rollback, savepoint, set transac-
rawtohex, rawtonhex, rowidtochar, rowidton- Window Aggregate: tion
char, to_char, to_clob, to_date, to_dsinterval, { count | sum | avg | min | max | stddev SessCtl
to_lob, to_multi_byte, to_nchar, to_nclob, | variance | var_samp | var_pop alter session, set role
to_number, to_single_byte, to_yminterval, | stddev_samp | stddev_pop | covar_samp SysCtl
translate…using, unistr | covar_pop | regr_slope | regr_intercept alter system
| regr_r2 | regr_avgx | regr_avgy
Micellaneous Functions | regr_count | regr_sxx | regr_sxy
bfilename, coalesce, decode, dump, empty_ | regr_syy }
blob, empty_clob, existsnode, extract, greatest, (<col>) over (
least, nls_charset_decl_len, nls_charset_id, [partition by <col> [, …]]

Optimizer -- index join (<tab> […] ), USE_HASH (<tab> […] ),


Access Paths -- bitmap index scan DRIVING_SITE (<tab> […] ), PARALLEL
1 single row by rowid (<tab> [, {<n> | default} [ {<n> | default} ] ]
Hints ), NOPARALLEL (<tab> […] ), PQ_DIS-
2 single row by cluster join
TRIBUTE (<tab> [,] <out>, <in>), APPEND,
3 single row by hash cluster key with unique {select | update | delete}
NOAPPEND, PARALLEL_INDEX (<tab>
or primary key { /*+ <HINT> [text] */
[<ind> [, …] ] [, {<n> | default} [ {<n> |
4 single row by unique or primary key | --+ <HINT> [text] }
default} ] ] ), NOPARALLEL_INDEX (<tab>
5 cluster join [<ind> [, …] ] ), CACHE (<tab> […] ),
6 hash cluster key RULE, CHOOSE, ALL_ROWS, FIRST_ NOCACHE (<tab> […] ), MERGE (<tab>),
7 indexed cluster key ROWS [(<n>)], FULL (<tab>), ROWID NOMERGE (<tab>), PUSH_JOIN_PRED
(<tab>), CLUSTER (<tab>), HASH (<tab>), (<tab>), NO_PUSH_JOIN_PRED (<tab>),
8 composite key
HASH_AJ, HASH_SJ, INDEX (<tab> PUSH_SUBQ, STAR_TRANSFORMA-
9 single-column indexes
[<ind> […] ] ), INDEX_ASC (<tab> [<ind> TION, ORDERED_PREDICATES, CUR-
10 bounded range search on indexed columns […] ] ), INDEX_DESC (<tab> [<ind> SOR_SHARING_EXACT, DYNAMIC_
11 unbounded range search on indexed […] ] ), INDEX_COMBINE (<tab> SAMPLING ([<tab>] <n>)
columns [<ind> […] ] ), INDEX_JOIN (<tab>
12 sort-merge join [<ind> […] ] ), INDEX_FFS (<tab> [<ind>
Serial direct-load insert:
13 max or min of indexed column […] ] ), NO_INDEX (<tab> [<ind> […] ] ),
insert /*+APPEND */ into <tab> <query>;
14 order by on indexed columns MERGE_AJ, MERGE_SJ, AND_EQUAL
Parallel direct-load insert:
15 full table scan (<tab> <ind> <ind> […] ), USE_CONCAT,
alter session {enable | force} parallel dml;
-- sample table scan NO_EXPAND, NOREWRITE, REWRITE
insert /*+PARALLEL(<tab>,<n>) */ into
[ (<mview> [, …] ) ], ORDERED, STAR,
-- fast full index scan <tab> <query>;
USE_NL (<tab> […] ), USE_MERGE

www.larsditzel.de
32 Oracle Server 9i Quick Reference Guide

SQL, PL/SQL & Java (cont.)

Queries update <tab> [returning <expr> [, …]


select set <col> = {<val> | ‘<string>’} [, …]; [bulk collect] into <var> [, …]];
{ [aggr_func (] merge into <tab1> update
[ {distinct | unique} | all ] using <tab2> on (<join_expr>) {<tab> | table (<subquery>)}
{ [<alias>.]<col> | * } [)] when matched then update set… set <col> = <expr> [, …]
[ { + | - | * | / } <expr>] when not matched then insert [where {<expr> | current of <curs>}]
[as] [“<alias>”] [, …] (<col>…) values (…); [returning <expr> [, …]
| <seq>.{nextval | currval} delete [from] <tab> [bulk collect] into <var> [, …]];
| cursor (<subquery>) } [partition (<part>)] [alias] delete from
from [where <expr>]; {<tab> | table (<subquery>)}
{ [(] [<schema>.] [where {<expr> | current of <curs>}]
<tab/view/snapshot>[@<dblink>] [returning <expr> [, …]
Control
[partition (<part>)] [bulk collect] into <var> [, …]];
commit [work] execute immediate <‘dyn_sql_stat‘>
[subpartition (<subpart>)] [ comment ‘<string>’
[<alias>] [, …] [sample [block] (<n>)] [[bulk collect] into
| force ‘<id>’ [,<scn>] ]; {<var> [, …] | <rec>}]
[ [inner | {left | right | full} [outer] ] savepoint <sp>;
join <tab> { on <expr> [using [in | out | in out] <arg> [, …]]
rollback [work] [{returning | return} [bulk collect]
| using (<col> [, …]) }
[to [savepoint] <sp> | force ‘<id>’]; into <arg> [, …]];
| cross join <tab>
| natural [inner | {left | right | full} set transaction open <refcurs>
[outer] ] join <tab> ] [)] { read only | read write for <‘dyn_multi_row_query‘>
| ( <subquery> [with {read only | check | isolation level [using <var> [, …] ];
option [constraint <constr>]} ] ) {serializable | read committed} open <curs> [ (<par>, …) ];
| use rollback segment <rbs>} <curs>%{ found | isopen | notfound | rowcount }
| table (<coll_expr>) [(+)] }
[name ‘<tx>’]; fetch <curs> [bulk collect] into
where {<var> [, …] | <rec>} [limit <n>];
[(] [(] [<alias>.]<col/expr> [(+)] alter session {enable | disable}
commit in procedure; close <curs>;
[,<expr>…)]
alter session {enable | disable | force} if <expr> then <stat>;
{ { = | != | ~= | <> | <= | >= | < | > }
parallel {dml | ddl} [parallel <n>]; [elsif <expr> then <stat>;]
[any | some | all]
[else <stat>;]
(<expr> [, …] | <subquery>) alter session {enable | disable}
end if;
| like ‘[ _%]<string>‘ resumable [timeout <7200>]
[ << <label> >> ]
| [not] in (<expr> [, …] | <subquery>) [name ‘<str>’];
[ while <expr>
| [not] between <expr> and <expr>
| for <i> in [reverse] <a>..<b>
| = [<alias>.]<col> PL/SQL | for <rec> in {<curs> [(<par>, …)]
| [not] exists (<subquery>) declare | (<query>) } ]
| is [not] null { -- <comment> loop <stat>;
| is dangling } | /* <comment> */ } [if <expr> then exit; end if;]
[{and [not] | or} <expr>] [, …] [)] pragma autonomous_transaction; [exit [<label>] when <expr>;]
[[start with <expr>] pragma serially_reusable; end loop [<label>];
connect by [prior] <expr>] pragma restrict_references forall <i> in <a>..<b> [save exceptions]
[group by [{rollup | cube} (] (<name>, rnds, wnds, rnps, { <stat> [returning <col>
<expr> [, …] [)] wnps, trust); bulk collect into <collect>];
[having {<expr> | (<subquery>)}] ] read, write, no, database, package, state
| execute immediate
[ {union [all] | intersect | minus} pragma exception_init (<exc>, <err_no>); <upd | ins | del> … }
(<subquery>) ] <var> [constant] SQL%{bulk_rowcount(i)
[order by {<col> | <n>} [asc | desc] [, …]] { <type> | <tab>.<col>%TYPE | bulk_exceptions(i).error_{index | code}
| bulk_exceptions.count }
[for update [of <tab>.<col>] | <var>%TYPE | <tab>%ROWTYPE }
lock table <tab>
[nowait | wait <n>] ]; [[not null] { := | default } <n>];
in {share [row exclusive] | exclusive}
with <query_name> as (<subquery>) [, …] cursor <curs>
mode [nowait];
select … from <query_name> … ; [(<par> <type> [, …])] is
<< subquery factoring set transaction
<query> [for update of <col> [, …]];
{read only | read write
type <refcurs_type> is
| isolation level
DML ref cursor return <type>;
{serializable | read committed}
insert into <refcurs> <refcurs_type>;
| use rollback segment <rbs>};
{ <tab> [partition (<part>)] type <rec_type> ist record (<col> [, …] );
commit [work] [comment ‚<str>‘];
| [the] <subquery1> } <rec> <rec_type>;
savepoint <sp>;
[(<col> [, …] )] <exc> exception;
rollback [work] [to [savepoint] <sp>];
{ values (<expr>, …) begin [ << <blocklabel> >> ] null;
| <subquery2> } [ref into <item>]; select … [ << <label> >> ]
insert [[bulk collect] into <var> [, …]] goto <label>;
{ all into <tab>… [, <tab>…] from …; {<var> := <func> | <proc>}
| [all | first] insert into ([<form_par> => ] <act_par> [, …]);
when <expr> then into <tab>… {<tab> | table (<subquery>)} return [ [(] <expr> [)] ];
[else into <tab>…] } [(<col> [, …])] raise <exc>;
<subquery>; {values (<expr>, …) | <subquery>}

www.larsditzel.de
Oracle Server 9i Quick Reference Guide 33

SQL, PL/SQL & Java (cont.)

exception { is <var> <type>; | {clob | blob | bfile} <subquery>


when {<exc> | others} [or <exc2> …] begin <stat>; | ‘<key_for_BLOB>‘} };
then <stat>; [sqlcode; sqlerrm(<n>);] end [<func>]; alter java {source | class} “<java>”
raise; | as external library <lib> [resolver…]
>> Predefined Server Exceptions: [name ‘<func>’] [language <lang>]
no_data_found, too_many_rows, invalid_cursor, { {compile | resolve}
zero_divide, dup_val_on_index << [calling standard {C | pascal}] | authid {current_user | definer} };
end; parameters ( drop java {source | class | resource} “<java>”;
{ <par> [ indicator | length | maxlen
Packages | charsetid | charsetform ]
Miscellaneous
[by ref ] <type> [, …]
create [or replace] package <pack> return [indicator | …] create [or replace] library <lib> {is | as} ‘<file>‘;
[authid {current_user | definer}] [by ref ] <type> drop library <lib>;
{is | as} {procedure | function} | context } [, …]) [with context] create [or replace] operator <oper>
<name> (<par> <type> [, …]) | as [language <lang>] name binding (<type> [, …]) return <type>
[return <type>]; ‘<func> (<par>, …) return <type>‘ }; [ancillary to <prim> (<type> [, …] )]
[type <refcurs> is ref cursor [with index context] [scan context]
drop function <func>;
return <type>;] [compute ancillary data] using <func>;
create [or replace] procedure <proc>
end [<pack>]; create [or replace] indextype <itype>
[(<par> [ in | out [nocopy]
create [or replace] package body for <oper> (<par> [, …]) using <package>;
| in out [nocopy] ] <type>
<pack> {is | as} create [or replace] context <namespace>
[{:= | default} <expr>] [, …] )]
{procedure | function} <name> using <pack|type>;
[authid {current_user | definer}]
[(<par> [ in | out [nocopy]
{ is <var> <type>; drop context <namespace>;
| in out [nocopy] ] <type>
begin <stat>; create schema authorization <schema>
[{:= | default} <expr>] [, …] )]
end [<proc>]; {create table… | create view… | grant…};
[return <type>]
| as [language <lang>] name explain plan [set statement_id = ‘<string>’]
[authid {current_user | definer}]
‘<func>(<par>, …)‘ }; [into <tab>] for <stat>;
{ is begin <stat>; end; end [<pack>];
drop procedure <proc>; create [or replace] outline <outln>
| is external library <lib>
[name ‘<func>’] [language <lang>] alter {function | procedure} <name> [for category <cat>] on <stat>;
[calling standard {C | pascal}] compile [debug]; alter outline <outln>
[with context] call {<proc> | <func> | <method>}[@<dblink>] { rebuild | rename to <new>
| as [language <lang>] name (<expr> [, …]) | change category to <newcat> };
‘<func> (<par>, …) return <type>‘ }; [into <:var> [indicator <:ind>]]; drop outline <outln>;
drop package [body] <pack>;
alter package <pack> compile Java
[debug] [package | specification | body]; create [or replace]
[and {resolve | compile} [noforce] java
Procedures & Functions { {source | resource} named “<java>”
| class [schema <schema>] }
create [or replace] function <func>
[authid {current_user | definer}]
[(<par> [ in | out [nocopy]
[resolver (
| in out [nocopy] ] <type>
(“<pack/class | * >“ [,] {<schema> | - } )
[{:= | default} <expr>] [, …] )]
[…] )]
return <type>
{ as <src_text>
[authid {current_user | definer}]
| using { bfile (<dir>, ‘<file>‘)
[deterministic] [parallel_enable]

Boolean Conditions
AND true false null OR true false null NOT
true true false null true true true true true false
false false false false false true false null false true
null null false null null true null null null not null

www.larsditzel.de
34 Oracle Server 9i Quick Reference Guide

Embedded SQL

exec oracle define <symbol>; set <col> = <expr> into <bind_descr>;


exec oracle {ifdef | ifndef } <symbol>; [where {<expr> | current of <curs>}] exec sql [for <n>] open <curs>
exec oracle {else | endif }; [{return | returning} <expr> [, …] [using descriptor <bind_descr>];
exec oracle option (<name> = <value>); into <:var> [[indicator] <:ind>] [, …]]; exec sql describe [select list for] <stat>
exec sql include {oraca | sqlca}; exec sql [at <db>] [for <n>] delete [from] into <sel_descr>;
sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc {(<subquery>) | <tab>} [alias] exec sql [for <n>] fetch <curs>
exec sql enable threads; [where {<expr> | current of <curs>}] using descriptor <sel_descr>;
exec sql declare <db> database; [{return | returning} <expr> [, …] exec sql close <curs>;
into <:var> [[indicator] <:ind>] [, …]];
exec sql connect
{<:user> identified by <:pw> | <:user_pw>} exec sql [at <db>] execute
ANSI dyn. SQL method 4
[ [at <db>] using <:db>] begin <stat>; [, …] end;
end-exec; exec sql [for <n>] allocate descriptor
{ [in {sysdba | sysoper} mode] [global | local] {<:descr> | ‘<descr>‘}
| [alter authorization <:new_pw>] }; exec sql [at <db>] declare <curs>
[with max <100>];
exec sql whenever for <static_stat>;
exec sql prepare <stat> from {<:str> | ‘<str>‘};
{not found | sqlerror | sqlwarning} exec sql open <curs> [using <:var>];
exec sql describe input <stat>
{ continue | goto <label> | stop exec sql fetch <curs> into <:var> [, …];
using [sql] descriptor
| do {<routine> | break | continue} }; exec sql close <curs>;
[global | local] {<:descr> | ‘<descr>‘};
exec sql declare <tab> table exec sql [for <n>] set descriptor
(<col> <type> [not null] [, …]); Oracle dyn. SQL method 1 [global | local] {<:descr> | ‘<descr>‘}
exec sql declare <tab> table of <obj_type>; non-query, no bind vars
{ count = <n> | value <item_no>
exec sql declare <type> type as exec sql [at <db>] execute immediate { type | length | [ref ] indicator
{ object ( <col> <type> [, …]) {<:str> | ‘<str>‘}; | [ref ] data | character_set_name
| varray (<size>) of <elem_type> <str> may be PL/SQL block
| [ref ] returned_length
| table of <obj_type> }; | national_character
exec sql type <typ> is <datatype> [reference]; Oracle dyn. SQL method 2 | host_stride_length
non-query, known number and types of bind vars | indicator_stride_length
exec sql call <proc>(<par> [, …] )
[into <:var> [[indicator] <:ind>] ]; [exec sql [at <db>] declare <stat> statement;] | returned_length_stride
exec sql register connect using <:ext_proc> exec sql prepare <stat> from {<:str> | <str>}; | user_defined_type_{name | name_
[{return | returning} <:cont>]; exec sql execute <stat> [using <:var> [, …] ]; length | schema | schema_length }}
exec sql var <:var> is <type> = <:var> [, …] };
{ [(<len> | <prec>,<scal>)] Oracle dyn. SQL method 3 exec sql [for <n>] execute <stat>
[convbufsz [is] (<n>)] query, known number of columns and known number [using [sql] descriptor
and types of bind vars [global | local] {<:descr> | ‘<descr>‘}]
| [convbufsz [is] (<n>)] };
[exec sql [at <db>] declare <stat> statement;] [into [sql] descriptor
exec sql [at <db>] allocate <:curs_var>
[[indicator] <:ind>]; exec sql [at <db>] prepare <stat> [global | local] {<:descr> | ‘<descr>‘}];
from {<:str> | ‚<str>‘}; exec sql execute immediate {<:str> | ‘<str>‘};
exec sql [at <db>] commit [work]
exec sql declare <curs> cursor for <stat>; str> may be PL/SQL block
[ [comment ‘<str>’] [release]
| force ‘<id>’ [,<n>] ]; exec sql [for <n>] open <curs> exec sql [at <db>] declare
[using <:var> [[indicator] <:ind>] [, …]]; <curs> cursor for <stat>;
exec sql [at <db>] savepoint <sp>;
exec sql [for <n>] fetch <curs> into <:var> exec sql [for <n>] open <curs>
exec sql [at <db>] rollback [work]
[[indicator] <:ind>] [, …]; [using [sql] descriptor
[ to [savepoint] <sp>
exec sql close <curs>; [global | local] {<:descr> | ‘<descr>‘}]
| force ‘<id>’ | release ];
[into [sql] descriptor
[global | local] {<:descr> | ‘<descr>‘}];
Static SQL Oracle dyn. SQL method 4
query, unknown number of columns or unknown exec sql describe output <stat>
exec sql [at <db>] select <val> into <:var>… number or types of bind vars using [sql] descriptor
from <tab> where <expr>…; [exec sql [at <db>] declare <stat> statement;] [global | local] {<:descr> | ‘<descr>‘};
exec sql [at <db>] [for <n>] exec sql prepare <stat> from {<:str> | ‚<str>‘}; exec sql [for <n>] fetch <curs>
insert into {<tab> | (<subquery1>)} into [sql] descriptor
exec sql [for <n>] execute <stat>
[(<col> [, …] ] [global | local] {<:descr> | ‘<descr>‘} };
[using descriptor <bind_descr>];
{values (<expr> [, …]) | <subquery2>} exec sql [for <n>] get descriptor
exec sql [at <db>] declare <curs> cursor
[{return | returning} <expr> [, …] [global | local] {<:descr> | ‘<descr>‘}
for <stat>;
into <:var> [[indicator] <:ind>] [, …]]; { <:var> = count
exec sql describe bind variables for <stat>
exec sql [at <db>] [for <n>] update <tab>

www.larsditzel.de
Oracle Server 9i Quick Reference Guide 35

Embedded SQL (cont.)


| value <item_no> <:var> = <:obj> [[indicator] <:ind>] to <:var> Utilities
{ type | length | octet_length [[indicator] <:ind>] [, …]; proc
| returned_octet_length | precision exec sql [at <db>] object auto_connect={yes | no} char_
| scale | nullable | name get [ { * | <attrib> [, …] } from ] map={varchar2 | charz | string | charf }
| character_set_name | indicator | data <:obj> [ [indicator] <:ind>] into <:var> close_on_commit={yes | no} code={ansi_c
| returned_length | national_character [[indicator] <:ind>] [, …]; | kr_c | cpp} comp_charset={multi_byte
| internal_length | host_stride_length exec sql [for <n>] [object] free <:point> | single_byte} config=<file> cpp_
| indicator_stride_length [[indicator] <:ind>]; suffix=<ext> dbms={native | v7 | v8}
| returned_length_stride exec sql [at <db>] [object] cache free all; def_sqlcode={yes | no} define=<name>
| user_defined_type_{version | name duration={transaction | session}
| name_length | schema dynamic={oracle | ansi} errors={yes | no}
LOBs
| schema_length} errtype=<file> fips={sql89 | sql2 | yes
} [, …] }; exec sql [at <db>] lob append <:src> to <:dst>;
| no} header=<ext> hold_cursor={yes
exec sql close <curs>; exec sql [at <db>] lob trim <:src> to <:x>; | no} iname=<ifile> include=<path>
exec sql deallocate descriptor exec sql [at <db>] lob assign <:src> to <:dst>; intype=(<file, …>) lines={yes | no}
[global | local] {<:descr> | ‘<descr>‘}; exec sql [at <db>] lob copy <:x> lname=<lisfile> ltype={none | short | long}
from <:src> [at <:y>] to <:dst> [at <:z>]; maxliteral=<1024> maxopencursors=<10>
Collections exec sql [at <db>] lob mode={ansi | iso | oracle} nls_char=<var>
exec sql [at <db>] collection describe erase <:x> from <:src> [at <:y>]; nls_local={yes | no} objects={yes |
<:coll> [ [indicator] <:ind>] exec sql [at <db>] lob create temporary <:src>; no} oname=<ofile> oraca={yes | no}
get <attrib> [, …] into <:var> exec sql [at <db>] lob free temporary <:src>; pagelen=<80> parse={full | partial | none}
[[indicator] <:ind>] [, …]; exec sql [at <db>] lob describe <:src> get prefetch=<1> release_cursor={yes | no}
{ chunksize | directory | fileexists | filename select_error={yes | no} sqlcheck={semantics
exec sql [at <db>] [for <n>] collection append
| isopen | istemporary | length } [, …] | full | syntax} sys_include=<path>
<:var> [ [indicator] <:ind>] to <:coll>
into <:var> [[indicator] <:ind>] [, …]; threads={yes | no} type_code={oracle |
[[indicator] <:ind>];
ansi} unsafe_null={yes | no} userid=<user>/
exec sql [at <db>] collection trim <:x> exec sql [at <db>] lob enable buffering <:src>;
<pwd>[@<serv>] utf16_charset={nchar_
from <:coll> [[indicator] <:ind>]; exec sql [at <db>] lob disable buffering <:src>;
charset | db_charset} varchar={yes | no}
exec sql [at <db>] [for <n>] collection exec sql [at <db>] lob flush buffer <:src> [free]; version={recent | latest | any}
set <:coll> [[indicator] <:ind>] exec sql [at <db>] lob open <:src>
to <:var> [[indicator] <:ind>]; [read only | read write];
lnproc
exec sql [at <db>] [for <n>] collection exec sql [at <db>] lob close <:src>;
get <:coll> [[indicator] <:ind>] exec sql [at <db>] lob file close all;
into <:var> [[indicator] <:ind>]; exec sql [at <db>] lob file set <:file>
exec sql [at <db>] collection reset <:coll> directory = <:dir>, filename = <:name>;
[[indicator] <:ind>]; exec sql [at <db>] lob load <:x> from file
<:file> [at <:y>] into <:dst> [at <:z>];
Objects exec sql [at <db>] lob read <:x> from <:src>
exec sql [at <db>] [for <n>] object [at <:y>] into <:buff> [with length <:z>];
create <:obj> [indicator] <:ind> exec sql [at <db>] lob write [append]
[table <tab>] [returning ref into <:ret>]; [first | next | last | one] <:x>
exec sql [at <db>] [for <n>] object from <:buff> [with length <:y>]
release <:obj>; into <:dst> [at <:z>];
exec sql [at <db>] [for <n>] object
update <:obj>; Context
exec sql [at <db>] [for <n>] object exec sql context allocate <:cont>;
delete <:obj>; exec sql context use {<:cont> | default};
exec sql [at <db>] [for <n>] object exec sql context object get <option> [, …]
deref <:ref> into <:obj> into <:var> [, …];
[[indicator] <:ind>] [for update [nowait]];
exec sql context object set <option> [, …]
exec sql [at <db>] [for <n>] object to <:var> [, …];
flush <:obj>;
exec sql context free <:cont>;
exec sql [at <db>] object
set [ { * | <attrib> [, …] } of ]

www.larsditzel.de
36 Oracle Server 9i Quick Reference Guide

SQLJ

#sql <mod> iterator <iter> Utilities –user <user> –password <pwd> –service
[implements <intfc> [, …] ] sqlj <url> –{ssl | iiop}
[with ( [sensitivity = {sensitive –d[ir]=<dir> –encoding=<enc> –url=<url> deployejb
| asensitive | insensitive}] –status –compile=false –user=<user>/ –generated <clientjar> –descriptor <file>
[holdability = {true | false}] <pwd>@jdbc:oracle:thin@<host>:<port>: –verbose –republish –beanonly –addclass-
[returnability = {true | false}] <sid> –linemap –profile=false –ser2class path <path> –resolver <res> –h[elp] –keep
[updatecolumns = ‘<col> [, …] –P–<opt> –C–<opt> –P–help –C–help –version –describe –p[roperties] <file>
[<var> = <val>] [, …] )] –J–<opt> –version –help–alias –help–log –user <user> –password <pwd> –role
(<type> [<col>] [, …]); –<key>=<value> <role> –service <url> –{ssl | iiop}
named or positional iterator –credsfile <file> –useservicename –temp
{ <in>.sqlj [<out>.java] …
#sql <mod> context <cont> | <in>.ser [<out>.jar] … } <dir> <EJBjarfile>
[implements <intfc> [, …]] ejbdescriptor
loadjava
[with ( … <var>=<val> [, …] )]; –{parse | dump} <infile> <outfile>
–d[efiner] –e[ncoding] <latin1> –f[orce]
#sql [ [<conn_cont_inst>, <exec_cont_inst>] ] –g[rant] <user / role>, … –h[elp] java2rmi_iiop
[<var / iter> =] { <SQL stat> }; –noverify –order –r[esolve] –a[ndresolve] –no_bind –no_comments –no_examples
>> Curly braces are part of syntax! <<
–s[ynonym] –oracleresolver –no_tie –wide –root_dir <dir> –verbose
#sql { select /*+ <HINT> */ <expr> [, …] –version –W <n>
–R[esolver] “((<name> <schema>) …)”
into <:[out] var> [, …]
–o[ci8] –t[hin] –v[erbose] <true> java2idl
from <tab> [where <expr> …] };
–S[chema] <schema> modifyprops
#sql <iter> = { select <expr> [, …] –u[ser] <user>/<pwd>@<netserv> –{o[ci8] | t[hin]}
from <tab> [where <expr>…] }; <classes> <jars> <resources> <properties> –u[ser] <user>/<pwd>@<netserv>
#sql { fetch <:iter> into <:var> [, …] }; dropjava {<key> <val> | <key> –delete}
<iter>.next(), <iter>.endFetch(), <iter>.close()
–encoding <latin1> –h[elp]–s[ynonym]
#sql { insert into… }; –{o[ci8] | t[hin]} –v[erbose] –S[chema]
#sql { update… }; <schema> –user user>/<pwd>@<netserv>
#sql { delete from… }; <classes> <jars> <resources> <properties>
#sql { commit }; publish
#sql { rollback }; –republish –h[elp] –version –describe
#sql { set transaction <mode> –g[rant] <user / role>, … –role <role>
[, isolation level <level>] }; –user <user> –password <pwd> –service
#sql { call <proc> (<par> [, …] ) }; <url> –schema <schema> –{ssl | iiop}
#sql <var / iter> = <name> <class> [<helper>]
{ values ( <func> (<par> [, …] ) ) }; remove
#sql { set <:var> = <expr> }; –r[ecurse] –h[elp] –version –d[escribe]
–role <role> –user <user> –password
#sql <iter> = { cast <:result_set> };
<pwd> –service <url> –{ssl | iiop} <name>
#sql { [declare <var> <type>;]
sess_sh
begin <stat>; […] end; };
–h[elp] –version –d[escribe] –role <role>

www.larsditzel.de
Oracle Server 9i Quick Reference Guide 37

Label Security

Views & Tables {create | alter | drop}_label


dba_sa_audit_options, dba_sa_compartments, SA_POLICY_ADMIN
dba_sa_data_labels, dba_sa_groups, dba_sa_ {apply | remove | enable | disable}_table_
group_hierachy, dba_sa_labels, dba_sa_levels, policy, {apply | alter | remove | enable |
dba_sa_policies, dba_sa_prog_privs, dba_ disable}_schema_policy
sa_schema_policies, dba_sa_table_policies, SA_USER_ADMIN
dba_sa_users, dba_sa_user_compartments, set_levels, {set | add | alter | drop}_com-
dba_sa_user_groups, dba_sa_user_labels, partments, {set | add | alter | drop}_groups,
dba_sa_user_levels, dba_sa_user_privs drop_all_{groups | compartments},
set_user_labels, set_{default | row}_label,
Packages set_prog_privs
SA_SESSION SA_AUDIT_ADMIN
privs, {min | max}_level, comp_{read | audit, noaudit, {audit | noaudit}_label,
write}, group_{read | write}, label, row_la- audit_label_enabled, {create | drop}_view
bel, sa_user_name, {save | restore}_de- SA_UTL
faults_labels, set_label, set_row_label, {numeric | numeric_row | data}_label,
set_access_profile, set_user_privs set_{label | row_label}
SA_SYSDBA
{create | drop | enable | diable}_policy
SA_COMPONENTS
{create | alter | drop}_level, {create | alter
|drop}_compartment, {create | alter |
drop}_group, alter_group_parent
SA_LABEL_ADMIN

Performance

Performance Gains • serialization? • data block serialization (free lists, free


• minimal for instance tuning investigate wait events list groups, block size, transaction slots,
• large for application tuning 6. apply series of remedy actions ordered and rollback segments)
stepwise • long full table scans (indexes, statistics)
Oracle Performance Improvement 7. validate impact on statistics and user • disk sorts
Method perception • recursive SQL (space management)
8. repeat steps 5 to 7 until goals are met or • schema errors and optimizer problems
1. user feedback: scope and goals?
become impossible • nonstandard initialization parameters
2. get full set of OS, database, and applica-
tion statistics for good and bad perfor- (undocumented features)
Emergency Performance Method
mance
3. sanity-check OS (over-used resources or 1. user feedback: throughput or response
hardware errors?) time problem? changes in environment?
• CPU: user & kernel mode 2. hardware utilization (CPU, disk, memory,
• disk: response times & queues network)
• memory: paging 3. constrained CPU or wait events?
• network: latency 4. emergency action to stabilize system
4. check for top ten performance issues 5. get reference data and perform detailed
5. build/refine conceptual model of system analysis
• inadequate single-user response time?
points to application problems Top Ten Performance Issues
(investigate SQL and application • connection management
internal statistics)
• cursor sharing (bind variables, avoid
• full CPU utilization?
dynamic SQL)
kernel mode (network or memory)
user mode (non-database, database: top • I/O design (controller, bandwidth)
SQL) • redo log sizes and groups

www.larsditzel.de

You might also like