From The IBM Informix Champions Informix Tutorial . - Advanced DataTools

Transcription

Advanced DataToolsWebcastfrom the IBM Informix ChampionsInformix TutorialBasic Informix ServerMonitoringby Lester KnutsenThursday, August 20, 20202:00pm EDT

Informix Tutorials Webcastsby Lester Knutsen, IBM Informix ChampionA step by step guide to using Informix Database ServersØGetting Started with Informix – January ReplayØConfiguring a New Informix Server – February ReplayØManaging Informix Disk Space – March ReplayØManaging Informix Logs – April ReplayØInformix Backup, Recovery, and High Availability – May ReplayØConnecting Users to Informix Servers – June ReplayØCreating Databases and Tables in Informix – July ReplayØBasic Informix Server Monitoring – August ReplaySee the Complete Webcasts Series -topics/tech-beginners/

Lester KnutsenLester Knutsen is President of Advanced DataToolsCorporation and has been building large datawarehouse and business systems using InformixDatabase software since 1983. Lester focuses onlarge database performance tuning, training, andconsulting. Lester is a member of the IBM GoldConsultant program and was presented with one ofthe Inaugural IBM Information Champion awards byIBM. Lester was one of the founders of theInternational Informix Users Group and theWashington Area Informix User ols.com703-256-0267 x102Informix Monitoring3

Webcast Guidelines The Webcast is pre-recorded. TheWebcast replay and slides will beavailable after the broadcast. Please Mute your line - backgroundsounds will distract everyone. Use the Chat Button in the upper rightto ask questions.Informix Monitoring4

AgendaBasic Informix Monitoring Onstat – Discovery OptionsOnstat – Performance RatiosOnstat – User Sessions and ThreadsOnstat – Measuring Disk IOOnstat – Monitoring LocksOther Onstat OptionsOncheck – Basic Dbspace ChecksOmode – How to Terminate a SessionInformixHQ ExamplesInformix Monitoring5

Informix Command Utilities ONSTAT - Shows shared memory andserver statistics ONCHECK - Checks and repairs diskspace ONMODE - Changes Server's operatingmode and terminates User SessionInformix Monitoring6

Onstat – Monitor InformixServer Operations Onstat utility reads shared-memory structures andprovides statistics about the database server at thetime that the command executes. The contents of shared memory might change as theonstat output displays. The onstat utility does not place any locks on sharedmemory, so running the utility does not affectperformance. Onstat is a key utility to monitor the performance ofyour Informix server.Informix Monitoring7

Informix Shared MemoryResident Memory Segment Control Tables BuffersOnstat DataLRU Page PageLRU Page PageLRU Page PageLRU Page PageVirtual Memory Segment Dictionary cache Working Storage Sort SpaceMessage Memory SegmentInformix Monitoring8

Discover Your InformixServerOnstatOptionPurposeonstat -Show version, status, and uptime of the serveronstat –g osiShow operation system and machine infoonstat –g disShow known Informix servers on machineonstat -cShow server configuration ONCONFIG Fileonstat -dShow Informix dbspaces and chunksonstat -lShow logical logs statusonstat –mShow Informix server message logonstat -g schShow Informix oninit processes and classesonstat –g segShow Informix memory segmentsInformix Monitoring9

Current status of Server:onstat Current status: onstat -Current status when Server is downlester@merlin onstat shared memory not initialized for INFORMIXSERVER 'merlindb'lester@merlin Informix Monitoring10

Onstat Header Information Product and Version Mode (and Type) (Optional: Reason when Server isBlocked) Time Server has been up Size of Shared Memory in KbytesInformix Monitoring11

Mode of Server Off-Line Mode (does not show inheader) Quiescent Mode On-Line Mode Read-Only Mode (DR Only) Recovery Mode Shutdown ModeInformix Monitoring12

Reason when Server isblocked CKPT - CheckpointLONGTX - Long transactionARCHIVE - Ongoing storage-space backupMEDIA FAILURE - Media failureHANG SYSTEM - Database server failureDBS DROP - Dropping a dbspaceDDR - Discrete data replication (Informix)LBU - Logs full high-watermarkInformix Monitoring13

Onstat –g osi : ShowOperation System InfoInformix Monitoring14

Onstat –g dis: ShowInformix ServersInformix Monitoring15

