200 likes | 558 Views
ASE 129: The MDA tables - new monitoring capabilities in ASE 12.5.0.3. Rob Verschoor DBA/Consultant rob@sypron.nl. MDA tables: new monitoring feature in 12.5.0.3+. About myself:. Consultant for ASE & Replication Server Worked with ASE since 1989 From Europe (The Netherlands)
E N D
ASE 129: The MDA tables - new monitoring capabilities in ASE 12.5.0.3 Rob VerschoorDBA/Consultantrob@sypron.nl
MDA tables: new monitoring feature in 12.5.0.3+ About myself: • Consultant for ASE & Replication Server • Worked with ASE since 1989 • From Europe (The Netherlands) • See www.sypron.nl
MDA tables: new monitoring feature in 12.5.0.3+ Overview • MDA tables: new feature in 12.5.0.3 • how it works • some applications • installation & configuration • compared with other ASE monitoring tools
MDA tables: new monitoring feature in 12.5.0.3+ What is it? • MDA = "Monitoring Data Access" • 35 proxy tables in the master database • all named "mon%" (i.e. "monObjectActivity") • can be queried with regular SQL • fast access to low-level information (native RPCs)
MDA tables: new monitoring feature in 12.5.0.3+ monProcessSQLText: returns currently executing SQL create existing table monProcessSQLText ( SPID smallint, KPID int, BatchID int, LineNumber int, SequenceInLine int, SQLText varchar(255) NULL) external procedure at "loopback...$monProcessSQLText" go grant select on monProcessSQLText to mon_role go
MDA tables: new monitoring feature in 12.5.0.3+ Secondary Title: Arial 16 pt. • MDA provides low-level details not previously available • #logical I/Os for each process • SQL 'stacktrace' (stored proc/trigger call stack) • cache usage details per table • and much, much more...
MDA tables: new monitoring feature in 12.5.0.3+ Installation • Out-of-the-box: no MDA tables present. • Installation steps: • Add a 'loopback' server alias name • Run ..../scripts/installmontables (when successful, prints no output whatsoever!) • Assign 'mon_role' to logins allowed MDA access
MDA tables: new monitoring feature in 12.5.0.3+ Installation • Installation Gotchas • running installmon instead of installmontables • forgetting to create a 'loopback' server alias • running installmontables with sqsh ('$' characters are interpreted by sqsh) --> use isql instead • forgetting to assign 'mon_role' before querying MDA tables (& disconnect/reconnect) • forgetting to set the 'enable monitoring' (and lots of other configuration parameters)
MDA tables: new monitoring feature in 12.5.0.3+ MDA table schema information • Practical problem: which table/column to query? • MDA tables are self-documenting • monTables : describes all MDA tables • monTableColumns : describes all columns in the MDA tables • monTableParameters : describes all 'parameter' columns in the MDA tables • sp_mda_help is an easy interface to these tables (--> www.sypron.nl/mda)
MDA tables: new monitoring feature in 12.5.0.3+ Examples Measuring # logical I/Os for a process select SPID, LogicalReads, PhysicalReads, PhysicalWrites from master..monProcessActivity where SPID=18 • This table shows cumulative I/O counts (zeroed at ASE start) • Must determine the difference between two calls
MDA tables: new monitoring feature in 12.5.0.3+ Examples Measuring # logical I/Os for a process • Easier interface to monProcessActivity : sp_mda_io (download from www.sypron.nl/mda) --SQL statement-- exec sp_mda_io --SQL statement-- exec sp_mda_io --SQL statement-- exec sp_mda_io
MDA tables: new monitoring feature in 12.5.0.3+ Examples Measuring # logical I/Os for a process • monProcessActivity also contains info about other things • log I/O • ULC activity • pages accessed due to table scan • pages accessed due to index scan • number of #temp tables accessed
MDA tables: new monitoring feature in 12.5.0.3+ Examples Number of pages in cache for each table/index select ObjectID, ObjectName, IndexID, CachedKB , ProcessesAccessing from master..monCachedObject where ObjectID > 99 ObjectID ObjectName IndexID CachedKB ProcessesAccessing ----------- ---------------- ------- -------- ------------------ 192933613 MyTable 0 96 0 32000114 spt_values 1 2 0 32000114 spt_values 0 78 0 1041800138 Customers_tb 0 4184 0 1041800138 Customers_tb 2 220 0 320934069 YourTable 0 56 0 160000570 syblicenseslog 0 4 0
MDA tables: new monitoring feature in 12.5.0.3+ Examples Number of pages in cache for each table/index • How much cache does each object use at this moment • This information can be useful when considering/evaluating cache configuration
MDA tables: new monitoring feature in 12.5.0.3+ Examples Most frequently accessed objects select object_name(ObjectID, DBID), IndexID, UsedCount, Operations from monOpenObjectActivity IndexID UsedCount Operations ---------------------- ------ ----------- ----------- MyTable 0 4 475 YourTable 0 2 18 syblicenseslog 0 0 15 sp_mda_help 0 0 10 monCachedObject 0 2 10 syscoordinations 2 0 0 […]
MDA tables: new monitoring feature in 12.5.0.3+ Examples SQL 'stacktrace' select ContextID, DBName, ObjectName, ObjectType from master..monProcessProcedures where SPID = your_spid order by ContextID ContextID DBName ObjectName ObjectType --------- --------------- -------------- ------------------- 1 PROD_DB Trig1 trigger procedure 2 PROD_DB Proc1 stored procedure 3 OTHER_DB Proc2 stored procedure (3 rows affected)
MDA tables: new monitoring feature in 12.5.0.3+ History tables • Some tables contain only current data, others keep some history monProcessSQLText --> currently executing SQL monSysSQLText --> recently executed SQL Amount of history is configurable: sp_configure 'sql text pipe max messages'
MDA tables: new monitoring feature in 12.5.0.3+ • MDA's strength: huge amount of low-level details • Also its weakness: how to distill usable information from this data? • Need an application; DBXRay does this for you • Great opportunities for open-source movement
MDA tables: new monitoring feature in 12.5.0.3+ MDA compared with other features • MDA tables vs. sp_sysmon • MDA provide per-object, per-session data • sp_sysmon provides cumulative data • MDA tables vs. sysprocesses/syslocks • MDA provide *much* more detail • MDA tables vs. MonServer/HistServer • MonServer/HistServer have great capabilities, but aren't easy to use (learning curve) • MDA tables can be queried with straightforward SQL statements • MDA tables vs. DBXRay • MDA is free; DBXRay is a license option • DBXRay pulls MDA details together for you
MDA tables: new monitoring feature in 12.5.0.3+ Documentation • ASE docs: 'newfunc.pdf' for 12.5.0.3 • Chapter 1: 40+ pages of info about MDA • Included in 12.5.0.3 deliverable • Also available at sybooks.sybase.com/as.html ==> 'core documentation set' ==> ASE 12.5.0.x (not ASE 12.5) • www.sypron.nl/mda • examples, applications, tricks…