the complete sybase ase quick reference guide

36
The Complete Sybase ASE Quick Reference Guide ASE versions 15.0, 15.5 & 15.7 6 th edition These pages are taken from "The Complete Sybase ASE Quick Reference Guide", as a sample of the contents. Note that the origi- nal page size is 11 by 22 cm (4.3 by 8.6 inch). The complete book can be ordered from http://www.sypron.nl/qr . Rob Verschoor Sypron Publications

Upload: phamhuong

Post on 31-Dec-2016

318 views

Category:

Documents


12 download

TRANSCRIPT

Page 1: The Complete Sybase ASE Quick Reference Guide

The Complete Sybase ASE Quick Reference Guide ASE versions 15.0, 15.5 & 15.7 6th edition

These pages are taken from "The Complete Sybase ASE Quick Reference Guide", as a sample of the contents. Note that the origi-nal page size is 11 by 22 cm (4.3 by 8.6 inch). The complete book can be ordered from http://www.sypron.nl/qr .

Rob Verschoor Sypron Publications

Page 2: The Complete Sybase ASE Quick Reference Guide

2 The Complete Sybase ASE Quick Reference Guide

The Complete Sybase ASE Quick Reference Guide ASE versions 15.0, 15.5 & 15.7 6th edition by Rob Verschoor ISBN 978-90-806117-1-9 Published by:

Sypron B.V. Het Wolfseind 24 3823 VS Amersfoort The Netherlands Internet www.sypron.nl Email [email protected]

Printed in The Netherlands

First edition : January 2001 (ASE 11.9 & 12.0) Second edition : March 2002 (ASE 11.9, 12.0 & 12.5) Third edition : July 2004 (ASE 12.0, 12.5, 12.5.1 & 12.5.2) Fourth edition : August 2006 (ASE 12.0, 12.5.4 & 15.0.1) Fifth edition : April 2009 (ASE 12.5, 15.0.3) Sixth edition : November 2012 (ASE 15.0, 15.5 & 15.7 ESD#3)

Sypron is a registered trademark of Sypron B.V. Sybase, Transact-SQL, Adaptive Server Enterprise and Replication Server are regis-tered trademarks of Sybase, Inc. Other product or brand names may be (registered) trademarks of their respective owners. Copyright © 2001-2012 Sypron B.V. All rights reserved. No part of this publication may be reproduced in any form, or by any means, without the prior written permission of the publisher. While this book has been prepared with care, neither the author, nor the publisher, nor SAP AG or Sybase Inc. (nor their subsidiaries), assume any responsibility for errors or omissions, nor do they accept any liabilities for damages resulting from the use of the information herein.

Page 3: The Complete Sybase ASE Quick Reference Guide

ASE versions 15.0, 15.5 & 15.7 3

Contents Introduction.................................................................................................. 5 About this Quick Reference Guide .............................................................. 5 ASE versions covered in this edition........................................................................... 5 How to use this Quick Reference Guide ..................................................................... 6 Electronic version of code samples............................................................................. 7 Undocumented commands: warning & disclaimer ...................................................... 7 Starting Points For Common DBA Tasks .................................................... 8 Developer Topics....................................................................................... 10 1 Datatypes.......................................................................................................10

1.1 Datatype conversion functions................................................................... 11 2 Identifiers .......................................................................................................11 3 Quotes & Comments......................................................................................12 4 Operators .......................................................................................................12 5 Built-in Functions............................................................................................13

5.1 Date & Time functions ............................................................................... 13 5.2 Date/time formatting .................................................................................. 14 5.3 String functions .......................................................................................... 14 5.4 System functions ....................................................................................... 17 5.5 Mathematical functions .............................................................................. 22 5.6 Trigonometric functions ............................................................................. 23 5.7 Login/user/role functions............................................................................ 23 5.8 Miscellaneous functions............................................................................. 24

6 Text & Image (LOB) data ...............................................................................24 6.1 LOB Locators (15.7) .................................................................................. 25

7 Aggregate functions .......................................................................................26 8 DML statements .............................................................................................27

8.1 Select statement ........................................................................................ 27 8.2 Subqueries................................................................................................. 29 8.3 Joins, ANSI Joins & Outer Joins................................................................ 29 8.4 Statements to modify data ......................................................................... 30

9 Tables ............................................................................................................31 9.1 Table Partitioning....................................................................................... 33 9.2 Identity columns......................................................................................... 35 9.3 Encrypted Columns (15.0.2) ...................................................................... 36

10 Indexes ..........................................................................................................40 11 Referential Integrity Constraints .....................................................................41 12 Object storage properties ...............................................................................42 13 Views .............................................................................................................43 14 Materialized Views/Precomp.result sets(15.7 ESD#2)....................................44 15 Rules & Defaults ............................................................................................45 16 Triggers..........................................................................................................46 17 Stored Procedures .........................................................................................47 18 SQL Functions (15.0.2) ..................................................................................48 19 Programming & flow control ...........................................................................48 20 Cursors ..........................................................................................................50

20.1 Example of cursor programming................................................................ 52 21 Transactions ..................................................................................................52

21.1 Example of transaction programming ........................................................ 53 22 Settings affecting ASE query behaviour .........................................................54

22.1 Settings affecting query results.................................................................. 54 22.2 Settings affecting query execution............................................................. 55 22.3 Settings affecting query plans.................................................................... 55 22.4 Advanced settings affecting query plans ................................................... 56 22.5 Settings for displaying query plan information........................................... 57 22.6 Miscellaneous settings............................................................................... 58

23 Statement cache ............................................................................................59 24 Commonly used system stored procedures....................................................60 25 Java in ASE (SQLJ) .......................................................................................61 26 XML (XPath/XQuery/SQLX) in ASE ...............................................................63 DBA Topics................................................................................................ 66 27 Database devices & dump devices ................................................................66

27.1 Device mirroring......................................................................................... 67 28 Creating & maintaining databases..................................................................67

28.1 Temporary databases................................................................................ 70 28.2 Segments................................................................................................... 70 28.3 Thresholds ................................................................................................. 71

29 Dumping & loading databases (backup & restore)..........................................71 29.1 Quiesce, Mount, Unmount ......................................................................... 74

Page 4: The Complete Sybase ASE Quick Reference Guide

4 The Complete Sybase ASE Quick Reference Guide

30 Data Compression (15.7) ...............................................................................75 31 Logins & Users...............................................................................................76

31.1 Logins (server-level 'users') .......................................................................76 31.2 Passwords..................................................................................................78 31.3 Login profiles (15.7) ...................................................................................80 31.4 Database-level users .................................................................................80 31.5 Roles ..........................................................................................................81

32 Permissions (grant/revoke) ............................................................................83 32.1 Classic permissions ...................................................................................83 32.2 Granular permissions (15.7 ESD#2)+ ........................................................85 32.3 Row-level access control (access rules) ....................................................85

33 Managing configuration parameters...............................................................86 34 Memory allocation..........................................................................................87

34.1 Named caches & buffer pools ....................................................................87 35 CPUs/Cores, Engines & Threads (15.7).........................................................88

35.1 Logical Process Manager ('Execution Classes') ........................................90 36 Update statistics.............................................................................................90 37 sp_sysmon.....................................................................................................93 38 Reorg.............................................................................................................93 39 Languages & messages.................................................................................94 40 Character set & sort order..............................................................................95

40.1 Unicode ......................................................................................................96 41 Miscellaneous DBA commands & config parameters .....................................96 42 DBA tools.......................................................................................................98 43 MDA tables / monitoring tables ......................................................................98 44 Setting up sybsystemprocs, pubs3 & sybsyntax.............................................99 45 Setting up 'dbccdb' for 'dbcc checkstorage' ....................................................99

45.1 'dbccdb' stored procedures ......................................................................100 Advanced DBA Topics............................................................................. 102 46 Advanced configuration parameters.............................................................102 47 Configuring parallel query processing ..........................................................103

47.1 Parallel index creation..............................................................................103 48 ASE Cluster Edition (CE) .............................................................................104 49 Supported DBCC commands.......................................................................106 50 Unsupported DBCC commands ...................................................................108 51 ASE Traceflags............................................................................................113 52 Accessing data located outside ASE............................................................115

52.1 Configuring remote access with RPCs ....................................................115 52.2 Configuring remote access with CIS........................................................116 52.3 Component Integration Services (CIS) features ......................................116

53 Locking ........................................................................................................120 53.1 Transaction isolation levels ......................................................................121 53.2 Lock promotion.........................................................................................121

54 Resource limits ('Resource Governor').........................................................122 55 XP Server ....................................................................................................123 56 Auditing........................................................................................................123 57 Database recovery.......................................................................................126 58 Abstract Plans..............................................................................................127 59 Query metrics capture..................................................................................128 60 Replication Server........................................................................................129 61 Job Scheduler..............................................................................................129 62 Shared memory dumps................................................................................129 Miscellaneous Topics .............................................................................. 131 63 The interfaces file.........................................................................................131 64 Server programs ..........................................................................................131 65 Client programs............................................................................................133 66 ASE environment variables..........................................................................138 67 Running servers as Windows services.........................................................139 68 Global variables ...........................................................................................139

68.1 Session-specific global variables .............................................................139 68.2 Server-wide & non-static global variables ................................................141 68.3 Server-wide & static global variables .......................................................142

69 Logical keys .................................................................................................143 70 Catalog stored procedures...........................................................................143 71 Issues with BCP-in.......................................................................................144 72 Minimally logged operations.........................................................................144 73 Monitor Server & Historical Server (pre-15.7)...............................................144 74 ASE limits ....................................................................................................145 75 ASE license manager & license options.......................................................146 Index ........................................................................................................ 148

Page 5: The Complete Sybase ASE Quick Reference Guide

8 The Complete Sybase ASE Quick Reference Guide

Starting Points For Common DBA Tasks Below is a brief list of some common ASE DBA tasks. See the index ( p.148) or Table of Contents ( p.3) if a topic is not listed here. On Windows, read sqlsrvr.exe instead of dataserver.

Task Command or procedure / see page Find ASE product manuals sybooks.sybase.com (online searchable and PDF) Install ASE See the ASE installation guide for your platform Download the ASE software, patches and upgrades

Download ASE from http://sybase.subscribenet.com; download patches from http://downloads.sybase.com

Manage ASE license options Generate license keys & put in license file ( p.146) Get a free version of ASE Developer/Express Ed., see www.sypron.nl/ase_free Create a new ASE server srvbuild[res]; syconfig; sybatch; dataserver -z -b Start an ASE server startserver( p.132); start as Windows service( p.139)Start ASE in standalone (single-user) mode

Use the -m option when starting dataserver ( p.131)

Stop an ASE server shutdown( p.97); or stop Windows service ( p.139) Find running ASE servers showserver ( p.132); or use the Windows service

manager ( p.139) Connect to an ASE server isql utility ( p.135) Change database context use ( p.50), with the database name Using a GUI DBA admin tool Sybase Control Center or Sybase Central ( p.98) Find the ASE version @@version ( p.143) or dataserver -v ( p.131) Find the ASE version for SAP Business Suite

@@sbssav ( p.143) or dataserver --sbssav ( p.132)

Find the ASE edition sp_lmconfig ( p.146) Find version of system procs sp_version( p.99) (=version of installmaster etc.) Find the ASE server's IP address and port number

In a running server, use sp_listener 'status' ( p.98); or look in the interfaces file ( p.131)

Add a user to ASE create login or sp_addlogin ( p.76) to allow access to the ASE server; sp_adduser or sp_addalias( p.80) to allow access to an ASE database

Change a login password sp_password or alter login…with passwd ( p.78) List all databases in an ASE server

sp_helpdb ( p.69), without parameters

List all tables/objects in an ASE database

sp_help ( p.60); or a direct query against the catalog: select name, type, crdate from sysobjects

Display free/used space in an ASE database

sp_spaceused ( p.33) without database name sp_helpdb ( p.69) with database name

Find size of a table sp_spaceused ( p.33), with the table name Find schema and indexes for a table

sp_help ( p.60), with the table name ddlgen utility ( p.134)

Find SQL code for stored procs, views, triggers, etc.

sp_showtext, sp_helptext ( p.61) defncopy utility ( p.135); ddlgen utility ( p.134)

Copy data to/from table/file bcp utility ( p.133) Backup an ASE database dump database & dump transaction ( p.71) Restore an ASE database from backups

load database & load transaction ( p.71), followed by online database

Information about database devices

sp_helpdevice ( p.67)

Create an ASE database disk init ( p.66) and create database ( p.67) Enlarge a database device disk resize ( p.66) Enlarge an ASE database alter database ( p.68) Shrink an ASE database alter database…log off ( p.68; transaction log only) Display ASE configuration parameters

sp_configure for all parameters ( p.86) sp_configure 'nondefault' for non-default parameters

Check database corruptions dbcc checkstorage ( p.106) Display all current users sp_who ( p.61) Kill a user connection kill ( p.96) Monitor ASE activity and resource usage

sp_monitorconfig ( p.87); MDA tables ( p.98); sp_sysmon ( p.93)

Look at ASE query plans set showplan ( p.57); set statistics plancost ( p.57)sp_showplan ( p.61); show_plan() ( p.60); & others

Gathering information for Sybase TechSupport

sybdiag utility ( p.137)

Find ASE limits p.145

Page 6: The Complete Sybase ASE Quick Reference Guide

12 The Complete Sybase ASE Quick Reference Guide

requiring set quoted_identifier on. The quotes/brackets reduce the max. length by 2. Examples: set quoted_identifier on create table "This is my table!" ("My Column!" int, YourColumn int)

select [name] from [sysobjects] where [type] = 'U' valid_name ( character_expression [, length ] ) Returns 0 if character_expression is not a valid identifier, or a number other than 0 if it is a valid identifier. With length (1..255, default=30), character_expression will be deemed an invalid identifier (i.e. returns 0) if its length exceeds length. In 15.7, returns 128 when the config setting 'quoted identifier enhancements' = 1, set quoted identifier = on, and character_expression is a quoted identifier that is valid under these settings, but would be invalid otherwise. (15.7) sp_configure 'quoted identifier enhancements', { 0 | 1 } (static) When 1 (default=0), certain aspects of quoted identifiers behave differently; see the ASE manuals for details. Also see valid_name(). This parameter can also be set via the config setting 'enable functionality group'.

3 Quotes & Comments /* …comment… */ Comment delimiters, which can extend over multiple lines; they may also be nested. -- a comment until the end of the line Single-line comment delimiter. All text after -- until the end of the line, is a comment. Quotes as string delimiters Character constants (often referred to as 'strings') must be enclosed in either single or double quotes; the opening and closing quote must be identical. When the delimiter quote appears twice, it evaluates to a single character in the string. With set quoted_identifier on (default=off), double quotes are interpreted as quoted identifiers and cannot be used as string delimiters, so best use single quotes instead. Examples: 'abc' or "abc" - these strings are identical "'" - a string consisting of a single quote, enclosed in double quotes 'He said: "How are you ?" ' - a string containing double quotes "He said: ""How are you ?"" " - the same string, but in double quotes Line continuation character Strings in T-SQL statements can span multiple lines when using the line continuation character '\'. This character will not be part of the actual string. Example: exec( ' print "This is a pretty long string, but fortunately, \ we can use two lines for it !" ' ) Without '\', this example is still valid T-SQL, but the string contains a newline.

4 Operators Numeric operators For all numeric datatypes, the operators +, -, *, / are supported. In pre-15.0.2, % (modulo) is supported for tinyint, smallint and int only; in 15.0.2, also for nu-meric, float, etc. For mathematical functions, such as abs() and power(), see p.22. String operators The only string operators is + (|| is identical) to concatenate two strings ( [var]binary as well as [var]char); in 15.7, this also concatenates LOB variables or LOB locators (but not LOB columns). For string functions (like substring()), p.14. Logical operators Logical operators are used in logical expressions (such as in predicates and if-statements), which evaluate to true or false (except for some cases involving NULL values, where the result can be unknown). • =, <> , != , > , >= , <, <=, !> (not greater than), !< (not less than) - comparisons • and, or - combines two logical expressions: if (@a > @b) and (@x != @y) • not - negates a logical expression: if not (@a > @b) • [not] like - a pattern matching operator; see next paragraph. • [not] in - matches a list of values: where a in (3,4,5) is equivalent to

where a=3 or a=4 or a=5 • [not] between - matches an interval (incl. boundaries): where a between @x

and @y - this is equivalent to where a >= @x and a <= @y • *=, =* - outer join operators; p.30. • exists, any, all, in - subquery operators; p.29.

Page 7: The Complete Sybase ASE Quick Reference Guide

ASE versions 15.0, 15.5 & 15.7 21

rm_appcontext ( 'app_context_name', 'attribute_name' ) Deletes the specified attribute from the specified application context. (pre-15) rowcnt ( doampg ) Returns the number of rows in a table, without scanning the entire table; instead, the rowcount is retrieved from the table's OAM page. Note that this value will usually be correct, but may be slightly off during heavy insert/delete activity on the table. Use the function in a query against the sysindexes table, for example:

select rowcnt( doampg ) from sysindexes where indid < 2 and id = object_id( 'my_table' )

Replaced by row_count() in 15.0.

row_count ( db_id, object_id [, ptn_id ] ) Replaces rowcnt() in 15.0. Example: select row_count( db_id(), object_id( 'my_table' )) set_appcontext ( 'app_context_name', 'attribute_name', 'attribute_value' ) Creates an attribute in the specified application context; if the context does not yet exist, it will be created as well. The size of the attribute value must be ≤ 255 bytes. The application context can also be set by a login trigger ( p.77). Example: select set_appcontext ( 'my_context', 'attrib_1', 'value_1' ) show_sec_services () Lists the active security services for the current session. showplan_in_xml () Returns information about query optimization/execution, in XML format; p.58. (15.0.2) show_plan (), show_cached_text[_long] () Display information about queries/plans in the statement cache; p.60. (15.7) show_cached_plan_in_xml (), show_dynamic_params_in_xml() Returns information about plans in the statement cache, in XML format; p.60. syb_quit () Causes ASE to terminate the current session. Example: select syb_quit(). syb_sendmsg ( 'ip_address', port_nr, 'message_string' ) (Unix only) Sends a UDP message to the specified port; requires the config option 'allow sendmsg' (dynamic) to be set to 1. The config option 'syb_sendmsg port number' (static) defines the outgoing port number used by ASE. The message string can be max. 16384 bytes; in pre-15.0.2, max. 255 bytes. sp_sendmsg is a wrapper around syb_sendmsg(), taking the same parameters (though in 15.0.2, the max. message length is 4096 bytes). tempdb_id ( [ spid ] ) Returns the database ID of the specified session's temporary database; without spid, for the current session. tran_dumpable_status ( db_name ) Returns 0 when the transaction log of the specified database can be dumped. Other-wise, returns a bitmap indicating the reasons why this is not possible. In 15.5, sp_tran_dumpable_status [ db_name ] displays both the bits and reason.

Bit Reason 1 the specified database does not exist 2 the transaction log is not on a separate device 4 the first log page is on a data-only fragment 8 database option 'trunc log on chkpt' is enabled 16 non-logged writes occurred in this database 32 dump tran…with truncate_only has been performed 64 database is newly created or upgraded; database dump is required first 128 the database's durability does not allow the log to be dumped 256 the database is read-only; a log dump starts a transaction 512 database is online for standby_access; a log dump starts a transaction1024 the database is an archive database; log dump not supported

(pre-15) used_pgs ( object_id, doampg, ioampg ) Returns the number of pages used by a table and its clustered index. Use in a query against sysindexes; see rowcnt() for an example. Replaced by used_pages() in 15.0.

Page 8: The Complete Sybase ASE Quick Reference Guide

ASE versions 15.0, 15.5 & 15.7 37

must have been run in this database, or, in 15.7, a master key created. For as de-fault, see alter encryption key. options can be: • keylength length - key length in bits; for AES: 128 (=default), 192 or 256. • init_vector [ random | NULL ] - with random (=default), uses an initialization

vector during encryption, so that identical plaintext values produce different ci-phertext; with NULL, no initialization vector is used.

• pad [ random | NULL ] - with random, encrypted values are padded randomly for better security; with NULL (=default), no padding is done.

• passwd 'key_passwd' - a password to protect (=encrypt) the encryption key with; it must satisfy configuration settings 'minimum password length' and 'check password for digit' (but not the sp_passwordpolicy settings). Before the key can be used, set encryption passwd… must be executed. NB: a lost password cannot be recovered unless a recovery key copy has been created (with alter encryption key…for recovery).

• (15.7) dual_control - specifies that the encryption key must be protected by two passwords (for PCI compliance). Without with passwd, the key is protected by the master key and dual master key, which must both exist; with with passwd, it is protected by this key password and the master key. dual_control is ignored when a master or dual master key is created.

Note: to index an encrypted column, init_vector NULL and pad NULL are required. Example: create encryption key my_key for AES with init_vector null pad null

create table my_tab (my_col int encrypt with my_key) insert my_tab values (1) (15.7) create encryption key [ dual ] master [ for AES ] with passwd 'key_passwd' alter encryption key [ dual ] master with passwd 'old_passwd' modify encryption with passwd 'new_passwd' Without dual, creates a master key in the current database, or changes its password. The master key is used to protect (=encrypt) encryption keys. Alternatively, sp_encryption system_encr_passwd can be used. For password requirements, see create encryption key…with passwd above. With dual, creates a dual master key in the current database, which is used together with the master key to encrypt encryption keys that are created with the dual_control option but without a key password. The master key and the dual master key must have different owners. When using a (dual) master key, the key password must be set (with set encryption passwd…) before data can be encrypted/decrypted. When using unattended startup mode with the master key startup file, this is not needed. This requires running alter encryption key…for automatic_startup ( p.38) for the (dual) master key, and enabling the config setting 'automatic master key access'. Example: create encryption key master with passwd 'S3cret'

set encryption passwd 'S3cret' for key master create encryption key my_key create table my_tab (my_col int encrypt with my_key)

drop encryption key key_name Drops the specified encryption key, including all its key copies. No columns or keys must be encrypted with the key. alter encryption key key_name …remainder-of-command… Modifies the specified encryption key or key copy. The remainder of the command can be as follows: • as [ not ] default - when marked as default, this key will be used for encrypted

columns where no key name is specified in the DDL statement. sp_encryption displays which key, if any, is the default key.

• modify owner 'user_name' - changes key ownership; see p.98 for full syntax. • with passwd 'orig_passwd' add encryption with passwd 'key_copy_passwd'

for user 'user_name' [ for recovery ] - creates a key copy of the specfied key for exclusive use by the specified user. A key copy is identical to the original key, but is protected with a different password, and accessible only by the des-ignated user. orig_passwd is the key's original password, known only to the key owner/key custodian. key_copy_passwd will be shared with the specified user (who can change it with alter encryption key…modify encryption). With for recovery, the key copy can be used for recovery purposes only; no encrypted data can be accessed through it. The designated user should be trustworthy, modify the password, and keep it in a safe place. To find recovery key copies, run sp_encryption with helpcol or helpuser, and key_copy.

• with passwd 'passwd' add encryption for user 'user_name' for login_association - creates a key copy for the specified user, encrypted with the user's login password. passwd is the key's original password, known only to the key owner/key custodian.

Page 9: The Complete Sybase ASE Quick Reference Guide

50 The Complete Sybase ASE Quick Reference Guide

raiserror error_nr [, value_list ] raiserror error_nr { 'format_string' | @ variable } ] [, value_list ] [ with errordata list ] With a comma following error_nr, the corresponding message in the session's current language will be retrieved, formatted using values in value_list, and printed. For sys-tem-defined messages (in master..sysmessages), error_nr must be between 17000 and 19999; for user-defined messages (in sysusermessages in the current data-base), error_nr must be ≥ 20000. format_string or @variable are used to format and display a message. Without a comma following error_nr, no message is retrieved, but an instant message is com-posed from the specified format string or variable, and any values in value_list. When raiserror completes, @@error will contain the value of error_nr. The clause with errordata list is for use with CT-Lib programs only. Examples: sp_addmessage 22222, 'This is a %1! message!'

raiserror 22222, 'strange' raiserror 33333 'This is an %1! message', instant -- note: no comma !

return [ [ ( ] expression [ ) ] ] [ AP ] Exits from a stored procedure or SQL function to the caller. expression will be the return value of the procedure or function. If the expression involves a query, this must evaluate to a single integer value. For procedures, ASE uses negative return values to indicate certain types of errors; therefore, don't use these in your SQL code. When the AP clause is used, the parentheses ( '(' and ')' ) are mandatory. See the while statement for more information about this optional AP clause. waitfor delay 'hh:mm:ss[.cccuuu]' / waitfor delay @variable waitfor time 'hh:mm:ss' / waitfor time @variable Waits for a while. delay waits for the specified interval (max. 24 hours); time waits until the specified time (max. 24 hours away). The number of concurrent waitfor statements is limited by config setting 'number of alarms' (dynamic); default=40. while logical_expression [ AP ] T-SQL-statement If logical_expression is true, executes T-SQL-statement in a loop until the expression is no longer true, or until the loop is exited via a break, return or goto statement. Example: while @i < 100 begin exec my_proc select @i = @i + 1 end If the expression involves a query, AP can specify the abstract plan for this query as plan '( AP-language )' ; p.127 for info on abstract plans. break Exits from a while-loop; execution continues at the first statement after the loop. continue Returns to the top of the while-loop and re-evaluates the logical expression. use { db_name | @character_variable } Changes the current database to db_name, or to the database in the character vari-able, effective as of the next query batch. use cannot be used in stored procedures or triggers. The use of @character_variable is undocumented. Also note: system stored procedures can access other databases without changing the current database though the use command. Example: to display the schema of table other_db..t1, regardless of the current database, use this: exec other_db..sp_help t1.

20 Cursors Cursors can be used for implementing loop-based, sequential, non-relational algo-rithms like those which are common in 3GL languages. ASE has 4 types of cursors: • server cursor - declared in a stored procedure. • language cursor - declared in command batches, outside a stored procedure. • client cursor and execute cursor - defined on the client side and implemented

though OpenClient (typically in a C-program) or Embedded SQL. These cursors can not be created interactively using client applications like isql.

The rest of this section applies only to language cursors or server cursors. declare cursor_name [ semi_sensitive | insensitive ] [ scroll | no scroll ] [(15.7) release_locks_on_close ] cursor for select_statement [ for { read only | update [ of updated_column_names_list ] } ] Declares (creates) a cursor based on the specified select statement. With no scroll (=default), the cursor is non-scrollable (i.e. only the next row can be fetched). With scroll, the cursor is scrollable (i.e. any row can be fetched). With semi_sensitive (=default in 15.0), changes to the underlying data rows may be visible through the cursor; with insensitive (=behaviour in pre-15), such changes are not visible. Trace-

Page 10: The Complete Sybase ASE Quick Reference Guide

ASE versions 15.0, 15.5 & 15.7 63

the related classes are dropped as well, unless retain classes is specified. To extract a JAR and its Java classes, use extractjava (Windows:extrjava); p.135. In pre-15.0.3, a debugger for Java-in-ASE is in $SYBASE/$SYBASE_ASE/debugger /Debug.jar. To start, run: java sybase.vm.Debug (from the command line). In 15.0.3, any Java-compliant debugger can be used, like jdb (requires installing the JDK). See the ASE manual Java in Adaptive Server Enterprise for details.

26 XML (XPath/XQuery/SQLX) in ASE ASE processes XML natively, with support for XPath queries ( p.65). For full details on XML/XPath/SQLX, see the manual XML Services in Adaptive Server Enterprise. sp_configure 'enable xml', { 0 | 1 } (dynamic) Enables (1) or disables (0) native XML features. Enabling requires, in pre-15 only, the ASE_XML license option. select …rest of statement… for xml [ schema | all ] [ returns datatype ] [ option 'sqlx_options…'] } For a select statement only, specifying for xml converts the SQL result set to a SQLX-XML document. returns can only be used when the select is a subquery. for xml schema generates the XML schema describing the result set generated by for xml, but not the result set data itself; for xml all generates both schema and data. For sqlx_options, see below. Example: select * from my_table where col1 > 0 order by col2 for xml option 'columnstyle=attribute statement=yes' xmlextract ( 'xpath_query[/text()]', xml_doc [ option 'options…'] returns datatype ] ) Extracts elements from the XML document, based on the XPath query, returning a scalar value. xmlextract() can be used in expressions and predicates (also see xmltable() (below), which can be used in the from clause). By default, the result is returned as an XML document; when /text() is appended, the outermost XML tags are removed. By default, the result datatype is text, unless specified otherwise (as an ASE datatype or as java.lang.String) with returns. op-tions can be xmlerror and ncr (see sqlx_options below). In 15.7, local variables and parameters can be of type text or image which can be useful when handling XML. Examples: select xmlextract('//t', '<doc><t>Hello</t></doc>') returns: '<t>Hello</t>' select xmlextract('//t/text()', '<doc><t>Hello</t></doc>') returns: 'Hello' select xmlextract('//t/text()', '<doc><t>1234</t></doc>' returns int) returns: 1234 (as an integer) select xmlextract('//t', xml_col option 'xmlerror=message' returns int) from your_tab …rest of query… xmlparse ( xml_doc [ option 'options…'] ) Parses an XML document, returning it as an image value. Parsed XML data can be accessed faster than raw XML. options can be xmlerror (see sqlx_options below) and also dtdvalidate={yes|no}: with yes (default=no), the XML document is validated against an embedded DTD. Example: create table my_tab (my_col int, xml_col image NULL) insert my_tab values (123, xmlparse('<doc><t>Hello</t></doc>')) -- parsed XML insert my_tab values (456, '<doc><t>Bonjour</t></doc>') -- raw XML xmlrepresentation ( image_column ) Determines if an image column contains a parsed XML document; if so, returns 0, otherwise returns >0; if the input is NULL, returns NULL. Example: select my_col, xmlrepresentation(xml_col) from my_tab 'xpath_query' xmltest xml_doc [ option 'options…'] xmltest evaluates to true or false (or NULL), after applying the XPath query against the XML document. This can be used like a logical expression, for example in a where clause, case expression, if statement etc. To negate the result, use not. options can be xmlerror (message and NULL only); see sqlx_options below. Example: select my_col from my_tab

