SlideShare a Scribd company logo
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    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
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    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
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    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
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    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
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    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
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    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
Oracle Server 9i Quick Reference Guide                             13



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                                          Parameters                                           Tuning/Contention
 v$object_usage, dba_indexes, dba_indextypes,            create_bitmap_area_size, bitmap_merge_               index_stats:
 dba_indextype_operators, dba_ind_columns,               area_size                                               ÂŤdel_lf_rows_lenÂť / ÂŤlf_rows_lenÂť > 20%
 dba_ind_expressions, index_stats, dba_part_                                                                     -> rebuild index
 indexes, dba_ind_partitions, dba_ind_sub-               Packages & Files
 partitions, dba_part_col_statistics, dba_sub-
                                                         DBMS_PCLXUTIL
 part_col_statistics, index_histogram
                                                           build_part_index




 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
14    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$sort_segment, v$sort_usage, dba_segments    Sorts:
                                                       ÂŤsorts (disk)Âť, ÂŤsorts (memory)Âť, ÂŤsorts
      Parameters                                       (rows)Âť (v$sysstat) disk.value / mem.value
                                                       > 5% -> increase ÂŤsort_area_sizeÂť
      sort_area_size, sort_area_retained_size
                                                       (+ decrease ÂŤ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                            15



Users, Privileges, Resources & Policies

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



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}_{client | server} = <n>,           trace_directory = <path>, show_tns_info
 tnsping.trace_{level | directory} = <n>,               = <n>, use_async_call = <n>, authentica-
 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