Onstat –c: Show ONCONFIGFileInformix Monitoring16

Onstat –d: Show DBSpacesand ChunksInformix Monitoring17

Onstat -d FlagsThe "flags" for Dbspaces are:Position 1M - Mirrored DbspaceN - Not Mirrored DbspacePosition 2X - Newly mirroredP - Physical recovery underwayL - Logical recovery underwayR - Recovery underwayD - DownPosition 3B – BlobspaceP – PlogdbsS – SbspaceT – Temporary DbspaceU – Temporary SBSpaceW – Temporary Dbspace on SD ServerPosition 4B – Chunk greater than 2GB EnabledPosition 5A Auto expandablePosition 6E - EncryptedInformix MonitoringThe "flags" for Chunks are:Position 1P - PrimaryM - MirrorPosition 2O - On-lineD - DownX - Newly mirroredI - InconsistentN – Renamed and Down or InconsistentPosition 3B - Blobspace DbspaceT - Temporary DbspacePosition 4B – Chunk greater than 2GB EnabledPosition 5E – Chunk is ExtendablePosition 6- Direct IO not enabledC – AIX Concurrent IO enabledD – Direct IO Enabled18

Onstat –l: Show LogsCurrent LogInformix Monitoring19

Onstat -l Flags A - New and ready to useB - Backed upC - Current logical-log fileD - Marked for deletionF - Free and available for reuseL - Contains the last checkpoint recordU - UsedInformix Monitoring20

Onstat –m: Show MessageLogsInformix Monitoring21

Using “tail -f” tocontinuously show the endof message log file Note: I like to have the OnLine log file always display in oneof my windows on screen. The trick to doing this is to usethe UNIX "tail" command with the "-f" option. Thiscontinually reads the last lines of a file as it is appended to.On my system I run the following command to continuallymonitor this log:tail -f INFORMIXDIR/online.logInformix Monitoring22

Onstat –g sch: Show OninitProcess and ClassesInformix Monitoring23

Oninit Process Classes CPU - Executes all user and session threads and some system threadsPIO - Handles physical log file when cooked disk space is usedLIO - Handles logical log file when cooked disk space is usedAIO - Handles disk I/OSHM - Performs shared memory communicationsTLI - Performs TLI network communicationsSOC - Performs socket network communicationsFIFO - Performs FIFO operationsOPT - Handles optical disk I/OADM - Executes administrative threadsADT - Executes auditing threadsMSC - Handles request for system callsInformix Introduction24

Onstat –g seg: ShowMemory SegmentsInformix Monitoring25

Informix Memory Classes R – Resident Memory Segment B – Buffer Pool Segment for data V – Virtual Memory Segment forWorking Storage M – Message Segment forcommunications between clientsInformix Introduction26

Onstat –p: Server ProfilePerformance Ratios1. Disk IO2. Actions3. CPU4. Waits5. Read AheadInformix Monitoring27

Key Elements of onstat -p Reads %cached - The goal is 95% Writes %cached - The goal is 85% The BUFFERS parameter in your ONCONFIG file will affect thisvalue. Be careful - if you make the BUFFERS too large this willtake memory away from other processes and may slowdown your whole system. bufwaits - This indicates the number of times a user thread haswaited for a BUFFER. lokwaits - This indicates the number of times a user thread haswaited for a LOCK. deadlks - This should be zero. This indicates the number oftimes a deadlock was detected and prevented. dltouts - This should be zero. This indicates the number oftimes a distributed deadlock was detected.Informix Monitoring28

Key Ratios Calculated fromOnstat -p Disk IO - KB read and written perminute/hour Buffer turnover ratio per minute/hour Buffer wait ratio Read Ahead UtilizationInformix Monitoring29

Key Ratios - Onstat -pInformix Monitoring30

User Sessions and ThreadsOnstat Option PurposeOnstat –uShow User Sessions StatusOnstat –xShow User Sessions TransactionsOnstat –g sqlShow Sessions and SQLOnstat –g sesShow Session DetailsInformix Monitoring31

Onstat –u: User StatusInformix Monitoring32