where '//t="Hello"' xmltest xml_col option 'xmlerror=NULL' and …further predicates…

(15.0.2) xmltable ( 'xpath_rows' passing xml_doc columns col_name datatype [ not null ] [ path 'xpath_cols' ] [ for ordinality ] [,…more columns…] ) Extracts elements from the XML document (which can also be a variable, column or subquery), returning a table that must be used as a derived table in the from clause. xmltable() can be seen as providing a relational view on XML data. Also, it simplifies

Page 11: The Complete Sybase ASE Quick Reference Guide

ASE versions 15.0, 15.5 & 15.7 77

login), enables (add) or disables (drop) that the roles are activated when the user logs into ASE. Default=not activated. System roles are always activated. all = all roles. When multiple roles are listed, they must be comma-separated. (15.7) alter login login_name drop attribute [attribute…] Removes one or more attribute settings for an existing login, reverting to the default setting. See alter login…modify for attributes that can be modified. Example: alter login jsmith drop login script min passwd length (15.7) drop login list_of_login_names [ with override ] sp_droplogin login_name [(15.7) , 1 ] Drops a login. drop login can drop multiple (comma-separated) logins. This fails when a login is still mapped to a database user and/or owns objects; in this case, use the stored proc sp_rv_helplogin (from www.sypron.nl/new_ssp.html) to help re-solve the problem; in 15.7, sp_helpuser, display_object also gives some info. drop login…with override and sp_droplogin with 1 as 2nd parameter will drop a login even if some databases cannot be accessed. In 15.7, use drop login. sp_addlogin login_name, passwd [, def_db [, def_lang [, full_name [, passwd_expi-ration [, min_passwd_len [, max_failed_logins [, authenticate_with ]]]]]]] Creates a new login with the specified password and optional attributes (which can also be set with sp_modifylogin). In 15.7, use create login which has more options. sp_modifylogin login_name, attribute, 'value' Modifies attributes of the specified login. In 15.7, use alter login instead. Possible values for attribute are below; see the corresponding attributes for alter login/create login as indicated with 'see…'. Note that value must always be quoted. • 'fullname' (see fullname), 'defdb' (see default database), 'deflanguage' (see

default language), 'passwd expiration' (see password expiration), 'min passwd length' (see min password length), 'max failed_logins' (see max failed attempts), 'authenticate with' (see authenticate with).

• For 'login script', see login script; also, specify value = NULL to drop the setting, or a different name to change it. In 15.0.2, with login_name = NULL, de-fines or removes a global login trigger (see sp_logintrigger for full details).

• For 'add default role' and 'drop default role', see alter login…add/drop auto activated roles.

When option is 'passwd expiration', 'min passwd length' or 'max failed_logins': • when login_name is 'all overrides', the setting is applied to all logins with a

non-default setting; with also '-1' for value, all non-default settings are dropped. • in 15.0.2, when value is 'clear', removes the login-specific setting. sp_displaylogin [ 'login_name' ] (15.0.2) sp_displaylogin [ 'suid' | 'login_name_pattern' ] Displays attributes of the specified login(s). Without parameter, displays the current session's login. In 15.0.2, the login name may contain wildcards; also, the login's suid number may be specified (as a quoted string). To display all existing logins, use this query: select name, suid from master..syslogins or, in 15.0.2, sp_displaylogin '%' (15.0.2) sp_logintrigger [ '[db_name.[owner].]proc_name' | 'drop' ] Defines or modifies (with proc_name) or removes (with 'drop') a global login trigger. This is executed for all logins (incl. sa), before a login's own login trigger, if defined. Without db_name, it must exist in the login's default database. Without parameter, shows the current setting, which is also in @@logintrigger. Running sp_logintrigger… is equivalent to sp_modifylogin NULL, 'login script',… The global login trigger is disabled with boot-time traceflag 4072 (undocumented). Example: sp_logintrigger 'my_db.dbo.p_globaltrg' suser_id ( [ login_name ] ) suser_name ( [ suid ] ) Returns the login ID (suid) or login name for the specified login name or ID, respec-tively, as stored in the master..syslogins table. Without parameter, returns the current session's login ID or login name. set proxy login_name set session authorization login_name Changes the current session's login name (suid) to login_name, inheriting all roles and permissions granted to login_name. To return to the session's original login name, specify the original login_name. The inherited roles can be restricted with grant set proxy…restrict role ( p.83). Before set proxy can be used, a user with sso_role must execute grant set proxy in

Page 12: The Complete Sybase ASE Quick Reference Guide

96 The Complete Sybase ASE Quick Reference Guide