18    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                           19



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
20    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         21



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
22    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_ac-
      tivity, 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                        23



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
24    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                               25



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                  disc[onnect]                                                     [ fold_a[fter] | fold_b[efore]]
 “<txt>”] [table “<txt>”] [entmap {on |                                                                                  [like <alias>] [newl[ine]]
                                                        passw[ord] [<user>]
 off }] [spool {on | off }] [pre[format] {on |                                                                           [ {new_v[alue] | old_v[alue]} <var>]
                                                        startup, shutdown, recover                                       [ jus[tify] { l[eft] | c[enter] | c[entre]
 off }], newp[age] {<1>|none}, null <txt>,
 numf[ormat] <fmt>, num[width] <10>,                                                                                                      | r[ight] }]
                                                        Data Access                                                 | {on | off } | {print | noprint} | cle[ar] }]
 pages[ize] <24>, pau[se] {on|off|<txt>}, recsep
 {wr[apped]|ea[ch]|off }, recsepchar <_>,               attribute <object_type>.<attr>                         bre[ak]
 serverout[put] {on|off } [size <n>] [for[mat]              [ali[as] <name>] [for[mat] <fm>]                        [on {<bcol> | row | report | <expr>}
 {wra[pped]|wor[d_wrapped|tru[ncated]}],                    [like <attr>] [cle[ar] ] [on |off ]                     [ski[p] <n> | page] [on…]
 shift[inout] {vis[ible]|inv[isible]}, show[mode]       acc[ept] <var>                                              [nodup[licates] | dup[licates]] ]
 {on|off }, sqlbl[anklines] {on|off }, sqlc[ase]            [num[ber] | char | date]                           comp[ute]
 {mix[ed]|lo[wer]|up[per]}, sqlc[ontinue] <>>,              [for[mat] <fm>] [def[ault] <def>]                       [{ sum | min[imum] | max[imum] | avg
 sqln[umber] {on|off }, sqlpluscompat[ibility]              [prompt <string> | nopr[ompt] ] [hide]                  | std | var[iance] | cou[nt] | num[ber] }
 <x.y[.z]>, sqlpre[fix] <#>, sqlp[rompt]                desc[ribe]                                                  […] [la[bel] <lab>]
 <SQL>>, sqlt[erminator] {<;>|on|off>}, suf[fix]            { <tab> | <view> | <pack>                               of <col> [<col>…]
 <SQL>, tab {on|off }, term[out] {on|off },                 | <func> | <proc> | <syn> | <type> }                    on {<bcol> | row | report} ]
 ti[me] {on|off }, timi[ng] {on|off }, trim[out]        sho[w]                                                 clear
 {on|off }, trims[pool] {on|off }, und[erline] {<-          { <var> | all                                           { scr[een] | col[umns] | bre[aks]
 >|on|off }, 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
26    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            may 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                                                      27



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
28    Oracle Server 9i Quick Reference Guide


     SQL, PL/SQL & Java

      Views & Tables                                       {open | close}_cursor, parse, last_er-              UTL_HTTP
      v$reserved_words, v$resumable, dba_source,           ror_position, bind_{variable | array},              UTL_URL
      dba_errors, dba_dependencies, deptree,               define_{column | column_long | array},              UTL_TCP
      ideptree, dba_libraries, dba_outlines,               execute, describe_columns, fetch_rows,              UTL_SMTP
      dba_outline_hints, dba_resumable,                    execute_and_fetch, last_row_{count | id},
                                                                                                               UTL_ENCODE
      outln.ol$, outln.ol$hints, java$options,             {column | variable}_value, column_value_
                                                           long, is_open, last_sql_function_code               UTL_INADDR
      java$class$md5$table, create$java$lob$table,
                                                         DBMS_LDAP                                             UTL_RAW
      dba_workspace_sessions, all_workspaces, all_
                                                                                                                 cast_{to | from}_{number | binary_integer}
      workspace_privs, all_workspace_savepoints,         DBMS_TRANSACTION
                                                           advise_{commit | nothing | rollback},               OUTLN_PKG
      all_version_hview, all_wm_locked_tables,
                                                           commit, commit_{comment | force},                     drop_unused, {drop | update}_by_cat,
      all_wm_modified_tables, all_wm_ric_info,
                                                           local_transaction_id, purge_lost_db_entry,            drop_{collision | extras | unrefd_hints}[_
      all_wm_tab_triggers, all_wm_versioned_
                                                           purge_mixed, read_{only | write}, rollback,           expact], deptree_fill
      tables, role_wm_privs, user_wm_privs,
      <tab>_conf, <tab>_diff, <tab>_lock, <tab>_lt,        rollback_{force | savepoint}, savepoint,            SQLJUTL
      <tab>_hist, <tab>_wm                                 step_id, use_rollback_segment, begin_dis-             has_default
                                                           crete_transaction
                                                             >> Discrete transactions do not generate undo     Files
      Parameters                                             information! <<
      optimizer_mode, db_file_multiblock_                DBMS_WM                                               utldtree.sql, initjvm.sql, utljavarm.sql,
      read_count, optimizer_features_enable,               {alter | goto}savepoint, {create |                  sqljutl.sql, owminst.plb
      optimizer_index_caching, optimizer_in-               alter | merge | compress | freeze
      dex_cost_adj, optimizer_max_permutations,            | get | goto | refresh | remove |                   Desupported Features
      complex_view_merging, partition_view_en-             rollback | unfreeze}workspace,                      hash_multiblock_io_count, opti-
      abled, hash_join_enabled, hash_area_size,            {begin | commit}resolve, {get |                     mizer_percent_parallel, always_anti_join,
      star_transformation_enabled, row_locking,            set}conflictworkspace, {remove |                    always_semi_join, fast_full_scan_enabled,
      sql_trace, timed_statistics, create_stored_out-      compress}workspacetree, {enable |                   push_join_predicate
      lines, use_stored_outlines, utl_file_dir,            disable}versioning, {get | set}diffversions,
      plsql_v2_compatibility, remote_dependen-             getlockmode, {get | set}multiworkspaces,
      cies_mode, undo_retention, plsql_compiler_           getopcontext, {grant | revoke}{system
      flags, cursor_sharing                                | workspace}priv, getprivs, gotodate,
                                                           copyforupdate, {create | delete}savepoint,
      Packages                                             isworkspaceoccupied, {lock | unlock}rows,
                                                           {merge | refresh | rollback}table,
      DBMS_STANDARD,
                                                           resolveconflicts, rollback{resolve |
      DBMS_TRACE
                                                           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,
        {pack | unpack}_message[_{raw | rowid} ],          get_line_nchar, put_line, put_line_nchar,
        next_item_type, {send | receive}_message,          put, put_nchar, putf, putf_nchar, fcopy,
        unique_name_session, purge                         fgetattr, fgetpos, fremove, frename, fseek,
                                                           get_raw, put_raw
      DBMS_SQL




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



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
 10 bounded range search on indexed columns         […] ] ), INDEX_DESC (<tab> [<ind>
 11 unbounded range search on indexed               […] ] ), INDEX_COMBINE (<tab>
 columns                                                                                                  Serial direct-load insert:
                                                    [<ind> […] ] ), INDEX_JOIN (<tab>
                                                                                                              insert /*+APPEND */ into <tab> <query>;
 12 sort-merge join                                 [<ind> […] ] ), INDEX_FFS (<tab> [<ind>
 13 max or min of indexed column                    […] ] ), NO_INDEX (<tab> [<ind> […] ] ),
                                                    MERGE_AJ, MERGE_SJ, AND_EQUAL                         Parallel direct-load insert:
 14 order by on indexed columns
                                                    (<tab> <ind> <ind> […] ), USE_CONCAT,                    alter session {enable | force} parallel dml;
 15 full table scan                                                                                          insert /*+PARALLEL(<tab>,<n>) */ into
 -- sample table scan                               NO_EXPAND, NOREWRITE, REWRITE
                                                    [ (<mview> [, …] ) ], ORDERED, STAR,                           tab> <query>;
 -- fast full index scan
                                                    USE_NL (<tab> […] ), USE_MERGE




                                                                                                                                          www.larsditzel.de
30    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;]
          [{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                                    31



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
32    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                          33



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
34    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         35



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

 Top Ten Performance Issues
 •   connection management
 •   cursor sharing (bind variables)
 •   I/O design (controller, bandwitdth)
 •   redo log sizes and groups
 •   data block serialization (free lists, free
     list groups, block size, transaction slots,
     rollback segments)
 •   long full table scans (indexes, statistics)
 •   disk sorts
 •   recursive SQL (space management)
 •   schema errors and optimizer problems
 •   nonstandard initialization parameters
     (undocumented features…)




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


     Architecture
                         ������ ������ ������������
                                                                             ��������           ���� ���� ����   ����������� ���
                              ������������
                                                  ������ �                                                ���� ���� ���� �
                                                                                                            ����              ����        ����         ���
                                                    ����� �       ����� �          ����� �                     ����                  ���� ���� ���
                                ����������
                                                   ������� ���� ���� ��������
                                                                                                            ��������� ���������
                                                                                                                                  ���� ���� �
                             ��������� ����                                                                  ����
                                                                                                                           ���� ���� ���� ���
                                                  ������ � ������ ���� ���� ����������          ����
                                                                                                                                                      ���
                                                                                                                             ���                        ����
                             �������� ����                                                                                  ������     ����� ���        � ���
                                                    ����� �       ����� �          ����� �          ����                                                  ���
                                                                                                                                                        � ��




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




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

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

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


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

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




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




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


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

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


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

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

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



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




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




                                                                                                                                      www.larsditzel.de

More Related Content

PDF
oracle 9i cheat sheet
PDF
Test labs 2016. Тестирование data warehouse
PDF
March 2009 DIA Janus Update
 
DOC
Ramesh_Oracle_DBA
PDF
InfosĂźsteemide infrastruktuuri haldus ja monitooring Oracle Enterprise Manage...
PDF
Architecture3
DOC
Oracle Complete Interview Questions
PPTX
From the Big Data keynote at InCSIghts 2012
oracle 9i cheat sheet
Test labs 2016. Тестирование data warehouse
March 2009 DIA Janus Update
 
Ramesh_Oracle_DBA
InfosĂźsteemide infrastruktuuri haldus ja monitooring Oracle Enterprise Manage...
Architecture3
Oracle Complete Interview Questions
From the Big Data keynote at InCSIghts 2012

What's hot (20)

PDF
381 Pdfsam
PDF
201 Pdfsam
PDF
21 Pdfsam
PDF
Oracle developer interview questions(entry level)
PDF
161 Pdfsam
PPTX
Oracle Database 12c New Features for Developers and DBAs - OTN TOUR LA 2015
PDF
Ebs performance tune_con9030_pdf_9030_0001
 
PDF
Overview of Optimizer Features in 5.6 and 5.7-Manyi Lu
PDF
Ebs performance tune2_con9030_pdf_9030_0002
 
PDF
Datastage
PPTX
Oracle golden gate 12c New Features
PDF
"Cost/Benefit Case for Enterprise Warehouse Solutions"
PPTX
Things learned from OpenWorld 2013
PDF
Replication Tips & Trick for SMUG
PDF
Oracle 10g sql fundamentals i
PDF
PLSQL Standards and Best Practices
PDF
Oracle Application Containers
PDF
153 Oracle dba interview questions
PPTX
Oracle GoldenGate, Streams, and Data Integrator
PDF
Replication Tips & Tricks
381 Pdfsam
201 Pdfsam
21 Pdfsam
Oracle developer interview questions(entry level)
161 Pdfsam
Oracle Database 12c New Features for Developers and DBAs - OTN TOUR LA 2015
Ebs performance tune_con9030_pdf_9030_0001
 
Overview of Optimizer Features in 5.6 and 5.7-Manyi Lu
Ebs performance tune2_con9030_pdf_9030_0002
 
Datastage
Oracle golden gate 12c New Features
"Cost/Benefit Case for Enterprise Warehouse Solutions"
Things learned from OpenWorld 2013
Replication Tips & Trick for SMUG
Oracle 10g sql fundamentals i
PLSQL Standards and Best Practices
Oracle Application Containers
153 Oracle dba interview questions
Oracle GoldenGate, Streams, and Data Integrator
Replication Tips & Tricks
Ad

Viewers also liked (16)

PPTX
Presentazione africa copia
PPTX
Financial brokerage houses must consider using rtb
PPTX
Presentation1 120412125243-phpapp02
PPTX
Freshman Project Slideshow
PPT
T성과콘텐츠
PPTX
PDF
Brandon b freshman project
PPTX
Alanapinell theory
PPTX
Добруджа в Europeana
PPTX
65 години Регионална библиотека "Дора Габе"
PDF
Vbasic
PPT
grammer
PPTX
InfecciĂłn tracto urinario en pediatrĂ­a
PPT
Elemente de teoria comunicarii
PPTX
Etiket di meja makan
PPTX
Learning Theory- Behaviorism
Presentazione africa copia
Financial brokerage houses must consider using rtb
Presentation1 120412125243-phpapp02
Freshman Project Slideshow
T성과콘텐츠
Brandon b freshman project
Alanapinell theory
Добруджа в Europeana
65 години Регионална библиотека "Дора Габе"
Vbasic
grammer
InfecciĂłn tracto urinario en pediatrĂ­a
Elemente de teoria comunicarii
Etiket di meja makan
Learning Theory- Behaviorism
Ad

Similar to orical (20)

PDF
Sqlref
PDF
[Oracle数据库11 g初学者指南].oracle.database.11g,.a.beginner's.guide
PDF
Summer training oracle
PDF
10g sql e book
PPTX
The Very Very Latest In Database Development - Lucas Jellema - Oracle OpenWor...
PPTX
The Very Very Latest in Database Development - Oracle Open World 2012
PDF
Introducing ms sql_server
PPT
Db trends final
PPTX
Summer training oracle
PDF
SQL Server User Group 02/2009
PPT
Modern Database Development Oow2008 Lucas Jellema
PDF
SQL Server 2008 Migration Workshop 04/29/2009
PDF
SQL Server Workshop Paul Bertucci
PPT
Remote DBA Experts 11g Features
PPTX
Confio presentation
PPT
ORACLE 9i
PDF
Sql Performance Tuning For Developers
PDF
Lee oracle
PDF
Oracle SQL Basics by Ankur Raina
DOC
DBMS Practical File
Sqlref
[Oracle数据库11 g初学者指南].oracle.database.11g,.a.beginner's.guide
Summer training oracle
10g sql e book
The Very Very Latest In Database Development - Lucas Jellema - Oracle OpenWor...
The Very Very Latest in Database Development - Oracle Open World 2012
Introducing ms sql_server
Db trends final
Summer training oracle
SQL Server User Group 02/2009
Modern Database Development Oow2008 Lucas Jellema
SQL Server 2008 Migration Workshop 04/29/2009
SQL Server Workshop Paul Bertucci
Remote DBA Experts 11g Features
Confio presentation
ORACLE 9i
Sql Performance Tuning For Developers
Lee oracle
Oracle SQL Basics by Ankur Raina
DBMS Practical File

Recently uploaded (20)

PDF
Empathic Computing: Creating Shared Understanding
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Sensors and Actuators in IoT Systems using pdf
PDF
GamePlan Trading System Review: Professional Trader's Honest Take
PDF
cuic standard and advanced reporting.pdf
PDF
Advanced IT Governance
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
madgavkar20181017ppt McKinsey Presentation.pdf
PDF
AI And Its Effect On The Evolving IT Sector In Australia - Elevate
PPTX
Cloud computing and distributed systems.
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
 
PDF
Advanced Soft Computing BINUS July 2025.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PPT
Teaching material agriculture food technology
PDF
KodekX | Application Modernization Development
 
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
 
Empathic Computing: Creating Shared Understanding
NewMind AI Monthly Chronicles - July 2025
Reach Out and Touch Someone: Haptics and Empathic Computing
Advanced methodologies resolving dimensionality complications for autism neur...
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Sensors and Actuators in IoT Systems using pdf
GamePlan Trading System Review: Professional Trader's Honest Take
cuic standard and advanced reporting.pdf
Advanced IT Governance
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
madgavkar20181017ppt McKinsey Presentation.pdf
AI And Its Effect On The Evolving IT Sector In Australia - Elevate
Cloud computing and distributed systems.
The Rise and Fall of 3GPP – Time for a Sabbatical?
 
Advanced Soft Computing BINUS July 2025.pdf
MYSQL Presentation for SQL database connectivity
Teaching material agriculture food technology
KodekX | Application Modernization Development
 
NewMind AI Weekly Chronicles - August'25 Week I
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
 

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 • [email protected] 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
  • 13. Oracle Server 9i Quick Reference Guide 13 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 Parameters Tuning/Contention v$object_usage, dba_indexes, dba_indextypes, create_bitmap_area_size, bitmap_merge_ index_stats: dba_indextype_operators, dba_ind_columns, area_size ÂŤdel_lf_rows_lenÂť / ÂŤlf_rows_lenÂť > 20% dba_ind_expressions, index_stats, dba_part_ -> rebuild index indexes, dba_ind_partitions, dba_ind_sub- Packages & Files partitions, dba_part_col_statistics, dba_sub- DBMS_PCLXUTIL part_col_statistics, index_histogram build_part_index 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
  • 14. 14 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$sort_segment, v$sort_usage, dba_segments Sorts: ÂŤsorts (disk)Âť, ÂŤsorts (memory)Âť, ÂŤsorts Parameters (rows)Âť (v$sysstat) disk.value / mem.value > 5% -> increase ÂŤsort_area_sizeÂť sort_area_size, sort_area_retained_size (+ decrease ÂŤsort_area_retained_sizeÂť) Desupported Features sort_multiblock_read_count, sort_direct_ writes, sort_write_buffers, sort_write_buf- fer_size www.larsditzel.de
  • 15. Oracle Server 9i Quick Reference Guide 15 Users, Privileges, Resources & Policies Views & Tables sumer_group_privs, dba_rsrc_manager_sys- | update | delete}_{plan | plan_directive | v$enabledprivs, v$resource, v$resource_limit, tem_privs consumer_group}, delete_plan_cascade, v$pwfile_users, v$context, v$rsrc_plan, switch_consumer_group_for_{sess | user} v$rsrc_plan_cpu_mth, v$rsrc_consumer_ Parameters DBMS_RESOURCE_MANAGER_PRIVS group, v$rsrc_consumer_group_cpu_mth, o7_dictionary_accessibility, remote_os_au- {grant | revoke}_system_privilege, {grant | v$parallel_degree_limit_mth, v$max_ac- thent, os_roles, remote_os_roles, max_en- revoke}_switch_consumer_group tive_sess_target_mth, v$vpd_policy, abled_roles, resource_limit, resource_man- DBMS_SESSION dba_users, dba_roles, dba_profiles, dba_us- ager_plan, ent_domain_name switch_current_consumer_group tats, dba_ts_quotas, dba_sys_privs, DBMS_RLS dba_tab_privs, dba_col_privs, dba_role_privs, Environment {add | drop | enable | refresh}_policy, {add | role_sys_privs, role_tab_privs, role_role_privs, drop | enable | disable | refresh}_grouped_ user_tab_privs_made, user_tab_privs_recd, $ORA_ENCRYPT_LOGIN policy, {add | drop}_policy_context, {create user_col_privs_made, user_col_privs_recd, | delete}_policy_group user_password_limits, user_resource_limits, Packages session_privs, session_roles, dba_context, DBMS_RESOURCE_MANAGER dba_policies, proxy_users, resource_cost, set_initial_consumer_group, {create | sub- dba_rsrc_plans, dba_rsrc_plan_directives, mit | clear | validate}_pending_area, {create 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
  • 16. 16 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
  • 17. Oracle Server 9i Quick Reference Guide 17 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}_{client | server} = <n>, trace_directory = <path>, show_tns_info tnsping.trace_{level | directory} = <n>, = <n>, use_async_call = <n>, authentica- 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
  • 18. 18 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
  • 19. Oracle Server 9i Quick Reference Guide 19 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
  • 20. 20 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
  • 21. Oracle Server 9i Quick Reference Guide 21 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
  • 22. 22 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_ac- tivity, 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
  • 23. Oracle Server 9i Quick Reference Guide 23 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
  • 24. 24 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
  • 25. Oracle Server 9i Quick Reference Guide 25 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 disc[onnect] [ fold_a[fter] | fold_b[efore]] “<txt>”] [table “<txt>”] [entmap {on | [like <alias>] [newl[ine]] passw[ord] [<user>] off }] [spool {on | off }] [pre[format] {on | [ {new_v[alue] | old_v[alue]} <var>] startup, shutdown, recover [ jus[tify] { l[eft] | c[enter] | c[entre] off }], newp[age] {<1>|none}, null <txt>, numf[ormat] <fmt>, num[width] <10>, | r[ight] }] Data Access | {on | off } | {print | noprint} | cle[ar] }] pages[ize] <24>, pau[se] {on|off|<txt>}, recsep {wr[apped]|ea[ch]|off }, recsepchar <_>, attribute <object_type>.<attr> bre[ak] serverout[put] {on|off } [size <n>] [for[mat] [ali[as] <name>] [for[mat] <fm>] [on {<bcol> | row | report | <expr>} {wra[pped]|wor[d_wrapped|tru[ncated]}], [like <attr>] [cle[ar] ] [on |off ] [ski[p] <n> | page] [on…] shift[inout] {vis[ible]|inv[isible]}, show[mode] acc[ept] <var> [nodup[licates] | dup[licates]] ] {on|off }, sqlbl[anklines] {on|off }, sqlc[ase] [num[ber] | char | date] comp[ute] {mix[ed]|lo[wer]|up[per]}, sqlc[ontinue] <>>, [for[mat] <fm>] [def[ault] <def>] [{ sum | min[imum] | max[imum] | avg sqln[umber] {on|off }, sqlpluscompat[ibility] [prompt <string> | nopr[ompt] ] [hide] | std | var[iance] | cou[nt] | num[ber] } <x.y[.z]>, sqlpre[fix] <#>, sqlp[rompt] desc[ribe] […] [la[bel] <lab>] <SQL>>, sqlt[erminator] {<;>|on|off>}, suf[fix] { <tab> | <view> | <pack> of <col> [<col>…] <SQL>, tab {on|off }, term[out] {on|off }, | <func> | <proc> | <syn> | <type> } on {<bcol> | row | report} ] ti[me] {on|off }, timi[ng] {on|off }, trim[out] sho[w] clear {on|off }, trims[pool] {on|off }, und[erline] {<- { <var> | all { scr[een] | col[umns] | bre[aks] >|on|off }, 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
  • 26. 26 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 may 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
  • 27. Oracle Server 9i Quick Reference Guide 27 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
  • 28. 28 Oracle Server 9i Quick Reference Guide SQL, PL/SQL & Java Views & Tables {open | close}_cursor, parse, last_er- UTL_HTTP v$reserved_words, v$resumable, dba_source, ror_position, bind_{variable | array}, UTL_URL dba_errors, dba_dependencies, deptree, define_{column | column_long | array}, UTL_TCP ideptree, dba_libraries, dba_outlines, execute, describe_columns, fetch_rows, UTL_SMTP dba_outline_hints, dba_resumable, execute_and_fetch, last_row_{count | id}, UTL_ENCODE outln.ol$, outln.ol$hints, java$options, {column | variable}_value, column_value_ long, is_open, last_sql_function_code UTL_INADDR java$class$md5$table, create$java$lob$table, DBMS_LDAP UTL_RAW dba_workspace_sessions, all_workspaces, all_ cast_{to | from}_{number | binary_integer} workspace_privs, all_workspace_savepoints, DBMS_TRANSACTION advise_{commit | nothing | rollback}, OUTLN_PKG all_version_hview, all_wm_locked_tables, commit, commit_{comment | force}, drop_unused, {drop | update}_by_cat, all_wm_modified_tables, all_wm_ric_info, local_transaction_id, purge_lost_db_entry, drop_{collision | extras | unrefd_hints}[_ all_wm_tab_triggers, all_wm_versioned_ purge_mixed, read_{only | write}, rollback, expact], deptree_fill tables, role_wm_privs, user_wm_privs, <tab>_conf, <tab>_diff, <tab>_lock, <tab>_lt, rollback_{force | savepoint}, savepoint, SQLJUTL <tab>_hist, <tab>_wm step_id, use_rollback_segment, begin_dis- has_default crete_transaction >> Discrete transactions do not generate undo Files Parameters information! << optimizer_mode, db_file_multiblock_ DBMS_WM utldtree.sql, initjvm.sql, utljavarm.sql, read_count, optimizer_features_enable, {alter | goto}savepoint, {create | sqljutl.sql, owminst.plb optimizer_index_caching, optimizer_in- alter | merge | compress | freeze dex_cost_adj, optimizer_max_permutations, | get | goto | refresh | remove | Desupported Features complex_view_merging, partition_view_en- rollback | unfreeze}workspace, hash_multiblock_io_count, opti- abled, hash_join_enabled, hash_area_size, {begin | commit}resolve, {get | mizer_percent_parallel, always_anti_join, star_transformation_enabled, row_locking, set}conflictworkspace, {remove | always_semi_join, fast_full_scan_enabled, sql_trace, timed_statistics, create_stored_out- compress}workspacetree, {enable | push_join_predicate lines, use_stored_outlines, utl_file_dir, disable}versioning, {get | set}diffversions, plsql_v2_compatibility, remote_dependen- getlockmode, {get | set}multiworkspaces, cies_mode, undo_retention, plsql_compiler_ getopcontext, {grant | revoke}{system flags, cursor_sharing | workspace}priv, getprivs, gotodate, copyforupdate, {create | delete}savepoint, Packages isworkspaceoccupied, {lock | unlock}rows, {merge | refresh | rollback}table, DBMS_STANDARD, resolveconflicts, rollback{resolve | DBMS_TRACE 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, {pack | unpack}_message[_{raw | rowid} ], get_line_nchar, put_line, put_line_nchar, next_item_type, {send | receive}_message, put, put_nchar, putf, putf_nchar, fcopy, unique_name_session, purge fgetattr, fgetpos, fremove, frename, fseek, get_raw, put_raw DBMS_SQL www.larsditzel.de
  • 29. Oracle Server 9i Quick Reference Guide 29 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 10 bounded range search on indexed columns […] ] ), INDEX_DESC (<tab> [<ind> 11 unbounded range search on indexed […] ] ), INDEX_COMBINE (<tab> columns Serial direct-load insert: [<ind> […] ] ), INDEX_JOIN (<tab> insert /*+APPEND */ into <tab> <query>; 12 sort-merge join [<ind> […] ] ), INDEX_FFS (<tab> [<ind> 13 max or min of indexed column […] ] ), NO_INDEX (<tab> [<ind> […] ] ), MERGE_AJ, MERGE_SJ, AND_EQUAL Parallel direct-load insert: 14 order by on indexed columns (<tab> <ind> <ind> […] ), USE_CONCAT, alter session {enable | force} parallel dml; 15 full table scan insert /*+PARALLEL(<tab>,<n>) */ into -- sample table scan NO_EXPAND, NOREWRITE, REWRITE [ (<mview> [, …] ) ], ORDERED, STAR, tab> <query>; -- fast full index scan USE_NL (<tab> […] ), USE_MERGE www.larsditzel.de
  • 30. 30 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;] [{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
  • 31. Oracle Server 9i Quick Reference Guide 31 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
  • 32. 32 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
  • 33. Oracle Server 9i Quick Reference Guide 33 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
  • 34. 34 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
  • 35. Oracle Server 9i Quick Reference Guide 35 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 Top Ten Performance Issues • connection management • cursor sharing (bind variables) • I/O design (controller, bandwitdth) • redo log sizes and groups • data block serialization (free lists, free list groups, block size, transaction slots, rollback segments) • long full table scans (indexes, statistics) • disk sorts • recursive SQL (space management) • schema errors and optimizer problems • nonstandard initialization parameters (undocumented features…) www.larsditzel.de
  • 36. 36 Oracle Server 9i Quick Reference Guide Architecture ������ ������ ������������ �������� ���� ���� ���� ����������� ��� ������������ ������ ďż˝ ���� ���� ���� ďż˝ ���� ���� ���� ��� ����� ďż˝ ����� ďż˝ ����� ďż˝ ���� ���� ���� ��� ���������� ������� ���� ���� �������� ��������� ��������� ���� ���� ďż˝ ��������� ���� ���� ���� ���� ���� ��� ������ ďż˝ ������ ���� ���� ���������� ���� ��� ��� ���� �������� ���� ������ ����� ��� ďż˝ ��� ����� ďż˝ ����� ďż˝ ����� ďż˝ ���� ��� ďż˝ �� �������� ����������� ������� ��������� ďż˝ ��� �������� ������������ ������������ ���� ���� ��� ����� ������� �������� ������ ����� ���� ďż˝ ����� ������� ������ ������ ����� ���� ďż˝ ����� ��������� ����� ���� �������� ďż˝ ��� ����� ����� ������� ďż˝ ������ ďż˝ ���� ďż˝ ��������� ��� ���� ����� ������������ ������ ďż˝ ����� ���� ����� ďż˝ �� ����� ����� ����� �������� ���� ���������� ���� ����� ����� �������� ������ ���� ������� ������ ďż˝ �������� ������� ďż˝ ���� ��� ��� ����� ����� ďż˝ ��� ������ �� ���� ďż˝ ���� ������� ��������� ��������� ���� ����� �� ���� ��������� ��������� ������� ��� ������ ����������� ��� ������� ���� ���� ���� ���� ���� ����� ��������� ��������� ���� ������� ���� ���� ��� ���������� �������� ������� �������� ����� �������� ���������� ���������� �� ����� ���� �� ������ ����� ������� �������� �������� ������� ��������� ������� ���� www.larsditzel.de
  • 37. Oracle Server 9i Quick Reference Guide 37 ���� ďż˝ �������� ���� ���� �������� ďż˝ ������ ���� ���� ���� ���� �� ����������� ���� ��������� ����� ďż˝ ����� ďż˝ ������ ����� �������� ďż˝ ������� �� ������ ����� ������� �������� ďż˝ �������� �� ���� ��� �� ďż˝ �������� ��� ��� ����� ������ ���� ����������� ���������� �������� ďż˝ ������������� �� ���� ���� ���� ���� ���� ���� ��� �������� ��� �� ���� �������� ������� ������ ��������� ������������� ������ ����� ������� ����� ������� ��� ��� �������������� ���� ���������� ���� �� ������ ����� ���� ������ ��� ��� ������� ������� ďż˝ ���� ���� �������� ��� ���� ���������� ������� ���� ����� ďż˝ ���� ����� ��������� ������� ��� ����� ���������� ����� ������ ����� ���� ��� ���������� ������ ������ ��� ďż˝ �� ������� ������� ������ ďż˝ ����� ��������� ������ ������� ďż˝ ����� ���� ���� ��������� ������ ���� ������� �������� ����������� ������ ďż˝ ����� ������� ����� ������� �������� ����� ���� ���� ������� ������� ������������ ���� ����� ������ ďż˝ ������� �� �� ��� ďż˝ ������ ���� ���������� ���� ďż˝ ďż˝ ��� ������ ���������� ďż˝ ������ ������� ��� ����������� ���������� ������� ��� ����� �������� ��������� ��������� �������� ďż˝ ������ ďż˝ ������ ������������� �������� ďż˝ ���������� �������� ����������� ďż˝ �������� ������� �������� ������� ��������� ďż˝ ���� ��� ���� ������ �������� ���������� ďż˝ ����������������� www.larsditzel.de