orical
- 1. Copyright © 2000-2002 Dr. Lars Ditzel Database Management
Oracle Server 9i
Quick Reference Guide
Disclaimer 2
Instance 3
Database 6
Database Utilities 7
Tablespaces, Datafiles & Segments 8
Logfiles 9
Tables, Constraints & Triggers 10
Views, Synonyms & Sequences 12
Clusters 12
Index-organized Tables 13
Indexes 13
Temporary Segments 14
Undo Management 14
Users, Privileges, Resources & Policies 15
Auditing 16
Net Services 16
Recovery Manager 18
Distributed DB, Replication, Heterogenous Services,
Advanced Queuing & Data Warehousing 20
Real Application Clusters 22
Globalization Support 24
SQL*Plus 25
Data Types (PL/SQL & Database) 26
SQL, PL/SQL & Java 28
Embedded SQL 32
SQLJ 34
Label Security 35
Performance 35
Architecture 36
www.larsditzel.de
- 2. 2 Oracle Server 9i Quick Reference Guide
Disclaimer
This document is nothing official by Oracle ers for input data are enclosed in brackets <>
Corporation. Oracle holds all rights on its with corresponding default values underlined.
documentation. Certain terms are registered A comma followed by an ellipsis inclosed in
trademarks. The major goal of this quick ref- square brackets [, …] indicates that the pre-
erence guide is compaction, not clarity. Some ceding syntactic element may be repeated. An
syntax options only work under certain circum- ellipsis without preceding comma … indicates
stances, some options exclude each other. This that the corresponding syntactic elements have
behaviour is intentionally not reflected to avoid been specified beforehand.
proliferation of similar statements. Be aware of Each section commonly starts with dynamic
your actions! The author disclaims liability for performance views and static data dictionary
errors within this document and subsequent views (only DBA variants listed) and – oc-
mistakes that might harm your database. In casionally – tables. Initialization parameters
case of uncertainties please refer to Oracle’s follow as well as database packages and im-
original documentation, which comprises sev- portant files or processes. Then comes a list
eral hundred megabytes meanwhile, or contact of performance tuning measures and desup-
Oracle Customer Support. Suggestions and ported or deprecated features. The main part
corrections to improve this guide are welcome. of each section is comprised of SQL statements
This reference uses a modified Backus-Naur grouped by functionality. The final section may
Form syntax which is adapted from the Oracle state utilities if any exist.
online documentation. Optional parts are Changes from Release 8i to 9i are colored
enclosed in square brackets [], a list of items is blue for new features or red for obsolete fea-
enclosed in curly braces {}, alternatives within tures. Outdated syntax has not been removed
brackets or braces are separated by a vertical most of the time as one eventually comes
bar |. Keywords appear in regular style and across databases running older releases of
are not case-sensitive in most OS. Placehold- Oracle Server.
Dr. Lars Ditzel Database Management • Ringstraße 23a • 65824 Schwalbach • Germany
Phone/Fax +49 (6196) 889739-0/5 • Mobile +49 (173) 6530050 • info@larsditzel.de
www.larsditzel.de Copyright © 2000-2002 Dr. Lars Ditzel Database Management
- 3. Oracle Server 9i Quick Reference Guide 3
Instance
Background Processes (v$bgprocess) cess, v$px_process_sysstat, v$pq_sesstat, Tuning/Contention
ARC<n>, CJQ0, J<nnn>, CKPT, DBW<n>, v$pq_slave, v$pq_sysstat, v$pq_tqstat, Buffer cache: «Cache Hit Ratio» (v$sysstat)
DIAG, DMON, EMN0, LCK<n>*, LGWR, v$execution, v$mls_parameters, deptree, or per pool (v$buffer_pool_statistics)
LMD0*, LMON*, LMS<n>*, LNSV, LSP0, session_context 1 – («physical reads» / («db block gets» +
MRP0, NSV0, PMON, QMN<n>, RECO, «consistent gets»)) < 90–95% -> increase
RLAP, RSM0, SMON, RFS<n> Parameters (init<sid>.ora) «db_block_buffers» or «buffer_pool_keep»,
BSP<n>*, SNP<n> << obsolete spfile, ifile, instance_name, service_names, «buffer_pool_recycle»
* RAC processes Shared pool: «Shar. Cursors»
db_block_size, sga_max_size, db_cache_size,
Failure of LGWR (Err 470), CKPT (470), DBW<n>
(471), ARC<n> (473), SMON (474) or RECO (476) db_keep_cache_size, db_recycle_cache_size, (v$librarycache) gethitratio for SQL AREA
lead to termination of instance by PMON. Failure of db_<n>k_cache_size, db_cache_advice, < 99%
PMON leads to termination of instance by DBW<n> shared_pool_size, log_buffer, large_pool_size,
(Err 472). Library cache: sum(reloads) / sum(pins) > 1%
Failed SNP<n> processes are restarted by PMON. java_pool_size, shared_pool_reserved_size, (v$librarycache)
pre_page_sga, sessions, processes, user_dump_ Dict. cache: sum(getmisses) / sum(gets) >
dest, background_dump_dest, max_dump_ 15% (v$rowcache) -> increase «shared_
Foreground Processes
file_size, local_listener, remote_listener, pool_size»
D<nnn>, S<nnn>, P<nnn> mts_service, circuits, dispatchers, max_dis- LRU latch: «cache buffers lru chain»
patchers, shared_servers, max_shared_servers, (v$latch) sleeps / gets > 1% -> increase
Views & Tables shared_server_sessions, dbwr_io_slaves, «db_block_lru_latches» (max. CPU * 6 or
v$fixed_table, v$fixed_view_definition, remote_os_authent, os_authent_prefix, BUFFERS / 50)
v$indexed_fixed_column, v$instance, v$sga, dml_locks, enqueue_resources, parallel_auto-
Redo buffer: «redo%retries» (v$sysstat)
v$sgastat, v$pgastat, v$session, v$process, matic_tuning, parallel_min_servers, paral-
PGA: «%ga memory%» (v$sysstat), «sorts%»
v$bgprocess, v$version, product_compo- lel_max_servers, parallel_min_percent, paral-
(v$sysstat), sorts (v$sqlarea), «work-
nent_version, v$license, v$option, v$access, lel_adaptive_multi_user, parallel_threads_
area%» (v$sysstat, v$sesstat), v$pgastat,
v$timer, v$parameter, v$parameter2, per_cpu, parallel_execution_message_size, par-
v$sql_workarea, v$sql_workarea_active,
v$spparameter, v$system_parameter, allel_broadcast_enabled, oracle_trace_enable,
pga_%_mem (v$process)
v$system_parameter2, v$obsolete_parameter, oracle_trace_collection_{name | path | size},
v$sql, v$sqlarea, v$sqltext, v$sqltext_with_ oracle_trace_facility_{name | path}, java_
soft_sessionspace_limit, java_max_sessions- Deprecated Features
newlines, v$sql_cursor, v$sql_bind_data,
v$sql_bind_metadata, v$sql_shared_memory, pace_size, lock_sga, shared_memory_address, v$mts
v$sql_plan, v$sql_workarea, v$sql_work- hi_shared_memory_address, object_cache_op- db_block_buffers, buffer_pool_keep, buf-
area_active, v$librarycache, v$rowcache, timal_size, object_cache_max_size_percent, fer_pool_recycle, mts_circuits, mts_dispatch-
v$rowcache_parent, v$rowcache_subordi- serial_reuse, session_max_open_files, timed_ ers, mts_max_dispatchers, mts_servers,
nate, v$open_cursor, v$object_dependency, os_statistics, cursor_sharing, drs_start mts_sessions
v$db_object_cache, v$shared_pool_reserved, utlbstat.sql, utlestat.sql
v$bh, v$cache, v$subcache, v$buffer_pool, Packages
v$buffer_pool_statistics, v$db_cache_advice, DBMS_SYSTEM Desupported Features
v$filestat, v$sysstat, v$sesstat, v$mystat, set_sql_trace_in_session v$recent_bucket, v$current_bucket, db_
v$statname, v$waitstat, v$latch, v$latchname, DBMS_SESSION block_lru_latches, use_indirect_data_buffers,
v$latchholder, v$latch_parent, v$latch_chil- set_sql_trace db_block_lru_extended_statistics, db_block_
dren, v$event_name, v$system_event,
DBMS_SHARED_POOL lru_statistics, lock_sga_areas, shared_pool_re-
v$session_event, v$session_wait, v$circuit,
keep, unkeep, sizes served_min_alloc, parallel_server_idle_time,
v$queue, v$shared_server, v$shared_serv-
DBMS_APPLICATION_INFO parallel_transaction_resource_timeout, paral-
er_monitor, v$dispatcher, v$dispatcher_rate,
set_module, set_action, set_client_info, lel_min_message_pool, mts_rate_log_size,
v$reqdist, v$queue, v$lock, v$enqueue_lock,
read_module, read_client_info mts_rate_scale, mts_max_servers
v$locked_object, v$global_blocked_locks,
v$session_connect_info, v$session_longops,
v$system_cursor_cache, v$session_cur- Files
sor_cache, v$session_object_cache, v$sess_io, dbmspool.sql, prvtpool.plb, catparr.sql,
v$bsp, v$px_session, v$px_sesstat, v$px_pro- utldtree.sql
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,
www.larsditzel.de
- 4. 4 Oracle Server 9i Quick Reference Guide
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}, timed_os_statistics = <0>,
stance = <4>, optimizer_features_enable
| false}, parallel_threads_per_cpu = <n>, timed_statistics = {true | false}, tracefile_iden-
= <9.0.0>, oracle_trace_collection_name
pga_aggregate_target = <0>, plsql_native_c_ tifier = ‘<id>’, undo_suppress_errors = {true |
= <name>, oracle_trace_collection_path =
compiler = <path>, plsql_native_library_dir false}, workarea_size_policy = {auto | manual}
<dir>, oracle_trace_collection_size = <n>,
= <dir>, plsql_native_library_subdir_count =
oracle_trace_facility_name = {oracled, oraclee,
<0>, plsql_native_linker = <path>, plsql_na- Session Parameters Only
oraclesm, oraclec}, oracle_trace_facility_path =
tive_make_file_name = <path>, plsql_native_ constraint[s] = {immediate | deferred | default},
<dir>, os_authent_prefix = <OPS$>, os_roles
make_utility = <path>, resource_limit = {true create_stored_outlines = {true | false | ‘<cat>’}
= {true, false}, parallel_automatic_tuning =
| false}, resource_manager_plan = <plan>, ser- [nooverride], current_schema = <schema>, er-
{true | false}, parallel_execution_message_size
vice_names = <serv> [, …], shared_pool_size = ror_on_overlap_time = {true | false}, flagger =
= <n>, parallel_max_servers = <n>, paral-
<16/64m>, shared_servers = <0/1>, standby_ {entry | immediate | full | off }, instance = <n>,
lel_min_servers = <0>, pre_page_sga = {true
archive_dest = <path>, standby_file_manage- isolation_level = {serializable | read commit-
| false}, processes = <n>, rdbms_server_dn =
ment = {manual | auto}, trace_enabled = {true ted}, plsql_debug = {true | false}, skip_unus-
<x.500>, read_only_open_delayed = {true |
| false}, transaction_auditing = {true | false}, able_indexes = {true | false}, sql_trace = {true
false}, recovery_parallelism = <n>, remote_ar-
undo_retention = <900>, undo_tablespace = | false}, time_zone = {‘<{+|-}hh:mi>’ | local |
chive_enable = {true | false}, remote_listener =
<ts>, user_dump_dest = <dir> dbtimezone | ‘<tz_region>’}, use_{private |
<serv>, remote_login_passwordfile = {none |
shared | exclusive}, remote_os_authent = {true stored}_outlines = {true | false | ‘<cat>’}
www.larsditzel.de
- 5. Oracle Server 9i Quick Reference Guide 5
Instance (cont.)
Deprecated Initialization Parameters oradebug | hanganalyze [level]
mts_dispatchers, mts_servers { help [cmd] | ffbegin
%_area%_size <<for dedicated server cofigurations | setmypid | ffderegister
| setospid <ospid> | ffterminst
| setorapid <orapid> [‘force’] | ffresumeinst
Obsolete Initialization Parameters
| dump <dump> <lev> [addr] | ffstatus
job_queue_interval, db_block_max_dirty_tar- | dumpsga [bytes] | core
get, hash_multiblock_io_count = <n> | dumplist | ipc
| event <evt> | unlimit
Events | session_event <evt> | procstat
{ alter system set event = | alter session set | dumpvar {p | s | uga} <var> [lev] | call <func> [<arg> , …] }
events [=] } ‘<dbg_evt> trace name context | setvar {p | s | uga} <var> <val>
{forever, level <n> | off }’ | peek <addr> <len> [lev]
alter session set events [=] {‘immediate trace | poke <addr> <len> <val>
name {heapdump | controlf | systemstate} level | wakeup <orapid>
<n>’ | ‘<oerr> trace name errorstack level 3’} | suspend
| resume
| flush
Debug events
| close_trace
10015 (rollback), 10046 (process), 10049,
| tracefile_name
10051, 10053, 10210, 10211, 10212, 10231,
| lkdebug
10232, 10235, 10248 (dispatcher), 10249
| nsdbx
(shared server + dispatcher), 10257 (pmon), 10262,
| -G {<inst> | def | all}
10297 (oid caching), 10325 (control), 10408
| -R {<inst> | def | all}
(block keywords), 10520 (avoid invalidations),
| setinst {“<inst> [, …]” | all}
10619 (compatibility), 19027 (ctxxpath), 29700
| sgatofile <”path”>
(v$ges_convert% views), 30441
| dmpcowsga <”path”>
| mapcowsga <”path”>
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
- 6. 6 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_ana- u080<n>0<n>0.sql, r08000<n>0.sql,
lyze_objects, props$, database_properties, d080<n>0<n>.sql
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
- 7. Oracle Server 9i Quick Reference Guide 7
Database Utilities
Views & Tables Loads {whitespace | [x]’<str>’ | eof }
v$loadcstat, v$loadistat, v$loadpstat, sqlldr [[optionally] enclosed…] }
v$loadtstat, dba_exp_files, dba_exp_objects, userid = <user>/<pwd> data = <data> [trailing [nullcols] ]
dba_exp_version, sys.incexp, sys.incfil, control = <ctrl> parfile = <par> log = [sorted indexes]
sys.incvid <log> bad = <bad> discard = <discard> [singlerow]
discardmax = <n> skip = <n> load = ( { <col> { <sqlfunc> | sysdate | recnum
<n> errors = <n> rows = <n> bindsize | sequence [( { <n>[.<x>]
Files
= <65536> readsize = <65536> silent | max | count } )] }
catexp.sql, catexp7.sql, migrate.bsq | <col> [filler]
= ( {header | feedback | errors | discards
| partitions | all} [, …] ) direct = <n> [ position ( { <x> [ {: | -} <y>]
Export multithreading = <n> streamsize = <n> | * [+<z>] } ) ]
exp columnarrayrows = <n> parallel = <n> { char [(<n>)]
help = <n> userid = <user>/<pwd> parfile file = <file> skip_unusable_indexes = <n> | varchar [(<n>)]
= <par> file = <expdat.dmp> filesize skip_index_maintenance = <n> com- | varcharc
= <n> volsize = <n> log = <log> buf- mit_discontinued = <n> external_table | date [“<fmt>”]
fer = <n> silent = <n> recordlength = = {not_used | generate_only | execute} | time
<n> direct = <n> rows = <y> indexes resumable = <n> resumable_name = <str> | timestamp
= <y> grants = <y> constraints = <y> resumable_timeout = <7200> datecache | time with time zone
triggers = <y> feedback = <0> statistics = <n> | timestamp with time zone
= {estimate | compute | none} record = bind array size = | interval year to month
(n rows) * ( SUM (fixed field lengths) + SUM(max. | interval day to second
<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 | integer [external] [(<n>)]
<scn> flashback_time = <time> resumable dependent]) ) ) | smallint
= <n> resumable_name = <str> resum- | float [external]
able_timeout = <7200> template = <x> Controlfile | double
tablespaces = (<ts> [, …]) transport_ta- [ options ( | byteint
blespace = <n> tts_full_check = <x> [, …] [bindsize = <n>] [columnsarrayrows = | zoned [external] (p [,<s>])
point_in_time_recover = <n> <n>] [direct = {true | false}] [errors = <n>] | decimal [external] (p [,<s>])
recovery_tablespaces = <ts> [, …] [load = <n>] [multithreading = {true | | raw [(<n>)]
{ full = <n> | owner = <schema> false}] [parallel = {true | false}] [readsize | varraw
| tables = (<tab>[:<part>] [, …] = <n>] [resumable] [resumable_name] | long varraw
[query = <expr>] ) } [resumable_timeout] [rows = <n>] [silent | varrawc
inctype = {complete | cumulative | incre- = ({feedback | errors | discards | all} [, …])] | graphic [(<n>)]
mental} << deprecated [skip = <n>] [skip_index_maintenance] | graphic external [(<n>)]
Perform full exports as user System. [skip_unusable_indexes] [streamsize = | vargraphic [(<n>)] }
buffer size =
<n>] ) ] [terminated by
(n rows) * SUM(max. field length + size of length
indicator [2 or 3, system dependent]) {“<str>” | whitespace} ]
{load | continue_load} data
[ {nullif | defaultif } ({<col> | <pos>})
[{infile | inddn} [‘<load.dat>’ | * ]
<op> { [x]‘<str>’ | blanks } [and…] ]
Import [“str [x]’<char>’”]
[enclosed by ‘<chr>’ and ‘<chr>’]
imp [“recsize <n> buffers <n>”]
[“<sql_stmt>(:<col>)”]
help = <n> userid = <user>/<pwd> parfile [badfile ‘<load.bad>’ | baddn]
[, <col> …] )
= <par> file = <expdat.dmp> filesize = [{discardfile | discarddn} ‘<load.dsc>’]
[into table <tab> …]
<n> volsize = <n> log = <log> buffer [{discards | discardmax} <n>]
[characterset <char>] [begindata…]
= <n> recordlength = <n> rows = <y>
grants = <y> indexes = <y> indexfile = [byteorder {big | little} [endian] ]
[byteordermark {check | nocheck} ] Migration
<file> constraints = <y> commit = <n>
compile = <y> ignore = <n> inctype = [length [semantics] mig
{system | restore} feedback = <0> show {byte | char | character} ] dbname = <db> new_dbname = <new>
= <n> statistics = {always | none | safe | [concatenate <n>] pfile = <initfile> spool = <logfile> check_
recalculate} analyze = <y> recalculate_sta- [continueif only = <false> no_space_check = <false>
tistics = <n> destroy = <n> skip_unus- { [this | next] [preserve] multiplier = <15> nls_nchar = <char >
able_indexes = <n> toid_novalidate = [(] <pos>
(<type> [, …] ) resumable = <n> resum- | last [preserve] [(] }
able_name = <str> resumable_timeout <op> [x]’<str>’ [)] ]
= <7200> streams_configuration = <y> into table <tab>
streams_instatiation = <n> { full = <n> | [ ({partition | subpartition} <part>) ]
tables = (<tab>[:<part>] [, …])} fromuser [skip <n>]
= <schema> [, …] touser = <schema> [, {insert | replace | truncate | append}
…] transport_tablespace = <n> datafiles = [options (file = <db_file>) ]
‘(<file> [, …] )‘ tablespaces = (<ts> [, …]) [when ({<col> | <pos>})
tts_owners = <owner> [, …] point_in_ <op> { [x]‘<str>’ | blanks } [and…] ]
time_recover = <false> [fields
Order: type defs – table defs – table data – indexes { enclosed [by]
– constraints, views, procedures, triggers [[x]’<str>’] [and [x]’<str>’]
– bitmap, functional, domain indexes | terminated [by]
www.larsditzel.de
- 8. 8 Oracle Server 9i Quick Reference Guide
Tablespaces, Datafiles & Segments
Views & Tables Parameters tablespace_migrate_{from | to}_local,
v$tablespace, v$datafile, v$datafile_copy, db_block_checking, db_block_checksum, segment_{verify | corrupt | dump |
v$datafile_header, v$dbfile, v$offline_range, recovery_parallelism, fast_start_parallel_roll- moveblocks}, segment_drop_corrupt, seg-
v$tempfile, v$tempstat, v$temp_extent_map, back, db_file_name_convert, log_check- ment_number_{blocks | extents},
v$temp_extent_pool, v$temp_space_header, point_timeout, log_checkpoints_to_alert, DBMS_TTS
v$temp_ping, v$backup, v$recover_file, db_writer_processes, db_file_simultane- transport_set_check, downgrade
v$recovery_file_status, v$recovery_log, ous_waits, standby_file_management,
v$recovery_progress, v$recovery_status, read_only_open_delayed Deprecated Features
v$recovery_transactions, v$instance_recovery, fast_start_io_target, log_checkpoint_interval
v$fast_start_servers, v$fast_start_transac- Packages
tions, v$managed_standby, dba_tablespaces,
DBMS_REPAIR Desupported Features
dba_ts_quotas, dba_data_files, filext$,
check_object, {skip | fix}_corrupt_blocks, db_block_max_dirty_target, db_file_simul-
dba_temp_files, dba_segments, dba_extents,
dump_orphan_keys, rebuild_freelists, taneous_writes, db_block_checkpoint_batch,
dba_free_space, dba_free_space_coalesced,
admin_tables, segment_fix_status parallel_transaction_recovery
dba_free_space_coalesced_tmp[1-3],
DBMS_SPACE
ts_pitr_objects_to_be_dropped, ts_pitr_check,
unused_space, free_blocks, space_usage
transport_set_violations, dba_dmt_free_space,
dba_dmt_used_extents, dba_lmt_free_space, DBMS_SPACE_ADMIN
dba_lmt_used_extents, pluggable_set_check, tablespace_verify, tablespace_{rebuild |
uni_pluggable_set_check, straddling_ts_ob- relocate | fix}_bitmaps, tablespace_rebuild_
jects quotas, tablespace_fix_segment_states,
TS Creation alter tablespace <ts> { online | offline [immediate] [nowait] | disconnect
create tablespace <ts> [ normal | temporary | immediate [from session] [finish [nowait]] ]
[datafile ‘<file>’] << only optional if | for recover ] }; << deprecated | [standby] tablespace ‘<ts>’ [, …]
DB_CREATE_FILE_DEST is set alter tablespace <ts> { read {write | only} [until [consistent with] controlfile]
[size <n>] [reuse] | permanent | temporary }; | [standby] datafile {‘<file>’ | <n>} [, …]
[autoextend {off | on [next <n>] alter tablespace <ts> [minimum extent <n>] [until [consistent with] controlfile]
[maxsize {<n> | unlimited} ] } ] default storage (…); | logfile ‘<log>’ }
[,’<file>’… [autoextend…] ] alter tablespace <ts> coalesce; [test [allow <x> corruption] ]
[minimum extent <n>] [noparallel | parallel [<n>] ]
alter tablespace <ts> {begin | end} backup;
[blocksize <n> [k]] | continue [default] | cancel };
alter database [<db>] datafile <n> [, …]
[default storage ( [initial <5xBS>] recover [automatic] [from ‘<log_path>’]
end backup;
[next <5xBS>] [pctincrease <50>] { database [until { cancel | change <scn>
[minextents <1>] | time ‘<YYYY-MM-DD:HH24:MI:SS>’ }]
Datafiles [using backup controlfile]
[maxextents {<n> | unlimited} ]
[freelists <1>] [freelist groups <1>] alter system checkpoint [global | local]; | [managed] standby database
[buffer_pool {default | keep | recycle} ] )] alter system check datafiles [global | local]; [timeout <n> | cancel [immediate] ]
[logging | nologging] alter database [<db>] datafile ‘<file>’ [, …] | [standby] tablespace ‘<ts>’ [, …]
[permanent | temporary] [online | offline] { resize <n> | autoextend… | online [until [consistent with] controlfile]
[extent management | offline [drop] | end backup }; | [standby] datafile {‘<file>’ | <n>} [, …]
{ dictionary | local alter database [<db>] tempfile ‘<file>’ [, …] [until [consistent with] controlfile]
[autoallocate | uniform [size <1m>]] }] { resize <n> | autoextend… | online | logfile <log>
[segment space management | offline | drop [including datafiles] }; | continue [default]
{manual | auto} ]; alter database [<db>] rename file | cancel }
create undo tablespace <ts> ‘<file>’ [, …] to ‘<new_file>’ [, …]; [noparallel | parallel (degree {<n> | default}
[datafile ‘<file>’… [autoextend…] ] << s.a. [instances <1> | default] )]
alter database [<db>] create datafile
[extent management local] ‘<file>‘ [, …] [as {new | ‘<file>‘ [, …]} ];
[uniform [size <1m>]];
create temporary tablespace <ts> Recovery
[tempfile ‘<file>’… [autoextend…] ] << s.a.
set autorecovery {on | off }
[extent management local]
[uniform [size <1m>]]; set logsource <dir>
drop tablespace <ts> alter database [<db>] recover
[including contents [and datafiles] [automatic] [from ‘<log_path>‘]
[cascade constraints] ]; { { [standby] database
[until { cancel | change <scn>
| time ‘<YYYY-MM-DD:HH24:MI:SS>’ }]
TS Modification
[using backup controlfile]
alter tablespace <ts> add {datafile | tempfile} | managed standby database
‘<file>’ size <n> [reuse] [autoextend…]; [ next <n> | timeout <n> | delay <n>
alter tablespace <ts> rename datafile | nodelay | expire <n> | cancel
‘<file>’ [, …] to ‘<new>’ [, …];
www.larsditzel.de
- 9. Oracle Server 9i Quick Reference Guide 9
Tablespaces, Datafiles & Segments (cont.)
Utilities RowID Packages
dbv file=<file> Logical: DBMS_ROWID
start=<n> end=<n> logfile=<log> hex string of variable length (rowid_create, rowid_object, rowid_rela-
blocksize=<2048> feedback=<0> Extend(10B): tive_fno, rowid_block_number, ro-
parfile=<fil> segment_id=<ts.fil.blck> DataObj#{32b} - RelFile#{10b} - wid_row_number, rowid_to_absolute_fno,
Block#{22b} - Row#{16b} rowid_to_extended, rowid_to_restricted)
Blocks Base64
v$type_size OOOOOO – FFF – BBBBBB – RRR
Header: Restrict(6B):
static(61B), row directory(2B*rec), transac- Block#{Xb} - Row#{Xb} - File#{Xb}
tion headers (23B*TX)
[Cluster: table directory]
Logfiles
Views & Tables Packages Tuning/Contention
v$log, v$logfile, v$thread, v$loghist, v$log_ DBMS_LOGMNR_D v$system_event, v$sysstat
history, v$database, v$archive, v$archive_dest, build Redo latch:
v$archive_dest_status, v$archive_gap, DBMS_LOGMNR «redo allocation», «redo copy» (v$latch)
v$standby_log, v$archived_log, v$archive_ add_logfile, start_logmnr, end_logmnr, «misses» / «gets» > 1% or
processes, v$logmnr_dictionary, v$logmnr_pa- mine_value, column_present «immediate_misses» / («immediate_gets» +
rameters, v$logmnr_logs, v$logmnr_contents, DBMS_LOGMNR_SESSION «immediate_misses») > 1%
dba_source_tables, dba_source_tab_columns, {add | remove}_logfile, {create | attach | -> decrease «log_small_entry_max_size»
dba_subscriptions, dba_subscribed_tables, detach | destroy}_session, column_present, -> increase «log_simultaneous_copies»
dba_subscribed_columns, change_sources, include_src_tbl, mine_value, {prepare | (max. CPU * 2)
change_sets, change_tables release}_scn_range, set_dict_attr, set_ses-
sion_params Desupported Features
Parameters DBMS_[LOGMNR_]CDC_PUBLISH v$targetrba, log_archive_buffers, log_archive_
db_create_online_log_dest_<1-5>, thread, {create | alter | drop}_change_table, drop_ buffer_size, log_block_checksum, log_simul-
log_buffer, log_archive_max_processes, {subscription | subscriber_view}, purge taneous_copies, log_small_entry_max_size,
log_archive_start, log_archive_dest, log_ar- DBMS_[LOGMNR_]CDC_SUBSCRIBE lgwr_io_slaves
chive_format, standby_archive_dest, log_ar- get_subcription_handle, subscribe,
chive_duplex_dest, log_archive_dest_ {activate | drop}_subscription, {extend |
<1-10>, log_archive_dest_state_<1-10>, purge}_window, {prepare | drop}_ sub-
remote_archive_enable, fal_client, fal_server, scriber_view
log_archive_trace, archive_lag_target, log_ar-
chive_min_succeed_dest, log_file_name_con- Files
vert, arch_io_slaves, utl_file_dir, logmnr_
dbmslm.sql, dbmslmd.sql, dbmslms.sql,
max_persistent_sessions
dbmscdcp.sql, dbmscdcs.sql catcdc.sql,
(_allow_resetlogs_corruption
<< undocumented & unsupported) initcdc.sql
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
- 10. 10 Oracle Server 9i Quick Reference Guide
Tables, Constraints & Triggers
Views & Tables DBMS_STATS «table scans%» (v$sysstat) -> adjust
dba_tables, dba_all_tables, dba_object_tables, {set | get}_{column | index | system | «db_file_multiblock_read_count»
dba_external_tables, dba_external_locations, table}_stats, gather_{system | database | row migr.:
dba_tab_comments, dba_tab_columns, col, schema | table | index}_stats, delete_{sys- «table_name», «head_rowid» (chained_
dba_tab_col_statistics, dba_associations, tem | database | schema | table | index | rows << utlchain.sql, utlchain1.sql) or «table
dba_ustats, dba_col_comments, dba_up- column}_stats, {export | import}_ {sys- fetch continued row» (v$sysstat)
datable_columns, dba_unused_col_tabs, tem | database | schema | table | index | -> increase pctfree
dba_tab_modifications, dba_nested_tables, column}_stats, prepare_column_values, -> recreate table (create as, delete from,
dba_part_tables, dba_tab_partitions, convert_raw_value, generate_stats, {create | insert into select, commit, drop)
dba_tab_subpartitions, dba_part_col_sta- drop}_stat_table, alter_{database | sche- freelists:
tistics, dba_part_key_columns, dba_par- ma}_table_monitoring, flush_{database | «segment header» (v$waitstat), «buffer
tial_drop_tabs, dba_subpart_col_statistics, schema}_monitoring_info busy waits» (v$system_event)
dba_subpart_key_columns, dba_constraints, DBMS_REDEFINITION -> alter pctfree/pctused, inittrans or
dba_cons_columns, dba_triggers, dba_trig- {can | start | finish | abort}_redef_table, -> increase freelist/freelist groups
ger_cols, dba_internal_triggers, dba_tab_his- sync_interim_table (v$session_wait -> dba_extents -> dba_seg-
tograms, dba_part_histograms, dba_sub- ments -> recreate object)
part_histograms, hist_head$ Files full & partial partition-wise joins
utlexcpt.sql, utlexcpt1.sql, dbmsstdx.sql,
Parameters dbmsutil.sql, utlvalid.sql, utlchain.sql, Desupported Features
_system_trig_enabled utlchn1.sql dba_histograms, cache_size_threshold
Packages Tuning/Contention
DBMS_UTILITY pctfree = UPD/AVG
analyze_database, analyze_schema, pctused = 1 – pctfree – AVG/nBLK
analyze_part_object scans:
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
- 11. Oracle Server 9i Quick Reference Guide 11
Tables, Constraints & Triggers (cont.)
[, partition…]) [, …] […]; | { primary key | unique (<col> [, …]) }
| partitions <n> alter table <tab> coalesce partition […]; [cascade] [{keep | drop} index] };
store in (<ts> [, …]) } ] alter table <tab> truncate set constraint[s] {<constr> [, …] | all}
[{disable | enable} row movement] {partition | subpartition} <part> {immediate | deferred};
[cache | nocache] [{drop | reuse} storage] […];
[rowdependencies | norowdependencies] alter table <tab> rename Triggers
[monitoring | nomonitoring] {partition | subpartition} <part> to <new>; alter table <tab> {enable | disable} all triggers;
[parallel [<n>] | noparallel]
alter table <tab> modify create [or replace] trigger <trigg>
[{enable | disable} [validate | novalidate]
{partition | subpartition} <part> { before | after | instead of }
{ primary key | unique (<col> [, …])
[storage (…) ] [allocate extent…] { {delete | insert | update [of <col> [, …]] }
| constraint <constr> } [using index…]
[logging | nologging] … [or…] on {<tab> | [nested table <col>
[exceptions into <tab>] [cascade]
[[rebuild] unusable local indexes]; of ] <view>}
[{keep | drop} index] ]
[as <subquery>]; alter table <tab> modify | { { {associate | disassociate} statistics
partition <part> | analyze | audit | noaudit | comment
{add subpartition | create | alter | rename | drop | grant
Table Modification [<subpart> [tablespace <ts>]] | revoke | truncate | ddl } [or…]
alter table <tab> modify (<col> <type>…); | coalesce [subpartition] } […]; | { shutdown | startup | servererror
alter table <tab> add (<col> <type>…); alter table <tab> modify default attributes | logon | logoff | suspend } [or…] }
alter table <tab> set unused [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>} [, …] ]
alter table <tab> drop partition <part> [for each row] [when (<expr>)]
{(<col> [, …]) | column <col>} {add | drop} values (<val> [, …]); { begin <stat>; end;
[cascade constraints] [invalidate] alter table <tab> move | call … ; }
[checkpoint <512>]; {partition | subpartition} <part> alter trigger <trigg>
alter table <tab> drop tablespace <ts> {enable | disable | compile [debug]};
{unused columns | columns continue} [logging | nologging] […]; drop trigger <trigg>;
[checkpoint <512>]; alter table <tab> split
drop table <tab> [cascade constraints]; partition <part1> at (<n>) Statistics
rename <tab> to <new_tab>; into (partition <part2>, deprecated (use DBMS_STATS) >>
alter table <tab> move partition <part3> [, …] ) […];
analyze table <tab>
[tablespace <ts>] [storage (…)] alter table <tab> merge partitions <part1>, [partition (<n>) | subpartition (<n>)]
[logging | nologging] <part2> [into partition <part3>] […]; { compute [system] statistics
[parallel [<n>] | noparallel]; alter table <tab> exchange | estimate [system] statistics
truncate table <tab> {partition | subpartition} <part> [sample <1064> {rows | percent}] }
[[preserve | purge] snapshot log] with table <tab> [including indexes] [for table] [for all [local] indexes]
[{drop | reuse} storage]; [{with | without} validation] […]; [for all [indexed] columns [size <75>] ]
alter table <tab> [storage (…)] [for columns [size <75>]
[noparallel | parallel [<n>] ] … Constraints <col> [size <75>] [<col>…] ];
[{nominimize | minimize} alter table <tab> add analyze table <tab> delete [system] statistics;
records_per_block]; ( [constraint <tab_constr>] analyze table <tab> list chained rows
alter table <tab> { primary key (<col> [, …]) [into <chained_rows>];
{ allocate extent ( [size <n>] [using index…] analyze table <tab> validate
[datafile ‘<file>‘] [instance <n>] ) | unique (<col> [, …]) [using index…] { structure [cascade] [into <invalid_rows>]
| deallocate unused [keep <n>] }; | foreign key (<col> [, …]) {online | offline}
lock table <tab> in {share [row exclusive] references <tab> [(<col> [, …])] | ref update [set dangling to null] };
| exclusive} mode [nowait]; [on delete {cascade | set null} ] associate statistics with
alter table <tab> {enable | disable} table lock; | check (<expr>) } { columns [<tab>.]<col> [, …]
comment on {table <tab> | column [[not] deferrable | functions <func> [, …]
<tab>.<col>} is ‘<str>’; [initially {immediate | deferred}] ] | packages <pack> [, …]
alter table add supplemental log group <grp> [{disable | enable} [validate | novalidate] | types <type> [, …]
(<col> [, …] ) [always]; [exceptions into <tab>]] ); | indexes <ind> [, …]
alter table drop supplemental log group <grp>; alter table <tab> | indextypes <indtype> [, …] }
{disable | enable} [validate | novalidate] [using <stat_func>]
{ constraint <constr> [default cost (<cpu>, <io>, <network>)]
Partitioning
| primary key [default selectivity <selec>];
alter table <tab> add partition <range_part> | unique (<col> [, …]) } disassociate statistics from
values less than (<value> [, …] ) [using index…] { columns [<tab>.]<col> [, …]
[tablespace <ts>] [exceptions into <tab>] [cascade] | functions <func> [, …]
[{update | invalidate} global indexes] [{keep | drop} index]; | packages <pack> [, …]
[parallel [<n>] | noparallel]; alter table <tab> modify constraint <constr> | types <type> [, …]
alter table <tab> add partition … [rely | norely]; | indexes <ind> [, …]
[<hash_part> [tablespace <ts>]] […]; alter table <tab> drop | indextypes <indtype> [, …] }
alter table <tab> drop partition <part> { constraint <constr> [cascade] [force];
www.larsditzel.de
- 12. 12 Oracle Server 9i Quick Reference Guide
Tables, Constraints & Triggers (cont.)
External Table Opaque Format | terminated by { whitespace | ‘<str>’} | char <n> [enclosed…] [ltrim…]
record [[optionally] enclosed by…] ] [dateformat
{ {fixed | variable} <n> [ltrim | rtrim | lrtrim | ldtrim | notrim] { { date | {time | timestamp}
| delimited by {newline | ‘<str>’} } [missing field values are null] [with timezone] }
[characterset ‘<char>’] [(<field> mask “<fmt>”
[data is {little | big} endian] [ [position] ({ * | <start> | [+|-] | interval { year_to_month
[string sizes are in {bytes | characters} ] <incr>} [:|-] {<end> | <len> }) ] | day_to_second } } ]
[load when <expr>] [ [unsigned] integer [external] <n> | { varchar | varraw | varcharc
[{badfile [<dir>:] ‘<file>’ | nobadfile] | {decimal | zoned} [external] | varrawc } ([<n>,] <max>) ]
[discardfile [<dir>:] ‘<file>’ | nodiscardfile] (<p> [, <s>]) [{defaultif | nullif } <expr>]
[logfile [<dir>:] ‘<file>’ | nologfile] | oracle date [, <field> …] ) ]
[skip <n>] | oracle number [counted]
[fields | {double | float} [external]
[ enclosed by ‘<str>’ [and ‘<str>’] | raw <n>
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