User status: onstat -u FlagsFlags inB C G L S T Y X Flags in* Flags inA B P X C R H -Informix Monitoringposition 1Waiting on a bufferWaiting on a checkpointWaiting on a logical log buffer writeWaiting on a lockWaiting on a mutexWaiting on a transactionWaiting on a conditionWaiting on a transaction rollbackposition 2Transaction active during I/O errorposition 3Dbspace backup threadBegin workPrepared for commit workTP/XA prepared for commit workCommitting workRolling back workHeuristically rolling back work33

User status: onstat -u FlagsFlags in position 4P - Primary thread for a sessionFlags in position 5R - Reading callX - Transaction is committingFlags in position 6NoneFlags in position 7B - Btree cleaner threadC - Cleanup of terminated userD - Daemon threadF - Page flusher threadM - ON-Monitor user threadInformix Monitoring34

Onstat –x: Show TransactionsUserLogStartLogNowCurrent LogInformix Monitoring35

Onstat –g sql: List SQLstatementsInformix Monitoring36

Onstat –g ses: List SQLstatements and more by SIDInformix Monitoring37

Onstat - Show ThreadsOnstat Optiononstat -g athonstat -g reaonstat -g waionstat -g actonstat -g bthInformix MonitoringPurposeShow all threadsShow threads ready to runShow threads waiting to runShow active threads runningShow blocking threads38

Onstat –g ath: Show threadsInformix Monitoring39

Onstat – Show Disk IOOnstat Optiononstat -Donstat -g iofonstat –g iovonstat –g iohonstat –g ckponstat -Fonstat -RInformix MonitoringPurposeShow Dbspaces and Chunk IO StaticsShow Disk IO Statistics by Chunk/fileShow Disk IO Statistics by Oninit VPShow Disk IO HistoryShow Checkpoint StatisticsShow Buffer Flush StatisticsShow LRU Queue Statistics40

Onstat –D: Disk IOInformix Monitoring41

Informix IO Path to DiskInformix SharedMemory BuffersLRU QUE ThreadCleaner ThreadsAIO or KAIODisk ChunkInformix Monitoring42

Onstat –R: LRU StatisticsInformix Monitoring43

Onstat –F: Flush to DiskInformix Monitoring44

Flush to Disk Foreground writes occur when the Server needs a buffer andmust interrupt processing to flush buffers to disk to free abuffer. These are the least desirable type of writes. Background writes (LRU Writes) occur when a set percent ofthe buffers are dirty. This is controlled by the LRU parametersin the ONCONFIG file. These do not interrupt user processingand are the best for interactive systems. Chunk writes occur at checkpoints, and all dirty buffer pagesare written to disk. The more dirty pages, the longer acheckpoint will take. Checkpoint writes are sorted andoptimized, but the longer a checkpoint is, the longer it will blockuser activity. Checkpoint writes are best for batch systems.Informix Monitoring45

Onstat –g iov: Show IO byOninit ProcessInformix Monitoring46

Onstat –g iof: Show IO byChunkInformix Monitoring47

Onstat –g ioh: Show IOHistory by ChunkInformix Monitoring48

Onstat –g ckp: ShowCheckpoint HistoryInformix Monitoring49

LOCKS Onstat –k to Show LocksHow many Lock Table overflows?What User Owns the Lock?What Table is Locked?What Type of Lock is it?Informix Monitoring50

Onstat –k: Show Locks WARNING: If you have a large number of LOCKS defined in your ONCONFIGfile and many users, you could see thousands of rows from this command.Lock TableOverflowNeed ToIncreaseLOCKSInformix MonitoringNew in14.1051

Who owns a lock The "owner" column lists the address in shared memoryof the user who owns a lock. Use this with "onstat -u" tosee all users and compare this with the "address" columnto identify username of the owner.Informix Monitoring52

What table is locked? The "tblsnum" column identifies the table that is being locked. Compare thiswith the output of the following SQL statement to convert a table's partnum tohex. This will identify which table is locked.1. Find a list of tblsnumdbaccess database - EOFselect tabname, hex(partnum) tblsnumfrom systables where tabid 99;EOFdatabase selectedtabnamegenjournalgjsumInformix Monitoringtblsnum0x0010009E0x0010009F53

What table is locked?2. Find what is lockedonstat -kLocksaddress wtlistownerlklisttypea103e44 0a2d1118 a103de4 HDR X3 active, 20000 total, 16384 hash buckets3.tblsnum10009frowid0key#/bsiz0Compare tblsnum from step 1 and step 2.This identifies the table gjsum as the one that is locked. The tblsnum 100002 has a special meaning. Thisindicates a database lock. Every user who opens adatabase will place a shared lock on the database.Informix Monitoring54

