TZASE_EN_Col98_FV_Ltr1

Share Embed Donate


Short Description

gfjfjfjcjc...

Description

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) Multi Processor (SMP) machines.

boost performance on Symmetric

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 have multiple NT threads. In this course when we speak of an ASE database server or an ASE server instance, we refer to the running 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 it is common to have a dedicated host for a database server . The following slides refer to master database and system databases, user databases are covered later in this course.

6

System Databases An 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 for proper 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 default The 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 information Some 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 Remote servers that this server can interact with System error messages Databases on Adaptive Server Storage space allocated to each database Tapes and disks mounted on the system Character sets Languages Users who hold server-wide roles Server roles

syslogins sysservers sysmessages sysdatabases sysusages sysdevices syscharsets syslanguages sysloginroles syssrvroles

Ongoing processes Active locks Adaptive Server engines that are online Current ASE server configuration

sysprocesses syslocks sysengines syscurconfigures

8

Each database has a couple of system catalog tables of ist own. System catalog tables that are created in every database store database specific metadata and provide an SQL interface to the database specific metadata. Examples: sysusers sysobjects sysindexes syscolumns

store information about database users (has a foreign key relation to master..syslogins) database objects (tables, procedures, ) information about indexes 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 databases

sp_helpdevice sp_ddlgen

display information about devices

generate the DDL for a database

sp_who

display information about who's logged into the server

sp_lock

display information about locks hold and waited for

more

10

Directory structure The 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 any location, however, in SAP environment this is always '/sybase/' (UNIX) resp. :\sybase\ (Windows). The directory and all of its contents belong to the local sybase user id with which the software was installed. This is the user 'syb' in SAP installations. Some subdirectories Directory 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) contains the RUN_ file (more on that later) and the .log (ASE server error log file). executables of the server utilities license information for the configured ASE server(s) 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 version 15.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 Windows isql is able to run SQL scripts in batch mode , output can get redirected to output files. Example: The above example calls isql, connects to a server 'TNT', username is sapsa , password is apparently 'pass' , the database it uses is called 'TNT', the input is received from the file input.sql and the output is stored in output.txt. A usage is displayed with the ' ' option. useful options (more options are avaialblewhich are not printed here) : -b -c cmdend -D database -i inputfile -o outputfile -P password -S server_name -U username -w column_width

Disables the display of the table headers output. Changes the command terminator. Selects the database in which the isql session begins. Specifies the name of the operating system file to use for input to isql. Specifies the name of an operating system file to store the output from isql. Specifies your Adaptive Server password. Specifies the name of the Adaptive Server to which to connect to. Specifies a login name. Login names are case sensitive. 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 : Clears the query buffer. Changes the current database. (UNIX) or (Windows) opens the default editor, allows you to edit the last SQL command in the buffer reads an operating system file into the command buffer and displays it. Enter the terminator interactively on a line by itself (not in the file). Executes an operating system command. Place at the start of a line. or Redirects or appends the output of the T-SQL command to file_name. Appends the output of the T-SQL command to file_name Pipes the output of the T-SQL command to an external command Example: Find all instances of 'SAPSR3' in the listing produced by sp_who:

14

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 ASE On 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 ' 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 running The utility 'showserver' can be used to display running Sybase servers. 'showserver' will also show backup server, when it is online Stop ASE There is no separate utility to shutdown ASE. To shutdown ASE, log in with a user with administrator role and use the shutdown command The command 'shutdown SYB_BACKUP' shuts down a running backup server 'shutdown with nowait' shuts down ASE immediately, forcing users off. Example:

16

