TZASE_EN_Col98_FV_Ltr1

141
Material Number: 50110995 1

description

gfjfjfjcjc

Transcript of TZASE_EN_Col98_FV_Ltr1

  • Material Number: 50110995

    1

  • 2

  • A bit of history

    1984 Sybase Inc. is founded

    1988 first RDBMs is released as Sybase SQL Server 3.0

    1992 Version 4.8 supports multiple engines (server processes) boost performance on Symmetric Multi Processor (SMP) machines.

    1994 Microsoft launches Microsoft SQL Server, based on a copy of the 4.2 Sybase code.

    1997 version 11.5 is renamed to Adaptive Server Enterprise ASE (to distinguish more clearly from MSSQL)

    1998 ASE 11.9 introduces Row Level locking (previously the task of locking items was placed on application side)

    2005 ASE 15.0 gets released, with a complete redesign of the query optimizer and support for semantic data partitioning

    2010 SAP buys Sybase and the project SAP on Sybase is started

    3

  • Sybase ASE is available in four editions, which are technically all the same, some features are disabled though in the EE, DE SMB Edition.

    Sybase ASE Cluster Edition provides the ability to configure several ASE Servers commonly using a shared disk . In that aspect it is comparable to Oracle RAC and DB2 Pure Scale. Sybase ASE Cluster Edition is not yet available with SAP and will not get covered in this course.

    4

  • ASE Versions

    Sybase ASE A major release usually contains many new features and may bring changes to system tables, which requires conversion of existing databases. Hence, a downgrade to a previous major version is not easy .

    A minor release does often contain new features but no changes to system tables, a downgrade to a previous minor release of the same major release is usually possible

    The term ESD refers to 'Electronic software delivery' , it is a collection of fixes for software defects. Usually any one minor release receives several ESDs on top. These are cumulative, , i.e. you can install ESD #4 directly without the need to install ESD 1,2 and 3. An Interim Release is a kind of super ESD, it does increase the minor release number, but somewhat less than a true minor release.

    EBF refers to 'Electronic Binary Format' , the EBF number of a build uniquely identifies the build and the software level. EBF number is unique, i.e. same software level , different platform (e.g. Windows vs. Linux ) will have different EBFs . The EBF number is displayed in the ASE version string.

    N-OFF refers to an emergency build based on an ESD or another N-OFF . N-OFFs are delivered to customers as a temporary solution for a software defect, when a customer can't wait until the next regular ESD, which contains a fix.

    5

  • An ASE database server is one or several coordinatedly running 'dataserver' processes on a UNIX server, with a defined set of disk devices it uses to store data persistently. On Windows there is only one ASE server process , it is called sqlsrv.exe. It may, however havemultiple NT threads.

    In this course when we speak of an ASE database server or an ASE server instance, we refer to therunning server processe(s), not the UNIX or Windows host on which the ASE server runs on. One ASE database server can (and usually does) manage multiple databases.

    Multiple ASE server instances may run on a single UNIX host, however, in production environments itis common to have a dedicated host for a database server .

    The following slides refer to master database and system databases, user databases are coveredlater in this course.

    6

  • System DatabasesAn ASE server comes with a couple of system databases installed by default. These are used by ASE to manage ist own metadata . Some of the system databases are mandatory , these are required forproper functioning of the system. Mandatory system databases

    master ASE's boot sector model template database for all other databases tempdb system temporary database sybsystemprocs stores server wide system 'stored procedures' sybsystemdb used for distributed transactions

    Additional system database (not mandatory) sybmgmtdb job scheduler database (mandatory for SAP instances) dbccdb stores data generated by 'dbcc' checktool sybsecurity auditing database

    Neither the 'sybsecurity' nor 'dbccdb' database are created by defaultThe master database stores information about user databases , devices, ASE server logins and roles. You must be in the master database to issue certain commands such as 'create database', 'alter database', 'disk init' and some other. The minimum size of your master database depends on your server's logical page size. The master database must contain at least 6656 logical pages, so its minimum physical size for page size 16k is 104MB

    ASE server in SAP environment always use 16k page size.

    7

  • System tables in the master database System tables in the master database store server wide informationSome are real tables which store ASE metadata, some tables are virtual, the latter provide an SQL interface to server runtime state.

    Examples:User accounts / logins sysloginsRemote servers that this server can interact with sysserversSystem error messages sysmessagesDatabases on Adaptive Server sysdatabasesStorage space allocated to each database sysusagesTapes and disks mounted on the system sysdevicesCharacter sets syscharsetsLanguages syslanguagesUsers who hold server-wide roles sysloginrolesServer roles syssrvroles

    Ongoing processes sysprocessesActive locks syslocksAdaptive Server engines that are online sysenginesCurrent ASE server configuration syscurconfigures

    8

  • Each database has a couple of system catalog tables of ist own. System catalog tables that arecreated in every database store database specific metadata and provide an SQL interface to the database specific metadata.

    Examples: sysusers store information about database users

    (has a foreign key relation to master..syslogins) sysobjects database objects (tables, procedures, ) sysindexes information about indexes syscolumns stores information about columns

    9

  • Some important stored procedures you will probably need are:

    sp_configure - display and change ASE configuration sp_helpdb display information about databasessp_helpdevice display information about devicessp_ddlgen generate the DDL for a database sp_who display information about who's logged into the serversp_lock display information about locks hold and waited formore

    10

  • Directory structureThe top directory where you install ASE (and perhaps other Sybase products is referred to as$SYBASE (UNIX) , resp. %SYBASE% (Windows). Sybase ASE software may get installed in anylocation, however, in SAP environment this is always '/sybase/' (UNIX) resp. :\sybase\ (Windows). The directory and all of its contents belong to the local sybaseuser id with which the software was installed. This is the user 'syb' in SAP installations. Some subdirectoriesDirectory OCS-15_0 contains the Sybase open client related files. It also contains isql (command line interactive SQL Editor) and some utilities such as bcp , a tool for bulk copying of large dataset out of or into a table. OCS_15_0 also contains the runtime libaries for ESQL C. Directory DBISQL contains the dbisql tool , a graphical SQL Editor.Directory ASE-15_0 is the main ASE server directory , it contains some subdirectories itself. The ASE server configuration file .cfg lies here (directly under %SYBASE% on Windows)%7)CMRWXEPP contains the RUN_ file (more on that later) and the .log (ASE server error log file). %7)CFMRGSRXEMRWexecutables of the server utilities%7)CW]WEQ GSRXEMRWlicense information for the configured ASE server(s) %7)CWGVMTXW contains additional scripts (installmaster , installjsdb , installdbccdb, )Directory charsets (directly below $SYBASE) holds installable character sets and codepages. Directory log contains logs from the installation. Look here when installation of ASE fails. The directory does not contain the ASE server log , contrary to what one might think. For some reason the directories are called ASE-15_0 , OCS-15_0 , even though we install version15.7 .

    11

  • On UNIX the correct Sybase environment gets set when sourcing the file $SYBASE/SYBASE.sh. Review the contents of that file in case you receive error messages that might result from incorrect environment settings. Check that the file was indeed sourced .

    On Windows a corresponding file SYBASE.bat exists, however the important environment variables are set as system wide environment variables. To review these, right click on the computer icon on the desktop, choose Properties. In the popup window go to 'Advanced System Settings'. In the popup 'system Properties' click the button 'Environment variables'. (Windows is so easy and intuitive, isn't it)

    12

  • Sybase ASE comes with an SQL editor 'isql', which is available on UNIX and Windowsisql is able to run SQL scripts in batch mode , output can get redirected to output files. Example: MWUP 78289WETWE 4TEWW(828MMRTYXWUP SSYXTYXX\X

    The above example calls isql, connects to a server 'TNT', username is sapsa , password isapparently 'pass' , the database it uses is called 'TNT', the input is received from the fileinput.sql and the output is stored in output.txt.

    A usage is displayed with the '{LIPT' option. useful options (more options are avaialblewhich are not printed here) :

    -b Disables the display of the table headers output.-c cmdend Changes the command terminator.-D database Selects the database in which the isql session begins.-i inputfile Specifies the name of the operating system file to use for input to isql.-o outputfile Specifies the name of an operating system file to store the output from isql.-P password Specifies your Adaptive Server password.-S server_name Specifies the name of the Adaptive Server to which to connect to.-U username Specifies a login name. Login names are case sensitive.-w column_width Sets the screen width for output.

    Useful are the options w (adapt output width, when using isql interactively at a terminal) and

    b' (to suppress header output when calling isql in shell skripts)

    13

  • Useful isql commands in interactive mode : VIWIXClears the query buffer.YWIHEXEFEWICREQIChanges the current database.ZM (UNIX) or IHMX(Windows)opens the default editor, allows you to edit the last SQL command in the buffer6JMPIREQIreads an operating system file into the command buffer and displays it. Enter the terminator interactively on a line by itself (not in the file).SWCGSQQERHExecutes an operating system command. Place at the start of a line."JMPICREQI or ""JMPICREQIRedirects or appends the output of the T-SQL command to file_name.Appends the output of the T-SQL command to file_name`GSQQERHPipes the output of the T-SQL command to an external command

    Example: Find all instances of 'SAPSR3' in the listing produced by sp_who:"WTC[LS"KS `KVIT 7%47614

  • dbisql is a graphical SQL editor written in Java . It is availablae on Windows and UNIX , it requires an X Server on UNIX.

    After successful login to an ASE server, the user may enter and execute SQL commands. We will not explore dbsiql in this course.

    15

  • Start ASEOn UNIX/Linux platform , ASE is usually started with a 'RUN_' file, which is nothing more than a shell script which calls the ASE dataserver executable with the proper command options.The ASE executable is named 'dataserver', it is located in $SYBASE/ASE-15_0/bin. When you start an ASE server, you need to specify the location of the master device to be used by the server, this is a mandatory option. Usually the location of the error log file, the config file , the server name and the directory for shared memory files is specified also in the RUN_ file. You may use the 'WXEVXWIVZIV utility to call a prepared RUN_ file , it starts ASE and sends it to the background. (if you call the RUN_SERVER file directly, use the & to send ASE ot the background). The RUN_ is usually located in $SYBASE/ASE-15_0/install.

    Verify ASE is runningThe utility 'showserver' can be used to display running Sybase servers. 'showserver' will also show backup server, when it is online

    Stop ASEThere is no separate utility to shutdown ASE. To shutdown ASE, log in with a user with administrator role and use the shutdown commandThe command 'shutdown SYB_BACKUP' shuts down a running backup server'shutdown with nowait' shuts down ASE immediately, forcing users off.

    Example:MWUP z7828z9WETWE z4 TEWW[SVH""WLYXHS[R7=&C&%'/94"KS"WLYXHS[R"KS16

  • Start ASEOn NT, an ASE server is a Windows service. You may start command line with the command RIXWXEVX7=&750C WIVZIVREQI" (needs Administrator rights). Usually on will use the 'services' panel to start ASE or configure the service to startup automatically. A 692C 7)6:)6"FEXfile is available, too, however, this does not start ASE as a service when called from a DOS command prompt. Using the RUN_.bat file not recommended as a standard procedure on Windows to start ASE. (usually only used to debug problems). When using the RUN_.bat file, you must NOT close the CMD prompt where you started ASE, otherwise the ASE server process will close as well. Startup parameters for the ASE service are stored in the NT registry under HKEY_LOCAL_MACHINE\SOFTWARE\SYBASE\Server\\Parameters. The may get configured using 'Server Config' tool (available at 'Start -> All Programms -> Sybase -> Adaptive Server Enterprise -> Server Config ')

    Verify ASE is runningOn the command line, type 'net start' , search for Sybase SQL Server in the outputIn the task manager, look for a process 'sqlserver.exe' or open the 'services' window , check the status of the Sybase SQL server.

    Shutdown ASETo shutdown ASE ,click stop button in services panel or log in to ASE with isql , execute WLYXHS[RcommandN.B. : Clicking the stop button in the services panel in Windows executes a 'forced shutdown' as well. So it is probably better to execute the shutdown command in isql. Another alternative is to call the command 'net stop SYBSQL_' on a DOS command prompt with Administrator rights.

    17

  • On UNIX/Linux the WXEVXWET' script is located in YWVWET 7%47-("7=7I\IVYRdirectory. It calls another script WXEVXHF' in the same location. The WXEVXHF script does some checking, sets some defaults and then executes the WXEVXWIVZIV command with the correct 692C 7)6:)6" file as a parameter. The WXSTWET script calls the stopdb script (also located in /usr/sap//SYS/exe/run/) . The WXSTHF script after some checking calls an executable tool W]FGXVP, which connects to ASE and executes the Sybase command WLYXHS[R'.

    18

  • ASE comes with some utilities, that can be used to perform certain tasks. The above list is not complete and meant only as an overview. Some of these tools will be covered in depth later.

    19

  • ASE Configuration file ASE server configuration is stored in a configuration file, it determines server wider settings and resources default name MW 7)6:)6"GJK , it is an ASCII file that can get edited with any editor. Its default location on LINUX/UNIX is 7=&%7)%7)C , on Windows it MW7=&%7) directoryIf it is not present or not specified at server startup, default values are used for all parameters. On UNIX , the configuration file usually gets specified at startup in the RUN_SERVER file, by adding a '-c ' command line flag.On Windows you may use the W]GSRJMK' tool (click the 'Add Command line parameters' button) to specify a configuration file for the service or update the registry directly. ( HKEY_LOCAL_MACHINE\SOFTWARE\SYBASE\Server\ \Parameters key )

    Most configuration parameters are dynamic, i.e. changes take effect immediately, w/o the need to restart ASE. Some are readonly , these cannot get changed. Some Parameters are static, any change takes effect at server startup.

    Viewing and changing the configuration file is done with the stored procedure WTCGSRJMKYVI' or in DBACOCKPIT. DBACOCKPIT uses WTCGSRJMKYVI' to change values in configuration file

    20

  • 21

  • The interfaces file

    The 'interfaces' file is an address book that list the names and 'addresses' of every known ASE server.It is a text file, can be edited with any text editor. It may also be edit with utility HWIHMX' , a graphical tool The interfaces file's format differs slightly between platformsOn UNIX the standard location of the file is 7=&%7)MRXIVJEGIW. On Windows the standard location of the file is 7=&%7)@MRM@WUPMRM. When clients connect to a server, they look up the interfaces file and use the information about machine name, protocol and port to connect to the server.When ASE starts up, it looks up its name in the interfaces file and determines port number and protocol it uses to listen for incoming client connections interfaces file must be maintained by administrators and made available to users who want to connect to a server.can be a challenge in large networks with clients connecting to different servers from multiple client machines.LDAP services can get used instead .

    In an SAP environment it is not necessary to distribute the interfaces file , SAP instances do not use the interfaces file.

    22

  • The Sybase ODBC and JDBC driver are available on all SAP instances on the globally mounted directory. The drivers are installed in /sapmnt//global/syb//sybodbc resp. sybjdbc.

    23

  • Sybase Infocenter

    http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.help.ase.15.7/title.htm

    24

  • 25

  • You have to prepare the host where ASE is installed (Central instance or Database instance), this is described in the SAP Installation Guides for your platform. Sybase ASE does not require a particular location where the software gets installed, however, in an SAP environment ASE always gets installed into the directory W]FEWI (&7-("(UNIX, Linux) resp. (6-:)"@W]FEWI@ (&7-("(Windows) On UNIX /Linux the software installation directory is also the HOME directory of the user that owns the ASE software, this is the user W]F WMH" user. Sybase ASE OEM license gets installed by SAPINST , therefore it is not possible to install ASE server manually in advance and then install SAP into an existing ASE database server.

    It is recommended to review Installation Guide before you start or (alternatively) when you run intotroubles during installation

    Some Hints for system preparation: For Linx systems , set kernel.randomize_va_space = 0 in sysctrl.conf, see SAP note 1570335 For Windows systems install Microsoft Visual C++ 2005 Redistributable Package SP1 plus KB973544On AIX systems, ensure I/O completion port is available, check with the command "lsdev | grep iocp" . I/O completion port may get enabled with the AIX tool 'smit' .

    Review limits (ulimit a) before you start sapinstReview amount of swap spaceDirectories /sapmnt , /sybase , /usr/sap reside on a sufficiently large filesystem

    26

  • In an SAP installation you don't have to install Sybase ASE server separately. SAP Installer does an embedded ASE installation. All necessary input for ASE installation is generated in the dialog phase of SAP installation.We briefly cover Sybase installation , to give you an overview of the step.

    SAPINST does a silent installation of ASE. SAPINST creates a response file for the Sybase installer from a template which is located on the RDBMS DVD. The SAP template file is dbsrvresp.txt , it is copied to the temporary sapinst_instdir and parameters are adjusted as needed for the particular system. SAPINST then calls the Sybase installer as : WIXYTFMR zJVIWTJMPIX\XMWMPIRX(%+6))C83C7=&%7)C0-')27)!XVYI(692C7-0)28!XVYIIf embedded ASE installation fails during SAP installation, you should review the log files in 7=&%7)PSKW. This directory does not contain the ASE error log file (as one might be inclined to assume) but the log files which are written by the ASE installer.

    27

  • SAPINST calls the Sybase Installer with a response file, which includes parameters for configuration of a new Sybase ASE server. The Sybase Installer, however, does not create the ASE server itself, but generates another response file for the tools srvbuildres (UNIX/Linux) resp. sybatche.exe (Windows). These tools are then called by the Sybase Installer and do perform the necessary actions. The response file for creation of a new server are: sqlsrv.res - response file to create a new ASE server bsrv.res - response file to create a new backup server js.res - response file to create a new Sybase scheduler

    These files are highly useful, when you have to re-create your SAP ASE server after disk crash . So it is recommended to back these up along with the complete contents of the directory $SYBASE. The sqlsrv.res file specifies amongst other the server name, the server page size (16k in SAP environment) , the location and size of the master device and other system devices to be created and the network protocol and port for the server.

    28

  • ASE's default character set is the western language character set, english locale settings and binarysort order for the western character set. In an SAP system, utf8 with unicode binary sort order is required for ASE. (N.B. unicode binary sortorder is different from binary sort order for western character set. So the default character set and sort order of ASE is changed directly after the ASE server is created. On UNIX/Linux, a second response file 'sqlsrv_lang.res' is generated by the Sybase Installer andthen the command line tool 'sqllocres' is called, which changes the default charcacter set. On Windows, the necessary information is generated directly into the server respsone file. However, in both cases, ASE is brought up initially with the western character set and the change to utf-8 is donein a second step. ASE is shutdown automatically after the change.

    You don't have to bother about changing the character set during installation (SAPINST takes care ofthat) , however, it is mandatory that you remember to change the character set, in case you recreatedASE from scratch after a complete loss of the system.

    29

  • Instructions: Do not install a new copy of the ASE software, use the existing software installation in /sybase/TR1Create a subdirectory /sybase/TR1/T, were XX refers to your group number (00,01,02,) . This is your working directory. All files you create and edit should reside in this directory (or subdirectories you create). All device files of your ASE server should reside there. Copy the contents of the file sqlsrv.res to you working directory. Edit its contents so, that all the system devices are created in your working directory. Set server name to T (refering to your group name). Change the port number , add 10 times XX to the port number, e.g. 4901 gets 4911 for group 01 . Leave the sizes for the system devices as they are. Adapt the name of the error.log accordingly, leave the location of your errorlog in $SYBASE/ASE-15_0/install Create the new server, use utility 'srvbuildres to create the ASE. Instructions for configuring utf8 and unicode binary sort orderCopy the contents of $SYBASE/ASE-15_0/sqlsrv_lang.res to your local directory, change the server name accordingly.Use the utility 'sqllocres' with the created response file to configure the change for your server.

    Instructions for configuring a new backup serverCopy the contents of bsrv.res to your local directoryAdapt server_name port, and errorlog accordinglyCreate and start the new backup server , use 'srvbuildres

    Tip: 'sqlbuildres' and 'sqllocres' display a usage on the command line when called with '-h' option

    30

  • 31

  • No operating system user is needed on the database host for end users in order to access an ASE server. End users just need a valid 'login' to the ASE server. In order to use a database, the 'login' must be mapped to a valid 'user' in the database. Finally the database 'user' needs appropriate access permissions in order to access any objects in a database.

    32

  • Roles define a set of privileges , which then may get granted to a login as a set. A 'login' which hasbeen granted a specific role has all the privileges that make up the role. ASE comes with a couple of predefined system roles, these define sets of administrative privileges.

    logins that have 'sa_role' are able to modify configuration parameters (non security related) manage disk storage create databases, grant ownership of databases grant / revoke 'sa_role' to other logins

    logins that have sso_role are able to : create / drop logins lock / unlock logins grant 'sso_role' and 'oper_role' to other logins

    logins that have oper_role are able to : dump and load any database

    A role that has not been defined as a default role for a login has to get enabled manually with thecommand "set role 'role_name' on" . Only after that the corresponding privileges are active. If a role has been set as 'default role' for a login, this is not necessary. The command 'alter login' may get used to set roles as 'default roles' for logins (sso_role is required toexecute the command)

    33

  • To get information about roles , use stored procedure sp_displayroles:Example 1 display roles granted to you :"WTCHMWTPE]VSPIW"KS6SPI2EQIWETCEHQW]FEWICXWCVSPINWCEHQMRCVSPIQSRCVSPIExample 2 display roles included in role sap_adm: "WTCHMWTPE]VSPIW WETCEHQ"KS6SPI2EQIWECVSPINWCEHQMRCVSPIWETCQSR

    34

  • ASE comes with a predefined login , the 'sa' login. The 'sa' login is the default ASE server administrator. It has assigned 'sa_role' , 'sso_role' , 'oper_role' ). The default password of the 'sa' login is empty. During a SAP installation the password for the 'sa' is set to the master password and the 'sa' login is also locked, i.e. it is not possible any longer to login as 'sa'. The 'sa' login cannot get dropped. SAPINST creates the following logins during installation: sapsa ASE System administrator in SAP installations roles granted are 'sap_adm' and 'sybase_ts_role' , database owner of 'saptools' and the SAP database

    sapsso ASE system security office in SAP installations , has role 'sso_role' , but not 'sa_role'

    SAPSR3 / SAPSR3DB owner of all tables in (strictly speaking this is not true, as it is the user in the database that owns the tables, not the login, see next slide) has role 'sap_mon' , i.e. is able to access and modify data in 'saptools'

    35

  • Example unlock and lock login 'sa' "MWUP 78289WETWWS [4EWW[SVH"WTCPSGOPSKMR WEuYRPSGOv"KS%GGSYRXYRPSGOIHWhen the job is done tahe requires both sa_role and sso_role, lock 'sa' again. "WTCPSGOPSKMR WEPSGO"KS%GGSYRXPSGOIH

    36

  • Example:Change your own password:"YWIQEWXIV"KS"EPXIVPSKMRWETWE [MXLTEWW[SVH8VMRMRKQSHMJ]TEWW[SVH4WW;SVH"KS

    37

  • When you start with the -p parameter, Adaptive Server generates, displays, and encrypts a random password and saves it in master..syslogins or in master..syssrvroles as that account or roles new password.

    It is strongly recommended that you change the password when the server restarts.

    38

  • The 'dbo' user has the ability to set database options (more on database options later) , create and drop additional database users, grant and revoke permission to create objects in a database. execute checkpoints, dump and load the database and check consistency of the database.

    Mapping of a server login to a database is done via a foreign key relationship between 'suid' field in sysusers to field 'suid' in master..syslogins.Attention: if you load a dump of database into an existing (or newly created) database in a different ASE sever, you need to make sure that mapping between logins and users matches your intentions.

    39

  • Tips:Create new roles with the 'CREATE ROLE' command. Create a new login with the command 'create login' command: Syntax: create login with [encrypted] password '' (N.B. create login has additional options to set the default database and other things, these are not needed here, review Sybase documentation if interested) Grant roles to a role or a login with the 'grant role' command .

    40

  • 41

  • ASE supports raw as well as file system devices, SAP on Sybase uses file system devices only . Installation devices are created during ASE installation (ASE server creation) , these are the master device , the sysprocsdev and the systemdbdev,During installation process of SAP BS on Sybase ASE also all the devices needed for the SAP database and saptools database are created, too. However, these are not referred to as 'installation devices', as these are user defined devices from ASE's point of view. Multiple databases can reside on one database device, however users are advised to map databases to their own dedicated devices. So, when you have to increase the SAP database, don't increase it on to devices of other databases. Creation of devices is done with the 'HMWOMRMX command. If file system devices are used the file must not exist, the directory where it is stored does have to exist, rwx permissions for sybase software owner required on the directory. If raw devices are used, these have to exist with 'read / write' permissions for the sybase software owner. Example:"HMWOMRMX REQI!HEXE828CTL]WREQI!W]FEWI828WETHEXECHEXE828CHEXHMVIGXMS!XVYIWM^I!1disk init ZWXEVX specifier allows you to set offset into a device. Maybe useful on logical volumes, when the first block of the volume is used by LVM ( AIX ! )ZHIZRS is the device number, a 4-byte integer, may be specified, too. If not specified ASE uses the lowest unused available number. maximum size of a device is 4TB (depending on OS limits) maximum number of devices is 231 1

    42

  • You may get further information about O_DSYNC and O_DIRECT from the man page for the open() system call

    O_DSYNC has much lower performance compared to O_DIRECT , internal 'quick and dirty' benchmark with 10.000 insert transaction ran 5650ms with DSYNC compared to 1450ms with DIRECTIO .

    Never ! configure dysnc='true' for a Sybase device ! (exception is the master device, it always has the dsync attribute set, this can't get changed)

    43

  • Synchronous versus Kernel Asynchronous I/O (KAIO) Synchronous I/O is also called blocking I/O

    When a UNIX process does a synchronous (i.e. blocking) I/O call, it tells the OS kernel that it wants to wait for the I/O process gets scheduled out from the CPU immediately by the OS kernel this is usually bad for database server processes, which usually have a lot of other stuff to

    do Kernel Asynchronous I/O (KAIO)

    with a KAIO call a process only tells the OS kernel to perform an I/O. The process stays on the CPU and can perform other stuff (e.g. schedule another runnable task)

    The OS kernel asynchronously performs the I/O in kernel context and places a complete notification

    eventually the ASE scheduler polls for I/O completion and, when the I/O has arrived, places the task which has been waiting for I/O back on the run queue.

    don't mix up blocking I/O with DSYNC (O_SYNC flag when opening a file) these are complete separate things

    You do want KAIO enabled for ASE, which is the default in an SAP installation

    44

  • 45

  • Resizing a deviceIt is possible to dynamically increase ASE devices in size with the HMWOVIWM^I command, the device is online and available to users during operation . Only increasing size is supported, no shrinking. Resize is possible only on unmirrored devices. After resize operation, you still have to issue an 'EPXIVHEXEFEWI , so that database(s) utilise the additional space. Example for disk resize, increases the device 'dataTNT_1' by another 512 MB 1> disk resize name=dataTNT_1 , size='512M'2> go

    Default devicesWhen a default device has been defined, it is not necessary to specify the device(s) where a database should reside on when issuing the 'create database' commandAfter installation master is a default device. It is recommended to turn that off by executing stored procedure WTCHMWOHIJEYPX QEWXIVHIJEYPXSJJ(master refers to the master device , not the master database here ! )It is not necessary to have any default devices the master, any devices used solely for transaction logs or devices for critical databases should in any case not be default devices. maybe even a good idea to not have any default devices

    46

  • Device Mirroring

    Serial writes means that a write goes to the primary disk first and then to the mirror device. Example: "HMWO QMVVSV REQI!PSK828CQMVVSV !G@W]FEWI@828@WETQMVVSV@PSK828CCQMVVHEX[VMXIW !WIVMEP"KS'VIEXMRK XLI TL]WMGEP JMPI JSV XLI QMVVSV7XEVXMRK (]REQMG1MVVSVMRK SJ TEKIW JSV PSKMGEP HIZMGI QEWXIVTEKIW QMVVSVIHTEKIW QMVVSVIH TEKIWQMVVSVIH8LIVIQEMRMRKTEKIWEVIGYVVIRXP]YREPPSGEXIHERH[MPPFIQMVVSVIHEWXLI]EVIEPPSGEXIH

    47

  • The 'disk unmirror' command may get used to unmirror either the primary or secondary device. This provides a means to move devices to another physical location. User initated unmirroring may be temporary (mode=retain) or final (mode = remove). System initated unmirroring happens after a disk fault. A message is then written to error log. IO to the faulty device disabled, status for faulty device updated in the table sysdevices.

    48

  • These limits apply to ASE 15.x and higher, 12.x has lower limits

    49

  • Possible page types are data page index page allocation pages store management information about a group of pages (allocation unit) Global Allocation Management pages (GAM) - store information about other allocation

    units in a database Object allocation management pages (OAM) - store information about allocations for

    particular objects Control pages control information for a partition (one per partition) Text /Image pages - LOB storage

    50

  • 51

  • WIPIGX HFCREQIYHFMHHFHREQIHIZMGIYZWXEVX HIZMGISJJWIX 1&YPWXEVX(&SJJWIX 1&YWM^IWM^I1&JVSQ W]WYWEKIW YW]WHIZMGIW H[LIVI YZHIZRS!HZHIZRS ERH HWXEXYW "SVHIV F] HF HIZMGI SJJWIX 1&(&SJJWIX 1&WM^I 1& &0+HEXE&0+C&0+PSK&0+CQEWXIV QEWXIV QEWXIV QEWXIV QSHIP QEWXIV WETXSSPW HEXEWETXSSPWCWETXSSPW PSKWETXSSPWCW]FQKQXHF W]FQKQXHIZ i WRMT"Although it is possible to have multiple databases on one device for administrative purposes it is recommended to place fragments of only one database on a given device, i.e. devices should be dedicated to databases. This is particularly important when you plan to use the 'quiesce database' command together with an external storage backup method (split mirror disks) to backup your ASE databases.

    52

  • A database device is either a file in the file system or a raw device. Database devices have physical names (the physical location in the filesystem or path to the device) and logical names. The logical names are ASE internal and are used to specify the device inside ASE. On a device there are one or several fragments. A fragment is a contiguous strech of space on a device that is used by a particular database. Fragments are organized in allocation units. An allocation unit consists of 256 pages, organized in extents. The first page in each allocation unit is the so called OAM (Object Allocation Map) page, which tracks the usage of extents in its allocation unit. An extent consists of 8 consecutive pages. When an object in a database allocates space it always allocates a complete extent.

    53

  • SELECT to display device usgae information:WIPIGX HFCREQIYHFMHHFHREQIHIZMGIYZWXEVX HIZMGISJJWIX 1&YPWXEVX(&SJJWIX 1&YWM^IWM^I1&JVSQ W]WYWEKIW YW]WHIZMGIW H[LIVI YZHIZRS!HZHIZRS ERH HWXEXYW "SVHIV F] 54

  • 55

  • Example: "GVIEXIHEXEFEWI828SRHEXE828C!1PSKSRPSK828C!1"KSCreates a database called TNT with 100GB data fragment on device dataTNT_1 and 10GB log fragment on device 'logTNT_1'

    'Mixed log and data' databases It is possible to create so called 'mixed log and data' databases. No separate log segement is createdfor these databases and it is not possible to to dump the transaction log for such databases.The system databases are created as 'mixed log and data' databases, however, user databasesshould probably usually get created with a data and a separate log segment. Syntax to create a 'mixed' databases is "create database on = 'size>' " (i.e. no log location is specified separately.

    56

  • sp_helpdb displays information about all databases (if called w/o argument) or detailed information about one database when called with DB name as argument

    Detailed information includes the set options and also information about database fragments on devices.

    57

  • You have to put the keyword 'database' as well as the database name in quotes when calling sp_ddlgen. The procedure sp_ddlgen can be used only to generate the DDL for databases, so its a bit a question why the keyword database is required .

    When you have to recreate and load a database, you need the DDL statement for the database, so save the output of the stored procedure to a file which you back up, too.

    To generate DDLs for object inside databases, call the command line utility 'ddlgen' (outside of isql) .

    58

  • Database options are an important feature of any database. Options control the behaviour of thedatabase and have to get set for each database individually. The option settings for a database are determined by the needs of the application. Options are boolean, they may get set to 'true' or 'false'. Database options are set with the stored procedure 'sp_dboption' , you have to be in the masterdatabase to set options.

    Example: "WTCHFSTXMSR 828HHP MRXVERXVYI"KS(EXEFEWISTXMSR HHP MRXVERXYVRIH 32JSV HEXEFEWI 8286YRRMRK ',)'/43-28SRHEXEFEWI 828JSV STXMSR HHP MRXVERXS XEOIIJJIGXVIXYVR WXEXYW !59

  • The option 'full logging for' determines logging for statements like 'select into' or the bulk copyoperation. Usually, thes operations are minimally logged only, i.e. only space allocations are logged, but not the data that are inserted. This breaks the log sequence, no HYQT XVERWEGXMSRcommand is possible afterwards until a complete dump database has been done. In some situatiuonsit may be desirable to execute these operations, but still maintain the log sequence. The option 'fulllogging for' makes the operation a fully logged one, which does not break the log sequence.

    Option 'enforce dump tran sequence' is a mandatory DB option for database in production environments ! If set, it prevents any minimally logged operation in the database and prevents truncation of the transaction log .

    It might be a good idea to save information about which options were set at backup time when a database has to get recreated for a restore , its options are set to a default. This is different from what is required e.g. for a SAP database. Unfortunately database options are not part of the database dump, so these have to get set manually after a database has been recreated for a load.

    60

  • You don't have to enable compression in an SAP database on Sybase ASE. Compression is enabledby default for the SAP database and does not require any DBA interaction. Not compressed are anycluster or pool tables. This is as the binary fields contain compressed data already, an additional compression on ASE layer would probably not achieve too much gain.

    61

  • Off row storage of LOBs makes sense when you assume that LOBs are what their name suggests : 'Large Objects' However Off row storage of LOBs is suboptimal when you have many tables with many small LOBs -like in SAP Business Suite. Therfore the InLine Lob Feature was introduced into Sybase ASE 15.7. The InLine LOB feature is dynamically enabled and transparent to the application. There is no actionto be taken by the DBA.

    62

  • Temporary tables that start with a pound sign in their name are session private and cannot get accessed by other sessions. Tables explicitly created in a temporary database may get accessed by other sessions (provided access permissions are given). Implicitly created tables in tempdb are dropped when the session ends. Tables that are created explicitly in a temporary database are permanent until dropped explicitly or when ASE is restarted and the temporary database gets recreated from the model database.

    Rule of thumb to estimate the required size of the temporary database when creating an index: ( width of the index columns x number of rows ) x 1.2

    The statement 'update index statistics' requires space in a temporary database, too.

    63

  • The stored procedure 'sp_tempdb' may get used to bind logins to a temporary database or to assigntemporary databases to a group.

    Example: "WTCXIQTHF FMRH0+WETWE+6HIJEYPX"KSVIXYVR WXEXYW !"WTCXIQTHF FMRH0+7%476(&WETXIQTHF"KSVIXYVR WXEXYW !The above commands bind the 'sapsa' login the the system temporary database 'tempdb' . The login'SAPSR3' is bound to a temporary database 'saptmepdb' (which has to exist of course). Thus the administrative login 'sapsa' is not affected by usgae of temp database space of the SAPSR3 login.

    64

  • 65

  • 66

  • If a dump of the database along with the complete sequence of dumps of the transaction log is available, it is always possible to restore the database into an ASE server which was created from scratch. You have to install Sybase ASE software then again using the original installation media from SAP, on top install any database patches that might have been installed and then create the ASE server instance. However, to speed up the restore process, it is highly recommended to backup the file system W]FEWI (&7-(", instead of relying on the process to recreate the complete software installation from scratch. FS backup of $SYBASE directory is recommended for three reasons: 1) software can get re-installed using the FS backup which is faster than re-install via SAPINST2) probably more important: the FS backup of $SYBASE contains the response files that were

    created originally by the Sybase software installer. The response files may get used to rebuild the ASE server from scratch

    3) the FS backup contains the ASE configuration file , the error log and other files you might want to have available even after a system crash.

    The 'disk init' statement is useful to re-create all the devices that are defined in ASE server. The database DDL statement is necessary as you have to re-create a database for load, before you can actually load a dump into the database. Although not mandatory it is highly recommended to re-create the database exactly as it existed before with respect to data and log segments. It is recommended to save the database options as these are not stored in a dump . Some of the database options are mandatory for SAP. The 'disk init' , the DDL for the database(s) and the DB options may however as well get created from the master database after the master DB has been reloaded.

    67

  • Of course it is not mandatory to use this setup as it is suggested here. However, whatever you set up it should be well documented and as simple as possible.

    The suggestion to use separate hard disks may sound somewhat outdated in times of storage subsystems. However, make sure that the file systems map to the storage sub-system in a way that it is at least equally secure as if you used indeed separate hard disks.

    In any case save the dump files to tape or a storage manager frequently.

    68

  • When a DUMP database is started ASE first dumps all database pages , as they are on disk. ASE does not bother at this time whether the contents are consistent from a logical point of view. After the dump of all pages has finished, ASE dumps the contents of the TX log to the dump file. Both the database pages and the contents of the TX log contain a timestamp, which is used during load to determine whether or not a particular log entry has to get applied to a page from the dump. As inactive entries from the TX log do not get cleared it is necessary to make the TX log large enough to hold all TX entries that are generated during the duratoion of a 'DUMP DATABASE' command.

    69

  • If you want to use dump compression , you might want to use compression = 100 or 101 , the old style compression algorithm did use quite some CPU resources and lots of time.

    When you use the 'with verify = [header |full ] , information about any suspect pages is reported in the backup server error.log, not in the ASE server error log.

    70

  • Dumps of the transaction log are also called 'incremental backups' somewhere don't confuse this with level 1 backups of the database, where only database pages are backed up which are newer than the last full backup. L1 database dumps are not available on Sybase ASE, but have been requested as a new feature.

    A database option that has to be set for SAP production database is 'enforce dump tran sequence' it ensures no so called 'minimally logged' operation can accidentally get executed that breaks the transaction sequence.

    Other options are available to enable full logging of operations that are normally only minimally logged. full logging for alter table full logging for reorg rebuild full logging for select into

    71

  • It is not possible to dump the transaction log of a database while a 'dump database' is in progress. A database dump has to include all the transaction logs entries that are generated from the begin to the point in time the dump database is finished, so that the dump can get restored to a logically consistent database image. The database dump does backup the log entries after all data pages have been saved. A dump of the transaction log that took place while a database dump is in progress would truncate the log and the database dump would not contain all the necessary log entries. As a relief - make your dump database fast (use multiple streams) - put your transaction logs on hardware mirrored devices (minimizes the risk of transaction loss due to HW failures)

    SAP requested a feature to allow dump transaction while dump database is in progress.

    72

  • 73

  • A threshold is a defined 'fill level' for a segment in a database. Any database comes with a predefined so called 'Last Chance Threshold' (LCT) for the log segment. The LCT is not user defined but calculated by ASE dynamically. When it is reached (i.e. the log is filled up to this level), ASE will call the stored procedure 'sp_thresholdaction' if it is defined in the current database. The DBA has to define 'sp_thresholdaction' - ASE does not know what action should be taken at that point. An example for a 'sp_thresholdaction' is available in the training material and also in the Sybase documentation. The DBA could for example execute a 'dump transaction' when the LCT is reached.

    Additional thresholds may get defined with the stored procedure sp_addthreshold: WTCEHHXLVIWLSPH HEXEFEWI" WIKQIRX" XLVIWLSPHCMRCTEKIW" TVSGIHYVI"These additional thresholds can be used to execute a dump transaction whenever a certain fill level has been crossed, independent of scheduled dumps of the transaction log.

    74

  • This sample may get implemented in any database for which dumps of the transaction are being taken. The PRINT command prints to the user's screen when called interactively (which you would usually not do) . If called by ASE upon hitting the last chance threshold print writes to the ASE error.log.

    N.B. Please note that we call a transaction sp_dumptrans. This is NOT a predefined stored procedure, you have to create it yourself in database saptools. (see OSS note SAP Note No. 1588316 SYB: Configure automatic database and log backups)

    75

  • SAP note 1588316 provides SQL text to implement the stored procedure sp_dumptrans, which may get used to dump the transaction log of your database(s) to some location in you file system. You may use it as a template to create your own solution.

    'sp_dumptrans' takes a database name as input. The procedure creates a file name of the dump device from the database name and a current timestamp, which makes it easier to determine which of the dump files are relevant in case of a restore.

    A sample code for sp_dumptrans which may get used in this classroom training is provided on the server in directory xxxxxxxx ?????

    76

  • Scheduling a transaction log dump frequently minimises the risk of loosing transaction data due to a device error on the log device is the time interval for log dumps at maximuma threshold based transaction dump avoids the risk of a filled transaction log due to extraordinary high load at some times.

    77

  • Before dropping a damaged database, make sure you know the options that have been set options a re stored in the master database and are not part of the the loaded dump. Some options are mandatory for SAP databases! Database options are displayed in the output of sp_helpdb . Alternatively use the previously discussed SQL script to generate an SQL script to reset any DB option. Also, save the DDL statement for you database before you drop it (use sp_ddlgen) .

    When you create a file system device for loading a database, create it with the skip_alloc = 'true' option of the disk init command. This speeds up the creation of the device, as pages are not initialised with binary zeroes. Also, use the 'FOR LOAD' option when creating a database for load. You won't be able to use such a database for anything but loading a dump, but it speeds up database creation.

    78

  • Example : "PSEHXVERWEGXMSR828"JVSQW]FEWI828PSKCEVGLMZIW828CXVERWC8CCHQT"[MXLYRXMPCXMQI !2SZ"KSAfter the load of all transaction logs has finished bring the database online: "SRPMRIHEXEFEWI 828"KS

    79

  • The easiest way to recreate the master device and to reset the utf8 charset is to use the response file that were created during ASE installation (see module 2 Installing ASE) .

    For a detailed step by step description see OSS notes: 1618817 SYB: How to restore a Sybase ASE database server (UNIX ) 1611715 SYB: How to restore a Sybase ASE database server (Windows)

    80

  • Syntax of the quiesce database command block write operations to databases: UYMIWGI HEXEFEWIXEKCREQI LSPHHEXEFEWICPMWX ?JSVI\XIVREPHYQTA?XSQERMJIWXCJMPI ?[MXLSZIVVMHIAA'tag_name' is a user specified tag, which names the quiesce operation. It is used later to release the specific set of databases. 'hold' specifies to hold the database and create a manifest file that describes it. 'for external dump' specifies that the DBA will create a backup of the devices with a tool external to ASE. The backup serves as a replacement for the dump database command. 'to manifest file' specifies the path to the mainfest file to be created. A manifest file is a binary file that describes the database(s) on a device / a set of devices. It is needed later when you want to mount the database(s) on the copy of the devices.

    Syntax of the quiesce database command resume write operations : UYMIWGI HEXEFEWIXEKCREQI VIPIEWI81

  • It is NOT possible to mount system databases (master, sybsystemdb) and tempdb. You may, however, start ASE on a set of devices, you previously copied while the databases where quiesced.

    82

  • 83

  • 84

  • Internally ASE is devided into a so called 'server' layer and a 'kernel' layer. The server layer is the user facing part of the ASE server. It deals with databases, queries, users, locks, logging and transactions.

    The ASE kernel provides a generic run-time environment for the RDBMS engine, it does task management and scheduling, provides SMP support (engines and spinlocks), disk I/O and network I/O. The ASE kernel also provides memory management , signal handling , error log services , security Integration (SSL, LDAP, PAM, Kerberos) and the JVM host environment. In short, it is the 'operating system' of the upper layer , the RDBMS engine.

    85

  • A running ASE server consists of one or more 'engines' . In ASE pre-15.7 an engine is one or several running dataserver process(es). ASE engines are what is visible on OS level, all the tasks an RDBMS server has to do, are delivered by the engine(s). Inside an engine different ASE internal 'tasks' (i.e. ASE internal threads) run and do fulfill different tasks.

    ASE on Windows NT is an exception. On Windows engines are implemented as NT threads , running inside one sqlsrvr.exe process.

    86

  • The architecture of ASE does not change fundamentally with the threaded mode. Engines are implemented as lightweight process (LWP) now instead as real OS processes. Further performance gains in disk and network IO handling and better handling of different workloads (I/O vs CPU bound) are expected from the change. In the process model configuring for CPU bound workload often had negative impact on I/O bound workload and vice versa.

    87

  • This schema represents two physical CPUs, on which two ASE engines run (OS light weight processes in 15.7). The ASE engines currently execute TASK8 and TASK6 (i.e. the context of these tasks has been loaded into the engine process context.

    In ASE shared memory another 6 runnable tasks are in the engines' and the global run queue, 4 tasks are placed in wait queues. These will get moved to one of the run queues as soon as their wait event arrives.

    Tasks Each connection to the ASE server is represented by a task. Tasks are identified by a SPID (Server Process ID) , additionally all tasks have a KPID (Kernel Process ID) The SPID is associated with structures that describes the sessions database, queries, locks, transaction, (server layer) , whereas the KPID is associated with structures that represent ASE kernel layer state of the task.Some internal tasks in ASE do not have a SPID , only a KPID . Tasks can migrate between engines, if load is distributed unevenly between engines.

    88

  • ASE's internal threading model vs the competition

    The multithreaded process architecture has been implemented by Sybase ASE and Informix. Each user connection is a task (thread) within ASE's engines (processes or OS threads). This architecture has a low overhead and scales extremly well on SMP machines using one multitasking process per CPU.

    The 2nd Architecture has been implemented by Oracle and DB2 / UDB. Here each user connection has an agent process on the database server. The agent process (db2bp, oracle shadow process) parses and executes the SQL and sends results to the application process (since DB2 V9.5 the db2bp is implemented as OS thread , not a process any longer). A user agent / shadow process is similar to a task in the multithreaded architecture. This has a higher overhead than multithreaded architecture.

    89

  • TCP/IP connection is established between two sockets, Client and Server each own a socket. The ASE Server has one socket for each client connection. Each SPID (i.e. ASE internal tasks) knows its socket.

    Network IO is one of the areas where the new threaded kernel mode has its advantage. Sockets are owned by the OS process. Hence, in ASE pre15.7 a task had to return to its original engine process before it could send results back to the application process. With the new threaded kernel, an engine is a light weight process inside the parent dataserver process. Network I/O can get initiated by a task at any time, there is no need to migrate back to the original engine.

    Since 12.5 ASE has introduced dynamic listeners: Prior to 12.5.1 network listens ports were read from the interfaces file at boot time and were static after that. In 12.5.1 the SA has the ability add or remove listen ports at run time and can bind them to specific engines. The procedure WTCPMWXIRIV is the interface to this functionality. This adds flexibility to network configuration.

    90

  • As ASE uses a non-preemptive scheduling scheme, tasks have to determine themselves that they should release the CPU to some other runnable task. Tasks are given a time slice, i.e. time, in milliseconds, a task can run without yielding. If a task cross a yield point it checks its after it has exceeded its timeslice counter. If it has exceeded its timeslice, it yields voluntarily. Time slice is internally tracked in clock ticks, rounded up, the default is 100 msThe configuration parameter cpu grace time specifies the number of clock ticks a task is allowed to run after it exceeds its time slice. It allows a longer running task to hit a yield point or go to sleep. Tasks that exceed their grace time are killed by the scheduler (preemptive) . The default for cpu grace time is 500 ticks, i.e. 50 secs. (an eternity)

    You would rather seldom change time slice configuration parameter, as it affects all threadsIncreasing CPU GRACE TIME maybe workaround in certain scenarios .

    91

  • An automatic yield of a task vs a voluntary (time slice driven) yield.A task yields voluntarily when it reaches a yield point in the code and time slice counter is negative. An automatic yield happens when a task determines it has to wait for a resource. That resource can be a lock or an I/O request. The task places itself on the corresponding wait queue.

    92

  • RECURRING TIME SLICE ERRORS SHOULD BE ADDRESSEDTry to find the root cause instead of covering them up

    Dont adjust the time slice parameterineffective solutionwill affect all tasks, not only those that exceed grace time

    cpu grace time should be a temporary solutionconsider increasing grace time while the root cause is being investigateddefault value of 500 ticks = 50 seconds. This is an eternity!increasing this will simply cause a longer hang in many cases

    Pursue the root cause!

    93

  • Tasks may change their priority , thus help ASE run smoothly. Tasks on lock or latch sleep change to priority 3 prior to sleeping on a lock or latch and revert to original priority upon wake-up. High priority helps waking task get scheduled, reduces contention.The Housekeeper task may be accelerated to priority 5 if its queues reach > 80% full.Login processing is done at priority 3, this helps newly spawning user process get CPU time to speed loginThe priority reset after login completes

    Priority may also be altered using the Logical Process Manager

    94

  • Task can migrate between engines

    Engines can run tasks from local run queues, global run queues, or may steal tasks from another engines run queues. Local tasks preferred due to locality of reference, local tasks at a given priority always have preference. Global queues help important tasks on SMP systems. Gglobal queue is checked after local queue in priority order (local pri 0, global pri 0, local pri 1, global pri 1, etc.). Waking priority 3 tasks are placed in the global queue, this ensures they are run by first available engine.

    Tasks may be stolen from another engine, an idle engines may check priority 5 queue of other engines, this improves load balancing

    95

  • In 15.7 checking for I/O has been offloaded from the scheduler to separate IO threads in pool 'syb_system_pool'. These system threads use highly efficient modern OS specific APIs (completion ports). This reduces the number of CPU cycles used for polling , compared to the pre-15.7 architecture.

    Network I/O Configuration parameter 'number of network tasks' All open sockets for a given network type (TLI, TCP, etc.) are checked Network types processed round-robin, one per I/O check

    Disk I/O Configuration parameter 'number of disk tasks' outstanding asynchronous I/O checked for completion Completed disk I/Os are processed and sleeping tasks woken

    ASE still uses polling to check for async IO completion. So, don't increase the number of disk or network IO tasks unless you verified you actually have to. Otherwise you might see wasted CPU cycles due to unnecessary polling. Internal test on a Linux system showed 200.000 disk IOs were handled by one 'disk IO task' .

    96

  • 97

  • 98

  • Although memory pages are always of 2k size , in a 16k page size server, pages from disk of course are read in to the data cache 16k blocks of course

    99

  • 100

  • ASE comes with a default data cache into which all data are loaded from disk. In SAP installations the initial size of the default data cache has been set to 400MB, which is probably too small for most scenarios. You should determine how much physical memory is available on the machine which can get allocated to ASE. Then allocate a significant portion of that memory to the default data cache. What significant portion is optimal depends on your system of course, but maybe 55% and is a good starting point. It is possible to create additional named caches and bind objects to these (any object that has not been bound to a particular named cache will get loaded into the default data cache). However, in most cases it is probably a god idea to have only the default data cache, which should be sized as large as possible (w/o causing swapping). There is one exception to that rule. Often, it is probably useful to create a named cache for the temporary database and bind the tempdb to that cache. Optimally this cache is large enough to keep the whole tempdb in memory, however, one has to balance this with other memory requirements of ASE. Use the stored procedure 'sp_cacheconfig' to configure data caches, or alternatively, configure the data cache in the server configuration file (.cfg ) and reboot ASE after you made the changes. N.B. You may increase caches online (there is no need to reboot ASE) , however to shrink a cache, ASE needs to get rebooted.

    101

  • Configuring large IO pools inside a cacheYou may divide a cache into pools of different IO sizes. Possible are pools for 2, 4 and 8 times the server pages size. When a large IO pool has been configured and ASE reads in data, it determines whether it better to read in single pages or larger blocks of consecutive pages (e.g. during a table scan). A large IO pool may provide performance improvements in such cases.

    Configuring a pool does not change the size of the cache, it just allocates a certain amount of memory out of the cache for a pool. As a starting point , configure 25% percent of your default data cache as an 128K pool . The procedure sp_poolconfig is available to configure pools in existing data caches , this can be done while ASE is online.

    Large I/O pages are treated as a unit in the pool, they age together and are written out to disk together.

    Asynchronous prefetch limit specifies the percentage of the pool that can be used to hold pages that have been brought into the cache by asynchronousprefetch, but have not yet been used by any queries. The configuration parameter 'global asyncprefetch limit' parameter sets the default value for the server.

    102

  • If the pool size is less than 300MB, the default wash size is 20 percent of the buffers in the pool. If the pool size is greater than 300MB, the default wash size is 20 percent of the number of buffers in 300MB. The minimum wash size is 10 buffers. The maximum size of the wash area is 80 percent of the pool size. You must specify the pool size and wash size for all pools larger than 2KB

    103

  • A Data cache may get partitioned when spinlock contention is an issue. Per default a data cache has only a single spinlock. This spinlock may become a hot spot when may tasks try to access the cache on a SMP machine. To reduce this type of spinlock contention , a data cache may get partitioned into 2,4,8,64 partitions(number of partitions must be a power of 2).

    Creation of cache partitions is not dynamic, i.e. when you use sp_cacheconfig to alter an existingcache, the change takes effect only at next reboot of the ASE server.

    If the number of partitions is not configured , ASE will set bit to a power of two , that is closest to thenumber of engines configured. In most cases there shouldn't be a need to change this.

    104

  • An starting point for how to set 'procedure cache size' is perhaps some 15% of 'max memory' . Statement cache size is initally set 51200 (100MB) , which is probably not too bad for a starting point. If you increase it, increase it cautiously. Cached statements are implemented as 'leightweight storedprocedures' and as such require an object descriptor. As object descriptors are limited and needed for other stuff as well, don't overconfigure statementcache size. It may lead to object descriptors becoming a hot spot.

    105

  • 106

  • 107

  • If some basic , important settings are correct , generally you may expect good performance for yourSAP system on Sybase ASE. As has been pointed out already Sybase ASE is a RDBMS systemdesigned for high performance and throughput and many mission critical real time applications run on Sybase ASE. On the following slides we will discuss the basic settings that have to be correct in order to achievegood performance.

    108

  • Migrated systems that were not compressed before the migration will occupy less disk spaceafterwards, how much space is saved depends on the source data of course. If lots of data reside in R3 cluster tables, the disk space reduction will not be that large, as data in these tables is compressed by R3. The number of devices depends on the size of your database, of course. Too many small devices areprobably not convenient for administration . Perhaps there is no unique formula to determine the correct number of devices, however, it seemsthat the closest whole number to the square root of the database size in GB has served quite well forother RDBMS vendors. Of course it is recommended to have one or several separate filesystems on separate disks for thedatabase devices. Also, RAID10 or at least hardware mirroring should be considered, particularly for the log devices. (thelatter more for data safety than performance reasons)If on a SAN, ensure the SAN administrator does her/his job with respect to eliminating hot spots andmapping the the database devices FS to fast disks / disk areas.

    Devices of tempdb are usually configured to use the file system cache. This speeds up writes to thetempdb . However, if the file system uses large large portions of main memory for ist own cache, thiscould use to paging, if the cache is indeed used by the filesystem.

    109

  • spsysmon output - Example (excerpt)8LVIEH9XMPM^EXMSR379WIV&YW]7]WXIQ&YW]-HPI 8LVIEH4SSPW]FCW]WXIQCTSSP8LVIEH2IX'SRXVSPPIV8LVIEH(MWO'SRXVSPPIV(MWO'SRXVSPPIV %GXMZMX] TIVWIG TIV\EGX GSYRXSJXSXEP 4SPPW RE4SPPW6IXYVRMRK)ZIRXW 4SPPW6IXYVRMRK1E\)ZIRXW 8SXEP)ZIRXW RE)ZIRXW4IV4SPP RE RE REFor this system it is not necessary to increase the number of disk IO threads.

    110

  • ASE should be running in threaded kernel mode (it is considered to provide better performance) Entry in Athe configuration file .cfg : OIVRIP QSHI !()*%908In threaded kernel mode , the number of engines is configured with the command 'alter thread pool' Example: 1>EPXIVXLVIEHTSSPW]FCHIJEYPXCTSSP [MXLXLVIEHGSYRX!"KSThis sets the number of threads in the thread pool 'syb_default_pool' to 6 , i.e. the number of ASE engines. The parameter 'idle timeout' specifies the number of microseconds an engine will loop , looking for more work, before going to sleep. The lower the value the less idle CPU cycle will get wasted by ASE. A value of '0' specifies that an ASE engine will go to sleep immediately, when there is not work left to do. A value of '-1' , however specifies the ASE engine will never sleep. Consider decreasing the value of 'idle timeout' particularly when ASE does run on a host that is not a dedicated database host. Example: "EPXIVXLVIEHTSSPW]FCHIJEYPXCTSSP [MXLMHPIXMQISYX!"KSThis sets idle timeout to 50 microseconds instead the default 100 microseconds

    111

  • Determine how much of physical memory is needed for the operating system and other processes (isthis a CI host as well ?) Allocate as much memory to ASE as possible, w/o cuasing memory paging on the host. Set 'maxmemory' to that amount. On a production system it is recommended to set ASE configuration parameter 'allocate max shared memory' to 1 , so that ASE will allocate 'max memory' h

    Most important is the configuration of the data caches. The default data cache should perhaps take up50 % 55 % of max memory. Additional named data caches should get configured only when youdetermined a need for it. For example , if you have one query that has to run repeatedly and due tothe size of the result set thrashes the default data cache for many other queries, it might improveoverall performance to have a separte cache for such queries. However, keep in mind, that namedcaches always reduce the memory that would otherwise be available for the default data cache. If a named cache is configured but used only rarely it may turn out to be a waste of memory and mayhave a negative impact on performance. A seprate, named cache for the temporary database(s) is perhaps useful in most cases,

    112

  • The procedure cache is an important part to configure in order to achieve good performance. The more users and the more varying workload the larger should be the procedure cache. The suggested value of 15 % of 'max memory' are a starting point. The statement cache needs to be enabled and configured, but should not be over configured. Too many cached statements may

    113

  • Example output of sp_monitorconfig: (not information displayed) "WTCQSRMXSVGSRJMK EPPRYPPRYPP"KS2EQI2YQCJVII 2YQCEGXMZI 4GXCEGX 1E\C9WIH 6IYWICGRXRYQFIVSJSTIRHEXEFEWIWRYQFIVSJSTIRMRHI\IWRYQFIVSJSTIRSFNIGXWRYQFIVSJSTIRTEVXMXMSRWIn this example all open partitions descriptors are used and there is a high reuse count. The parameter should get increased, although it is impossible to say how much from this output. Even if the number of partition descriptors in this example was only off by 1 (i.e. 50001 partitions were constantly in use) it would lead to a very high reuse count.

    114

  • Number of locks depends on the number of concurrent users and type of workload they generate. Ifmigrating from another RDBMS vendor you may have to rething the setting of this parameter, if yourDB used lock escalation. ASE does provide some sort of lock escalation, however, for SAP systems it is generallyrecommended to not have lock escalations. In order ot prevent ASE from attempting to escalate locks set row lock promotion hwm and row lock promotion lwm to some high values.

    Number of connections should get high enough to prevent accidentally running out of connections(e.g. when temporarily an additional SAP instance is started) . If in doubt set it higher. Please bear in mind that each disp+work process uses at least two connections to the database .

    115

  • 116

  • 117

  • 118

  • 119

  • 120

  • DBA Cockpit contains release specific metadata that describes the available data sources. Stored procedures for data collection are generated based on this metadata.

    Tables definitions for historic data are generated

    121

  • The DBA Cockpit injects the stored procedures into the systems. Tables for historic data are created

    If you want to monitor a (non-SAP) legacy ASE server, you have to create the 'saptools' database in that server first. SAP Note No. 1593987 explains how to create the saptools database. This is usually not necessary for SAP systems, the saptools database is created during installation by SAPINST.

    122

  • The ASE job scheduler triggers execution of the stored procedures, data is stored in local history tables in the saptools database.No communication between monitoring system and monitored database necessary

    data collection occurs even if SAP system is shut down.

    123

  • Collected historic and current data on system status is done via DBA Cockpit generates SQL queries based on the metadata model. DBACockpit generates monitoring screens to present the data to the userData extraction for the DB Performance Warehouse is based on the same set of data in the saptoolsdatabase.

    124

  • 125

  • User connection : Specifies the Sybase ASE login , which is used to connect to the ASE Server. For SAP systems, it is recommended to use the 'sapsa' login . If you don't specify a login with sufficient administrative rights, not all DBACOCKPIT features will be functional.

    126

  • 127

  • 128

  • Setting up the Data Collection FrameworkFor DBACOCKPIT to be useful you have to set up the collection framework, so that the necessarystored procedures and jobs are created in the monitored system.The data collection framework is based on templates, a collection of collector settings, either deliveredby SAP or defined by the DBA (to be used for several systems)To set up the data collection framework, open the system you want to use, choose 'Configuration''Data Collection Framework'. On the screen that appears, choose the button 'Implement Template'.A popup occurrs that allows you to choose of the defined templates. Two pre-defined templates areavailable: 'SAP Default (hourly)' and 'SAP Detailed (15 Minutes)' .DBAs may copy the predefined templates and adapt to suit their needs. However, at least the settingsin template SAP Default should be active to ensure supportability.For each collector frequency and history length can be configured

    Data Collector Status-Flags:Red: Not set upYellow: Version of the collector not up to dateGreen: Most recent version running

    Auto Update of Collectors (Default: On)Automatic Update/ Repair of Back-End performed once per dayThis is disengageable for SOX Compliance Systems

    129

  • DBACOKPIT is organized in function groups , which provide access to screens relavent for DBA tasks.

    130

  • Changing Server Configuration with the DBA CockpitConfiguration parameters are organized in groupsDepending on user authorization only display or change is possibleChanges to dynamic parameters will take into effect immidiatleyChanges to static parameters require a restart of ASEThe run value is the value currently in use, the config value the value that will be used after nextrestartIntegrated documentation for each parameterAll changes done in DBA Cockpit are recorded in the Audit Log (Diagnostics Menu)

    131

  • Screens using historic data offer a time selection at the top of the screen (here the screen to display space allocation by tables). Data from the history tables is aggregated based on the chosen time frame (e.g. today, this week, last week, custom selection...)After selecting a value all information on that time frame will be shown on the summary tab. Information about the development of values during this time frame is available on the details tab.Time values are based on DB server time, not DBA wall clock time!

    132

  • The SQL statement cache is crucial for performance . It can get accessed in the Performance menueitem.

    Starting point when investigating SQL performance in DBACOCKPIT

    Upper part of the screen shows a list of the top 100 SQL Statements in the cache , sorted by totalelapsed time , other metrics can be chosen from the drop down box. Custom criteria for the list can get entered, too.

    Lower part of the screen displays details about the SQL statement that has been selected in the list

    The tab 'Cached Query Plans' in the details pane for an SQL statement provides access to a graphical display of query plans.

    133

  • Graphical ExplainThe graphical explain display is accessible from several screens / transactions. Line thicknessrepresents number of rows (highlights potential problems in a plan) Display of table/index information integrated (existing indexes , general table information, histograms)Explain shows an ASE plan. Several plans per SQL statement are possible. If you observe badperformance on some executions, check whether differing plans are cached and why these exists. Parameter sets for initial compilation and slowest execution listed, can help to understand badperforming plans.

    134

  • SDN Article on ATM in DBACOCKPIT : http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/00a022d1-dce2-2e10-e687-f4903ed95a54

    135

  • The recommended 'update statistics' command in an SAP database is 'update index statistics' , whichgenerates column histograms for all indexed columns plus table level statistics. Volatile tables in the SAP database , such as VBDATA, VBMOD, ARFCRSTATE , are excluded from update statistics, as it has been observed in the past that existing statistics on these tables may cause performance issues (all databases not just Sybase ASE).

    ATM table reorganisation runs the command 'REORG COMPACT ' to remove row forwarding and to compact pages (compacts rows on a page and moves unused space on a page to the end of the page). ATM table reorganisation does NOT run rebuild tables ('REORG REBUID '), as it requires lots of resources (additional disk space, sufficient space in the transaction log ) . The command 'REORG REBUILD' is the only command that returns space allocated by a table to the database as unallocated space.

    You may alter existing ATM profiles or create your own ATM profiles to your needs.

    136

  • ATM stores information about past statistic updates and past table reorganisations.

    137

  • To determine which error messages have ben altered to get logged to the error log file run this query: "WIPIGXIVVSVHIWGVMTXMSRJVSQW]WQIWWEKIW [LIVIHPIZIP \!\"KSIVVSVHIWGVMTXMSR8LIVIMWRSXIRSYKLTVSGIHYVIGEGLIXSVYRXLMWTVSGIHYVIXVMKKIVSV750FEXGL6IXV]PEXIVSVEWO]SYV7%XSVIGSRJMKYVI%7)[MXLQSVITVSGIHYVIGEGLI =SYGERRSXVYRXLMWTVSGIHYVIXVMKKIVSV750FEXGLFIGEYWIMXVIUYMVIWQSVIXLERPH TEKIWSJQIQSV]&VIEOMXYTMRXSWLSVXIVUYIVMIWMJTSWWMFPI)\GITXMSRWXEGOPMQMXHI\GIIHIH3RP]XLIS[RIVSJSFNIGX7C3&.-(SVEYWIV[MXLWVSPIGERVYRXLMWGSQQERH138

  • ASE 15.7 includes a useful command line tool 'sybdiag' . The tool automatically captures importantdiagnostic information and packs the diagnostics into a zip file, which then can get attached to a support message.

    Particularly useful when diagnosing general performance issues.

    Diagnostic information generated can get browsed using an web browser, just open the file'sybdiag_start.html' inside the diagnostic directory .

    Usage help is displayed when called with '-h' option.

    sybdiag may get called specifiying different types of diagnostics with the 'T' option, default is captureeverything (which requires elevated permissions on the operating system level) . Often it might be sufficient to limit the output to just capture ase related diagnostics (ommit OS data) with"W]FHMEK z7 (&7-("9WETWE 4 TEWW[H"8EWIGSVIEWIEHHOI]JMPIIt is recommended to attach sybdiag output to just any Sybase ASE related SAP support messageyou create (SAP messages on BC-DB-SYB).

    139

  • To capture advanced diagnostic data for Sybase ASE support, it is possible to configure sharedmemory dumps. When specified conditions are encountered ASE automatically initiate the wirte of a shred memory dump, which may get analysed by Sybase support staff. The above 'add' example configures a dump conditon on error 701. The maximum number of dumpsto written for that condition is one 1 (dump counter). The directory were the dump is been written to isspecified as '/sybase/TNT/dumpdir'. Verify that syb has read/write/execute permissions to that directory and that it is large enough tohold the dump. Adaptive Server does not capture additional memory dumps on a condition when the dump counter has been reached (i.e. number of dumps have been written for that specific condition since last ASE boot)The dump counter for a dump condition is reset when ASE is restarted. To reset the dump counter for a dump condition dynamically, call sp_shumdumpconfig with the 'reset' action.Example: "I\IG WTCWLQHYQTGSRJMK VIWIXIVVSV"KSA disadvantage of configuring shared memory dumps is that ASE is hung while the dump is beingwritten, which may take a while depending on allocated shared memory. (so be careful what youconfigure for production systems)

    140

  • 141