Types of locks Database - Lock on tablespace 100002Table - Lock on actual tablespace with rowid of 0Page- Lock on tablespace with rowid ending in 00Row- Lock on tablespace with actual rowid (not 00)Byte- Lock on tablespace/page with size of bytesKey- Lock on tablespace hex rowid (starting with f)Informix Monitoring55

Types of locks FlagsHDRBSXIUIXISSIXInformix Monitoring- Header- Bytes lock- Shared lock- Exclusive- Intent- Update- Intent-exclusive- Intent-shared- Shared, Intent-exclusive56

More Onstat OptionsOnstatOptionPurposeonstat -rRepeat every seconds seconds (default: 5)onstat -zZero profile countsonstat -oPut shared memory into specified dump fileonstat infile Read shared memory information fromspecified dump fileonstat -iInteractive modeInformix Monitoring57

Onstat –r: RepeatRepeat ONSTAT commands: -r To continually repeat an ONSTAT command use the "-r # ofseconds" option. This is very useful when you need to monitora situation. The following example displays the status of thelogical logs every 10 seconds.onstat -l -r 10Informix Monitoring58

Onstat –z: Reset StatisticsClear ONSTAT shared memory statistics: onstat -z The Server statistics are reset every time OnLine is restarted.To reset all the statistics while OnLine is running withoutshutting it down, use the following command:onstat -zInformix Monitoring59

Onstat – Reading from aMemory Dump onstat –o filename - to create a Dump ofShared Memory onstat –i filename – to interactive readand run onstat commands on the Dumpof Shared Memory Useful for DebuggingInformix Monitoring60

Onstat – Reading from aMemory DumpSaved Memory DumpOnstat –PInteractive ModeInformix Monitoring61

Oncheck - Check and PrintDisk SpaceOncheck CommandPurposeoncheck –pr or crCheck Server Reserved Pagesoncheck -peShow Extents by Chunkoncheck –cc databaseCheck Database System Catalogsoncheck –cDI database:tableCheck ALL Rows and Indexesoncheck –csCheck Smart Large Objectsoncheck -cSCheck Smart Large Objects andExtentsoncheck -pTShow Table and Index PartitionInformationInformix Monitoring62

Oncheck - Check and PrintDisk Space ONCHECK is the tool to check and display information about your dbspaces,blobspaces, chunks, tables, indexes, and disk pages.The purpose of this utility is to ensure that your database server disk space hasno inconsistencies.ONCHECK operates in two basic modes with two basic options.–– The '-c' list of options perform consistency checks and display a limited amount of information unlessthere is a problem.The '-p' list of options perform the consistency checks and display much more information about whatyou selected.When ONCHECK finds a problem it will provide you with an error message toindicate what the problem is. If the problem is a corrupt index, ONCHECK willprompt you to tell it to fix the index.The only problem ONCHECK can fix is corrupt indexes. However, it may befaster to drop and re-create the index using SQL commands than for ONCHECKto fix it.ONCHECK will place locks on all tables and databases that itneeds to access.Informix Monitoring63

Oncheck –cc: CheckingReserved Pages The first 12 pages of the rootdbs contain crucial information the Serverneeds to operate.If these pages are damaged, your database server cannot operate.Informix Monitoring64

Oncheck –cc Database:Checking System Tables The System Tables are the key structures which define all the tables, columns,indexes, stored procedures, and constraints for a database.This option checks, or checks and displays, the consistency of these structures.Informix Monitoring65

Oncheck –pe: Checking andPrinting Storage Extents This option shows how your tables are spread out over chunks. It produces areport by dbspace and chunk, listing each extent for each table with the startingaddress and size.Informix Monitoring66

Oncheck –cDIDatabase:Table When Index Errors are discovered, itmay be faster to drop and rebuild theIndex using SQLInformix Monitoring67

Onmode – How to Terminatea User Thread Do NOT Use UNIX command “Kill -9”(The Server may not rollback thetransaction correctly) Onmode must be run by the UserInformix or DBSAInformix Monitoring68

