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
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
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
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)
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
20.1 Example of cursor programming................................................................ 52 21 Transactions ..................................................................................................52
21.1 Example of transaction programming ........................................................ 53 22 Settings affecting ASE query behaviour .........................................................54
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
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
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.
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
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
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.
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.
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.
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-
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
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
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.
• '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.
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.
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).
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
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
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.
A abort tran on log full (DB option) ..........68 abs() ....................................................22
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
char() ...................................................15 char_convert, set .................................96 char_length()........................................15 character device.............................18, 66 character set
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
D data compression ................................75 data transfer utility (DTU).....................31 data_pages() .......................................17 data_pgs() ...........................................17 database devices.................................66 database dump....................................72
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
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
with no_log..................................... 73 with no_truncate............................. 73 with standby_access ...................... 72 with truncate_only .......................... 72
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
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
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
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
for text data .................................... 24 pattern matching............................ 13, 15 pci memory size (config)...................... 62
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
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
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
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
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