Start ASE On NT, an ASE server is a Windows service. You may start command line with the command (needs Administrator rights). Usually on will use the 'services' panel to start ASE or configure the service to startup automatically. A file 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 running On the command line, type 'net start' , search for Sybase SQL Server in the output In the task manager, look for a process 'sqlserver.exe' or open the 'services' window , check the status of the Sybase SQL server. Shutdown ASE To shutdown ASE ,click stop button in services panel or log in to ASE with isql , execute command N.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 ' script is located in directory. It calls another script ' in the same location. The script does some checking, sets some defaults and then executes the command with the correct file as a parameter. The script calls the stopdb script (also located in /usr/sap//SYS/exe/run/) . The script after some checking calls an executable tool , which connects to ASE and executes the Sybase command '.

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 , it is an ASCII file that can get edited with any editor. Its default location on LINUX/UNIX is , on Windows it directory If 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 ' 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 DBACOCKPIT. DBACOCKPIT uses ' to change values in configuration file

20

' or in

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 ' , a graphical tool The interfaces file's format differs slightly between platforms On UNIX the standard location of the file is . On Windows the standard location of the file is . 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 (UNIX, Linux) resp. (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 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 into troubles 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 KB973544 On 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 sapinst Review amount of swap space Directories /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 :

If embedded ASE installation fails during SAP installation, you should review the log files in . 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 binary sort order for the western character set. In an SAP system, utf8 with unicode binary sort order is required for ASE. (N.B. unicode binary sort order 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 and then 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 done in 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 of that) , however, it is mandatory that you remember to change the character set, in case you recreated ASE 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/TR1 Create 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/ASE15_0/install Create the new server, use utility 'srvbuildres to create the ASE. Instructions for configuring utf8 and unicode binary sort order Copy 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 server Copy the contents of bsrv.res to your local directory Adapt server_name port, and errorlog accordingly Create 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 has been 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 the command "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 to execute the command)

33

To get information about roles , use stored procedure sp_displayroles: Example 1 display roles granted to you :

Example 2

display roles included in role sap_adm:

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'

When the job is done tahe requires both

sa_role and sso_role, lock 'sa' again.

36

Example: Change your own password:

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 role s 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 ' 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:

disk init 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 ! ) 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 device It is possible to dynamically increase ASE devices in size with the 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 ' , 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 devices When 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' command After installation master is a default device. It is recommended to turn that off by executing stored procedure (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:

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

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:

54

55

Example:

Creates 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 created for 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 databases should 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 the database 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 master database to set options. Example:

59

The option 'full logging for ' determines logging for statements like 'select into' or the bulk copy operation. 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 command is possible afterwards until a complete dump database has been done. In some situatiuons it may be desirable to execute these operations, but still maintain the log sequence. The option 'full logging 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 database has to get recreated for a restore , its options are set to a default.

when a

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 enabled by default for the SAP database and does not require any DBA interaction. Not compressed are any cluster 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 action to 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 assign temporary databases to a group. Example:

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 , 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 SAPINST 2) 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' 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

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:

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 maximum a 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 :

After the load of all transaction logs has finished bring the database online:

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:

'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 :

81

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 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 ms The 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 threads Increasing 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 ADDRESSED Try to find the root cause instead of covering them up Don t adjust the time slice parameter ineffective solution will affect all tasks, not only those that exceed grace time cpu grace time should be a temporary solution consider increasing grace time while the root cause is being investigated default 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 login The 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 engine s 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 cache You 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 asynchronous prefetch, but have not yet been used by any queries. The configuration parameter 'global async prefetch 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 existing cache, 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 the number 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 stored procedures' and as such require an object descriptor. As object descriptors are limited and needed for other stuff as well, don't overconfigure statement cache 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 your SAP system on Sybase ASE. As has been pointed out already Sybase ASE is a RDBMS system designed 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 achieve good performance.

108

Migrated systems that were not compressed before the migration will occupy less disk space afterwards, 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 are probably not convenient for administration . Perhaps there is no unique formula to determine the correct number of devices, however, it seems that the closest whole number to the square root of the database size in GB has served quite well for other RDBMS vendors. Of course it is recommended to have one or several separate filesystems on separate disks for the database devices. Also, RAID10 or at least hardware mirroring should be considered, particularly for the log devices. (the latter 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 and mapping 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 the tempdb . However, if the file system uses large large portions of main memory for ist own cache, this could use to paging, if the cache is indeed used by the filesystem.

109

spsysmon output - Example (excerpt)

For 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 : In threaded kernel mode , the number of engines is configured with the command 'alter thread pool' Example: 1>

This 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:

This 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 (is this a CI host as well ?) Allocate as much memory to ASE as possible, w/o cuasing memory paging on the host. Set 'max memory' 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 up 50 % 55 % of max memory. Additional named data caches should get configured only when you determined a need for it. For example , if you have one query that has to run repeatedly and due to the size of the result set thrashes the default data cache for many other queries, it might improve overall performance to have a separte cache for such queries. However, keep in mind, that named caches 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 may have 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)

In 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. If migrating from another RDBMS vendor you may have to rething the setting of this parameter, if your DB used lock escalation. ASE does provide some sort of lock escalation, however, for SAP systems it is generally recommended 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 user Data extraction for the DB Performance Warehouse is based on the same set of data in the saptools database.

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 Framework For DBACOCKPIT to be useful you have to set up the collection framework, so that the necessary stored procedures and jobs are created in the monitored system. The data collection framework is based on templates, a collection of collector settings, either delivered by 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 are available: 'SAP Default (hourly)' and 'SAP Detailed (15 Minutes)' . DBAs may copy the predefined templates and adapt to suit their needs. However, at least the settings in 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 up Yellow: Version of the collector not up to date Green: Most recent version running Auto Update of Collectors (Default: On) Automatic Update/ Repair of Back-End performed once per day This 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 Cockpit Configuration parameters are organized in groups Depending on user authorization only display or change is possible Changes to dynamic parameters will take into effect immidiatley Changes to static parameters require a restart of ASE The run value is the value currently in use, the config value the value that will be used after next restart Integrated documentation for each parameter All 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 menue item. 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 total elapsed 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 Explain The graphical explain display is accessible from several screens / transactions. Line thickness represents 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 bad performance 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 bad performing plans.

134

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

135

The recommended 'update statistics' command in an SAP database is 'update index statistics' , which generates 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:

138

ASE 15.7 includes a useful command line tool 'sybdiag' . The tool automatically captures important diagnostic 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 capture everything (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

It is recommended to attach sybdiag output to just any Sybase ASE related SAP support message you create (SAP messages on BC-DB-SYB).

139

To capture advanced diagnostic data for Sybase ASE support, it is possible to configure shared memory 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 dumps to written for that condition is one 1 (dump counter). The directory were the dump is been written to is specified as '/sybase/TNT/dumpdir'. Verify that syb has read/write/execute permissions to that directory and that it is large enough to hold 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:

A disadvantage of configuring shared memory dumps is that ASE is hung while the dump is being written, which may take a while depending on allocated shared memory. (so be careful what you configure for production systems)

140

141

View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF