SYBASE DBA

Sybase DBA Manual
Sybase DBA 11/10/2010

It is a humble attempt from our end to welcome the readers into the intriguing and amazing world of SYBASE. Outmost care has been taken to ensure that it is easily grasped even by the novices. This document hopefully will become the first step before you launch yourself into the profession of DATABASE ADMINISTRATION. Few of the topics have been copied from www.sybase.com.

Sybase DBA Manual

Contents
What is DBMS/RDBMS? Duties of DBA ASE Overview and Architecture Diagram What is Database? How is data stored in database? Disk Initialization New Page Allocation Procedure in ASE Segments Thresholds Roles & Groups Logins & User Interface & Error Log File ASE Memory Usage Db_options Configuration Parameters Indexes Update Stats & Sp_recompile Locks & Isolation Level Phases When Query Is Executed & Process Status Hit/Miss Diagram 4 4 4 6 7 9 10 11 12 12 13 13 14 16 16 17 20 20 22 24

Page 2

Sybase DBA Manual
Start and Shut Down Of Server Backup/Recovery/Refresh/Restore Dbcc MDA Tables Multiple Temp Databases Utilities Troubleshooting How to Apply EBF Query and Server Performance Tuning Calculations Sybase Diagram Replication Overview and Architecture Diagram Crontab 26 26 27 28 29 29 30 34 35 36 37 37 41

Page 3

Sybase DBA Manual
What is DBMS/RDBMS?
A Data Base Management System is a collection of programs that enable users to create and maintain a database. It can also be said that DBMS is a process of managing data for efficient retrieval and storage of data. Hence it is general purpose software that facilitates the processes of defining, constructing, manipulating and sharing databases among various users. The RDBMS is a database management system that that stores data in the form of tables and there is also a relationship that exists between the tables. In a RDBMS data and information is acquired by the relations or tables.

Duties of DBA
The following are some of the duties of a DBA Checking the server status (automate the job in crontab to monitor the server status).  Ensure that backups happen daily.  Health check for all the databases.  Performance related tasks (automate Update statistics & sp_recompile in crontab).  Rebooting the servers during maintenance window.  Security Management (adding logins/users with proper approvals from application/technical leads).  Proactively monitoring the database data & log growth (threshold setup).  Monitoring error logs.

ASE Overview and Architecture Diagram
Adaptive Server Enterprise (ASE) has long been noted for its reliability, low total cost of ownership and superior performance. With its latest version, ASE 15, it has been dramatically enhanced to deliver capabilities urgently needed by enterprises today. It lays the long-term foundation for strategic agility and continuing innovation in mission-critical environments. ASE 15 provides unique security options and a host of other new features that boost performance while reducing operational costs and risk. Find out how you can exploit new technologies such as grids and clusters, service-oriented architectures and real-time messaging.

ASE 15 meets the increasing demands of large databases and high transaction volumes, while providing a cost effective database management system. Its key features include on-disk encryption, smart partitions and new, patent-pending query processing technology that has demonstrated a significant increase in performance, as well as enhanced support for unstructured data management. ASE is a highperformance, mission-critical database management system that gives Sybase customers an operational advantage by lowering costs and risks.

Page 4

Sybase DBA Manual SHARED MEMORY ASE executables DATA CACHE Error log PROCEDURE CACHE USER LOG CACHE STACK SPACE Configuration File <Servername>.krg Wash Area NH Master Device Initialized Master DB recovered System Processes M A X M E M O R Y Data Server Default 2K pool Statement Cache Interface Wash Marker can range from 20% to 80 % AS MRU SH LRU DH Pool POOL Uses the 2K pool for Roll forward / Rollback System Devices and Databases User Devices User Databases File System / Raw Devices DB Options Segments / Thresholds Figure 1 Architecture Diagram Page 5 .