sp_configure 'default sortorder id', sortorder_id (static) Changes the sort order for the current default character set. After restarting the ASE server, run sp_indsuspect to check for invalid indexes and sp_tab_suspectptn to check for invalid partitioned tables. To display the available sort orders (and their IDs) in the server: select id, csid, name, description from master..syscharsets where type >= 2000 sp_configure 'default character set id', charset_id (static) Changes the default character set used by the server. When ASE is restarted, the default character set will be changed and ASE will shutdown automatically. To display the available character sets (and their IDs) in the current server: select id, csid, name, description from master..syscharsets where type < 2000 sp_configure 'disable character set conversion', { 0 | 1 } (static) Enables (0, =default) or disables (1) automatic conversion between the character sets of the server and the client. sp_checknames Displays all identifiers in the current database that contain non-7-bit-ASCII characters. sp_helpsort Displays the default character set and sort order used by the server. sp_indsuspect [ table_name ] Checks the specified table_name (if omitted, checks all tables in the current data-base) for indexes marked as suspect during recovery as the result of changing the server sort order. Suspect indexes can be fixed by running dbcc reindex. set char_convert on [ with { error | no_error } ] set char_convert off set char_convert character_set [ with { error | no_error } ] Defines conversion between the character sets of server and client. on (=default) enables character set conversion; off disables it; character_set explicitly specifies the client character set to convert to. with no_error specifies that no error message is raised for conversion errors (ASE-to-client only); default=with error. @@char_convert indicates if character set conversion is currently in effect (1) or not (0). The global variables @@maxcharlen, @@ncharsize, @@client_csexpansion @@client_csname, @@client_csid are also related to character sets ( p.140).

40.1 Unicode To store Unicode data in [var]char or text data, configure ASE with the utf8 character set. Datatypes uni[var]char and unitext, which store UTF-16 values, and Unicode notation (like U&'\0041', = 'A'), can be used independent of the ASE character set.

Unicode-related configuration parameters are the following, set with sp_configure: • (15.7) 'enable permissive unicode', { 0 | 1 } (dynamic) - when 0 (=default),

uses strict Unicode and raises an error when encountering Unicode non-characters (like U&'\fffe'); when 1, such non-characters are allowed.

• 'default unicode sortorder', sortorder (static) - the default Unicode sort order, default=binary.

• 'enable unicode conversions', 'enable unicode normalization', 'enable surrogate processing' - all dynamic, and 0 or 1 (see ASE manuals for details).

Unicode-related functions and global variables: • to_unichar ( integer_expression ) - returns the Unicode expression for the

integer expression. • uhighsurr / ulowsurr ( unicode_expression, start ) - tests the Unicode value at

position start in the Unicode expression: if this is the high or low half, respec-tively, of a surrogate pair, returns 1; otherwise returns 0.

• uscalar ( unicode_expression ) - returns the Unicode scalar value for the first character in the Unicode expression.

• @@unicharsize - contains 2, the length (in bytes) of a unicode character.

41 Miscellaneous DBA commands & config parameters kill spid [ with trace ] kill spid with statusonly Kills the specified session. The undocumented option with trace prints a stacktrace for the killed session to the errorlog (this may not always work). kill…with statusonly does not kill, but only reports progress while the session is performing a rollback.

Page 13: The Complete Sybase ASE Quick Reference Guide

108 The Complete Sybase ASE Quick Reference Guide

dbcc tune ( option, value_1, value_2…) Modify certain run-time configuration settings. These settings are not persistent (i.e. not maintained after an ASE restart) unless specified otherwise. Possible options are: • ('ascinserts', value, table_name) - only for APLs tables with a composite clus-

tered index, when set to 1 (default=0) reduces page splits for inserts in ascending key order. This setting is persistent. In 15.0.2, this property can also be set with sp_chgattribute, and displayed with sp_help.

• ('cleanup', value) - if value = 0, memory cleanup checking is enabled (=default); if value = 1, disabled.

• ('cpuaffinity', firstcpu, { 'on' | 'off' } ) - enables/disables CPU affinity, provided this is supported by the platform; starting with engine 0, engines are bound to CPU firstcpu. Run ('cpuaffinity', -1) to write current setting to server errorlog.

• ('des_bind', db_id, table_name ) - binds a table to an object descriptor so that it won't be pushed out of the metadata cache. Use for hot tables when seeing Ob-ject Manager Spinlock contention in sp_sysmon. Use 'des_unbind' to remove.

• ('des_greedyalloc', db_id, table_name, { 'on' | 'off' } ) - enables (on) or dis-ables (off, =default) 'greedy allocation' for the table (to reduce latch contention).

• ('deviochar', vdevno, value) - sets max. outstanding I/Os by housekeeper for device vdevno to value (1..255; default=3); if vdevno = -1; applies to all devices.

• (pre-12.5.1) ('doneinproc', { 0 | 1 } ) - obsolete; replaced by sp_configure 'send doneinproc tokens' ( p.102).

• (pre-12.5.1) ('maxwritedes', value) - obsolete; replaced by sp_configure 'i/o batch size' ( p.102).

50 Unsupported DBCC commands WARNING! These (arbitrarily selected) DBCC commands represent unsup-ported functionality which may have unexpected side effects, may cause irreversible damage to your databases and/or lead to loss of data. Use entirely at your own risk. Do not contact Sybase Technical Support for assistance ! Many dbcc commands require that the role sybase_ts_role be enabled for the exe-cuting session. This can be done as follows (assuming the login is 'sa'):

grant role sybase_ts_role to sa set role sybase_ts_role on

dbcc help ( command ) Displays syntax info for the specified dbcc command. dbcc addtempdb ( db_id | db_name ) Adds a temporary database to the global list of temporary databases. dbcc allocdump ( db_id |db_name, alloc_page_nr ) Lists extents in an allocation unit, identified by the allocation page number. dbcc bytes ( address, length ) / dbcc bytes ( address, printopt, structure_name ) Dumps length bytes, starting at address (e.g. a physical page address), in hex & ASCII. dbcc bytes(0,0,'showlist') displays all structures that can be specified as masks in dbcc bytes(address, printopt, structure_name). Specify -1 for printopt. dbcc cacheremove ( db_id | db_name, object_id | object_name ) Deallocates the object descriptor (DES) for the specified table. dbcc dbcacheremove ( db_id | db_name ) Clears the DBTABLE information for the specified database, for use when commands fail with a 'keep count' reported as > 0 although no users are active in the database. (15.0.3) dbcc cachedataremove ( db_id | db_name [, object_id | object_name [, ix_id | ix_name [, ptn_id | ptn_name ]]] ) Removes all pages for the specified database/object/partition from the data cache. dbcc cis ( subcommand ) Displays CIS-related information. Subcommands are: • 'remcon' displays all CIS remote connections • 'showcaps' [, 'server_name' ] - displays the capabilities of the remote server • 'srvdes' [, server_id ] - without argument, displays all SRVDES structures. With

server_id, syncs the in-memory SRVDES with master..sysservers dbcc connection_hangup ( remote_server_name ) Closes a site handler connection to the specified remote server (like a Backup Server).

Page 14: The Complete Sybase ASE Quick Reference Guide

ASE versions 15.0, 15.5 & 15.7 131

Miscellaneous Topics

63 The interfaces file The interfaces file is an essential part of the Sybase client-server environment. For client applications, it must contain the network address for every server the client application connects to. To start a server, it must be able to find its own network ad-dress in the interfaces file. By default, the interfaces file is $SYBASE/interfaces (on Windows: %SYBASE%\INI\SQL.INI). When named or located differently, it must be specified with a command-line parameter for the client or server program (see the following sections). An LDAP server can replace the interfaces file for looking up the server network address by client apps; no license option is needed for this. For user authentication by an LDAP server instead of syslogins, license option ASE_SECDIR is needed. Best use the dsedit or dscp utilities to edit the interfaces file. Note that the inter-faces file (for Unix) and the SQL.INI file (for Windows) use incompatible formatting. dscp (Unix only) - an ASCII-interface utility to view/edit the interfaces file. dscp has its own command set. At the prompt, type help for on-line help. dsedit - a GUI utility to view/edit the interfaces file.

64 Server programs For all programs, the option -v displays the software version. backupserver (Windows: bcksrvr.exe) - Backup Server, for creating/loading data-base dumps and transaction log dumps. [-C nr_connections] max. # Backup Server connections (default=30) [-S server_name] server name (default=$DSLISTEN, otherwise SYB_BACKUP) [-I interfaces_file] interfaces file pathname (default=$SYBASE/interfaces) [-e errorlog_file] Backup Server errorlog (default=backup.log) [-M sybmultbuf] pathname of the sybmultbuf binary file [-N net_connections] max. # of Backup Server network connections (default=25) [-L language] language used by Backup Server [-J character_set] character set used by Backup Server [-P active_threads] max. # active stripes (for multiple dump/load sessions) [-c tape_config_file] tape configuration file (default=$SYBASE/backup_tape.cfg) [-Vn] error logging detail level, n=0..3, in 15.5 also 4; lower=more

detail, except -V4 (=-V0, but without connection events) [-T traceflag] boot-time OpenServer traceflags [-m max_MB] max. amount of memory (MB) to be used by Backup Server

(default= (number of active stripes)*1MB) [-p packet_size] TDS packet size (in bytes; default=2048) requested by a local

Backup Server from a remote Backup Server for a remote dump/load. Both servers must allow the requested value.

(Undocumented) Backup Server traceflags can be dynamically set with RPCs qatra-ceon (enable) or qatraceoff (disable): SYB_BACKUP…qatraceon N, where N can be 1 (prints blocksize), 2 (prints I/O optimization parameters), 3 (allows dumping to /dev/null), 4 (print allocation %age), 5 (print DB page size), 0 (prints active traceflags). dataserver (Windows: sqlsrvr.exe) - the ASE server itself. The options marked '(build)' apply only when building a new ASE server. In 15.5, all options also have a GNU-style equivalent (e.g. --error-log for -e); use -h to display these. The pre-12.5 buildmaster utility is replaced by dataserver -z -b and other '(build)' flags. [-v] displays software version of the ASE server [-h] 'help' function; displays all possible parameters [-d master_device] master device pathname [-r master_mirror] master device mirror pathname (when master is mirrored) [-s server_name] server name (default= $DSLISTEN, otherwise SYBASE) [-c config_file] server config. file (default= $SYBASE/server_name.cfg) [-e errorlog_file] ASE server errorlog (default=errorlog) [-m] start server in standalone (single-user) mode; this can be

tested with is_singleusermode() ( p.18) [-M sharedmem_dir] shared memory directory [-i interfaces_file_dir] directory containing interfaces file (default=$SYBASE) [-T traceflag] boot-time traceflags (multiple -T options can be specified) [-a keytab_file] CAPs directive filename [-G logserver_name] specifies a server name for event logging [-g] disables event logging

Page 15: The Complete Sybase ASE Quick Reference Guide

132 The Complete Sybase ASE Quick Reference Guide

[-H] specified when using the High Availability feature (ASE_HA) [-K keytab_file] keytab filename (when using DCE) [-k principal_name ] (15.0.2) server's principal name (used with Kerberos) [-N lic_prop_file] license properties file,dft=ASE-15_0/sysam/srvnm.properties [-P] (Windows) start ASE server with high priority(default=medium) [-p login_name] generates a new random password (printed on the console) for