Terminate a User Thread Onmode provides an option to kill and abort anindividual user's database process. Onmode is aware of a user's database transactionand will rollback any work that was not committed. Operating system commands to kill a user's process(e.g. the UNIX kill -9 command) are not aware of auser's database connection and may not cleanlyrollback their work. This can lead to corruption oftables or indexes.Informix Monitoring69

Terminate a User ThreadThe correct procedure to kill a user's database process is:1. Identify the user's session id using the ONSTATcommand with one of the following three options:onstat -uonstat -g sqlonstat -g ses2. Use the following onmode command to terminate theuser's session:onmode -z session idInformix Monitoring70

Using InformixHQ – BasicInfomation Informix Monitoring71

Using InformixHQ – MonitoringVirtual ProcessorsInformix Monitoring72

Using InformixHQ –Monitoring StorageInformix Monitoring73

Using the SQL API Functionin Dbaccess or InformixHQInformix Monitoring74

Questions?Send follow-up questions toLester@advancedatatools.com

International Informix User Group:http://www.iiug.orgInformix Monitoring76

IIUG and IBM announceInformix v.14.10.xC4W1 TechnicalDeep Dive webcast series! CSDK and IHQ - July 29, 2020 at 10 amCentral (July 29, 2020 15:00 GMT) Replication - August 12, 2020 at 10 amCentral (August 12, 2020 15:00 GMT) Java and System Administration - August 26,2020 at 10 am Central (August 26, 202015:00 GMT)More Info - https://www.iiug.org/events/Informix Monitoring77

Informix Tutorials Webcastsby Lester Knutsen, IBM Informix ChampionA step by step guide to using Informix Database ServersØGetting Started with Informix – January ReplayØConfiguring a New Informix Server – February ReplayØManaging Informix Disk Space – March ReplayØManaging Informix Logs – April ReplayØInformix Backup, Recovery, and High Availability – May ReplayØConnecting Users to Informix Servers – June ReplayØCreating Databases and Tables in Informix – July ReplayØBasic Informix Server Monitoring – August ReplaySee the Complete Webcasts Series -topics/tech-beginners/

Informix TrainingUpdated for Informix 14.10 Attend classes online on the web. All you need is: Web browser to connect to our WebEx training system An SSH client (like Putty) to connect to our training lab for hands-on Each student uses an 8-core Linux server with 16GB RAM, SSD driveswith Informix 14, and several large databases for benchmark exercises.Ø May 18-21, 2020 - Informix for Database Administrators DONEØ July 6-9, 2020 - Advanced Informix Performance Tuning DONEØ October 5-8, 2020 - Informix for Database AdministratorsMore information and registration at:https://advancedatatools.com/training/Informix Monitoring79

Informix 14.X TrainingAre you ready to take your DBA skills to the nextlevel?Each student in classwill have a serverrunning Informix14.10 with:- 8 CPU Cores- 16 GB RAM- 1 SSD Disk- 1-4 DisksClass size is limited to8 students.Attend online using our remotelearning system!Informix Monitoring80

Informix Support and Training from the Informix Champions!Advanced DataTools is an Advanced Level IBM Informix Data Management Partner, and has been an authorizedInformix partner since 1993. We have a long-term relationship with IBM, we have priority access to high-level supportstaff, technical information, and Beta programs. Our team has been working with Informix since its inception, andincludes 8 Senior Informix Database Consultants, 4 IBM Champions, 3 IIUG Director’s Award winners, and an IBMGold Consultant. We have Informix specialists Lester Knutsen and Art Kagel available to support your Informixperformance tuning and monitoring requirements! Informix Remote DBA Support MonitoringInformix Performance TuningInformix TrainingInformix ConsultingInformix DevelopmentFree Informix Performance Tuning Webcast replays casts/Email: info@advancedatatools.comWeb: https://www.advancedatatools.comInformix Monitoring81

Thank YouAdvanced DataTools CorporationFor more .advancedatatools.com

Informix Tutorials Webcasts by Lester Knutsen, IBM Informix Champion A step by step guide to using Informix Database Servers Ø Getting Started with Informix - January Replay Ø Configuring a New Informix Server - February Replay Ø Managing Informix Disk Space - March Replay Ø Managing Informix Logs - April Replay Ø Informix Backup, Recovery, and High Availability - May Replay