DBCC and sybsystemdb). Stored Procedures.  Syntax Create database database_name [On {default | database_device} [= size] [. sybsyntax. and dbcc. When db name is current database then displays even segment information.. o System databases are default databases created during adaptive server installation (master.Sybase DBA Manual What is Database?  Database is collection of data objects (Tables. o User databases can only be created by the system administrator or whoever has the system administrator privileges. For load: does not initialize the allocated space which saves times when a dump will be loaded next Alter database db_name on data_dev2= '100M' Drop database db_name: drops the database which is not currently in use and not contain any constraints referring to other databases. tempdb & sysbsystemprocs) few system databases are optional and can be created/configured by DBA (sybsecurity. sybsystemdb. Page 6 .. Views. Functions. database_device [= size]]. Triggers and indexes).] [Log on database_device [= size] [.] [With {override | default_location = "pathname"}] [For {load | proxy_update}]  Options: With override: must be specified when data and log segments are placed on a same Database     device. A max of 256 Databases can be created on single adaptive server.. sybsyntax.. Dbcc dbrepair (db_name. When used without any db name displays information about all databases.  Number of databases that can be created under one adaptive server depends on the configuration parameter number of databases  All the information regarding databases created in single adaptive server can be viewed in system table SYSDATABASES and the database space usage in SYSUSAGES. model. pubs. Some of them are Sybsecurity.  Databases are broadly divided into system and user databases. dropdb) Sp_helpdb: displays information about specified database. database_device [= size]].

It keeps track of all the databases. sysdevices. sysroles.  Temp DB can be referred as a workspace for the users to perform operations. Logins. etc.  Model DB is the template for all the databases. sysprocess. It s the heart of the Server. The following table describes the number of OAM entries for each logical page size: 2K logical page size 250 4K logical page size 506 8K logical page size 1018 16K logical page size 2042  Global Allocation Map (SYSGAMS system table) records and tracks all the information of all the AU s in the particular database. It has nearly 32 system tables. The size of a page can be 2KB. It s a volatile memory.  The number of entries per OAM page also depends on the logical page size the server is using. excluding the Master.  The smallest unit of data storage is Page. Devices. In return all the OAM point to the AP of the entire allocation unit where object data is stored. Some of them are syslogins.Sybase DBA Manual  Sp_helpdb db_name. so whenever the server is rebooted. or 16KB. new_dbname (db must be in single user mode)  Master DB stores information regarding all other databases. sysdb.Collection of 256 pages is called an Allocation Unit. 'device_name' displays device fragments in alphabetical order. default order in which device fragments are added  sp_spaceused: Displays total space used by all the tables in current database sp_spaceused appl3  sp_renamedb olddb_name.  Table size = 1 Extent * page size.  Object Allocation Map stores about the information of the pages of the Table. Page 7 . it has to be recreated using the template from Model DB. Server wide details are stored in here. SYSGAMS is not accessible by any user. 8 contiguous pages is an Extent.A global level temporary tables exists till the server is rebooted o Workable tables. etc. o Session level (table name prefixed with #) . which stores all the information of the pages of the Unit.A session level temporary table exists till the expiry of the session of the user o Global level (table name prefixed with tempdb) . 4KB. Three kinds of table are created in the Tempdb. Each Allocation unit has a first page called Allocation Page. For every 8GB of disk space a new GAM is created.System creates this kind of tables like for sorting purpose.  Allocation unit: .  SYBSYSTEMPROCS DB stores all the system procedures How is data stored in database?  The data in database is stored in the form of tables.

The most important distinction between a lock and a latch is the duration Table 1 Difference between Latch and Lock Latch A latch is held only for the time required to insert or move a few bytes on a data page.Latches are non transactional synchronization mechanisms used to guarantee the physical consistency of a page. only one Adaptive Server process can have access to the page at the same time. for the duration of a statement. updated or deleted. or for the duration of a transaction Page 8 . or to acquire a latch on another index page Lock A lock can persist for a long period of time: while a page is being scanned. columns or rows. Latches are used for datapages and datarows locking but not for all pages locking. while a disk read or network write takes place. to copy pointers. Note: . While rows are being inserted.Sybase DBA Manual Figure 2 Overview on Allocation Unit Latch: .

Sybase DBA Manual Disk Initialization  Disk initialization is the process of allocating disk space to server. {true.0 Disk init name = 'dev2'.  sp_deviceattr device_name. false} Page 9 . contiguous] [.  Device that can be connected to a server was up to 256 till version 12.] Size = number_of_blocks [. During initialization adaptive server will divide the new allocated disk into allocation units and an entry is made in sysdevices system table. (vdevno is automatic in 15. can be viewed in system table SYSDEVICES.0 256 15. Directio is faster than dsync both cannot be used. 'dsync/directio .  A disk that is allocated to a server cannot be shared with other servers. Maximum devices pre 15. Size = '100M'.disk writes are guranteed Note: dsync/directio applied only for File System. dsync = {true | false}] ASE 15.  Number of devices that can be allocated to the adaptive server depends on the configuration parameter number of devices  Disk once initialized to the adaptive server can only be dropped when all the associated databases are dropped  Disk default option for system database has to be turned off. restricting to a single file system. cntrltype = controller_number] [. vstart = virtual_address . later got unlimited from version 15. Any number of databases can use a disk as long as they are in the same server. Physname = '/data/sql_server.Directio= true Default (dsync = true) .dev2'.0).5. [Vdevno = virtual_device_number. Syntax Disk init Name = "device_name" . Physname = "physicalname" .0 onwards 2 million  sp_helpdevice: shows device details  sp_dropdevice device_name: drops the device name and will not delete file in file system. Make sure to drop the database before dropping any device.  All the information regarding devices connected to the Server.

Sybase DBA Manual New Page Allocation Procedure in ASE GAM Previous AU1 AU2 Page Header 1 2 3 NEXT 3 2 1 Table row offset AP OAM AP OAM OAM Extent The object is extended to another AU AU1 AU2 Figure 3 Page Allocation Procedure Whenever a user inserts some data it first checks for available pages in the current extent (OAM) and inserts into it. allocation page where a new extent can be allocated. Page 10 . If not found a new extent is allocated for that object in the same allocation unit with the help of the allocation page. This extent is mapped to the OAM of the object. If there are no allocation units available for the current requested page in the current GAM. this extent is mapped with the OAM of the object present in the other allocation unit. new GAM comes into picture. If the data exceeds 8GB. If the extent is not available in the same allocation unit it checks with GAM for a new allocation unit (available extent). AU. OAM come into picture when a new request for a page is requested. AP. After the extent is allocated to the object in a different allocation unit. a new GAM is created and later altogether the whole process for new page is processed. In this way GAM.

When we add the additional space to the database system and default segments will automatically extends on new device where as user created segments has to be manually extended. SYSSEGMENTS. segname.Take a backup of the objects and then copy them back to new segment. db_name. db_name: future allocation will be mapped to new segment.index_name') sp_helpsegment seg_name: Displays information about all the segments in current database.System and User System defined. There are 3 ways in which we can move tables form one segment to another. Before deleting the segments we should ensure that the objects associated to that segment are dropped. db_name. or index name. o Using clustered index. o Using sp_placeobject It moves the next upcoming records to the new segment. etc.System. The Data and Log segments for a single database should not be placed on a single device in order to improve the performance and recovery is impossible. Two types of segments.  Syntax Creates seg_name in the current database and device name sp_addsegment seg_name. o Using bcp. Object name can be table name. object_name. DB size. Default & Log System. device_name Page 11 . If specified display information about only one segment which is specified Sp_dropsegment segment_name.all data modifications in the database are temporarily stored in log Default.By re-creating a clustered index for the object on new segment. db_name. ('tab_name.stores the data related to user created data objects User defined. device_name: db_name matches to current database sp_placeobject segment_name. [device_name]: drops the segment in the current database Sp_extendsegment.stores all the data related to system tables in that particular database Log.Sybase DBA Manual Segments            Segment can be describes as the logical name that can be give to a single/fraction/more devices.A max of 32 segments can be created in a database including the 3 system segments. SYSUSAGES system tables stores detail information regarding the segments.

 Two types of thresholds : System & User o System level. LCT threshold limit value cannot be modified and is set by the adaptive server automatically. Sp_modifythreshold dbname. Roles are granted to individual server login accounts. Roles & Groups  Roles provide individual accountability for users performing system administration and securityrelated tasks. In other words. Syntax Sp_addthreshold dbname.  Sp_thresholdaction sends alert if transaction crosses the LCT.  The sp_addgroup system procedure adds a row to Sysusers in the current database.  A max of 256 thresholds can be created for a Database. proc_name: To add a threshold.  FCT s can be dropped or modified.Last chance Threshold.Sybase DBA Manual Thresholds  Thresholds monitor the free space in a database and alert the DBA to take appropriate action to prevent the max usage of the database segments coz if neglected the server will hang and is users cannot access. each group in a database-as well as each user-has an entry in Sysusers. new_segname]: To modify a given threshold. new_proc_name] [.Free chance Threshold.  All the details regarding the thresholds can be found in SYSTHRESHOLD. o User level.  Thresholds can be defined on data and log segments.  Below are a few descriptions of ROLESo System Administrator (sa_role ) o System Security Officer (SSO_role) o Operator (oper_role ) o Sybase technical support (sybase_ts_role) o Replication (replication_role) o Distributed transaction manager (dtm_tm_role) o High availability (ha_role) Page 12 . free_space. FCT is defined by the user as per the usage of the database and log segment size. free_space [. Usually 18% of log space is reserved for LCT. We can only modify the stored procedure Sp_thresholdaction.  By default ASE databases has default group as public group. new_free_space] [. segname. segname. and actions performed by these users can be audited and attributed to them  SYSTEMTABLE: sysroles  Groups provide a convenient way to grant and revoke permissions to more than one user in a single statement.

plus any other server applications such as Monitor Server. name. object. fullname][. Syntax Sp_addlogin loginame. Page 13 . SYSUSERS holds the details which allow people to access the Databases level. network name or address of the host machine. name. Interface & Error Log File  An interface file contains network information about all servers on your network. grpname]]: To create a user for a login for a database. Syslogins: Suid. gid. Using Dsedit or Dscp is preferred than text editor as it s easier to use and ensures that the interface file is consistent in format. Replication Server.  We notice error number. and the port. dbname. Logins & User      SYSLOGIN holds the details which allow people to access the Server level. password. passwdexp]: To create a login with a default database.  Error log is stored externally. severity level >16 and error message in the errorlog. {passwd expiration | min passwd length | max failed_logins} option_value] ]: To create a role. or socket number (depending on the network protocol) on which the server listens for queries.  The network information in the file includes the server name. passwd [. including Adaptive Server. defdb][. procid. Backup Server. srvname. and any other Open Server applications.  Dsedit or Dscp utility are used to create an interface file. deflanguage][. These two above table are related with the column suid . All the server level events and severity level >16 will be recorded in the error log. Sp_addgroup grpname: To create a group.Sybase DBA Manual o o o o o Monitor and diagnosis (Mon_role) Job Scheduler administration (js_admin_role) Real Time messaging (messaging_role) Web Services (web_services) Job scheduler user(js_user_role) Syntax Create role role_name [with passwd "password"[. uid. Sp_adduser loginame [. Sysusers: Suid. and XP Server. name_in_db [.

if a match is found. statement cache.  Severity level less than 17 are not recorded in the error log. if the configuration parameter 'allocate max shared memory' has been set. by default. This allows the application to amortize the costs of query compilation across several executions of the same statement. Space becomes available when unused plans age out of the cache.  'Max Memory' indicates the amount of memory you will allow for Adaptive Server needs. a user trying to execute stored procedures or queries that fire triggers receives an error message and must resubmit the query. and other system tables for each database  Active log pages for each database  The higher levels and parts of the lower levels of frequently used indexes Page 14 . Object level error messages are not included in the error log.Adaptive Server maintains an MRU/LRU (most recently used/least recently used) chain of stored procedure query plans. uses the plan cached from the initial execution. as the affect is minimal. However. typically:  sysobjects. procedure cache and data caches. The statement cache memory is taken from the procedure cache memory pool.Sybase DBA Manual  These error messages can be found in the table sysmessages. If the procedure cache is too small.  The total memory allocated during boot-time is the sum of memory required for all the configuration needs of Adaptive Server. Adaptive Server allocates memory based on the value of 'total logical memory'. it is placed on the MRU end of the chain. Adaptive Server looks in the procedure cache for a query plan to use. then the memory allocated will be based on the value of 'max memory'. ASE Memory Usage  Memory is consumed by various configuration parameters.  Caches in Max Memory / Adaptive Servero Procedure Cache. The data cache contains pages from recently accessed objects. o Data Cache. Adaptive Server compares a newly received ad hoc SQL statement to cached SQL statements and. o Statement Cache. If a query plan is available. The total memory required value can be obtained from the read-only configuration parameter 'total logical memory'.  The configuration parameter 'max memory' must be greater than or equal to 'total logical memory'.  We cannot start the ASE without errorlog file. Adaptive Server does not have to recompile SQL statements for which it already has a plan. there will be multiple copies of it in cache.The statement cache allows Adaptive Server to store the text of ad hoc SQL statements. If more than one user uses a procedure or trigger simultaneously. In this way.At the point of installation the default data cache is of 2K memory pool. the default procedure cache size is 3271 memory pages. During boot-time. and execution begins. sysindexes. As users execute stored procedures.

it cannot be released until the next server reboot. the Hit/Miss ratio should be over 90% and can be found by stored procedure sp_sysmon. data caches or for other configuration parameters. Page 15 . o If it does start. if the defaults are not sufficient. o The amount of memory to be allocated by Adaptive Server during boot-time is determined by either 'total logical memory' or 'max memory'. o Configure the different configuration parameters.Sybase DBA Manual  Recently accessed data pages  The key points for memory configuration are: o The system administrator should determine the size of shared memory available to Adaptive Server and set 'max memory' to this value. o Now the difference between 'max memory' and 'total logical memory' is additional memory available for procedure. Figure 4 How Adaptive Server uses memory  For a good performance. If this value too high: o Adaptive Server may not start. if the physical resources on your machine does is not sufficient. the operating system page fault rates may rise significantly and the operating system may need to re configured to compensate. Note that once a shared memory segment is allocated. Please check your operating system documentation to determine the optimal number of shared memory segments. o The configuration parameter 'allocate max shared memory' can be turned on during boot-time and run-time to allocate all the shared memory up to 'max memory' with the least number of shared memory segments. Large number of shared memory segments has the disadvantage of some performance degradation on certain platforms.

 Always have the backup for config file Page 16 . All the dynamic configured parameters values are stored in table syscurconfigure. optname. DB OPTION 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 abort tran on log full allow nulls by default async log service auto identity dbo use only ddl in tran delayed commit disable alias access identity in nonunique index no chkpt on recovery no free space acctg read only single user select into/bulkcopy/pllsort trunc log on chkpt unique auto_identity index MASTER MODEL No No No No No No No No No No No No No No No No Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes TEMPDB Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes SYBSYSTEMPROCS Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes  Syntax. optvalue [. All the static configured parameters values are stored in table sysconfigure.cfg file and every time you modify the config values the current <server name>. dockpt]] Configuration Parameters     Config parameter defines the server wide settings and is divided in to static and dynamic.  List of database options areTable 2 System Tables DB Options SNo.cfg file will be saved as <server name>.001 and new config values will be appeared in <server name>.sp_dboption [dbname.Sybase DBA Manual Db_options  To change the default settings for the database we use database options.cfg file.  We cannot start the ASE without valid config file. Config values also stored in the <server name>.  Sp_dboption.displays or changes database options.

Diagrams that explain clearly about clustered and non clustered index pages.There can be as many as 249 non clustered indexes for a table. it stored into the last available page called hot spot.  Figure 5 Non clustered index Page 17 .Sybase DBA Manual Indexes     Indexes are created for the faster retrieval of the data. Clustered index is identified by value 1. The leaf nodes contain the data itself. Total 3 levels (root. Indexes are preferred when the total requested records are less than or equal to 5% of total table rows. To avoid the table scan we prefer indexes. Total 4 levels (root. intermediate & data/leaf).There can only one clustered index for a table in binary tree format. All the indexes can be found in table sysindexes for a database. o Nonclustered Indexes. Table without a clustered index is known a Heap Table. Data is stored in physical order (asc/desc). where as rest non clustered indexes are identified from 2 to 249. The leaf nodes contain pointers that map to the actual data. When there is no index on the table the user requested query will perform the table scans (scanning each page that is allocated to the object). intermediate. Leaf & data). Whenever a new record is inserted into a table with no index. It is logical. This is the reason why it takes more time for nonclustered index data. Table is identified by value 0. Whenever we recreate the clustered index the non-clustered index (if exists) will be automatically recreated and update statistics will run on the object automatically (ASE will run internally). Indexes can be broadly divided into two types o Clustered Indexes.

Sybase DBA Manual Figure 6 Clustered Index Page 18 .

Page 19 . the search value. values. Overflow Pages. All indexes still point to the original row ID. with the nonunique clustered index with many duplicate key new row inserted in order. page in the page chain. page is allocated and linked ·The next and previous page into the page chain. a page created for nonunique split must be performed. Instead. all pointers to the affected overflow pages. Row Forwarding Page Split(APL) Overflow Pages Row Forwarding(DOL) A data-only-locked table is updated so that it no longer fits on the page. In a moved to the new page. to follow the chain of overflow pages until a value When you create a clustered index is found that does not match for a table that will grow over time. Indexes do not need to be modified when rows are forwarded. This reduces the number of page splits for a time. If same key as the last row on a there is no free page available. a full data page. A new data new extent is allocated. a process called row forwarding performs the following steps: ·The row is inserted onto a different page. and ·A pointer to the row ID on the new page is stored in the original location for the row. The clustered index does not ·If the table also has nonclustered contain pointers directly to indexes. and the pointers on adjacent pages are newly inserted row is placed changed to incorporate the new on the new page.Sybase DBA Manual Table 3 Page Split. page. are additional rows with the ·Approximately half of the rows are same key value. the data rows must be changed to point next page pointers are used to the new page and row locations. If there is not enough room on the Special overflow pages are data page for the new row. This requires The only rows that will be reading those pages into memory placed on this overflow page and locking them. clustered indexes on all pages-locked tables when a ·A new data page is allocated on an newly inserted row has the extent already in use by the table. there can be ·The higher levels of the clustered numerous overflow pages for index change to point to the new the same value. you may want to use fill factor to leave room on data pages and index pages.

The transaction with the least accumulated CPU time is killed and all of its work is rolled back. which locks only the data rows.  Syntax sp_recompile objname. o Datapages locking.Sybase DBA Manual Update Stats & Sp_recompile  The update statistics helps Optimizer to prepare the best plan for the query based on the density of the index key value in the sysstatistics table. and row level.  Syntax update statistics table_name [index_name]. Locking is a concurrency control mechanism: it ensures the consistency of data within and across transactions.It can acquire just one tablelevel lock. This is called lock contention. which locks only the data pages. When a transaction gets an exclusive lock. but no transaction can change data on the page or row while a shared lock exists. If a shared lock has been applied to a data page or data row or to an index page.  Adaptive Server has two levels of locking: o For tables that use allpages locking or datapages locking. It can acquire a lock for each page that contained one of the required rows. o For tables that use datarows locking. even when the first transaction is active. o Exclusive locks-Adaptive Server applies an exclusive lock for a data modification operation. It can acquire a lock on each row. which locks datapages and index pages . This means that many transactions can simultaneously read the page or row. o Datarows locking. Locks & Isolation Level  Adaptive Server protects the tables.  Adaptive Server supports locking at the table. o Allpages locking.  Locking affects performance when one process holds locks that prevent another process from accessing needed data. either page locks or table locks. no transaction can acquire an exclusive lock on the page or row until all shared locks on the page or row are released.  Execute/schedule update statistics on heavily modified user objects on daily basis.  A deadlock occurs when two user processes each have a lock on a separate page or table and each wants to acquire a lock on the same page or table held by the other process. other transactions can also acquire a shared lock. However. other transactions cannot acquire Page 20 . data pages. The process that is blocked by the lock sleeps until the lock is released.  Page and row locks o Shared locks-Adaptive Server applies shared locks for read operations.  SP_RECOMPILE causes each stored procedure and trigger that uses the named table to be recompiled the next time it runs. or data rows currently used by active transactions by locking them. either row locks or table locks. page.

except it affects the entire table. Update locks-Adaptive Server applies an update lock during the initial phase of an update. o Deadlock retries specifies the number of times a transaction can attempt to acquire a lock when deadlocking occurs during an index page split or shrink. Adaptive Server applies an exclusive table lock during create clustered index command. o Shared lock-This lock is similar to a shared page or lock.  Deadlock can be tuned with two options o Deadlock checking period specifies the minimum amount of time (in milliseconds) before Adaptive Server initiates a deadlock check for a process that is waiting on a lock to be released. the update lock is promoted to an exclusive lock as soon as no other shared locks exist on the page or row.  Syslocks contains information about active locks. or fetch (for cursors declared for update) operation while the page or row is being read. Setting an intent lock prevents other transactions from subsequently acquiring conflicting table-level locks on the table that contains that locked page.  Sp_lock reports information about processes that currently hold locks. A create nonclustered index command also acquires a shared table lock.A spinlock is a simple locking mechanism that prevents a process from accessing the system resource currently used by another process. No updates to Syslocks are allowed. the higher the number of spinlocks. If 100 are specified for the spinlock ratio. The lower the value specified for the spinlock ratio. For example. Update and delete statements require exclusive table locks if their search arguments do not reference indexed columns of the object. Adaptive Server applies an intent table lock with each shared or exclusive page or row lock.Sybase DBA Manual a lock of any kind on the page or row until the exclusive lock is released at the end of its transaction. The other transactions wait or block until the exclusive lock is released.  Config parameters related to locks are : o Number of locks o Lock scheme o Lock wait period o Lock spinlock ratio Page 21 . An intent lock is held as long as page or row locks are in effect for the transaction. All processes trying to access the resource must wait (or spin ) until the lock is released. except that it affects the entire table. delete. The number of spinlocks allocated by Adaptive Server depends on the total number of resources as well as on the ratio specified. and built dynamically when queried by a user. Update locks help avoid deadlocks and lock contention. o Exclusive lock-This lock is similar to an exclusive page or row lock. so an intent lock can be either an exclusive lock or a shared lock. If the page or row needs to be changed. Adaptive Server allocates one spinlock for each 100 resources.  Spinlock ratio.  Lock promotion can only happen from row to table and page to table level. o  Table locks o Intent lock-An intent lock indicates that page-level or row-level locks are currently held on a table.

compiler and execute. If the second transaction commits its change. allows a task to read uncommitted changes to data in the database. data. Below are mentioned the possible states of a process. delete. Level 2 also known as repeatable read. concurrent transactions. if a transaction needs to read a row that has been modified by an incomplete transaction in another session. prevents dirty reads. since the task can display results that are later rolled back. Page 22 . It prevents no repeatable reads. the single process can change to various states depending on the availability of the i/o. query plan. subsequent reads by the first transaction yield results that are different from the original read. If the first transaction repeats the read with the same search conditions. At isolation level 1. These occur when one transaction reads a set of rows that satisfy a search condition. and then a second transaction modifies the data (through an insert. There are four levels of isolation which ASE has. etc. execute checks for the result in the data cache ( if not found gets back from the database). Parser checks for the syntactical errors. Level 0 also known as read uncommitted. Queries at level 1 can read only committed changes to data.also known as read committed.       Phases When Query Is Executed & Process Status  When ever a query is executed it is executed in three phases parser. This is also known as a dirty read. or update statement). compiler checks for the query plan in data cache ( if not found gets backs from database). These occur when one transaction reads a row and a second transaction modifies that row. It prevents phantoms.  During the phases of execution. Level 1 . of which level 0 is default. the transaction waits until the first transaction completes (either commits or rolls back) . Level 3 also known as serializable reads.Sybase DBA Manual o page lock promotion HWM o page lock promotion LWM o page lock promotion PCT o row lock promotion HWM o row lock promotion LWM o row lock promotion PCT The isolation level controls the degree to which operations and data in one transaction are visible to operations in other.

Recommend procedure. such as a threshold Immediate. run by SQL Server a careful check of sysprocesses before killing a rather than by a user process background process killed when it "wakes up": 1) when space is freed in processes suspended by reaching the log by a dump transaction command or 2) the last-chance threshold on the when an SA uses the LCT_admin function to wake log up "log suspend" processes Infected Background log suspend Page 23 . and require a process that is running. Server reboot condition. extremely rare probably required to clear process a process. or some other killed when it "wakes up". Probably indicates a sleeping processes do not wake up. such as wait Immediate for delay "10:00" waiting on a lock acquisition Immediate Sleeping Waiting disk I/O. usually immediate.Sybase DBA Manual Table 4 Process Status Status recv sleep send sleep alarm sleep lock sleep Condition waiting on a network read waiting on a network send Immediate Immediate Effects of kill Command waiting on an alarm. use kill with extreme care. but doing Server reboot to clear extensive disk I/O in the queue processes of runnable Immediate Runnable Running actively running on one on the Immediate Server engines Server has detected serious error Kill command not recommended. a few resource.

it goes through many phases. 2. Connection is established between user and the ASE. it is passed to parser.HIT 1. 5. Parser checks for syntactical errors. If everything is found where expected. Page 24 . 4. 3. compiler checks for existing query plan in procedure cache. it s called a HIT. execute checks for the corresponding data in the data cache. next to complier and then executed till the result is fetched back to the user. When a query is fired. Shared Memory Max Memory Interface file Connection Established Network Handler A S E ASE E&O Configuration file Data Fetched back to USER User Send Sleep Receive Sleep Executes Query Session Created User Log Cache in Shared Memory Running Unused Space Parser Compiler Execute If Query Plan found HIT Data Cache Procedure Cache Figure 7 Steps when a Query is executed by a USER --. which can result as a HIT or a MISS depending on the availability of the data in the cache. A new session is created for the user.  The below diagrams clearly explain the steps involved during HIT or MISS.Sybase DBA Manual Hit/Miss Diagram  During the execution of a query.

Sybase DBA Manual Shared Memory Max Memory Interface file Connection Established Network Handler A S E ASE E&O Configuration file Data Fetched back to USER Send Sleep User Receive Sleep Executes Query Session Created User Log Cache in Shared Memory Running Data Cache Procedure Cache Unused Space MISS Sleeping DISK Parser If query plan not found Compiler Execute Optimizer prepares Query Plan T A B L E SYSQUERYPLANS SYSSTATISTICS UPDATE STATS Figure 8 Steps when a Query is executed by a USER --. Page 25 . 4. it is passed to parser.MISS 1. If any one of them (data or query plan) is not found where expected. execute checks for data in data cache and if not found gets from the disk and sent back to user. 5. When a query is fired. 3. Connection is established between user and the ASE. Parser checks for syntactical errors. 2. compiler checks for query plan in the procedure cache. next to complier and then executed till the result is fetched to the user. it s called a MISS. if not found it gets prepared by the optimizer. A new session is created for the user.

allocates shared memory for the ASE server. Page 26     .dbo.Taking the database to a previous state.  Restore. Bcp test.  Shut down of a server can be in two modes.7 GB can be allocated to the ASE server.Sybase DBA Manual Start and Shut Down Of Server  To start the ASE execute startserver f RUN_<server name>. In version 12.5. it creates memory in the shared memory and creates the file <server name>.dat o # master device size: 10752 o # errorlog: /usr/u/sybase/install/errorlog o # interfaces: /usr/u/sybase/interfaces o # o /usr/u/sybase/bin/dataserver -d/work/master.sysprotects out <file name> -Ulogin Sserver Ddatabase.it s a clean shut down which checks and ensures that all transactions are closed. which kill all the transactions forcefully.dbo. <Server name>. Solaris\Unix or any environment. SYSPROTECTS and SYSALIASES from Test DB. Backup/Recovery/Refresh/Restore  Recovery. Bcp test.  IPC does the job of controlling and monitoring the shared segments of shared memory. Take backup for Prod and Test DB.  Backup. Use m to start the server in single user mode.cfg m  Use P option in run server file to generate the password for the SA which prints the new SA password in the errorlog.Taking an extra copy of the existing data. o Nowait. and also db_options for the test should be saved before the refresh operation. Steps to be followed for test refresh. o Wait.Getting the database to the current state of data from a previously maintained backup.3 a max of 3.  The following examples show the RUN_servername file edited to start an Adaptive Server named TEST in single-user mode On UNIXo #!/bin/sh o # o # Adaptive Server Information: o # name: TEST o # master device: /work/master.  Once the configuration file is loaded.It s a don t care shut down.krg file will be automatically deleted when ASE server goes offline. BCP out the tables SYSUSERS.krg.  Refresh. for this we need to reboot the ASE server.dat o -sTEST -e/usr/u/sybase/install/errorlog o -i/usr/u/sybase/interfaces o -c/usr/u/sybase/TEST.Loading data from one database to another irrespective of sever.sysusers out <file name> -Ulogin Sserver Ddatabase.

o Partition statistics on the allocation pages are correct.Sybase DBA Manual  Bcp test. planning. 1.  To modify the system table configure the parameters. 0.  Remap the users after load/refresh dba_remap_users. o No page is allocated that is not used.  For copying the ddl of a table the command use ddlgen Ulogin Ppassword -S[server] T[object_type] (if user requested to take the backup for specific tables).dbo.sp_configure allow updates on system tables . Page 27 .sysusers in<path> -Ulogin Sserver Ddatabase. o No page is used that is not allocated o dbcc Checkalloc [(database_name [.sysprotects in<path> -Ulogin Sserver Ddatabase.  Load the Test DB with Prod DB backup.  For copying back the data to sysusers.tx t  Run dbcc and update stats on need basis.sp_configure allow updates on system tables .  Delete the rows from sysusers excluding dbo user-Delete from sysusers where name not in ( dbo ).dbo. Dbcc  Database consistency checker (dbcc) checks the logical and physical consistency of a database and provides statistics.  dbcc Tablealloc checks the specified user table to ensure thato All pages are correctly allocated. o All pages are correctly allocated to the partitions in the specified table and no page is used until allocated.  To reconfigure the access parameters to system tables . o No page is used that is not allocated.  dbcc Checkalloc ensures thato All pages are correctly allocated o Partition statistics on the allocation pages are correct o No page is allocated that is not used o All pages are correctly allocated to individual partitions and no page used until allocated.  Bcp test. sysprotects table we need to execute Bcp test.  Set the db_options for the database.dbo.sysaliases out <file name> -Ulogin Sserver Ddatabase. and repair functionality.  Online database database name. fix | nofix] )]  dbcc Tablealloc checks the specified user table to ensure thato All pages are correctly allocated. o Partition statistics on the allocation pages are correct.

 dbcc indexalloc checks the specified index to see thato All pages are correctly allocated.<object name> . o Evaluate Configurations. If you do not give a database name. PROXY TABLES  Sp_addserver PROX_<server name>. proxy_<table name> at PROX_<server name>. o Install Stored Procedures.  dbcc CheckTable checks the specified table to see thato Index and data pages are linked correctly. o Partition statistics for partitioned tables are correct.isql -Usa -P -SASESERVER iinstalldbccdb -odbccdb_error. PROX_<server name>. o No page is used that is not allocated.out.  Dbcc checkdb runs the same checks as dbcc CheckTable on each table in the specified database. dbcc checkdb checks the current database. 2. o No page is allocated that is not used. o All indexes and data partitions are correctly linked. o Create Workspaces. table  Create proxy_table . o Indexes are sorted properly. o Run dbcc checkstorage.Based on size create data and log devices. these entries match the locations for the data rows on the page. o Data rows on each page have entries in the row-offset table. <user at remote server>.Sybase DBA Manual o o o No page is allocated that is not used.<remote object owner>. o Set dbccdb Configuration Parameters.sp_configure "number of worker processes".Create dbccdb on the above created devices. o Initialize Disk Devices.NULL. o Create dbccdb Database.  DBCCDB database setup o Determine Size sp_plan_dbccdb.<server name that u mention in interface file>  Sp_addexternlogin PROX_<server name>. dbcc checkdb gives similar messages to those returned by dbcc CheckTable and makes the same types of corrections.<remote database name>.<remote database name>. o Pointers are consistent.<object name> Page 28 . No page is used that is not allocated.<remote object owner>. All pages are correctly allocated to the partitions in the specified table and no page is used until allocated. <password at remote server>  Sp_addobjectdef proxy_<table name>. <login name in source server>. o Configure Adaptive Server.

for its operations. so you should have these reports on hand. process wait events to 1.isql -U sa -P <password> -S<Server Name> i ~/scripts/installmontables o Assign 'Mon_role' to logins allowed MDA access.  Steps that need to be followed during installing MDA tableso Check for sp_configure enable cis and set to 1. If in any case if the rest tempdb are full. wait event timing to 1. <login name> .monstate o Assign several configuration parameters like enable monitoring to 1.sp_tempdb unbind . the activity of each process in the server. the default tempdb would be helpful in getting back the rest to normal operations.Sybase DBA Manual MDA Tables  MDA tables provides detailed information about server status. locks and the procedure cache. The number of user created tempdb can be configured according to the available hard ware resources and the user application. errorlog pipe active to 1.  Steps to be followed during creation of tempdbo Creating devices for tempdb . statement pipe active to 1.sp_addserver loopback. The advantages of Optdiag areo Optdiag can display statistics for all tables in a database. max sql text monitored to 2048 Multiple Temp Databases  Multiple tempdb is useful when a user or an application needs specified tempdb. or for a single table. o To add the database as a tempdb. <login name> . errorlog pipe max messages to 100. lg . sql text pipe active to 1. @@servername o Install MDA tables . Utilities  Optdiag -Displays optimizer statistics or loads updated statistics into system tables. The default tempdb is usually assigned to the SA.grant role Mon_role to sa o To test for basic configuration select * from master. db . plan text pipe active to 1. default . null.Sp_tempdb add. and the resource impact of each query that s run on the server. to avoid server tempdb full.sp_tempdb bind .. o Optdiag output contains addition information useful for understanding query costs. the utilization of resources such as data caches. <Tempdb name>. o To bind the tempdb . Page 29 . deadlock pipe active to 1. o To unbind the tempdb . object lockwait timing to 1. lg . per object statistics active to 1. such as index height and the average row length. <Tempdb name>. sql batch capture to 1. sql text pipe max messages to 100.Create temporary database <temp db name> on <device name>=<size on device>Log on <log device name>=<size on device>. o Optdiag is frequently used for other tuning tasks. deadlock pipe max messages to 100. db . <tempdb name>. statement pipe max messages to 100. statement statistics active to 1. plan text pipe max messages to 100. o Add loopback server name alias in master .

. pid. To know the current isolation level used by the server.  Bcp two options in and out. etc.kill PID. The PID for the current running transaction can be identified from table SYSLOGSHOLD. sp s.Interactive SQL parser to Adaptive Server.  Sp_monitorconfig. fast bcp (non-logged) and slow bcp (logged).This is used to take a back up of a table structure  Defncopy. triggers. it goes to the file (sql.Gives information about max usage/current max value of the above mentioned config parameters. Page 30       . Syntax isql Uuser Sserver Ddatabase. Please follow the steps below.  Sp_configure. & ps-esf |grep Sybase. number of user connections & number of locks .Select LCT_admin(abort.It occurs due to the non de-allocation of the shared segments in the shared memory.  Sp_countmetadata. Execute dbcc TRACEOFF (3604) f.. Once the PID is identified.  ddlgen. views.  To abort all the open transactions when log is full. When connecting to the server with isql.krg file and once you clear the memory then delete the <server name>.ini for Windows/interface.select @@isolation. To know server version details. dbid).ipcrm s/m<pid> and verify the values with <server name>. Troubleshooting  If server config value has reached the max threshold limit for number of open databases .select @@version OR records in error log OR dataserver v. number of open indexes . d. b. sp_countmetadata "configname" [. To view server status in Unix. the user details can be found from the table SYSPROCESSES. number of open objects .To reconfigure the parameters with new value. For copying back the data the option must be set to true. Kill the active Sybase process related to the particular server. Process to kill the open transactions a. Out is to extract the data from the e object to flat file and In is vice versa. c. Memory Jam.  To check if the port is opened Telnet <IP ADDRESS> <Port Number> if the port is opened you will see a blank screen in command prompt. dbname].This is used to take a backup of defaults.. views. Execute dbcc SQL TEXT (spid) : to view the details of the transaction e. To Kill Process. Execute dbcc TRACEON (3604): Turning on the trace flag will display the trace output on console rather than the error log.Sybase DBA Manual  Isql .krg file.showserver.Gives information about the total number of objects like tables.ini for Solaris). rules stored procedures and triggers.sp_dboption select into /pllsort . true. Also check for any active Sybase process ps eaf |grep Sybase. For manually clearing shared segments. Again In have two options. and finds the path for the server.

c. User should log into the server.krg file. in single user mode. When a process A is blocked by another process B. Backups of Necessary tables like syslogins. and sysalternatives should always be maintained.krg file with the details available on the shared segment allocated to the server. Recovering master Database can be done only if a valid dump of Master database exists. these all are blocked by the nth process. b. To build it again. and continued in similar fashion till N number of processes. and B blocked by C. sysusages. ii. kill the process. Restart the server. iv. Dataserver d<device name> -z<page size> -b<size>. Or else wait till the operation is completed. b. Load the Master DB from previous backup. steps followed are i. Point-In-Time Recovery Page 31 .Sybase DBA Manual  To recover this we have to check out the number of servers running. as it is deleted once the server gets shut down. Recovering Master Database a.  It s always a better practice to hold a backup of the <servername>. Later we have to match the <servername>. has to be executed. sysdatabases. a correlated query on sysprocess table.ipcrm s<PID>. To unblock process A. If it s a select operation. all the sub processes till Nth process should be killed or terminated. To retrieve the blocked and corresponding blocking process id s. Check the final process id dbcc dbcc traceon(3604) go dbcc (sqltext <pid>) dbcc dbcc traceoff(3604) go Or dbcc set tracefile <file-path> for spid go set show_sqltext on set showplan on go sp_helpapptrace go dbcc set tracefile off for spid go d. c.  Delete the identified segment by using. Checking the server blocking process a. iii. sysdevices.

Extending Temp Database to separate data and log segments a. Log free space issue (showing minus value in log segment usage) log on to Sybase server Use master Go Sp_stop_rep_agent <database name > go Logon to replication server admin health go suspend connection to go admin who go admin health go admin disk_space go log on to Sybase server use master go sp_dboption <database name >.Shows the details for the Temp database.). c. b. Restore the full backup ii. Restore all the transaction logs in the sequence iii. Bring the database online. Delete from sysusages where dbid=2 and segmap=<the segment id for master device> Sp_configure allow updates .Sybase DBA Manual a. 1 Allows updating the sysusages table.true go Page 32 . To do PITR. d. f. Initialize data and log devices separately Extend Temp database to these devices Sp_configure allow updates . b. this option will allow to perform the backup if database device fails. e. transaction log dumps and the dump of current transaction log (dump tran <db name> to <file name> with no_truncate. dbo use . 0 Sp_helpdb tempdb. PITR can be done only if a valid full dump of database. steps followed are i. Restore the most recent transaction log which was dumped with no_truncate option iv.

dbo use .false go Logon to replication server admin health go resume connection to go admin who go admin health go admin disk_space go log on to Sybase server use master go sp_start_rep_agent <database name > go Page 33 . single user .true go select spid from sysprocesses where dbid=db_id( <database name > ) go (if find any active process kill them) use <database name > go checkpoint go dbcc traceon(3604) go dbcc dbrepair(<database name >. fixlogfreespace ) go dbcc traceon(3604) go use master go sp_dboption <database name >.Sybase DBA Manual sp_dboption <database name >.false go sp_dboption <database name >. single user .

b.profile to point to new EBF directory and source it n. user databases and BCP out of specific system tables. Bring up the Server.exe from the explorer in the temporary directory.Sybase DBA Manual TIPS  To find the ROWID select rownum = identity(10) . and unzip the patch file into this directory. Download the patches from the Sybase Site. All of these patches / hot fixes are bundled in a package and released with the list of bugs fixed or enhancements of the product  Process for Patch Deployment: a. Deploy the required patches in the test environment. Classify them into required and not required. For DOS installations set the temporary directory as your current directory and run setup. q. The patch ZIP file contains a file called README. h. Evaluate the Patches and verify is the patch is suitable for your current version. g. Verify the errorlog for any issues. For Windows installations. Lock all the users on the data server as we need to perform some post install steps i. p. Change the $SYBASE variable in . installmsgs. f.TXT. Create a temporary directory. Take a backup of all the system. m. Verify the output for any issues. <column name> into #<temp table name> from <table name> select * from #<temp table name> drop #<temp table name> go How to Apply EBF  Sybase releases a bulletin and lists the details of the updates and bug fixes (EBF details) for each version of Sybase server. Any patch that is presumed not to be necessary for deployment now can be ignored as the final version of this hot fix will be rolled out in the next service pack of the product. r. Copy the run server file into the new location ( if required since most of the clients keep the run server file in $SYBASE/ASE/install ) o.exe in that directory. If you find any error in DBCC output fix the issue before rolling out the new patch. unlock all the users and handover the server to apps team Page 34 . c. Run standard upgrade scripts like installmaster. e. k. This is a text file documenting bug fixes and changes that were made to this release of the software. Run basic DBCC checks to make sure the all the databases are in good condition. Bounce the Server j. d. installmontables from $SYBASE/ASE_125/scripts l. Validate the errorlog and fix the issues with applications. double click on setup.

Show Plan. 302) . g. Plan for roll out into production.gives per table I/O estimates. Dbcc trace on (3604. f. and also exec sp_recompile. v. displays information about Adaptive Server performance. e. Run update index statistics f. Prepare a Checklist. t. Data cache should be configured such that hit/miss ratio should be greater than 90. Run reorg forward_row/reorg rebuild (select reorg rebuild +name+char(10)+ go from sysobjects where type= U and lockscheme(name) not it ( allpages )  Sp_monitor . All lookup tables should be placed on a separate segment.gives report about all the plans. Set Show Plan to turn the show plan off or on c. it also displays the total actual I/O cost. d. w. b. Query and Server Performance Tuning  Below are some tools for Query Tuning a.makes you understand why and how the optimizer makes choices. It sets internal counters to 0. It can help you debug queries and decide whether to use certain options. If resource limits are enabled.  Below are some points to be taken care for better performance a.Sybase DBA Manual s.prepares the query plan with out executing the query. h. d. Document all the steps. Statistics must be updated periodically. Adaptive Server keeps track of how much work it has done in a series of global variables. Data and Log of tempdb should be placed on different devices. Set no exec on. Dbcc trace on (3604. Indexes should be proper. 310) . All Nonclustered Indexes should be placed on a separate segment. and then waits for the specified interval while Page 35 .Displays statistics about Adaptive Server.  Sp_sysmon . c. Set Statistics I/O displays the number of logical and physical reads and writes required for each table in a query. like specifying an index or a join order for a particular query. u. If any of the hot fix is causing undesired results do not deploy the fix until further testing. Dbcc trace on (3604.tells you the final decisions that the optimizer makes about your queries. Reorg/Recreate if necessary. g. observations and workarounds that have been carried out during the testing phase. Once the test environment looks stable with the new patch deployments and all issues seen during the deployment are resolved the same can be moved to production. e. 317) . i. Data and log of user databases should also be placed on different devices.Displays performance information. Sp_monitor displays the current values of these global variables and how much they have changed since the last time the procedure executed. b.

lstart. lstart.Select max (low/16777218) from Master.unreservedpgs)) * abs(sign(segmap .unreservedpgs))* (1 . 2)+'.4)))) / 512.abs(sign(segmap . "Log Free" = str(100. 3) + "%"+'. Check the physical_io in sysprocesses table and trace the spid details Dbcc traceon(3604) Dbcc sqltext(spid) Sp_who Sp_lock Sp_object_stats 00:10:00 Sp_monitorconfig all Calculations          To find vdev number. sp_sysmon prints information from the values in the counters." = str(sum((size . unreservedpgs)) * abs(sign(segmap .sysdevices. 3) + "%" from master. Procedure cache size= (max number of concurrent users)*(4+size of largest plan)*1.4))). 7." = str(100.." = str(sum(size * abs(sign(segmap .  If you face the performance issues. To get a rough estimate of the size of a single stored procedure.curunreservedpgs(dbid. 7. 2)+'.'.abs(sign(segmap . When the interval ends..Sybase DBA Manual activity on the server causes the counters to be incremented." = convert(char(20).4)))) / sum(size * (1 . unreservedpgs))* (1 abs(sign(segmap .4))) / 512. view. Stored procedure to get the segment usage report  SQL to calculate database usage select "Database. 7.4)))) / 512.'.'.4))) / 512. .0.0 * sum((curunreservedpgs(dbid.'. "Log Size.4))) / sum(size * abs(sign(segmap.sysusages Page 36 £     get egment txt ¢¡ ¡ ce. 7.abs(sign(segmap .0. lstart.db_name(dbid))+'. "Data Size. Size of DBCC database. Size of Log disk= 10 % of the data disk of the particular device. "Data Free.0. "Log Used. "Data Used.'. Minimum procedure cache size needed=(number of main procedures)*(Average plan size)." = str(sum((size .0. or trigger.curunreservedpgs(dbid. lstart. 2)+'. Size of the tempdb = 20% of sum up of all the user databases. 2)+'.can be found out from sp_plan_dbccdb.25.'.5]. use: select(count(*) / 8) +1 from sysprocedures where id = object_id("procedure_name").4)))).0 * sum((curunreservedpgs(dbid." = str(sum(size * (1 . number of worker processes = [max parallel degree] X [the number of concurrent connections wanting to run queries in parallel] X [1.

totcpu.Log Transfer Manager (LTM) is a separate program/process which reads transaction log from the source server and transfers them to the replication server for further processing. size.accdate.master tli tcp /dev/tcp \x0002 0401 81 96 c451.physical_io.  Sybase Replication Agent extends the capabilities of Replication Server by allowing non-Sybase (heterogeneous) database servers to act as primary data servers in a replication system based on Sybase replication technology.program_name. This can be interpreted asX0002 no user interpretation (header info?) 0401 port number (1025 decimal) 81 first part of IP address (129 decimal) 96 second part of IP address (150 decimal) c4 third part of IP address (196 decimal) 51 fourth part of IP address (81 decimal) Sybase Diagram Sybase Diagram.name. and Informix. it can be Microsoft SQL Server.  Rep Server is configured by using command rs_init. Oracle. DB2.  Replication Agent/Log Transfer Manager.It is the source of data where client applications enter/delete and modify data. phyname "physical device"from sysusages. This need not be ASE. With ASE 11. this has become part of ASE and is now Page 37 .5.suser_name(suid).ipaddr from sysprocesses order by physical_io go Select name.memusage.hostname.totio from syslogins order by totcpu go  Entry in interface file .  Primary Dataserver .doc Replication Overview and Architecture Diagram  Sybase Replication Agent is the Sybase solution for replicating table data changing operations and stored procedure invocations against a primary database.Sybase DBA Manual where segmap < 5 group by db_name(dbid)  SQL to find the database and the related devices select dbid. sysdevices where name = 'xxx' and vstart between low and high compute sum(size) go  SQL to find the max CPU utilized Select spid.

The client part sends these transactions to the target server which could be another replication server or the final dataserver. Distributor. Replicate (target) Dataserver It is the server in which the final replication server (in the queue) will repeat the transaction done on the primary.  For every Replication Server to which a Replication Server has a route.The replication server is an Open Server/Open Client application. or if request stored procedures are to be executed in the database for asynchronous delivery. o Multiple servers can be connected in two ways.after Replication Server is installed. the replication server disconnects or fades out in replication terminology). This queue stores a valid transactional snapshot from the primary database during subscription materialization or from a replicate database during dematerialization. Data Server Interface. One connection for each target database. one connection per each replicated database in the source dataserver (sp_who). o Inbound Queue. in the target dataserver when the replication server is actively transferring data (when idle. they both have to be set into a single domain. However.It connects RDS and Rep Server. Stable Queue Manager manages all these operations related to Stable Device. o There can be multiple rep definitions for a single table. Any exceptions encountered during the process are recorded into rs_exception. o Subscription Materialization Queue.holds messages related to newly created or dropped subscriptions. If the database you add contains primary data. Replication Server temporarily stores updates in these queues. It reads data from Outbound Queue and replicates to RDS according to the subscriptions. The server part receives transactions being sent by either the source ASE or the source LTM. Otherwise they are managed by Replication Manager.Hierarchal and Star. each of which stores different type of data.holds messages for a replicate database or a replicate Replication Server. Replication Server creates an inbound queue and prepares to accept messages from a Replication Agent for the database.        Page 38 .Sybase DBA Manual called the Replication Agent.It takes care of sending committed transaction from inbound queue to outbound queue with the help of Stable Queue Transaction (SQT) Reader. o Outbound Queue. There are three different types of stable queues. Replication Server (s) . Rep monitoring service (RMS) is required to manage all of them. Stable Queue. During replication operations. o Whenever two servers required to be connected over WAN. there is a Replication Server Interface (RSI) outbound queue.holds messages only from a Replication Agent. you still need to use an LTM for non-ASE sources. There is one outbound queue for each of these destinations:  For each replicate database managed by a Replication Server. When replication is active. o If Rep Servers are more than 10. a disk partition is set up used by Replication Server to establish stable queues. there is a Data Server Interface (DSI) outbound queue.

Page 39 .Sybase DBA Manual o The time to reach from PDS to RS is known as latency.

Sybase DBA Manual LOG TRANSFER LANGUAGE PRIMARY DATA SERVER REP AGENT REPLICATION SERVER DATA SERVER INTERFACE REPLICATE DATA SERVER Rep Definition DISTRIBUTOR INBOUND QUEUE Stable Queue Transaction Reader Transac tion log STABLE DEVICE Committed Transactions OUTBOUND QUEUE Subscriptions AM NAM NM BM Secondary Transaction Point found in rs_loacter Stable Queue Managed by Stable Queue Manager Figure 9 Replication Architecture Page 40 .

Each user on UNIX level has own crontab and one should have the privilege to add/modify the crontab. All the DBA jobs are scheduled to run automatically in crontab.crontab [ -e [opens the crontab editor] | -l [lists all the crontab entries] | -r [removes the crontab file].  Always have the backup for crontab.Sybase DBA Manual Sybase License Definition License Definitions Crontab  Job scheduling at UNIX level is done in crontab.  Syntax. Page 41 .

Sign up to vote on this title
UsefulNot useful