the specified login (which must have been granted sso_role) [-u role_or_login] unlocks the specified role or login (which must have sa_role

and/or sso_role) [-A role_name] (15.7 ESD#2) list (max.10) unlocked logins with role_name [-n permission] (15.7 ESD#2) list (max.10) unlocked logins with (granular) permission [-q] databases 'created' via quiesce database for external dump

remain offline (so log dumps can be loaded) [-X] start a diagnostic tool known as 'sybmon' [-b sizek|K|m|M|g|G|t|T] (build) size of master device to create [-f[orcebuild]] (build) use with -b, -w and -z to override an existing situation [-w db_name ] (build) rewrites specified database (only master or model) [-z page_sizek|K] (build) server page size (2k, 4k, 8k, or 16k) [-D sizek|K|m|M|g|G] (build) default database size (for model and tempdb) [-Z sizek|K|m|M|g|G] (build) size of master database [-Q |--quorum_dev=device_name](CE) quorum device pathname; required for CE [--instance=instance_name] (CE) instance to be started; required for CE [--buildquorum[=force]] (CE) creates or overwrites a quorum device [-F |--cluster_input=input_file] (CE) cluster config input file for --buildquorum [--cluster_takeover] (CE) allow recovering from cluster failures that left the quorum device in incorrect state ( p.104) [--create_cluster_id] (CE) repairs coupling of quorum + master device [--sbssav] (15.7) displays @@sbssav (ASE version for SAP Business Suite) [--master-key-passwd[=passwd]] (15.7) master key encryption password in master

database (no need for set encryption passwd) diagserver (Windows: diagsrvr.exe) - a diagnostic, but otherwise functionally identi-cal, version of dataserver. Run this only when instructed by Sybase Technical Support. (pre-15.7) monserver (Windows: monsrvr.exe) - Monitor Server -M Mon_server_name name of the Monitor Server -S ASE_server_name name of the ASE server to monitor -U login_name login into the ASE server; also a login into Monitor Server [-P password] password for login_name [-E] don't overwrite an exiting .mrg file [-O] overwrite an exiting .mrg file [-i interfaces_file] interfaces file pathname (default=$SYBASE/interfaces) [-l errorlog_file] Monitor Server errorlog (default=ms.log) [-L config_file] Monitor Server configuration file [-m sharedmem_dir] ASE server shared memory directory [-n max_connections] max. number of client connections to Monitor Server [-p] (Windows only) sets Monitor Server execution priority to high [-T0] Monitor Server does not print ASE error messages [-T1] Monitor Server will not shut down when ASE shuts down (pre-15.7) histserver (Windows: histsrvr.exe) - Historical Server -D home_directory directory containing control file and recorded data files [-S Hist_server_name] name of the Historical Server [-U login_name] Historical Server super-user login (to execute hs_ commands) [-P password] password for super-user login [-i interfaces_file] interfaces file pathname (default=$SYBASE/interfaces) [-l errorlog_file] Historical Server errorlog (default=hs.log) [-n max_connections] max. number of client connections to Historical Server showserver (Unix only) - Displays running servers on the current host; located in $SYBASE/$SYBASE_ASE/install. startserver (Unix only) - starts one or more ASE-, Backup-, or other servers; located in $SYBASE/$SYBASE_ASE/install. [-f RUN_server_file] [-f …] file name of the RUN_servername file; multiple allowed Example: startserver -f RUN_PROD

Page 16: The Complete Sybase ASE Quick Reference Guide

148 The Complete Sybase ASE Quick Reference Guide

Index Legend • Keywords followed by ', sp_' are stored procedures where the sp_ prefix has

been chopped off to make a better reference; for example, addserver, sp_ refers to sp_addserver. This is done for other commands as well; for example checkdb, dbcc refers to dbcc checkdb, and showplan, set to set showplan.

• Keywords followed by (config) are server configuration options, settable with sp_configure. Keywords followed by (DB option) are database options, setta-ble with sp_dboption.

@ @@active_instances......................... 142 @@authmech ............................. 17, 139 @@bootcount ................................... 142 @@boottime ..................................... 142 @@bulkarraysize.............................. 139 @@bulkbatchsize ............................. 139 @@char_convert .............................. 139 @@cis_rpc_handling ........................ 140 @@cis_version ......................... 116, 142 @@client_csexpansion..................... 139 @@client_csid .................................. 139 @@client_csname ............................ 139 @@clusterboottime........................... 142 @@clustercoordid............................. 142 @@clustermode................................ 142 @@clustername................................ 142 @@connections................................ 141 @@cpu_busy.................................... 141 @@curloid ........................................ 140 @@cursor_rows.......................... 51, 140 @@datefirst ................................ 14, 140 @@dbts ............................................ 141 @@error ........................................... 140 @@errorlog....................................... 142 @@fetch_status.......................... 51, 141 @@identity.................................. 36, 140 @@idle ............................................. 141 @@instanceid................................... 142 @@instancename............................. 142 @@io_busy....................................... 141 @@isolation.............................. 121, 140 @@kernelmode .......................... 89, 142 @@langid ......................................... 140 @@language .................................... 140 @@lastkpgendate............................. 142 @@lastlogindate............................... 140 @@lock_timeout ....................... 121, 140 @@logintrigger ........................... 77, 141 @@lwpid............................................. 60 @@max_connections ................. 97, 142 @@max_precision ............................ 142 @@maxcharlen ................................ 140 @@maxpagesize.............................. 142 @@monitors_active .......................... 142 @@ncharsize.................................... 140 @@nestlevel......................... 47, 48, 140 @@nextkpgendate............................ 142 @@nodeid ........................................ 142 @@optgoal ................................. 55, 140 @@options ....................................... 140 @@optlevel................................. 55, 140 @@opttimeoutlimit ...................... 57, 140 @@ospid .......................................... 140

@@pack_received.............................142 @@pack_sent ...................................142 @@packet_errors..............................142 @@pagesize .....................................142 @@parallel_degree...................103, 140 @@plwpid ...........................................60 @@procid....................................48, 140

in a trigger.......................................47 @@qpmode.................................56, 141 @@quorum_physname .....................142 @@recovery_state ....................126, 142 @@repartition_degree.................57, 141 @@resource_granularity .............57, 141 @@rowcount .....................................141

in a cursor.......................................51 in a trigger.......................................47

@@sbssav ................................132, 143 @@scan_parallel_degree..........103, 140 @@servername.................................143 @@setrowcount ..........................54, 141 @@spid.............................................141 @@sqlstatus ...............................51, 141 @@ssl_ciphersuite ............................141 @@stringsize ..............................62, 141 @@sys_tempdbid .......................70, 143 @@system_busy...............................141 @@system_view ...............................104 @@tempdbid...............................70, 141 @@textcolid ........................................25 @@textdataptnid .................................25 @@textdbid.........................................25 @@textobjid ........................................25 @@textptnid ........................................25 @@textptr ...........................................25 @@textptr_parameters................25, 141 @@textsize .........................................25 @@textts.............................................25 @@thresh_hysteresis..................71, 143 @@timeticks..............................102, 143 @@total_errors .................................142 @@total_read....................................142 @@total_write ...................................142 @@tranchained.................................141 @@trancount...............................53, 141 @@transactional_rpc ........................141 @@transtate................................53, 141 @@unicharsize ...................................96 @@user_busy ...................................141 @@version........................................143 @@version_as_integer .....................143 @@version_number ..........................143

A abort tran on log full (DB option) ..........68 abs() ....................................................22

Page 17: The Complete Sybase ASE Quick Reference Guide

ASE versions 15.0, 15.5 & 15.7 149

abstract plan (show) ............................58 abstract plan cache (config)...............128 abstract plan dump (config) ...............127 abstract plan load (config)..................127 abstract plan replace (config).............128 abstract plans ....................................127 abstract query plan .... See abstract plans access rules...................................45, 86 acos() ..................................................23 acronyms used in this book ...................6 activeroles, sp_....................................82 add_qpgroup, sp_..............................128 add_resource_limit, sp_.....................122 add_time_range, sp_ .........................122 addalias, sp_ .......................................81 addauditrecord, sp_...........................124 addaudittable, sp_ .............................124 addengine, sp_ ....................................90 addexeclass, sp_.................................90 addextendedproc, sp_ .......................123 addexternlogin, sp_ ...........................117 addgroup, sp_......................................81 additional network memory (config) .....97 addlanguage, sp_ ................................94 addlogin, sp_ .......................................77 addmessage, sp_ ................................95 addobjectdef, sp_ ..............................119 addremotelogin, sp_ ..........................115 addsegment, sp_ .................................71 addserver, sp_...........................115, 116 addtempdb, dbcc ...............................108 addthreshold, sp_ ................................71 addtype, sp_........................................10 addumpdevice, sp_..............................67 adduser, sp_........................................81 aggregate functions .............................26 all (opposite of distinct) (operator)........27 all (subquery operator).........................29 allocate max shared memory (config) ..87 allocdump, dbcc.................................108 allocinfo().............................................19 allow nested triggers (config), ..............46 allow nulls by default (DB option).........68 allow procedure grouping (config)........47 allow remote access (config) .......72, 115 allow resource limits (config)..............122 allow sendmsg (config) ........................21 allow sql server async i/o (config) ......102 allow updates to system tables (conf) ..97 allow wide dol rows (DB option)...........68 allow_dup_row.....................................40 allpages (lock scheme) ......................120 allrows_dss (optgoal)...........................55 allrows_mix (optgoal)...........................55 allrows_oltp (optgoal)...........................55 alter database

for proxy_update...........................117 log off .............................................68 on, log on........................................68 set [lob_]compression.....................75

alter encryption key..............................37 add encryption..........................37, 38 as default........................................37 drop encryption...............................38 modify encryption ...........................38 modify owner ..................................37 recover encryption ..........................38 regenerate key................................38

alter login.......................................76, 77 alter login profile ..................................80 alter materialized view .........................44

alter precomputed result set ................ 44 alter role .............................................. 82 alter table

add (column) .................................. 31 add constraint .......................... 41, 42 add partition ................................... 34 decrypt ........................................... 38 disable trigger ................................ 46 drop................................................ 32 drop constraint ............................... 42 drop partition .................................. 34 enable trigger ................................. 46 encrypt ........................................... 38 lock .............................................. 120 merge partition ............................... 34 modify ............................................ 32 modify owner.................................. 98 move partition ................................ 34 partition .......................................... 34 partition by ..................................... 33 replace ........................................... 42 set dml_logging.............................. 32 set transfer table ............................ 32 split partition................................... 34 unpartition ...................................... 34

alter thread pool .................................. 89 altermessage, sp_............................... 95 alterws, sp_dbcc_ ............................. 100 and (operator) ..................................... 12 ANSI join ............................................. 30 ansi_permissions, set.......................... 54 ansinull, set ......................................... 54 any (subquery operator) ...................... 29 AP, AQP.....................See abstract plans APL (allpages lock scheme).............. 120 application context .............................. 17 application tracing ......................... 20, 59 archive databases ................... 67, 69, 73 arithabort arith_overflow, set ............... 54 arithabort numeric_truncation, set ....... 54 arithignore, set .................................... 54 ascii() .................................................. 15 ascinserts.................................... 43, 108 ASE editions

Cluster Edition (CE) ..................... 104 Developer Edition......................... 146 Enterprise Edition (EE)................. 146 Express Edition ............................ 146 Small Business Edition (SBE) ...... 146

ASE environment variables ............... 138 ASE licensing.................................... 146 ASE limits.......................................... 145 ASE resources on the Internet .............. 9 asecfg ............................................... 133 asehostname() .................................... 18 asin() ................................................... 23 aspects................................................ 12 async log service (DB option).............. 68 atan()................................................... 23 atn2()................................................... 23 AUDIT PROCESS thread.................. 124 audit queue size (config) ................... 124 audit, sp_ .......................................... 124 audit_event_name() .................... 17, 126 auditing ............................................. 123 auditing (config)................................. 124 auditinit.............................................. 133 authentication method ........17, 76, 78, 80 authmech().......................................... 17 auto identity (DB option)................ 36, 69 auto_temptable_stats, set ................... 56

Page 18: The Complete Sybase ASE Quick Reference Guide

150 The Complete Sybase ASE Quick Reference Guide

autoconnect, sp_ ............................... 118 autoformat, sp_ ................................... 60 automatic cluster takeover (config).... 104 automatic master key access (config).. 39 avg() (aggregate)................................ 26

B background, set................................... 58 Backup Server..................................... 72

in ASE CE .................................... 104 backups (dumps)................................. 71 backupserver..................................... 131 bcksrvr.exe........................................ 131 bcp .................................................... 133 bcp (fast/normal) ............................... 144 bcp (identity columns).......................... 36 begin transaction ................................. 52 begin…end.......................................... 48 between (operator) .............................. 12 biginttohex() ........................................ 11 bind objects to cache, sp_bindcache... 88 bindcache, sp_ .................................... 88 bindefault, sp_..................................... 45 bindexeclass, sp_................................ 90 bindmsg, sp_................................. 42, 95 bindrule, sp_........................................ 45 bintostr() .............................................. 11 bit operators ........................................ 13 block device .................................. 18, 66 break ................................................... 50 buffer pools ......................................... 87 buildmaster........................................ 131 builtin date strings (config)................... 11 builtin_date_strings, set....................... 11 bulk array size, set ............................ 119 bulk batch size, set............................ 119 Business Suite.. See SAP Business Suite bypass recovery ........................ 112, 114 bytes, dbcc ........................................ 108

C cache overhead, with sp_helpcache.... 88 cache partitions ................................... 88 cache wizard (sp_sysmon) .................. 93 cache_usage()..................................... 17 cacheconfig, sp_ ........................... 87, 88 cachedataremove, dbcc .................... 108 cachelets .................See cache partitions cacheremove, dbcc ........................... 108 caches................................................. 87 cachestrategy, sp_ .............................. 88 caching query plans............................. 59 capture missing statistics (config)........ 58 case expression .................................. 48 case-(in)sensitive identifiers ................ 11 cast() ................................................... 11 catalog stored procedures ................. 143 CE .............................See Cluster Edition ceiling()................................................ 22 certificates, SSL .................................. 98 chained, set................................. 53, 135 change ownership

for databases ................................. 69 for objects....................................... 98

change password ................................ 78 changedbowner, sp_ ........................... 69 changegroup, sp_................................ 81

char() ...................................................15 char_convert, set .................................96 char_length()........................................15 character device.............................18, 66 character set

install/change..................95, 134, 137 charindex()...........................................15 charset (utility)....................................134 check (constraint)...........................41, 42 check option, create view…with ...........43 check password for digit (config)..........78 checkalloc, dbcc.................................106 checkcatalog, dbcc ............................106 checkdb, dbcc....................................106 checkindex, dbcc ...............................106 checknames, sp_.................................96 checkpoint............................................53 checkreswords, sp_ .............................60 checksource, sp_.................................61 checkstorage, dbcc ............................106 checktable, dbcc ................................106 checkverify, dbcc ...............................106 chgattribute, sp_ .. 25, 33, 35, 36, 41, 120 ciphertext, set ......................................39 cis bulk insert array size (config) ........119 cis bulk insert batch size (config) .......119 cis connect timeout (config) ...............116 cis hafailover (server option) ..............117 cis idle connection timeout (config) ....116 cis packet size (config).......................119 cis rpc handling (config) .............115, 119 CIS RPCs ..........................................115 CIS(Component Integration Services)116 cis, dbcc.............................................108 cis_rpc_handling, set .................115, 119 cleanpwdchecks, sp_...........................79 cleanup, dbcc tune.............................108 clearpsexe, sp_....................................90 clearstats, sp_......................................98 client cursor .........................................50 client password encrypt...97,116,117,133 client programs ..................................133 client_addr, sp_....................................60 clientapplname, set ..............................58 clienthostname, set ..............................58 clientname, set.....................................58 close ....................................................51 close on endtran, set............................51 Cluster Edition (CE) ...........................104 cluster heartbeat interval (config) .......104 cluster heartbeat retries (config).........104 cluster vote timeout (config) ...............104 cluster, sp_ ........................................104 clustered ........................................40, 41 cmdtext (auditing) ..............................124 cmp_all_qplans, sp_ ..........................128 cmp_qplans, sp_................................128 coalesce() ............................................49 col_length() ..........................................17 col_name()...........................................17 column default cache size (config) .......32 Column encryption ...............................36 column_privileges, sp_.......................143 columns, sp_......................................143 combo (dbccdb exclusions)................100 command.............................................87 command_status_reporting, set .........107 Comment delimiters .............................12 comments ............................................12 commit .................................................52 common.loc (file)..................................14

Page 19: The Complete Sybase ASE Quick Reference Guide

ASE versions 15.0, 15.5 & 15.7 151

commonkey, sp_ ...............................143 compare() ............................................15 compatibility_mode, set .......................56 compatmode, sp_ ................................56 complete_xact, dbcc ..........................107 Component Integration Services(CIS)116 compression info pool size (config)......75 compression memory size (config) ......69 compression, data ...............................75 compute (clause) .................................29 computed column ........................32, 134 concurrency_opt_threshold..................42 config_dump, sp_ ................................74 config_rep_agent, sp_ .......................129 configreport, sp_dbcc_ ......................100 configuration file (config)......................86

recreating .......................................86 Configuration parameters

abstract plan cache ......................128 abstract plan dump .......................127 abstract plan load .........................127 abstract plan replace ....................128 additional network memory.............97 allocate max shared memory..........87 allow nested triggers.......................46 allow procedure grouping ...............47 allow remote access ...............72, 115 allow resource limits .....................122 allow sendmsg................................21 allow sql server async i/o..............102 allow updates to system tables .......97 audit queue size ...........................124 auditing.........................................124 automatic cluster takeover............104 automatic master key access..........39 builtin date strings...........................11 capture missing statistics................58 check password for digit .................78 cis bulk insert array size ...............119 cis bulk insert batch size...............119 cis connect timeout.......................116 cis idle connection timeout............116 cis packet size ..............................119 cis rpc handling..................... 115, 119 cluster heartbeat interval ..............104 cluster heartbeat retries ................104 cluster vote timeout ......................104 column default cache size ..............32 compression info pool size .............75 compression memory size ..............69 configuration file .............................86 cost of a cpu unit ............................57 cost of a logical io ...........................57 cost of a physical io ........................57 cpu grace time..............................102 current audit table.........................124 deadlock retries ............................120 default character set id .............95, 96 default database size......................67 default exp_row_size percent .........43 default fill factor percent..................43 default language id .........................95 default network packet size ............97 default sortorder id....................95, 96 default unicode sortorder ................96 deferred name resolution................58 disable character set conversion ....96 disable disk mirroring......................67 disable varbinary truncation............10 disk i/o structures............................97 displaying non-defaults ...................86

dump on conditions ...................... 130 dynamic allocation on demand....... 87 enable async database init............. 68 enable backupserver HA........ 72, 104 enable cis..................................... 116 enable compatibility mode.............. 56 enable compression ....................... 75 enable concurrent dump tran.......... 74 enable console logging................. 102 enable dump history....................... 74 enable encrypted columns ............. 36 enable file access......................... 118 enable functionality group .............. 59 enable granular permissions .... 81, 85 enable housekeeper GC ................ 94 enable hp posix async i/o ............. 102 enable i/o fencing ......................... 104 enable inline default sharing........... 45 enable java..................................... 62 enable literal autoparam................. 59 enable logins during recovery......... 97 enable merge join........................... 56 enable metrics capture................. 129 enable monitoring........................... 99 enable pci....................................... 62 enable permissive unicode............. 96 enable plan sharing........................ 59 enable predicated privileges........... 84 enable rep agent threads ............. 129 enable row level access ........... 85, 86 enable semantic partitioning........... 33 enable sort-merge joins and JTC ... 57 enable sql debugger..................... 138 enable ssl....................................... 97 enable surrogate processing .......... 96 enable unicode conversions........... 96 enable unicode normalization......... 96 enable xml...................................... 63 enforce dump configuration............ 74 extended cache size ...................... 88 FIPS login password encryption ..... 97 global cache partition number ........ 88 heap memory per user ................. 102 histogram tuning factor................... 92 housekeeper free write percent .... 102 i/o batch size ................................ 102 i/o polling process count............... 102 identity burning set factor ............... 36 identity grab size ............................ 36 identity reservation size.................. 36 idle migration timeout ................... 104 kernel mode ................................... 89 kernel resource memory................. 89 license information ....................... 147 lock address spinlock ratio ........... 102 lock hashtable size....................... 102 lock scheme ................................. 120 lock shared memory..................... 102 lock spinlock ratio......................... 102 lock table spinlock ratio ................ 102 lock wait period ............................ 120 log audit logon failure ................... 102 log audit logon success................ 102 max buffers per lava operator......... 55 max cis remote connections......... 116 max concurrently recovered db .... 126 max memory .................................. 87 max native threads per engine ....... 89 max nesting level ........................... 97 max network packet size ................ 97 max number network listeners........ 98

Page 20: The Complete Sybase ASE Quick Reference Guide

152 The Complete Sybase ASE Quick Reference Guide

max online engines ........................ 89 max parallel degree...................... 103 max query parallel degree ............ 103 max repartition degree ................... 57 max resource granularity ................ 57 max scan parallel degree ............. 103 max transfer history........................ 31 maximum dump conditions........... 130 maximum failed logins.................... 78 memory .......................................... 87 memory dump compression level . 130 metrics elap max .......................... 129 metrics exec max ......................... 129 metrics lio max ............................. 129 metrics pio max ............................ 129 min pages for parallel scan........... 103 minimum password length.............. 78 net password encryption reqd ........ 97 network polling mode ..................... 89 non-defaults ................................... 86 number of alarms ........................... 50 number of aux scan descriptors...... 42 number of backup connections....... 74 number of checkpoint tasks.......... 126 number of devices .......................... 66 number of disk tasks ...................... 89 number of dump threads .............. 130 number of engines at startup.......... 89 number of histogram steps ............. 92 number of java sockets................... 62 number of large i/o buffers.............. 97 number of locks ............................ 120 number of mailboxes .................... 103 number of messages.................... 103 number of network tasks ................ 89 number of open databases............. 87 number of open indexes ................. 87 number of open objects .................. 87 number of open partitions............... 87 number of pre-allocated extents ... 144 number of remote connections ..... 116 number of remote logins............... 116 number of remote sites................. 116 number of sort buffers .................. 103 number of user connections ........... 97 number of worker processes ........ 103 o/s file descriptors .......................... 97 open index hash spinlock ratio ..... 102 open index spinlock ratio .............. 102 open object spinlock ratio ............. 102 optimization goal ............................ 55 optimization timeout limit ................ 57 optimizer level ................................ 55 page lock promotion HWM ........... 122 page lock promotion LWM............ 122 page lock promotion PCT............. 122 partition spinlock ratio................... 102 pci memory size ............................. 62 print deadlock information ............ 120 procedure cache percent................ 87 procedure cache size ..................... 87 procedure deferred compilation...... 55 prod-consumer overlap factor....... 103 quorum heartbeat interval............. 104 quorum heartbeat retries .............. 104 quoted identifier enhancements...... 12 read committed with lock .............. 120 remote server pre-read packets.... 116 restricted decrypt permission.......... 40 row lock promotion HWM ............. 122 row lock promotion LWM.............. 122

row lock promotion PCT................122 runnable process search count .......89 sampling percent.............................92 select for update .............................55 send doneinproc tokens................102 session migration timeout .............105 session tempdb log cache size .....102 shared memory starting address...102 size of auto identity column (config)36 size of global fixed heap .................62 size of process object heap.............62 size of shared class heap................62 sproc optimize timeout limit.............57 sql server clock tick length ....102, 143 stack guard size............................102 stack size......................................102 start xp server during boot ............123 statement cache size ......................59 streamlined dynamic SQL...............55 suspend audit when device full .....124 syb_sendmsg port number..............21 sysstatistics flush interval................92 systemwide password expiration.....78 tcp no delay ..................................102 text prefetch size.............................25 time slice.......................................102 total data cache size .......................87 total logical memory ........................87 total memory ...................................87 total physical memory .....................87 transfer utility memory size .............31 update statistics hashing.................92 user log cache size .......................102 user log cache spinlock ratio.........102 workload manager cache size.......105 xp_cmdshell context .....................123

Configuration parameters, advanced .102 configure, sp_ ......................................86 Configuring CIS..................................116 Configuring parallel processing..........103 Configuring RPCs ..............................115 connect to ..........................................118 connection, reserved for DBA ..............97 Constraints...........................................41 continue ...............................................50 convert()...............................................11 convert(), for date/time formatting ........14 copy_all_qplans, sp_ .........................128 copy_qplan, sp_.................................128 cores, using multiple ............................88 corrupt, dbcc ......................................109 cos().....................................................23 cost factors, query plan........................57 cost of a cpu unit (config) .....................57 cost of a logical io (config)....................57 cost of a physical io (config).................57 cot() .....................................................23 count[_big]() (aggregate).....................26 count[_big](*) (aggregate) ...................26 countmetadata, sp_ .............................86 cpu grace time (config).......................102 cpuaffinity, dbcc tune .........................108 cpuinfo (license manager)..................146 CPUs, using multiple............................88 create access rule..........................45, 86 create database ...................................67

for proxy_update...........................117 in-memory (IMDB)...........................68 RDDB .............................................68 temporary database ........................70

create default .......................................45

Page 21: The Complete Sybase ASE Quick Reference Guide

ASE versions 15.0, 15.5 & 15.7 153

create encryption key...........................36 dual control.....................................37 master key................................37, 40

create existing table...........................118 create function .....................................48

Java functions.................................62 create index.........................................40 create login..........................................76 create login profile ...............................80 create manifest file...............................75 create materialized view ......................44 create plan.........................................127 create precomputed result set .............44 create procedure .................................47

Java procedures .............................62 create procedure...as external name .123 create proxy_table .............................118 create role ...........................................82 create rule ...........................................45 create schema authorization.... 33, 44, 84 create table..........................................31

CIS ...............................................119 create existing table......................118 create proxy_table ........................118 encryption.......................................38 RI constraints..................................41

create temporary database..................70 create thread pool................................89 create trigger .......................................46 create view ..........................................43 create_locator() ...................................26 createws, sp_dbcc_...........................100 current audit table (config) .................124 current_bigdatetime()...........................13 current_bigtime() .................................13 current_date() ......................................13 current_time() ......................................13 cursor rows, set ...................................51 cursorinfo, sp_ .....................................51 cursors.................................................50 cursors, update/delete .........................51 curunreservedpgs()..............................17

D data compression ................................75 data transfer utility (DTU).....................31 data_pages() .......................................17 data_pgs() ...........................................17 database devices.................................66 database dump....................................72

create .............................................72 restore ............................................73

Database options abort tran on log full ........................68 allow nulls by default.......................68 allow wide dol rows.........................68 async log service ............................68 auto identity ..............................36, 69 dbo use only ...................................69 ddl in tran........................................69 deferred table allocation .................69 delayed commit ........................31, 69 enforce dump tran sequence ..69, 144 full logging for all.....................69, 144 full logging for alter table.........69, 144 full logging for reorg rebuild ....69, 144 full logging for select into ........69, 144 identity in nonunique index .......36, 69 no chkpt on recovery ......................69

no free space acctg........................ 69 read only ........................................ 69 select into/bulkcopy/pllsort ............. 69 single user...................................... 69 trunc log on chkpt........................... 69 unique auto_identity index........ 36, 69

database recovery............................. 126 database timestamp.........See timestamp database users.................................... 80 databases ........................................... 67 databases, sp_.................................. 143 datachange() ................................. 17, 92 datalength()......................................... 17 data-only lock schemes..................... 120 datapages (lock scheme) .................. 120 datarows (lock scheme) .................... 120 dataserver ......................................... 131 datatype conversion functions ............. 11 datatype_info, sp_............................. 143 datatypes ............................................ 10 dateadd()............................................. 14 datediff().............................................. 13 datefirst, set......................................... 14 dateformat, set .................................... 14 datename().......................................... 13 datepart() ............................................ 13 day().................................................... 13 db_attr() .............................................. 17 db_id()................................................. 17 db_instanceid()............................ 70, 105 db_name()........................................... 17 db_recovery_status()......................... 105 DBA tasks ............................................. 9 DBA tools ............................................ 98 dbcacheremove, dbcc ....................... 108 dbcc addtempdb................................ 108 dbcc allocdump ................................. 108 dbcc bytes......................................... 108 dbcc cachedataremove ..................... 108 dbcc cacheremove ............................ 108 dbcc checkalloc................................. 106 dbcc checkcatalog............................. 106 dbcc checkdb .................................... 106 dbcc checkindex................................ 106 dbcc checkstorage ............................ 106 dbcc checktable ................................ 106 dbcc checkverify................................ 106 dbcc cis ............................................. 108 dbcc commands

supported ..................................... 106 unsupported ................................. 108

dbcc complete_xact........................... 107 dbcc corrupt ...................................... 109 dbcc dbcacheremove ........................ 108 dbcc dbinfo........................................ 109 dbcc dbreboot ................................... 109 dbcc dbrecover.................................. 109 dbcc dbrepair ............................ 107, 109 dbcc dbtable...................................... 109 dbcc delete_dol_page ....................... 109 dbcc deleteplan ................................. 109 dbcc des............................................ 109 dbcc extentcheck .............................. 110 dbcc extentdump............................... 110 dbcc extentzap.................................. 110 dbcc findnotfullextents....................... 110 dbcc fix_al ......................................... 110 dbcc fix_page.................................... 110 dbcc fix_text ...................................... 107 dbcc forget_xact................................ 107 dbcc gam .......................................... 110

Page 22: The Complete Sybase ASE Quick Reference Guide

154 The Complete Sybase ASE Quick Reference Guide

dbcc help........................................... 108 dbcc ides ........................................... 109 dbcc indexalloc.................................. 107 dbcc istraceon ................................... 110 dbcc listoam ...................................... 110 dbcc locateindexpgs.......................... 110 dbcc lock ........................................... 110 dbcc log............................................. 110 dbcc logprint ...................................... 111 dbcc memdump................................. 111 dbcc memusage ................................ 111 dbcc monitor...................................... 111 dbcc nodetraceoff...................... 105, 113 dbcc nodetraceon...................... 105, 113 dbcc object_atts .......................... 36, 111 dbcc object_stats............................... 111 dbcc orphantables ............................. 111 dbcc page.......................................... 111 dbcc pglinkage .................................. 111 dbcc pravailabletempdbs................... 111 dbcc printolog.................................... 111 dbcc prlobcache .................................. 26 dbcc proc_cache ............................... 111 dbcc proc_cacherm ........................... 111 dbcc procbuf...................................... 111 dbcc prsqlcache .................................. 60 dbcc prtipage..................................... 112 dbcc pss ............................................ 112 dbcc purgesqlcache ............................ 60 dbcc quorum...................................... 105 dbcc rebuild_log ................................ 112 dbcc rebuild_text ............................... 107 dbcc rebuildextents ........................... 112 dbcc refreshides ................................ 112 dbcc refreshpdes............................... 112 dbcc reindex...................................... 107 dbcc report_al.................................... 112 dbcc resource.................................... 112 dbcc save_rebuild_log....................... 112 dbcc serverlimits................................ 112 dbcc set_identity_burn_max.............. 112 dbcc set_scope_in_cluster ................ 105 dbcc settrunc..................................... 107 dbcc showrecovery............................ 112 dbcc sqltext ....................................... 112 dbcc sqtprint ...................................... 112 dbcc stacktrace ................................. 112 dbcc stackused.................................. 112 dbcc tablealloc................................... 107 dbcc textalloc..................................... 107 dbcc thresholds ................................. 113 dbcc traceflags .......................... 112, 113 dbcc traceoff...................................... 107 dbcc traceon...................................... 107 dbcc tune........................................... 108 dbcc upgrade_object ......................... 113 dbcc usedextents .............................. 113 dbcc user_stats ................................. 113 dbcc xls ............................................. 113 dbcc_alterws, sp_.............................. 100 dbcc_configreport, sp_ ...................... 100 dbcc_createws, sp_........................... 100 dbcc_deletedb, sp_ ........................... 100 dbcc_deletehistory, sp_..................... 100 dbcc_differentialreport, sp_ ............... 100 dbcc_evaluatedb, sp_........................ 100 dbcc_exclusions, sp_ ........................ 100 dbcc_faultreport, sp_......................... 100 dbcc_fullreport, sp_ ........................... 101 dbcc_help_fault, sp_.......................... 101 dbcc_patch_finishtime, sp_ ............... 101

dbcc_recommendations, sp_ .............101 dbcc_runcheck, sp_ ...........................101 dbcc_statisticsreport, sp_...................101 dbcc_summaryreport, sp_..................101 dbcc_updateconfig, sp_ .....................101 dbccalt ...............................................100 dbccdb stored procedures..................100 dbccdb, Setting up ...............................99 dbextend, sp_ ......................................71 dbinfo, dbcc .......................................109 dbinfo_get()..........................................20 dbisql .................................................134 dbo (DB user) ......................................80 dbo use only (DB option)......................69 dboption, sp_ .......................................68 dbreboot, dbcc ...................................109 dbrecover, dbcc .................................109 dbrecovery_order, sp_ .......................126 dbremap, sp_.....................................107 dbrepair, dbcc ....................................109 dbtable, dbcc .....................................109 dbts() .................................................141 ddl in tran (DB option) ..........................69 ddlgen................................................134 deadlock information, print (config) ....120 deadlock retries (config).....................120 deadlock, client error 1205.................120 dealloc_first_txtpg ..........................25, 43 deallocate cursor..................................51 deallocate locator.................................26 debugger (for SQL) ............................138 declare.................................................49 declare (cursors) ..................................50 decrypt (permission) ......................40, 83 decrypt_default ....................................38 default character set id (config) ......95, 96 default database size (config) ..............67 default exp_row_size percent (config)..43 default fill factor percent (config) ..........43 default language id (config)..................95 default network packet size (config) .....97 default sortorder id (config) ............95, 96 default unicode sortorder (config).........96 defaultloc, sp_....................................117 defaults ................................................45

sharing............................................45 deferred compilation ............................55 deferred name resolution (config) ........58 deferred table allocation (DB option)....69 deferred_allocation ........................31, 69 deferred_name_resolution, set.............58 defncopy ............................................135 degrees() .............................................23 delayed commit (DB option)...........31, 69 delayed_commit, set ......................55, 69 delete...................................................30 delete (cursors) ....................................51 delete shared statistics.........................92 delete statistics ....................................92 delete where current of ........................51 delete_dol_page, dbcc.......................109 deleted (trigger table) ...........................46 deletedb, sp_dbcc_............................100 deletehistory, sp_dbcc_ .....................100 deleteplan, dbcc.................................109 density (statistics) ..........................91, 92 depends, sp_ .......................................60 derived table ........................................28 derived_stat() .......................................17 des, dbcc ...........................................109 des_bind, dbcc tune...........................108

Page 23: The Complete Sybase ASE Quick Reference Guide

ASE versions 15.0, 15.5 & 15.7 155

des_greedyalloc, dbcc tune ...............108 des_unbind, dbcc tune.......................108 Developer Edition ..............................146 deviceattr, sp_ .....................................67 deviochar, dbcc tune..........................108 diagnostic utility (sybdiag)..................137 diagserver..........................................132 diagsrvr.exe .......................................132 difference() ..........................................16 differentialreport, sp_dbcc_................100 directio.................................................67 dirty reads..........................................121 disable character set conversion (conf)96 disable disk mirroring (config) ..............67 disable varbinary truncation (config) ....10 disconnect .........................................118 disk i/o structures (config) ....................97 disk init ................................................66 disk mirror............................................67 disk refit ...............................................66 disk reinit .............................................66 disk remirror.........................................67 disk resize ...........................................66 disk unmirror........................................67 diskdefault, sp_....................................66 displayaudit, sp_................................124 displaylevel, sp_ ..................................86 displaylogin, sp_ ..................................77 displayroles, sp_..................................82 distinct (operator)...........................26, 27 dml_logging, set ..................................55 DOL (data-only lock schemes)...........120 domain rule..........................................45 done-in-proc network packets.... 102, 113 doneinproc, dbcc tune .......................108 downgrade, sp_ ...................................97 download, IQ software and ESDs ..........8 drop database......................................68 drop default..........................................45 drop encryption key .............................37 drop function........................................48

Java functions.................................62 drop index............................................41 drop login.............................................77 drop login profile ..................................80 drop materialized view .........................44 drop partition.....................See alter table drop precomputed result set ................44 drop procedure ....................................47

Java procedures .............................62 drop role ..............................................82 drop rule ..............................................45 drop table ....................................31, 119 drop thread pool ..................................89 drop trigger ..........................................46 drop view .............................................44 drop_qpgroup, sp_.............................128 drop_resource_limit, sp_ ...................123 drop_time_range, sp_........................122 dropalias, sp_ ......................................81 dropdevice, sp_ ...................................67 dropengine, sp_...................................90 dropexeclass, sp_................................90 dropextendedproc, sp_ ......................123 dropexternlogin, sp_ ..........................117 dropglockpromote, sp_ ......................122 dropgroup, sp_ ....................................81 dropkey, sp_......................................143 droplanguage, sp_...............................94 droplogin, sp_......................................77 dropmessage, sp_ ...............................95

dropobjectdef, sp_............................. 119 dropremotelogin, sp_......................... 115 droprowlockpromote, sp_ .................. 122 dropsegment, sp_ ............................... 71 dropserver, sp_ ......................... 115, 117 dropthreshold, sp_ .............................. 71 droptype, sp_ ...................................... 11 dropuser, sp_ ...................................... 81 dscp .................................................. 131 dsedit ................................................ 131 dsync................................................... 67 dtm_tm_role ........................................ 81 DTU (data transfer utility) .................... 31 dual control (for encryption keys) ........ 37 dual master encryption key............ 37, 40 dump configuration.............................. 74 dump database ................................... 72 dump devices...................................... 66 dump history........................................ 74 dump on conditions (config) .............. 130 dump transaction

with no_log..................................... 73 with no_truncate............................. 73 with standby_access ...................... 72 with truncate_only .......................... 72

dump, password-protected.................. 72 dump_history, sp_............................... 74 dumping & loading databases ............. 71 dumpoptimize, sp_ .............................. 74 dynamic allocation on demand (config)87 dynamic ownership chain .............. 47, 49 dynamic SQL (execute immediate)...... 49

E EBF installation override ................... 139 EE ........................ See Enterprise Edition elapsed_time (resource limit) ............ 122 electronic code samples........................ 7 empty string......................................... 16 enable async database init (config) ..... 68 enable backupserver HA (config) 72, 104 enable cis (config) ............................. 116 enable compatibility mode (config) ...... 56 enable compression (config) ............... 75 enable concurrent dump tran (config).. 74 enable console logging (config)......... 102 enable dump history (config) ............... 74 enable encrypted columns (config)...... 36 enable file access (config)................. 118 enable functionality group (config)....... 59 enable granular permissions (config)... 85 enable granular permissions(conf) ...... 81 enable housekeeper GC (config)......... 94 enable hp posix async i/o (config) ..... 102 enable i/o fencing (config) ................. 104 enable inline default sharing (config), .. 45 enable java (config) ............................. 62 enable literal autoparam (config) ......... 59 enable login redirection (server opt) .. 105 enable logins during recovery (config). 97 enable merge join (config)................... 56 enable metrics capture (config) ......... 129 enable monitoring (config)................... 99 enable pci (config)............................... 62 enable permissive unicode (config) ..... 96 enable plan sharing (config) ................ 59 enable rep agent threads (config)...... 129 enable row level access (config) ... 85, 86 enable semantic partitioning (config) ... 33

Page 24: The Complete Sybase ASE Quick Reference Guide

156 The Complete Sybase ASE Quick Reference Guide

enable sort-merge joins and JTC(conf) 57 enable sql debugger (config) ............. 138 enable ssl (config) ............................... 97 enable surrogate processing (config)... 96 enable unicode conversions (config) ... 96 enable unicode normalization (config) . 96 enable xml (config) .............................. 63 encryption............................................ 36

column encryption .......................... 36 login passwords...... 97, 116, 117, 133 SSL ................................................ 98

encryption key ..................................... 36 automatic/unattended start . 37, 38, 39 dual control............................... 37, 40 key copies ...................................... 37 master key................................ 37, 40 master key startup file .................... 38 password recovery ................... 37, 38

encryption passwd, set ........................ 38 encryption, sp_.................................... 39 enforce dump configuration (config) .... 74 enforce dump tran seq. (DB opt) . 69, 144 engine groups................................ 89, 90 engine, process/thread ID ................. 140 engine, sp_.......................................... 89 enlarge a database.............................. 68 Enterprise Edition (EE) ...................... 146 environment variables ....................... 138 errata..................................................... 7 errorlog, sp_ ........................................ 97 escape, with like operator.................... 13 essential DBA tasks............................... 9 estspace, sp_ ...................................... 33 evaluatedb, sp_dbcc_........................ 100 exclusion list (dbccdb) ....................... 100 exclusions, sp_dbcc_ ........................ 100 exec(), execute() ................................. 49 exec, execute ................................ 47, 49 execute cursor..................................... 50 execute immediate (dynamic SQL)...... 49 execution classes ................................ 90 exists (subquery operator)................... 29 exp() .................................................... 22 exp_row_size .......................... 31, 32, 43 expand a database.............................. 68 export_options, set .............................. 59 export_qpgroup, sp_.......................... 128 Express Edition ................................. 146 extended cache size (config) ............... 88 extendsegment, sp_ ............................ 71 extentcheck, dbcc.............................. 110 extentdump, dbcc .............................. 110 extentzap, dbcc ................................. 110 extractjava................................... 63, 135 extrapwdchecks, sp_........................... 79 extrjava........................................ 63, 135

F familylock, sp_................................... 120 FAQ for Sybase..................................... 9 fast bcp.............................................. 144 faultreport, sp_dbcc_......................... 100 fetch .................................................... 51 fillfactor.......................................... 41, 43 findnotfullextents, dbcc ...................... 110 fine-grain access control

access rules ................................... 85 predicated privileges ...................... 84

FIPS login password encryption(conf) . 97

fipsflagger, set .............................59, 135 fix_al, dbcc.........................................110 fix_page, dbcc....................................110 fix_text, dbcc......................................107 fixindex, sp_.......................................109 fkeys, sp_...........................................143 floor() ...................................................22 flushmessage, set ................................59 flushstats, sp_......................................92 fmtonly, set ..........................................54 for browse ............................................29 for read only (cursors) ..........................29 for update (cursors)..............................29 for xml (select…for xml) .................29, 63 for xml [all|schema] (select...for xml) ....63 forceonline_db, sp_............................126 forceonline_object, sp_ ......................127 forceonline_page, sp_........................126 forceplan, set .......................................56 forcing an index....................................28 foreign key (constraint)...................41, 42 foreignkey, sp_...................................143 forget_xact, dbcc................................107 forsqlcreatej .........................................65 forsqlinsertj ..........................................65 forsqlscriptj...........................................65 forxmldtdj .............................................65 forxmlj ..................................................65 forxmlschemaj......................................65 from (clause)........................................28 full backup (database dump)................72 full logging for all (DB option) ........69,144 full logging for alter table (DB opt).69,144 full logging for reorg rebui(DB opt) 69,144 full logging for select into (DB opt) 69,144 fullreport, sp_dbcc_............................101 function index...............................40, 134 functions

Java functions.................................62 SQL functions .................................48

G gam, dbcc ..........................................110 garbage collection (housekeeper) ........94 get_appcontext() ............................17, 18 get_internal_date()...............................13 getdate() ..............................................13 getdevicetype() ....................................18 getmessage, sp_..................................95 getutcdate()..........................................13 global cache partition number (config) .88 global login trigger................................77 global variables

server-wide, non-static variables...141 server-wide, static variables..........142 session-specific variables .............139

GMT time, getutcdate() ........................13 goto......................................................49 grant (command permissions)..............83 grant (encryption).................................39 grant (object permissions)....................83 grant dbcc ............................................84 grant default permissions .....................84 grant role........................................82, 84 grant…with grant option.................83, 84 granular permissions......................81, 85 group by (clause) .................................28 guest (DB user)..............................80, 81 GUID - newid() .....................................22

Page 25: The Complete Sybase ASE Quick Reference Guide

ASE versions 15.0, 15.5 & 15.7 157

H ha_role ................................................81 has_role() ......................................23, 83 hash partitioning ..................................34 hash() ..................................................23 hash_join, set ......................................56 hashbytes()..........................................22 hashing

built-in functions........................22, 23 hashing, for update statistics ...............92 having (clause) ....................................28 heap memory per user (config)..........102 help, dbcc ..........................................108 help, sp_........................................11, 60 help_fault, sp_dbcc_..........................101 help_qpgroup, sp_.............................128 help_rep_agent, sp_..........................129 help_resource_limit, sp_....................123 helpapptrace, sp_ ................................59 helpartition, sp_ ...................................33 helpcache, sp_ ....................................88 helpcomputedcolumn, sp_...................33 helpconfig, sp_ ....................................86 helpconstraint, sp_...............................42 helpdb, sp_..........................................69 helpdevice, sp_....................................67 helpextendedproc, sp_ ......................123 helpexternlogin, sp_...........................117 helpgroup, sp_.....................................81 helpindex, sp_ .....................................41 helpjava, sp_ .......................................62 helpjoins, sp_.....................................143 helpkey, sp_ ......................................143 helplanguage, sp_ ...............................94 helplog, sp_ .........................................69 helpmaplogin, sp_ ...............................78 helpobjectdef, sp_ .............................119 helpremotelogin, sp_ .........................116 helprotect, sp_ ...............................82, 84 helpsegment, sp_ ................................71 helpserver, sp_ .......................... 115, 117 helpsort, sp_........................................96 helptext, sp_ ........................................61 helpthread, sp_....................................89 helpthreshold, sp_ ...............................71 helpuser, sp_.......................................81 hextobigint().........................................11 hextoint() .............................................11 hidetext, sp_ ........................................61 histogram tuning factor (config) ...........92 Historical Server ................................144 histserver...........................................132 histsrvr.exe ........................................132 HK CHORES thread ..........................102 HK GC thread..............................94, 102 HK WASH thread...............................102 holdlock .............................................121 host_id() ..............................................18 host_name() ........................................18 housekeeper free write percent(conf) 102 HOUSEKEEPER thread ....................102

I i/o batch size (config).........................102 I/O fencing .........................................104 i/o polling process count (config) .......102 identifiers .............................................11 identity ...........................................32, 35

identity burning set factor (config) ....... 36 identity columns .................................. 35 identity grab size (config) .................... 36 identity in nonunique index(DB opt)36, 69 identity reservation size (config) .......... 36 identity() ........................................ 18, 35 identity_burn_max (sp_chgattribute) ... 36 identity_burn_max()....................... 18, 35 identity_gap

create table .................................... 35 select…into .................................... 35 sp_chgattribute............................... 36

identity_insert, set ............................... 35 identity_update, set ............................. 35 ides, dbcc.......................................... 109 idle migration timeout (config) ........... 104 if .......................................................... 49 ignore_dup_key................................... 40 ignore_dup_row .................................. 40 image/text data.................................... 24 IMDB............................................... 6, 68 import_qpgroup, sp_ ......................... 128 in (operator)......................................... 12 in (subquery operator) ......................... 29 in row columns .............................. 24, 32

in-row LOB..................................... 24 incremental backup (log dump) ........... 72 index, forcing....................................... 28 index, function ..................................... 40 index_col() .................................... 18, 41 index_colorder() ............................ 18, 41 index_name() ................................ 18, 41 indexalloc, dbcc................................. 107 indexes................................................ 40 indsuspect, sp_ ................................... 96 inline default sharing ........................... 45 inline view ....................See derived table in-memory database (IMDB) ............... 68 ins_syn_sql ......................................... 99 insert...select ....................................... 30 insert...values...................................... 30 inserted (trigger table) ......................... 46 inssynsq .............................................. 99 install java (command) ........................ 62 INSTALL_ALL_PATCH ..................... 139 installdbextend .................................... 71 installjava (utility)......................... 62, 136 installjsdb .......................................... 129 installmaster, instmstr.......................... 99 installmontables .................................. 99 installpcidb .......................................... 62 installpubs3, instpbs3.......................... 99 installsecurity, instsecu...................... 124 instance, in ASE CE.......................... 104 instance_id()...................................... 106 instance_name() ............................... 106 instead-of-trigger (on a view)............... 46 instjava (utility) ............................ 62, 136 interfaces file ..................................... 131 International Sybase User Group .......... 9 inttohex() ............................................. 11 io_cost (resource limit) ...................... 122 IP address

of a client.................................. 20, 60 of the ASE server ........................... 98

is_quiesced()................................. 18, 75 is_sec_service_on() ............................ 18 is_singleusermode() ............................ 18 isdate() ................................................ 15 isnull() ................................................. 24 isnumeric() .......................................... 15

Page 26: The Complete Sybase ASE Quick Reference Guide

158 The Complete Sybase ASE Quick Reference Guide

isolation level (transactions ................. 20 isolation level (transactions) .............. 121 isql..................................................... 135 isql subcommands............................. 136 istraceon, dbcc .................................. 110 ISUG ..................................................... 9

J Java in ASE......................................... 61 jisql.................................................... 136 job scheduler ..................................... 129 join transitive closure (jtc) .................... 57 join, ANSI ............................................ 30 join, outer ............................................ 30 joins..................................................... 29 jreconfig, sp_....................................... 62 js_admin_role ...................................... 81 js_client_role ....................................... 81 js_user_role......................................... 81 jsagent............................................... 129 jtc, set.................................................. 57

K keep count................................. 108, 109 kernel mode (config)............................ 89 kernel resource memory (config) ......... 89 key copies, of encryption key............... 37 keycustodian_role ............................... 82 kill........................................................ 96

L langinst.............................................. 136 langinstall .......................................... 136 language cursor................................... 50 language, set....................................... 95 languages & messages ....................... 94 last login, keep track of.................. 78, 79 lc_id() ................................................ 106 lc_name() .......................................... 106 lct_admin() .......................................... 19 LDAP................................................. 131 left() ..................................................... 15 len()..................................................... 15 license information (config)................ 147 license options & keys ....................... 146 license_enabled() ........................ 19, 147 like (operator) ...................................... 13 limits of ASE...................................... 145 line continuation character (\) .............. 12 list partitioning ..................................... 34 list_appcontext() .................................. 19 listener, sp_......................................... 98 listoam, dbcc ..................................... 110 listsuspect_db, sp_............................ 126 listsuspect_object, sp_ ...................... 126 listsuspect_page, sp_........................ 126 literal autoparam............................ 20, 59 literal_autoparam, set .......................... 60 lmconfig,sp_ ...................................... 146 lmutil (license manager) .................... 146 load database...................................... 73 load transaction ................................... 73 LOB data (text/image) ......................... 24 LOB locators.................................. 10, 25 LOB variables................................ 10, 24 local index ........................................... 40

local system tempdb ............................70 locateindexpgs, dbcc .........................110 locator, LOB...................................10, 25 locator_literal() .....................................26 locator_valid() ......................................26 lock

for data/tables ...............................120 for logins, with sp_locklogin ............78

lock address spinlock ratio (config) ....102 lock hashtable size (config)................102 lock nowait .........................................121 lock nowait, set ..................................121 lock promotion ...................................121 lock roles, display.................................82 lock scheme (config) ..........................120 lock shared memory (config)..............102 lock spinlock ratio (config)..................102 lock table............................................121 lock table spinlock ratio (config) .........102 lock wait period (config) .....................120 lock wait, set ......................................121 lock, dbcc...........................................110 lock, sp_.............................................120 locking ...............................................120 locklogin, sp_ .......................................78 lockscheme() ...............................19, 120 log audit logon failure (config) ............102 log audit logon success (config) .........102 log dump..............................................72

create..............................................72 restore ............................................73

log() .....................................................22 log, dbcc ............................................110 log10() .................................................22 logarithm..............................................22 logbulkcopy, set .................................144 logdevice, sp_......................................69 logical cluster .............................104, 106 logical keys ........................................143 logical operators...................................12 logical process manager ......................90 login (ASE server user) ........................76

change password............................78 locking/unlocking.............................78

login password encrypt ...97,116,117,133 login profile ..........................................80 login script......................See login trigger login trigger

global ..............................................77 login-specific ...................................77

logintrigger, sp_ ...................................77 logiosize, sp_ .......................................69 logprint, dbcc .....................................111 long strings (multiple lines)...................12 lower()..................................................15 lprofile_id() ...........................................80 lprofile_name() .....................................80 lru.........................................................28 ltrim() ...................................................15

M makesuspect_obj, sp_ .......................127 manifest file..........................................75 maplogin, sp_ ......................................78 master encryption key....................37, 40 master key startup file..............37, 38, 39 materialized view .................................44 materialized_view_optimization, set.....45 mathematical functions ........................22

Page 27: The Complete Sybase ASE Quick Reference Guide

ASE versions 15.0, 15.5 & 15.7 159

max buffers per lava operator (config) .55 max cis remote connections (config)..116 max concurrently recovered db(conf).126 max memory (config) ...........................87 max native threads per engine (config) 89 max nesting level (config) ....................97 max network packet size (config).........97 max number network listeners (conf.) ..98 max online engines (config) .................89 max parallel degree (config) ..............103 max query parallel degree (config).....103 max repartition degree (config) ............57 max resource granularity (config) ........57 max scan parallel degree (config) ......103 max transfer history (config) ................31 max() (aggregate) ...............................26 max_rows_per_page .....................41, 43 maximum...........................................130 maximum dump conditions (config) ...130 maximum failed logins (config) ............78 maxwritedes, dbcc tune .....................108 md5 .....................................................22 MDA tables..........................................98 memdump, dbcc ................................111 memory (config)...................................87 memory dump compress.level (conf) .130 memusage, dbcc ...............................111 merge (statement) ...............................31 merge join......................................56, 57 merge partition..................See alter table merge_dup_inline_default, sp_............45 merge_join, set ....................................56 messaging_role ...................................82 metrics elap max (config)...................129 metrics exec max (config) ..................129 metrics lio max (config)......................129 metrics pio max (config).....................129 metrics, sp_ .......................................129 metrics_capture, set ..........................129 migrate_instance_id() ........................106 migration tool (sybmigrate) ................138 min pages for parallel scan config) ....103 min() (aggregate)................................27 minimally logged DML 31, 32, 55, 68, 144 minimally logged operations ..............144 minimum password length (config) ......78 mirroring, devices ................................67 missing statistics..................................58 modify owner

for databases..................................69 for objects.......................................98

modify_resource_limit, sp_ ................123 modify_time_range, sp_ ....................122 modifylogin, sp_.......................77, 82, 94 modifystats, sp_...................................92 modifythreshold, sp_............................71 modulo, % (operator) ...........................12 mon_role .............................................81 mon_stateful_history, set.....................99 Monitor Server ...................................144 monitor, dbcc .....................................111 monitor, sp_.........................................61 monitorconfig, sp_ ...............................87 monitoring tables .................................98 monserver .........................................132 monsrvr.exe.......................................132 month() ................................................13 mount database...................................75 move partition ...................See alter table mru ......................................................28 mut_excl_roles() ............................23, 83

N named caches..................................... 87 navigator_role ..................................... 82 negotiated logins (server option) ....... 117 net password encryption (server opt) 116, 117 net password encryption reqd (config). 97 NETWORK HANDLER thread............. 98 network polling mode (config).............. 89 newid() ................................................ 22 newline character .......................... 12, 15 next_identity()................................ 19, 35 nl_join, set........................................... 56 no chkpt on recovery (DB option) ........ 69 no free space acctg (DB option) .......... 69 nocount, set ........................................ 59 nodata, set .......................................... 54 node, in ASE CE ............................... 104 nodetraceoff, dbcc..................... 105, 113 nodetraceon, dbcc..................... 105, 113 noexec, set.......................................... 54 noholdlock......................................... 121 nonclustered.................................. 40, 41 non-default config parameters............. 86 not (operator) ...................................... 12 nullif() .................................................. 49 number of alarms (config) ................... 50 number of aux scan descrip. (conf) ..... 42 number of backup connections (config)74 number of checkpoint tasks (config) .. 126 number of devices (config) .................. 66 number of disk tasks (config)............... 89 number of dump threads (config) ...... 130 number of engines at startup (config) .. 89 number of histogram steps (config) ..... 92 number of java sockets (config)........... 62 number of large i/o buffers (config)...... 97 number of locks (config) .................... 120 number of mailboxes (config) ............ 103 number of messages (config) ............ 103 number of network tasks (config) ........ 89 number of open databases (config) ..... 87 number of open indexes (config) ......... 87 number of open objects (config) .......... 87 number of open partitions (config) ....... 87 number of pre-allocated ext. (config) . 144 number of remote connections (conf) 116 number of remote logins (config)....... 116 number of remote sites (config)......... 116 number of sort buffers (config) .......... 103 number of user connections (config) ... 97 number of worker processes (config) 103 numeric operators ............................... 12

O o/s file descriptors (config)................... 97 object storage properties..................... 42 object_attr() ......................................... 19 object_atts, dbcc ......................... 36, 111 object_id() ........................................... 19 object_name() ..................................... 19 object_owner_id()................................ 19 object_stats, dbcc ............................. 111 object_stats, sp_ ............................... 120 objects................................................. 60 off row columns ............................. 24, 32 on (clause)

ANSI join syntax............................. 28

Page 28: The Complete Sybase ASE Quick Reference Guide

160 The Complete Sybase ASE Quick Reference Guide

merge statement ............................ 31 online database................................... 73 open .................................................... 51 open index hash spinlock ratio (conf) 102 open index spinlock ratio (config) ...... 102 open object spinlock ratio (config) ..... 102 oper_role ............................................. 81 operators ............................................. 12 opt_querystats, sp_ ............................. 58 optdiag ........................................ 90, 136 optdiag, sp__..................................... 136 optgoal, sp_......................................... 55 optimistic locking, with timestamp........ 24 optimistic_index_lock......................... 120 optimization criteria ............................. 56 optimization goal (config)..................... 55 optimization goal, user-defined............ 55 optimization timeout limit (config) ........ 57 optimizer costing ................................. 57 optimizer level (config)......................... 55 options, sp_......................................... 58 or (operator) ........................................ 12 order by (clause) ................................. 29 orphantables, dbcc ............................ 111 outer join ............................................. 30 owner ID, of object .............................. 19 ownership change

for databases ................................. 69 for objects....................................... 98

P page lock promotion HWM (config).... 122 page lock promotion LWM (config) .... 122 page lock promotion PCT (config) ..... 122 page size, server ....................... 132, 142 page, dbcc......................................... 111 pageinfo() ............................................ 19 pagesize() ........................................... 20 parallel index creation........................ 103 parallel query processing................... 103 parallel_degree, set ........................... 103 parallel_query, set ............................... 56 parse_text() ......................................... 20 parseonly, set ...................................... 54 partition spinlock ratio (config) ........... 102 partition_id() ........................................ 20 partition_name() .................................. 20 partition_object_id() ............................. 20 partitioning, table ................................. 33 passthru, sp_..................................... 118 password lost

encryption key password ................ 38 login password, reset by SSO ........ 78 SSO password, dataserver -p....... 132

password, sp_ ..................................... 78 password_random() ............................ 80 passwordpolicy, sp_ ............................ 78 passwords ........................................... 78

change ........................................... 78 complexity checks .......................... 79 complexity requirements................. 78 configuration settings ..................... 78 custom checks ............................... 79 policy settings................................. 78

patch_finishtime, sp_dbcc_ ............... 101 patindex() ............................................ 15

for text data .................................... 24 pattern matching............................ 13, 15 pci memory size (config)...................... 62

pciconfig, sp_.......................................62 permissions..........................................83

granular ..........................................85 pglinkage, dbcc..................................111 pi() .......................................................22 pkeys, sp_..........................................143 placeobject, sp_.......................33, 41, 71 plan dump, set ...................................127 plan exists check, set.........................128 plan for, set (XML) ..............................58 plan load, set .....................................127 plan optgoal, set...................................55 plan optlevel, set ..................................55 plan opttimeoutlimit, set .......................57 plan replace, set.................................128 plan_dbccdb, sp_...............................100 plancost, set statistics ..........................57 pointer_size() .......................................20 poolconfig, sp_.....................................88 pools ....................................................87 port number

of a client ........................................20 of the ASE server............................98

post_xpload, sp_..................................74 power().................................................22 pravailabletempdbs, dbcc ..................111 precomputed result set.........................44 predicated privileges (config) ...............84 prefetch................................................28 prefetch, set .........................................56 preupgrade ........................................137 preupgrd ............................................137 primary key (constraint)........................41 primarykey, sp_..................................143 print......................................................49 print deadlock information (config) .....120 printolog, dbcc ...................................111 prlobcache, dbcc..................................26 proc_cache, dbcc...............................111 proc_cacherm, dbcc...........................111 proc_output_params, set .....................54 proc_return_status, set ........................54 proc_role() .....................................23, 83 procbuf, dbcc .....................................111 procedure cache percent (config).........87 procedure cache size (config) ..............87 procedure deferred compilation (conf)..55 process ID of ASE engine ..................140 process kernel .....................................89 process_limit_action, set....................103 procxmode, sp_ .............................47, 53 prod-consumer overlap factor ............103 profile............................. See login profile programming in SQL............................48 proxy tables (CIS) ......................118, 119 proxy, set .............................................77 prsqlcache, dbcc ..................................60 prtipage, dbcc ....................................112 pss, dbcc............................................112 pssinfo() ...............................................20 ptn_data_pgs().....................................20 public (DB user group) .........................81 pubs2/pubs3 ........................................99 purgesqlcache, dbcc ............................60

Q QPTune .............................................137 qrmutil ................................................105 query..................................................127

Page 29: The Complete Sybase ASE Quick Reference Guide

ASE versions 15.0, 15.5 & 15.7 161

query metrics .....................................128 query plan cost ....................................57 query plans, caching............................59 query plans, settings................ 55, 56, 57 query plans, sp_showplan ...................61 quiesce database ................................74 quorum device ........................... 104, 105 quorum heartbeat interval (config) .....104 quorum heartbeat retries (config).......104 quorum, dbcc.....................................105 quoted identifier enhancements (conf).12 quoted_identifier, set .....................11, 12 quotes (string delimiters) .....................12

R radians() ..............................................23 raiserror .........................................50, 95 rand()...................................................22 rand2().................................................22 random numbers .................................22 random string, for passwords...............80 range partitioning.................................34 raw_object_serialization, set................62 RDDB ..............................................6, 68 read committed..................................121 read committed with lock (config).......120 read only (DB option)...........................69 read uncommitted..............................121 readonly (server option).....................116 readpast ............................................121 readtext ...............................................25 reboot, a database.............................109 rebuild master device (dataserver).....131 rebuild_log, dbcc ...............................112 rebuild_text, dbcc ..............................107 rebuild_text, sp_ ................................107 rebuildextents, dbcc...........................112 recommendations, sp_dbcc_ .............101 recompile, create function…with..........48 recompile, create procedure…with ......47 recompile, execute with .......................49 recompile, sp_ ...............................33, 93 reconfigure ..........................................87 recovery bypass .....See bypass recovery recovery of databases .......................126 recovery, of encryption key passwd 37,38 reduce database size.....................68, 72 Reduced-Durability database (RDDB) .68 references (constraint)...................41, 42 referential integrity constraints .............41 refit_admin, sp_ ...................................66 refresh materialized view .....................45 refresh precomputed result set ............45 refreshides, dbcc ...............................112 refreshpdes, dbcc ..............................112 reindex, dbcc .....................................107 relocated joins (server option)............117 remote access with RPCs..................115 remote server pre-read packets(conf) 116 remote_indexes, set ..........................119 remoteoption, sp_..............................116 remotesql, sp_ ...................................118 remove java .........................................62 rename, sp_.........................................60 rename_qpgroup, sp_........................128 renamedb, sp_.....................................69 reorg....................................................93 repartition_degree, set.........................57 repeatable read .................................121

replicate() ............................................ 16 Replication Server............................. 129 replication, set ................................... 129 replication_role.............................. 46, 81 report_al, dbcc .................................. 112 reportstats, sp_ ................................... 98 reserve_identity() .......................... 20, 35 reserved connection............................ 97 reserved words.................................... 60 reserved_pages() ................................ 20 reserved_pgs() .................................... 20 reservepagegap ............................ 41, 43 resource files, examples.....133, 137, 138 resource governor ............................. 122 resource limits ................................... 122 resource, dbcc................................... 112 resource_granularity, set..................... 57 restart, a database ............................ 109 restore utility (sybrestore).................. 137 restore_system_role, sp_ .................... 85 restoring, from backups....................... 72 restricted decrypt permission (config).. 40 return................................................... 50 return_lob() ......................................... 26 reverse engineering

with ddlgen................................... 134 with defncopy ............................... 135 with sp_helptext, sp_showtext........ 61

reverse().............................................. 16 revoke (command permissions) .......... 84 revoke (encryption) ............................. 39 revoke (object permissions)................. 83 revoke dbcc......................................... 84 revoke default permissions.................. 84 revoke role .................................... 82, 84 revoke...grant option for ...................... 83 ribo.................................................... 137 right()................................................... 15 rm_appcontext() .................................. 21 role

display lock roles............................ 82 lock/unlock ..................................... 82 set on/off ........................................ 82

role, sp_ .................................. 81, 82, 84 role_contain() ................................ 23, 83 role_id()......................................... 23, 83 role_name()................................... 23, 83 roles .................................................... 81 rollback transaction ............................. 52

monitoring progress ....................... 96 rollback trigger............................... 46, 52 round() ................................................ 22 roundrobin partitioning......................... 34 row lock promotion HWM (config)...... 122 row lock promotion LWM (config) ...... 122 row lock promotion PCT (config) ....... 122 row_count (resource limit) ................. 122 row_count() ......................................... 21 rowcnt() ............................................... 21 rowcount, set....................................... 54 row-level access control

access rules ................................... 85 predicated privileges ...................... 84

row-level locking................................ 120 rpc security model A/B (server option)116 RPCs................................................. 115 rtrim() .................................................. 15 rules .................................................... 45 runcheck, sp_dbcc_ .......................... 101 runnable process search count(conf) .. 89

Page 30: The Complete Sybase ASE Quick Reference Guide

162 The Complete Sybase ASE Quick Reference Guide

S sa_role ................................................ 81 sa_serverprivs_role ............................. 85 sampling percent (config) .................... 92 SAP Business Suite .................. 132, 143 save transaction .................................. 53 save_rebuild_log, dbcc...................... 112 SBE..............See Small Business Edition scan_parallel_degree, set ................. 103 SCC .............See Sybase Control Center scratch database (DB option) .............. 69 scrollable cursors ................................ 50 sdc_intempdbconfig() .......................... 70 security mechanism (server option)... 116 securityprofile, sp_ .............................. 80 segments............................................. 70 select................................................... 27 select @variable.................................. 27 select for update (config) ..................... 55 select into/bulkcopy/pllsort (DB option) 69 select top N ......................................... 27 select...into .......................................... 27

existing table .......................... 28, 118 with compression............................ 76 with encryption ............................... 39 with lock scheme.......................... 120

self_recursion, set ............................... 47 semantic table partitioning................... 33 send doneinproc tokens (config)........ 102 send_locator, set ................................. 26 sendmsg, sp_...................................... 21 server cost (server option)................. 117 server cursor ....................................... 50 server logins (server option) .............. 117 server page size ........................ 132, 142 server programs ................................ 131 server_info, sp_................................. 143 serverlimits, dbcc............................... 112 serveroption, sp_ (CE)....................... 105 serveroption, sp_ (CIS)...................... 117 serveroption, sp_ (RPCs) .................. 116 service keys ........................................ 40 session authorization, set .................... 77 session migration timeout (config) ..... 105 session tempdb log cache size (conf) 102 set ansi_permissions........................... 54 set ansinull .......................................... 54 set arithabort arith_overflow ................ 54 set arithabort numeric_truncation ........ 54 set arithignore...................................... 54 set auto_temptable_stats .................... 56 set background.................................... 58 set builtin_date_strings........................ 11 set bulk array size ............................. 119 set bulk batch size............................. 119 set chained.................................. 53, 135 set char_convert.................................. 96 set ciphertext ....................................... 39 set cis_rpc_handling.................. 115, 119 set clientapplname .............................. 58 set clienthostname .............................. 58 set clientname ..................................... 58 set close on endtran ............................ 51 set command_status_reporting ......... 107 set compatibility_mode ........................ 56 set cursor rows .................................... 51 set datefirst.......................................... 14 set dateformat ..................................... 14 set deferred_name_resolution ............. 58

set delayed_commit .......................55, 69 set dml_logging....................................55 set encryption passwd..........................38 set export_options................................59 set fipsflagger ..............................59, 135 set flushmessage.................................59 set fmtonly ...........................................54 set forceplan ........................................56 set hash_join........................................56 set identity_insert .................................35 set identity_update...............................35 set index ..............................................56 set jtc ...................................................57 set language ........................................95 set literal_autoparam ...........................60 set lock nowait ...................................121 set lock wait .......................................121 set logbulkcopy ..................................144 set materialized_view_optimization......45 set merge_join .....................................56 set metrics_capture............................129 set mon_stateful_history ......................99 set nl_join.............................................56 set nocount ..........................................59 set nodata ............................................54 set noexec ...........................................54 set option show... .................................57 set parallel_degree ............................103 set parallel_query.................................56 set parseonly .......................................54 set plan dump ....................................127 set plan exists check..........................128 set plan for (XML) ................................58 set plan load ......................................127 set plan optgoal....................................55 set plan optlevel ...................................55 set plan opttimeoutlimit ........................57 set plan replace..................................128 set prefetch ..........................................56 set proc_output_params ......................54 set proc_return_status .........................54 set process_limit_action.....................103 set proxy ..............................................77 set quoted_identifier.......................11, 12 set raw_object_serialization .................62 set remote_indexes............................119 set repartition_degree ..........................57 set replication.....................................129 set resource_granularity.......................57 set role (on/off).....................................82 set rowcount ........................................54 set scan_parallel_degree ...................103 set self_recursion.................................47 set send_locator...................................26 set session authorization......................77 set show_exec_info .............................55 set show_permission_source...............85 set show_sqltext ..................................59 set show_transformed_sql ...................85 set showplan........................................57 set sort_merge.....................................57 set sort_resources .......................91, 103 set statement_cache............................59 set statistics io .....................................57 set statistics plancost ...........................57 set statistics resource...........................57 set statistics simulate ...........................92 set statistics subquerycache ................57 set statistics time..................................57 set string_rtruncation ...........................54 set stringsize........................................62

Page 31: The Complete Sybase ASE Quick Reference Guide

ASE versions 15.0, 15.5 & 15.7 163

set switch...........................................113 set system_view ................................104 set table count .....................................56 set textptr_parameters.................25, 119 set textsize ..........................................25 set tracefile ..........................................59 set tracing (permission) .......................83 set transaction isolation level .............121 set transactional_rpc..........................119 set triggers...........................................46 set_appcontext()..................................21 set_identity_burn_max, dbcc .............112 set_qplan, sp_ ...................................128 set_scope_in_cluster, dbcc................105 setdata() ..............................................26 setlangalias, sp_..................................95 setpglockpromote, sp_.......................122 setpsexe, sp_ ......................................90 setrowlockpromote, sp_.....................122 setsuspect_granularity, sp_ ...............127 setsuspect_threshold, sp_ .................127 settrunc, dbcc ....................................107 setuser.................................................81 shared ...............................................121 shared disk cluster.............................104 shared memory dumps ......................129 shared memory starting address(cfg) 102 shmdumpconfig, sp_..........................129 shmdumpsize, sp_.............................130 show switch .......................................113 show_cached_plan_in_xml() .........21, 60 show_cached_text().......................21, 60 show_cached_text_long() ....................60 show_dynamic_params_in_xml()...21, 60 show_exec_info, set ............................55 show_options, sp_.............................140 show_permission_source, set..............85 show_plan() .........................................60 show_role()....................................23, 83 show_sec_services() ...........................21 show_sqltext, set .................................59 show_transformed_sql, set ..................85 showcontrolinfo, sp_............................90 showexeclass, sp_...............................90 showoptstats, sp_................................93 showplan, set.......................................57 showplan, sp_......................................61 showplan_in_xml().........................21, 58 showpsexe, sp_...................................90 showrecovery, dbcc...........................112 showserver ........................................132 showtext, sp_.......................................61 shrink a database ..........................68, 72 shutdown .............................................97

a database....................................109 ASE server .....................................97

sign() ...................................................22 simulated statistics................. 91, 92, 136 sin() .....................................................23 single user (DB option) ........................69 single-user mode (boot mode) .....18, 131 site handler RPCs..............................115 size of auto identity column..................36 size of global fixed heap (config) .........62 size of process object heap (config).....62 size of shared class heap (config)........62 sjobcontrol, sp_ .................................129 sjobhelp, sp_ .....................................129 Small Business Edition (SBE)............146 SMP, non-cluster version of ASE.......104 SNMP agent ......................................133

sort buffers ........................................ 103 sort order

install/change ................. 95, 134, 137 sort_merge, set ................................... 57 sort_resources, set...................... 91, 103 sorted_data ......................................... 40 sortkey() .............................................. 16 soundex() ............................................ 16 sp__optdiag ...................................... 136 sp_activeroles ..................................... 82 sp_add_qpgroup ............................... 128 sp_add_resource_limit ...................... 122 sp_add_time_range........................... 122 sp_addalias......................................... 81 sp_addauditrecord ............................ 124 sp_addaudittable............................... 124 sp_addengine...................................... 90 sp_addexeclass .................................. 90 sp_addextendedproc......................... 123 sp_addexternlogin............................. 117 sp_addgroup ....................................... 81 sp_addlanguage.................................. 94 sp_addlogin......................................... 77 sp_addmessage.................................. 95 sp_addobjectdef................................ 119 sp_addremotelogin............................ 115 sp_addsegment................................... 71 sp_addserver ............................ 115, 116 sp_addthreshold.................................. 71 sp_addtype ......................................... 10 sp_addumpdevice ............................... 67 sp_adduser ......................................... 81 sp_altermessage................................. 95 sp_audit ............................................ 124 sp_autoconnect................................. 118 sp_autoformat ..................................... 60 sp_bindcache...................................... 88 sp_bindefault....................................... 45 sp_bindexeclass.................................. 90 sp_bindmsg................................... 42, 95 sp_bindrule ......................................... 45 sp_cacheconfig ............................. 87, 88 sp_cachestrategy ................................ 88 sp_changedbowner ............................. 69 sp_changegroup ................................. 81 sp_checknames .................................. 96 sp_checkreswords .............................. 60 sp_checksource .................................. 61 sp_chgattribute.....25, 33, 35, 36, 41, 120 sp_cleanpwdchecks ............................ 79 sp_clearpsexe ..................................... 90 sp_clearstats ....................................... 98 sp_client_addr..................................... 60 sp_cluster.......................................... 104 sp_cmp_all_qplans ........................... 128 sp_cmp_qplans ................................. 128 sp_column_privileges........................ 143 sp_columns....................................... 143 sp_commonkey ................................. 143 sp_compatmode.................................. 56 sp_config_dump.................................. 74 sp_config_rep_agent......................... 129 sp_configure........................................ 86 sp_copy_all_qplans........................... 128 sp_copy_qplan .................................. 128 sp_countmetadata............................... 86 sp_cursorinfo....................................... 51 sp_databases.................................... 143 sp_datatype_info............................... 143 sp_dbcc_alterws ............................... 100 sp_dbcc_configreport ........................ 100

Page 32: The Complete Sybase ASE Quick Reference Guide

164 The Complete Sybase ASE Quick Reference Guide

sp_dbcc_createws............................. 100 sp_dbcc_deletedb ............................. 100 sp_dbcc_deletehistory....................... 100 sp_dbcc_differentialreport ................. 100 sp_dbcc_evaluatedb.......................... 100 sp_dbcc_exclusions .......................... 100 sp_dbcc_faultreport ........................... 100 sp_dbcc_fullreport ............................. 101 sp_dbcc_help_fault ........................... 101 sp_dbcc_patch_finishtime ................. 101 sp_dbcc_recommendations............... 101 sp_dbcc_runcheck ............................ 101 sp_dbcc_statisticsreport .................... 101 sp_dbcc_summaryreport ................... 101 sp_dbcc_updateconfig....................... 101 sp_dbextend........................................ 71 sp_dboption......................................... 68 sp_dbrecovery_order......................... 126 sp_dbremap ...................................... 107 sp_defaultloc ..................................... 117 sp_depends......................................... 60 sp_deviceattr ....................................... 67 sp_diskdefault ..................................... 66 sp_displayaudit.................................. 124 sp_displaylevel .................................... 86 sp_displaylogin.................................... 77 sp_displayroles.................................... 82 sp_downgrade..................................... 97 sp_drop_all_qplans ........................... 128 sp_drop_qpgroup .............................. 128 sp_drop_qplan................................... 128 sp_drop_resource_limit ..................... 123 sp_drop_time_range.......................... 122 sp_dropalias........................................ 81 sp_dropdevice ..................................... 67 sp_dropengine..................................... 90 sp_dropexeclass ................................. 90 sp_dropextendedproc........................ 123 sp_dropexternlogin............................ 117 sp_dropglockpromote........................ 122 sp_dropgroup ...................................... 81 sp_dropkey........................................ 143 sp_droplanguage................................. 94 sp_droplogin........................................ 77 sp_dropmessage................................. 95 sp_dropobjectdef............................... 119 sp_dropremotelogin........................... 115 sp_droprowlockpromote .................... 122 sp_dropsegment.................................. 71 sp_dropserver ........................... 115, 117 sp_dropthreshold................................. 71 sp_droptype ........................................ 11 sp_dropuser ........................................ 81 sp_dump_history ................................. 74 sp_dumpoptimize ................................ 74 sp_encryption...................................... 39 sp_engine............................................ 89 sp_errorlog .......................................... 97 sp_estspace ........................................ 33 sp_export_qpgroup ........................... 128 sp_extendsegment .............................. 71 sp_extrapwdchecks............................. 79 sp_familylock..................................... 120 sp_find_qplan.................................... 128 sp_fixindex ........................................ 109 sp_fkeys ............................................ 143 sp_flushstats ....................................... 92 sp_forceonline_db ............................. 126 sp_forceonline_object........................ 127 sp_forceonline_page ......................... 126 sp_foreignkey.................................... 143

sp_getmessage....................................95 sp_help ..........................................11, 60 sp_help_qpgroup ...............................128 sp_help_qplan ...................................128 sp_help_rep_agent ............................129 sp_help_resource_limit ......................123 sp_helpapptrace ..................................59 sp_helpartition .....................................33 sp_helpcache.......................................88 sp_helpcomputedcolumn .....................33 sp_helpconfig.......................................86 sp_helpconstraint.................................42 sp_helpdb ............................................69 sp_helpdevice......................................67 sp_helpextendedproc.........................123 sp_helpexternlogin.............................117 sp_helpgroup .......................................81 sp_helpindex........................................41 sp_helpjava..........................................62 sp_helpjoins.......................................143 sp_helpkey.........................................143 sp_helplanguage..................................94 sp_helplog ...........................................69 sp_helpmaplogin..................................78 sp_helpobjectdef................................119 sp_helpremotelogin............................116 sp_helprotect .................................82, 84 sp_helpsegment...................................71 sp_helpserver ............................115, 117 sp_helpsort ..........................................96 sp_helptext ..........................................61 sp_helpthread ......................................89 sp_helpthreshold..................................71 sp_helpuser .........................................81 sp_hidetext ..........................................61 sp_import_qpgroup ............................128 sp_indsuspect......................................96 sp_jreconfig .........................................62 sp_listener ...........................................98 sp_listsuspect_db ..............................126 sp_listsuspect_object.........................126 sp_listsuspect_page ..........................126 sp_lmconfig........................................146 sp_lock ..............................................120 sp_locklogin .........................................78 sp_logdevice........................................69 sp_logintrigger .....................................77 sp_logiosize .........................................69 sp_makesuspect_obj .........................127 sp_maplogin ........................................78 sp_merge_dup_inline_default ..............45 sp_metrics .........................................129 sp_modify_resource_limit ..................123 sp_modify_time_range.......................122 sp_modifylogin .........................77, 82, 94 sp_modifystats.....................................92 sp_modifythreshold..............................71 sp_monitor ...........................................61 sp_monitorconfig..................................87 sp_object_stats..................................120 sp_opt_querystats................................58 sp_optgoal ...........................................55 sp_options ...........................................58 sp_passthru .......................................118 sp_password........................................78 sp_passwordpolicy...............................78 sp_pciconfig.........................................62 sp_pkeys............................................143 sp_placeobject .........................33, 41, 71 sp_plan_dbccdb.................................100 sp_poolconfig.......................................88

Page 33: The Complete Sybase ASE Quick Reference Guide

ASE versions 15.0, 15.5 & 15.7 165

sp_post_xpload ...................................74 sp_primarykey ...................................143 sp_procxmode ...............................47, 53 sp_rebuild_text ..................................107 sp_recompile .................................33, 93 sp_refit_admin .....................................66 sp_remoteoption................................116 sp_remotesql .....................................118 sp_rename ..........................................60 sp_rename_qpgroup..........................128 sp_renamedb.......................................69 sp_reportstats......................................98 sp_restore_system_role ......................85 sp_role..................................... 81, 82, 84 sp_securityprofile.................................80 sp_sendmsg ........................................21 sp_server_info ...................................143 sp_serveroption (CE).........................105 sp_serveroption (CIS)........................117 sp_serveroption (RPCs) ....................116 sp_set_qplan .....................................128 sp_setlangalias....................................95 sp_setpglockpromote.........................122 sp_setpsexe ........................................90 sp_setrowlockpromote.......................122 sp_setsuspect_granularity .................127 sp_setsuspect_threshold ...................127 sp_shmdumpconfig............................129 sp_shmdumpsize...............................130 sp_show_options...............................140 sp_showcontrolinfo..............................90 sp_showexeclass ................................90 sp_showoptstats..................................93 sp_showplan........................................61 sp_showpsexe.....................................90 sp_showtext.........................................61 sp_sjobcontrol ...................................129 sp_sjobhelp .......................................129 sp_spaceusage ...................................97 sp_spaceused ...............................33, 69 sp_special_columns ..........................143 sp_sproc_columns.............................143 sp_ssladmin.........................................98 sp_start_rep_agent............................129 sp_statistics .......................................143 sp_stop_rep_agent ............................129 sp_stored_procedures .......................143 sp_syntax ......................................61, 99 sp_sysmon ..........................................93 sp_tab_suspectptn...............................34 sp_table_privileges............................144 sp_tables ...........................................143 sp_tempdb...........................................70 sp_tempdb_markdrop..........................70 sp_thresholdaction...............................71 sp_tran_dumpable_status....................21 sp_transactions ...................................53 sp_unbindcache ..................................88 sp_unbindcache_all .............................88 sp_unbindefault ...................................45 sp_unbindexeclass ..............................90 sp_unbindmsg ...............................42, 95 sp_unbindrule ......................................45 sp_version ...........................................99 sp_volchanged ....................................74 sp_who ................................................61 space() ................................................16 spaceusage, sp_ .................................97 spaceused, sp_ .............................33, 69 special_columns, sp_ ........................143 spid_instance_id() .............................106

split partition..................... See alter table sproc optimize timeout limit (config) .... 57 sproc_columns, sp_ .......................... 143 SQL Advantage................................. 138 SQL debugger................................... 138 sql server clock tick length(conf) 102,143 SQL.INI file........................................ 131 sqladv.exe......................................... 138 sqldbgr .............................................. 138 SQLJ................................................... 61 sqlloc................................................. 137 sqllocres............................................ 137 sqlsrvr.exe......................................... 131 sqltext, dbcc ...................................... 112 sqlupgrade ........................................ 138 sqlupgraderes ................................... 138 SQLX .................................................. 63 sqrt().................................................... 22 sqsh .............................................. 9, 135 sqtprint, dbcc..................................... 112 square()............................................... 22 srvbuild.............................................. 133 srvbuildres......................................... 133 SSL ..................................................... 97

@@ssl_ciphersuite ...................... 141 certificates...................................... 98 sp_ssladmin ................................... 98 with sp_addserver ................ 115, 116

sso_role ...................................... 81, 124 ssqlid (in stmt cache), finding .............. 60 stack guard size (config) ................... 102 stack size (config) ............................. 102 stacktrace, dbcc ................................ 112 stackused, dbcc ................................ 112 standalone mode (boot mode)..... 18, 131 standard deviation, aggregate ............. 27 standby_access (dump tran) ............... 72 standby_access (online database) ...... 73 start xp server during boot (config) .... 123 start_rep_agent, sp_ ......................... 129 starting ASE (Unix)............................ 132 starting ASE (Windows) .................... 139 startserver ......................................... 132 statement cache size (config).............. 59 statement_cache, set .......................... 59 statistical aggregates........................... 27 statistics io, set.................................... 57 statistics plancost, set ......................... 57 statistics resource, set......................... 57 statistics simulate, set ......................... 92 statistics subquerycache, set............... 57 statistics time, set................................ 57 statistics, sp_..................................... 143 statisticsreport, sp_dbcc_.................. 101 stddev() (aggregate)........................... 27 stddev_pop() (aggregate)................... 27 stddev_samp() (aggregate) ................ 27 stdev() (aggregate)............................. 27 stdevp() (aggregate)........................... 27 stop_rep_agent, sp_.......................... 129 stopping ASE (shutdown).................... 97 storage, required for datatypes............ 10 store_index, set................................... 56 stored procedures ............................... 47 stored_procedures, sp_..................... 143 str() ..................................................... 16 str_replace() ........................................ 16 streamlined dynamic SQL (config) ...... 55 string delimiters (quotes) ..................... 12 string functions .................................... 14 string operators ................................... 12

Page 34: The Complete Sybase ASE Quick Reference Guide

166 The Complete Sybase ASE Quick Reference Guide

string, empty........................................ 16 string_rtruncation, set .......................... 54 strings spanning multiple lines............. 12 stringsize, set ...................................... 62 strtobin() .............................................. 11 stuff() ................................................... 16 subqueries........................................... 29 subquerycache, set statistics............... 57 substring() ........................................... 16 sum() (aggregate)............................... 27 summaryreport, sp_dbcc_ ................. 101 supported DBCC commands............. 106 suser_id() ...................................... 23, 77 suser_name() ................................ 23, 77 suspect database .............................. 107 suspect global index, after alter table .. 34 suspect index, after sort order chg ...... 96 suspect page..................................... 126 suspect partition .................................. 35 suspend audit when device full (conf) 124 switch, set ......................................... 113 switch, show...................................... 113 SYB_BACKUP .................................... 72 syb_extpasswdkey .............................. 40 syb_identity ......................................... 35 SYB_IDENTITY_COL.......................... 36 syb_quit() ............................................ 21 syb_sendmsg port number (config) ..... 21 syb_sendmsg().................................... 21 syb_syscommkey ................................ 40 Sybase Central.................................... 98 Sybase Control Center (SCC) ............. 98 Sybase FAQ.......................................... 9 sybase_ts_role ............................ 81, 108 sybatch.exe ....................................... 133 sybcluster .................................. 105, 138 sybdiag.............................................. 137 sybinit4ever ....................................... 133 syblicenseslog........................... 102, 147 sybmgmtdb........................................ 129 sybmigrate......................................... 138 sybmon.............................................. 132 sybpcidb .............................................. 62 SybPerl.................................................. 9 sybrestore ......................................... 137 sybsecurity ........................................ 123 sybsyntax ............................................ 99 sybsystemprocs................................... 99 syconfig.exe ...................................... 133 syntax conventions in this book ............. 6 syntax, sp_ .................................... 61, 99 SYS_SESSION ................................... 18 sys_tempdbid()............................ 70, 106 syscacheinfo........................................ 88 syscachepoolinfo................................. 88 syslogshold ......................................... 53 sysmon, sp_ ........................................ 93 syspoolinfo .......................................... 88 sysquerymetrics ................................ 128 sysqueryplans ................................... 127 sysstatistics flush interval (config) ....... 92 system functions.................................. 17 system local tempdb............................ 70 system roles ........................................ 81 system_view, set ............................... 104 systemwide password expir.(config) .... 78

T tab_suspectptn, sp_ ............................ 34

table.....................................................85 table count, set.....................................56 table partitioning...................................33 table_privileges, sp_ ..........................144 tablealloc, dbcc ..................................107 tables ...................................................31 tables, sp_ .........................................143 tan() .....................................................23 tcp no delay (config)...........................102 TCP/IP address

of a client ..................................20, 60 of the ASE server............................98

tempdb, sp_ .........................................70 tempdb_id()....................................21, 70 tempdb_markdrop, sp_ ........................70 tempdb_space (resource limit) ...........122 temporary databases ...........................70

local, system, global (CE) ...............70 text pointer ...........................................24 text prefetch size (config) .....................25 text/image (LOB) data..........................24 text/image variables .............................24 textalloc, dbcc ....................................107 textptr() ................................................25 textptr_parameters, set ................25, 119 textsize, set..........................................25 textvalid() .............................................25 thread ID of ASE engine ....................140 thread pool...........................................89 threaded kernel ....................................89 three-valued logic for NULL .................54 thresholdaction, sp_.............................71 thresholds ............................................71 thresholds, dbcc.................................113 time range..........................................122 time slice (config) ...............................102 time zone information...........................13 timeouts (server option) .....................116 timeslice error ....................................102 timestamp ..............................10, 24, 141 Tivoli Storage Manager ........................72 to_unichar()..........................................96 tools for the DBA..................................98 top N, select.........................................27 total data cache size (config) ...............87 total logical memory (config) ................87 total memory (config) ...........................87 total physical memory (config)..............87 tracefile, set .........................................59 traceflags ...........................................113 traceflags, dbcc..........................112, 113 traceoff, dbcc .....................................107 traceon, dbcc .....................................107 tran_dumpable_status() .................21, 72 tran_dumpable_status, sp_..................21 transaction isolation level .............20, 121 transaction isolation level, set ............121 transaction log dump............................72

create..............................................72 restore ............................................73

transactional_rpc, set.........................119 transactions .........................................52 transactions, sp_..................................53 transfer table..................................31, 32 transfer utility memory size (config)......31 trigger

for-trigger (on a table) .....................46 global login trigger...........................77 instead-of-trigger (on a view) ..........46 login trigger (login-specific) .............77

triggers, set ..........................................46

Page 35: The Complete Sybase ASE Quick Reference Guide

ASE versions 15.0, 15.5 & 15.7 167

trigonometric functions.........................23 trunc log on chkpt (DB option) .............69 truncate lob..........................................26 truncate materialized view ...................45 truncate precomputed result set ..........45 truncate table.......................................31 tsequal() ..............................................24 TSM.....................................................72 tune, dbcc..........................................108

U UAF (Unified Agent Framework)........133 uafstartup.sh, uafshutdown.sh ...........133 uhighsurr() ...........................................96 ulowsurr() ............................................96 unattended startup (encryption) ...........39 unbindcache, sp_ ................................88 unbindcache_all, sp_ ...........................88 unbindefault, sp_ .................................45 unbindexeclass, sp_ ............................90 unbindmsg, sp_ .............................42, 95 unbindrule, sp_ ....................................45 undocumented commands, warning & disclaimer ..............................................7 unicode................................................96 union....................................................29 union in view........................................43 unique (constraint) ...............................41 unique (index)......................................40 unique auto_identity index(DB opt) .36,69 unlocked login

find with dataserver -A / -n............132 unlocking a login

(or a role) with dataserver -u.........132 'sa', with traceflag 4044 ................114 with sp_locklogin ............................78

unlocking a role ...................................82 unlogged operations ..........................144 unmount database...............................75 unsigned datatypes..............................10 unsupported DBCC commands .........108 update .................................................30 update (cursors) ..................................51 update all statistics ..............................91 update index statistics .........................91 update statistics...................................90 update statistics hashing (config).........92 update table statistics ..........................91 update where current of.......................51 update() ...............................................46 updateconfig, sp_dbcc_.....................101 upgrade_object, dbcc ........................113 upper().................................................15 uscalar() ..............................................96 use ......................................................50 used_pages().......................................22 used_pgs() ..........................................21 usedb_user (DB user)..........................80 usedextents, dbcc..............................113 user ...............................................24, 81 user connections, number of (config)...97 user log cache size (config) ...............102 user log cache spinlock ratio (config).102 user_id() ........................................24, 81 user_name() ..................................24, 81 user_stats, dbcc ................................113 user-defined functions .........................48

Java functions.................................62 user-defined roles................................81

users (database users)........................ 80 UTC time, getutcdate() ........................ 13 utf8, UTF-16........................................ 96 UUID - newid() .................................... 22

V valid_name() ....................................... 12 valid_user() ......................................... 24 var() (aggregate) ................................ 27 var_pop() (aggregate) ........................ 27 var_samp() (aggregate)...................... 27 variable assignment ............................ 27 variance() (aggregate)........................ 27 variance, aggregate............................. 27 varp() (aggregate) .............................. 27 version ID of ASE

@@sbssav (for SAP) ................... 143 @@version .................................. 143 @@version_as_integer................ 143 @@version_number .................... 143

version, sp_......................................... 99 views ................................................... 43

materialized.................................... 44 volchanged, sp_ .................................. 74 vpd.properties file.............................. 139

W waitfor delay........................................ 50 waitfor mirrorexit.................................. 67 waitfor time.......................................... 50 webservices_role ................................ 82 where (clause)..................................... 28 while.................................................... 50 who, sp_.............................................. 61 wildcard characters ....................... 13, 15 Windows, service .............................. 139 worker processes .............................. 103 workload management, in CE ........... 104 workload manager cache size (conf) . 105 workload_metric().............................. 106 worktables....................70, 112, 122, 145 writetext............................................... 25

X xa_bqual() ........................................... 22 xa_gtrid()............................................. 22 xls, dbcc ............................................ 113 XML

query plan in XML format ............... 58 XML functionality in ASE................ 63

xml (select…for xml)............................ 29 xmlextract() ......................................... 63 xmlparse() ........................................... 63 xmlrepresentation() ............................. 63 xmltable() ............................................ 63 xmltest (predicate)............................... 63 xmlvalidate()........................................ 64 XP Server.......................................... 123 xp_cmdshell ...................................... 123 xp_cmdshell context (config) ............. 123 xp_deletemail .................................... 123 xp_enumgroups ................................ 123 xp_findnextmsg ................................. 123 xp_logevent....................................... 123 xp_readmail....................................... 123 xp_sendmail ...................................... 123

Page 36: The Complete Sybase ASE Quick Reference Guide

168 The Complete Sybase ASE Quick Reference Guide

xp_startmail ....................................... 123 xp_stopmail ....................................... 123 XPath .................................................. 65 xpserver ............................................ 133 XQuery ................................................ 65

Y year()................................................... 13

Z zero, divide by

nullif()..............................................49 traceflag 3610 ...............................114

zeros, padding with leading..................16