1#!/bin/bash
2###################################################################################
3# filename: GBase8schk.sh
4# Last modified by: L3 2023-12-26
5# support OS: Linux
6# support database version: GBase 8s V8.x
7# useage: sh GBase8schk.sh
8###################################################################################
9echo ""
10echo "Begin to collect data for GBASEDBTSERVER:"${GBASEDBTSERVER}
11echo ""
12mytime=`date '+%Y%m%d%H%M%S'`
13outpath="GBase8schk_${GBASEDBTSERVER}_${mytime}"
14if [ ! -d ${outpath} ]; then
15mkdir ${outpath}
16fi
17###################################################################################
18## Machine
19###################################################################################
20echo "collect machine info using sql ......"
21dbaccess sysmaster - << EOF
22unload to ./${outpath}/machine.unl delimiter '|'
23select
24os_name,os_release,os_nodename,os_version,os_machine,os_num_procs,os_num_olprocs,
25os_pagesize,os_mem_total,os_mem_free,os_open_file_lim,os_shmmax
26from sysmachineinfo;
27EOF
28###################################################################################
29## Instance
30###################################################################################
31echo "collect instance info using sql ......"
32dbaccess sysmaster - << EOF
33unload to ./${outpath}/instance.unl delimiter '|'
34select
35dbinfo('UTC_TO_DATETIME',sh_boottime)||' T' start_time,
36(current year to second - dbinfo('UTC_TO_DATETIME',sh_boottime))||' T' run_time,
37sh_maxchunks as maxchunks,
38sh_maxdbspaces maxdbspaces,
39sh_maxuserthreads maxuserthreads,
40sh_maxtrans maxtrans,
41sh_maxlocks locks,
42sh_longtx longtxs,
43dbinfo('UTC_TO_DATETIME',sh_pfclrtime)||' T' onstat_z_running_time
44from sysshmvals;
45EOF
46###################################################################################
47## CPUVP
48###################################################################################
49echo "collect cpuvp info using sql ......"
50dbaccess sysmaster - << EOF
51unload to ./${outpath}/cpuvp.unl delimiter '|'
52select vpid,classname class,pid,round(usecs_user,2) user_cpu,round(usecs_sys,2) sys_cpu,num_ready,
53total_semops,total_busy_wts,total_yields,total_spins,vp_cache_size,vp_cache_allocs
54from sysvplst ;
55EOF
56###################################################################################
57## Memory
58###################################################################################
59echo "collect instance memory info using sql ......"
60dbaccess sysmaster - << EOF
61unload to ./${outpath}/memory.unl delimiter '|'
62select
63indx,bufsize pagesize,
64nbuffs buffers,
65round(nbuffs*bufsize/1024/1024/1024,2)||'GB' buffsize,
66nlrus,mindirty,maxdirty,
67(bufwaits / (bufwrites + pagreads)) * 100.00 buff_wait_rate,
68100 * (bufreads-dskreads)/ bufreads buff_read_rate,
69100 * (bufwrites-dskwrites)/ bufwrites buff_write_rate,
70fgwrites,lruwrites ,chunkwrites
71from sysbufpool;
72EOF
73###################################################################################
74## Network
75###################################################################################
76echo "collect sqlhosts info using sql ......"
77dbaccess sysmaster - << EOF
78unload to ./${outpath}/sqlhosts.unl delimiter '|'
79select dbsvrnm,nettype,hostname,svcname,options,
80svrsecurity,netbuf_size,svrgroup
81from syssqlhosts;
82EOF
83###################################################################################
84## Session time
85###################################################################################
86echo "collect session runtime info using sql ......"
87dbaccess sysmaster - << EOF
88unload to ./${outpath}/sessiontime.unl delimiter '|'
89SELECT first 500 s.sid, s.username, s.hostname, q.odb_dbname database,
90dbinfo('UTC_TO_DATETIME',s.connected) conection_time,
91dbinfo('UTC_TO_DATETIME',t.last_run_time) last_run_time,
92current - dbinfo('UTC_TO_DATETIME',s.connected) connected_since,
93current - dbinfo('UTC_TO_DATETIME',t.last_run_time) idle_time
94FROM syssessions s, systcblst t, sysrstcb r, sysopendb q
95WHERE t.tid = r.tid AND s.sid = r.sid AND s.sid = q.odb_sessionid
96ORDER BY 8 DESC;
97EOF
98###################################################################################
99## Session wait
100###################################################################################
101echo "collect session waits info using sql ......"
102dbaccess sysmaster - << EOF
103unload to ./${outpath}/sessionwait.unl delimiter '|'
104select first 20 sid,pid, username, hostname,
105is_wlatch, -- blocked waiting on a latch
106is_wlock, -- blocked waiting on a locked record or table
107is_wbuff, -- blocked waiting on a buffer
108is_wckpt, -- blocked waiting on a checkpoint
109is_incrit -- session is in a critical section of transaction-- (e.g writting to disk)
110from syssessions
111order by is_wlatch+is_wlock+is_wbuff+is_wckpt+is_incrit desc;
112EOF
113###################################################################################
114## Session IO
115###################################################################################
116echo "collect session IO info using sql ......"
117dbaccess sysmaster - << EOF
118unload to ./${outpath}/sessionio.unl delimiter '|'
119select first 100 syssesprof.sid,isreads,iswrites,isrewrites,
120isdeletes,bufreads,bufwrites,seqscans ,
121pagreads ,pagwrites,total_sorts ,dsksorts ,
122max_sortdiskspace,logspused
123from syssesprof, syssessions
124where syssesprof.sid = syssessions.sid
125order by bufreads+bufwrites desc
126;
127EOF
128###################################################################################
129## Checkpoint
130###################################################################################
131echo "collect checkpoint info using sql ......"
132dbaccess sysmaster - << EOF
133unload to ./${outpath}/checkpoint.unl delimiter '|'
134select
135intvl,type,caller,dbinfo('UTC_TO_DATETIME',clock_time)||' T' clock_time,
136round(crit_time,4),round(flush_time,4),round(cp_time,4),n_dirty_buffs,
137plogs_per_sec,llogs_per_sec,dskflush_per_sec,ckpt_logid,ckpt_logpos,physused,logused,
138n_crit_waits,tot_crit_wait,longest_crit_wait,block_time
139from syscheckpoint order by intvl;
140EOF
141###################################################################################
142## Database
143###################################################################################
144echo "collect database info using sql ......"
145dbaccess sysmaster - << EOF
146unload to ./${outpath}/database.unl delimiter '|'
147SELECT trim(name) dbname,trim(owner) owner, created||' T' created_time,
148TRIM(DBINFO('dbspace',partnum)) AS dbspace,
149CASE WHEN is_logging+is_buff_log=1 THEN "Unbuffered logging"
150 WHEN is_logging+is_buff_log=2 THEN "Buffered logging"
151 WHEN is_logging+is_buff_log=0 THEN "No logging"
152ELSE "" END Logging_mode
153FROM sysdatabases
154where trim(name) not like 'sys%';
155EOF
156###################################################################################
157## DBspace
158###################################################################################
159echo "collect dbspaces info using sql ......"
160dbaccess sysmaster - << EOF
161unload to ./${outpath}/dbspace.unl delimiter '|'
162SELECT A.dbsnum as No, trim(B.name) as name,
163CASE WHEN (bitval(B.flags,'0x10')>0 AND bitval(B.flags,'0x2')>0)
164 THEN 'MirroredBlobspace'
165 WHEN bitval(B.flags,'0x10')>0 THEN 'Blobspace'
166 WHEN bitval(B.flags,'0x2000')>0 AND bitval(B.flags,'0x8000')>0
167 THEN 'TempSbspace'
168 WHEN bitval(B.flags,'0x2000')>0 THEN 'TempDbspace'
169 WHEN (bitval(B.flags,'0x8000')>0 AND bitval(B.flags,'0x2')>0)
170 THEN 'MirroredSbspace'
171 WHEN bitval(B.flags,'0x8000')>0 THEN 'SmartBlobspace'
172 WHEN bitval(B.flags,'0x2')>0 THEN 'MirroredDbspace'
173 ELSE 'Dbspace'
174END as dbstype,
175round(sum(chksize)*2/1024/1024,2)||'GB' as DBS_SIZE ,
176round(sum(decode(mdsize,-1,nfree,udfree))*2/1024/1024,2)||'GB' as free_size,
177case when sum(decode(mdsize,-1,nfree,udfree))*100/sum(decode(mdsize,-1,chksize,udsize))
178 >sum(decode(mdsize,-1,nfree,nfree))*100/sum(decode(mdsize,-1,chksize,mdsize))
179then TRUNC(100-sum(decode(mdsize,-1,nfree,nfree))*100/sum(decode(mdsize,-1,chksize,mdsize)),2)||"%"
180else TRUNC(100-sum(decode(mdsize,-1,nfree,udfree))*100/sum(decode(mdsize,-1,chksize,udsize)),2)||"%"
181 end as used,
182 TRUNC(MAX(A.pagesize/1024))||"KB" as pgsize,
183 MAX(B.nchunks) as nchunks
184FROM syschktab A, sysdbstab B
185WHERE A.dbsnum = B.dbsnum
186GROUP BY A.dbsnum,name, 3
187ORDER BY A.dbsnum;
188EOF
189###################################################################################
190## Chunks
191###################################################################################
192echo "collect chunk info using sql ......"
193dbaccess sysmaster - << EOF
194unload to ./${outpath}/chunks.unl delimiter '|'
195SELECT A.chknum as num, B.name as spacename,
196TRUNC((A.pagesize/1024)) as pgsize,
197A.offset offset,
198round( A.chksize*2/1024/1024,2)||'GB' as size,
199round(decode(A.mdsize,-1,A.nfree,A.udfree)*2/1024/1024,2)||'GB' as free,
200TRUNC(100 - decode(A.mdsize,-1,A.nfree,A.udfree)*100/A.chksize,2 ) as used,
201A.fname
202FROM syschktab A, sysdbstab B
203WHERE A.dbsnum = B.dbsnum
204order by B.dbsnum;
205EOF
206###################################################################################
207## Chunk IO
208###################################################################################
209echo "collect chunk IO using sql ......"
210dbaccess sysmaster - << EOF
211unload to ./${outpath}/chunk_io.unl delimiter '|'
212select d.name dbspace, fname[1,125] chunk_name,reads read_count,writes write_count,
213reads+writes total_count,pagesread,pageswritten,
214pagesread+pageswritten total_pg
215from sysmaster:syschkio c, sysmaster:syschunks k, sysmaster:sysdbspaces d
216where d.dbsnum = k.dbsnum and k.chknum = c.chunknum
217order by 8 desc;
218EOF
219###################################################################################
220## Logical Log
221###################################################################################
222echo "collect logical log using sql ......"
223dbaccess sysmaster - << EOF
224unload to ./${outpath}/logicallog.unl delimiter '|'
225SELECT A.number as num, A.uniqid as uid, round(A.size*2/1024,2)||'MB' as size,
226TRIM( TRUNC(A.used*100/A.size,0)||'%') as used,
227d.name as spacename,
228TRIM( A.chunk||'_'||A.offset ) as location,
229decode(A.filltime,0,'NotFull',
230dbinfo('UTC_TO_DATETIME', A.filltime)::varchar(50))||' T' as filltime,
231CASE WHEN bitval(A.flags,'0x1') > 0 AND bitval(A.flags,'0x4')>0
232 THEN 'UsedBackedUp'
233 WHEN bitval(A.flags,'0x1') > 0 AND bitval(A.flags,'0x2')>0
234 THEN 'UsedCurrent'
235 WHEN bitval(A.flags,'0x1') > 0 THEN 'Used'
236 ELSE hex(A.flags)::varchar(50)
237END as flags,
238CASE WHEN A.filltime-B.filltime > 0 THEN
239 round(CAST(TRUNC(A.size/(A.filltime-B.filltime),4)
240 as varchar(20))*2/1024,2)||'MB/S'
241 ELSE ' N/A ' END as pps
242FROM syslogfil A, syslogfil B,syschktab c, sysdbstab d
243WHERE A.uniqid-1 = B.uniqid
244and c.dbsnum = d.dbsnum
245and a.chunk=c.chknum
246UNION
247SELECT A.number as num, A.uniqid as uid, round(A.size*2/1024,2)||'MB' as size,
248TRIM( TRUNC(A.used*100/A.size,0)||'%') as used,
249d.name as spacename,
250TRIM( A.chunk||'_'||A.offset ) as location,
251decode(A.filltime,0,'NotFull',
252dbinfo('UTC_TO_DATETIME', A.filltime)::varchar(50))||' T' as filltime,
253CASE WHEN bitval(A.flags,'0x1') > 0 AND bitval(A.flags,'0x4')>0
254 THEN 'UsedBackedUp'
255 WHEN bitval(A.flags,'0x1') > 0 AND bitval(A.flags,'0x2')>0
256 THEN 'UsedCurrent'
257 WHEN bitval(A.flags,'0x1') > 0 THEN 'Used'
258 WHEN bitval(A.flags,'0x8') > 0 THEN 'NewAdd'
259 ELSE hex(A.flags)::varchar(50) END as flags,
260 'N/A' as pps
261FROM syslogfil A ,syschktab c, sysdbstab d
262WHERE ( A.uniqid = (SELECT min(uniqid) FROM syslogfil WHERE uniqid > 0)
263 OR A.uniqid = 0 )
264and c.dbsnum = d.dbsnum
265and a.chunk=c.chknum
266ORDER BY A.uniqid ;
267EOF
268###################################################################################
269## Locks on Table
270###################################################################################
271echo "collect table locks using sql ......"
272dbaccess sysmaster - << EOF
273unload to ./${outpath}/tab_actlock.unl delimiter '|'
274select dbsname,tabname,
275sum(pf_rqlock) as locks,
276sum(pf_wtlock) as lockwaits,
277sum(pf_deadlk) as deadlocks
278from sysactptnhdr,systabnames
279where systabnames.partnum = sysactptnhdr.partnum
280group by dbsname,tabname
281order by lockwaits,locks desc;
282EOF
283dbaccess sysmaster - << EOF
284unload to ./${outpath}/tab_lock.unl delimiter '|'
285select dbsname,tabname,
286sum(lockreqs) as lockreqs,
287sum(lockwts) as lockwaits,
288sum(deadlks) as deadlocks
289from sysptprof
290group by dbsname,tabname
291order by deadlocks,lockwaits,lockreqs desc;
292EOF
293###################################################################################
294## Databaes Used Space
295###################################################################################
296echo "collect database used space using sql ......"
297dbaccess sysmaster - << EOF
298unload to ./${outpath}/database_space.unl delimiter '|'
299select t1.dbsname,
300round(sum(ti_nptotal)*max(ti_pagesize)/1024/1024/1024,2)||'GB' allocated_size,
301round(sum(ti_npused)*max(ti_pagesize)/1024/1024/1024,2)||'GB' used_size
302from systabnames t1, systabinfo t2,sysdatabases t3
303where t1.partnum = t2.ti_partnum
304and trim(t3.name)=trim(t1.dbsname)
305group by dbsname
306order by sum(ti_nptotal) desc;
307EOF
308###################################################################################
309## Tables Space
310###################################################################################
311echo "collect table and index used space using sql ......"
312dbaccess sysmaster - << EOF
313unload to ./${outpath}/tab_space.unl delimiter '|'
314SELECT st.dbsname databasename, st.tabname,
315 MAX(dbinfo('UTC_TO_DATETIME',sin.ti_created)) createdtime,
316 SUM( sin.ti_nextns ) extents,
317 SUM( sin.ti_nrows ) nrows,
318 MAX( sin.ti_nkeys ) nkeys,
319 MAX( sin.ti_pagesize ) pagesize,
320 SUM( sin.ti_nptotal ) nptotal,
321 round(SUM( sin.ti_nptotal*sd.pagesize )/1024/1024,2)||'MB' total_size,
322 SUM( sin.ti_npused ) npused,
323 round(SUM( sin.ti_npused*sd.pagesize )/1024/1024,2)||'MB' used_size,
324 SUM( sin.ti_npdata ) npdata,
325 round(SUM( sin.ti_npdata*sd.pagesize )/1024/1024,2)||'MB' data_size
326FROM
327 sysmaster:systabnames st,
328 sysmaster:sysdbspaces sd,
329 sysmaster:systabinfo sin
330WHERE
331 sd.dbsnum = trunc(st.partnum / 1048576)
332 AND st.partnum = sin.ti_partnum
333 AND st.dbsname NOT IN ('sysmaster','sysuser','sysadmin','sysutils','sysha','syscdr','syscdcv1')
334 AND st.tabname[1,3] NOT IN ('sys','TBL')
335GROUP BY 1, 2
336ORDER BY 9 DESC;
337EOF
338###################################################################################
339## Tables Space By Partition
340###################################################################################
341echo "collect table and index partition used space using sql ......"
342dbaccess sysmaster - << EOF
343unload to ./${outpath}/tab_space_frag.unl delimiter '|'
344SELECT st.dbsname databasename, st.tabname,st.partnum partnum,
345 dbinfo('UTC_TO_DATETIME',sin.ti_created) createdtime,
346 sin.ti_nextns extents,
347 sin.ti_nrows nrows,
348 sin.ti_nkeys nkeys,
349 sin.ti_pagesize pagesize,
350 sin.ti_nptotal nptotal,
351 round(( sin.ti_nptotal*sd.pagesize )/1024/1024,2)||'MB' total_size,
352 ( sin.ti_npused ) npused,
353 round(( sin.ti_npused*sd.pagesize )/1024/1024,2)||'MB' used_size,
354 ( sin.ti_npdata ) npdata,
355 round(( sin.ti_npdata*sd.pagesize )/1024/1024,2)||'MB' data_size
356FROM
357 sysmaster:systabnames st,
358 sysmaster:sysdbspaces sd,
359 sysmaster:systabinfo sin
360WHERE
361 sd.dbsnum = trunc(st.partnum / 1048576)
362 AND st.partnum = sin.ti_partnum
363 AND st.dbsname NOT IN ('sysmaster','sysuser','sysadmin','sysutils','sysha','syscdr','syscdcv1')
364 AND st.tabname[1,3] NOT IN ('sys','TBL')
365ORDER BY 9 DESC;
366EOF
367###################################################################################
368## Tables and index IO and seqscans
369###################################################################################
370echo "collect table and index io and seqscans using sql ......"
371dbaccess sysmaster - << EOF
372unload to ./${outpath}/tab_io.unl delimiter '|'
373SELECT
374 st.dbsname,p.tabname,SUM( sin.ti_nrows ) nrows,
375 round(SUM( sin.ti_nptotal*sd.pagesize )/1024/1024,2)||'MB' total_size,
376 round(SUM( sin.ti_npused*sd.pagesize )/1024/1024,2)||'MB' used_size,
377 SUM( seqscans ) AS seqscans,
378 SUM( pagreads ) diskreads,
379 SUM( bufreads ) bufreads,
380 SUM( bufwrites ) bufwrites,
381 SUM( pagwrites ) diskwrites,
382 SUM( pagreads )+ SUM( pagwrites ) disk_rsws,
383 trunc(decode(SUM( bufreads ),0,0,(100 -((SUM( pagreads )* 100)/ SUM( bufreads + pagreads )))),2) AS rbufhits,
384 trunc(decode(SUM( bufwrites ),0,0,(100 -((SUM( pagwrites )* 100)/ SUM( bufwrites + pagwrites )))),2) AS wbufhits
385FROM
386 sysmaster:sysptprof p,
387 sysmaster:systabinfo sin,
388 sysmaster:sysdbspaces sd,
389 sysmaster:systabnames st
390WHERE
391 sd.dbsnum = trunc(st.partnum / 1048576)
392 AND p.partnum = st.partnum
393 AND st.partnum = sin.ti_partnum
394 AND st.dbsname NOT IN ('sysmaster','sysuser','sysadmin','sysutils','sysha','syscdr','syscdcv1')
395 AND st.tabname[1,3] NOT IN ('sys','TBL')
396GROUP BY 1, 2
397ORDER BY 11 DESC;
398EOF
399###################################################################################
400## Current slowest sql
401###################################################################################
402echo "collect current slowest sql using sql ......"
403dbaccess sysmaster - << EOF
404unload to ./${outpath}/slowsql.unl delimiter '|'
405Select first 100 sqx_estcost,sqx_estrows,sqx_sqlstatement
406FROM sysmaster:syssqexplain
407order by sqx_estcost desc;
408EOF
409###################################################################################
410## Table statistics,lockmode,index keys
411###################################################################################
412echo "collect tables statistics,lockmode,index keys using sql ......"
413dbaccess sysmaster - << EOF
414unload to ./${outpath}/tabstat.sql delimiter ";"
415select
416"unload to ./${outpath}/"||trim(name)||"_stat.unl Select t.tabname,t.created as tabcreated,t.nrows,tmpt.nrows as realrows,t.locklevel,t.ustlowts,i.idxname,"||
417"trim(case when i.part1>0 then (select colname from "||trim(name)||":syscolumns where colno=i.part1 and tabid=i.tabid) else '' end)||"||
418"trim(case when i.part2>0 then (select ','||colname from "||trim(name)||":syscolumns where colno=i.part2 and tabid=i.tabid) else '' end)||"||
419"trim(case when i.part3>0 then (select ','||colname from "||trim(name)||":syscolumns where colno=i.part3 and tabid=i.tabid) else '' end)||"||
420"trim(case when i.part4>0 then (select ','||colname from "||trim(name)||":syscolumns where colno=i.part4 and tabid=i.tabid) else '' end)||"||
421"trim(case when i.part5>0 then (select ','||colname from "||trim(name)||":syscolumns where colno=i.part5 and tabid=i.tabid) else '' end)||"||
422"trim(case when i.part6>0 then (select ','||colname from "||trim(name)||":syscolumns where colno=i.part6 and tabid=i.tabid) else '' end)||"||
423"trim(case when i.part7>0 then (select ','||colname from "||trim(name)||":syscolumns where colno=i.part7 and tabid=i.tabid) else '' end)||"||
424"trim(case when i.part8>0 then (select ','||colname from "||trim(name)||":syscolumns where colno=i.part8 and tabid=i.tabid) else '' end)||"||
425"trim(case when i.part9>0 then (select ','||colname from "||trim(name)||":syscolumns where colno=i.part9 and tabid=i.tabid) else '' end)||"||
426"trim(case when i.part10>0 then (select ','||colname from "||trim(name)||":syscolumns where colno=i.part10 and tabid=i.tabid) else '' end)||"||
427"trim(case when i.part11>0 then (select ','||colname from "||trim(name)||":syscolumns where colno=i.part11 and tabid=i.tabid) else '' end)||"||
428"trim(case when i.part12>0 then (select ','||colname from "||trim(name)||":syscolumns where colno=i.part12 and tabid=i.tabid) else '' end)||"||
429"trim(case when i.part13>0 then (select ','||colname from "||trim(name)||":syscolumns where colno=i.part13 and tabid=i.tabid) else '' end)||"||
430"trim(case when i.part14>0 then (select ','||colname from "||trim(name)||":syscolumns where colno=i.part14 and tabid=i.tabid) else '' end)||"||
431"trim(case when i.part15>0 then (select ','||colname from "||trim(name)||":syscolumns where colno=i.part15 and tabid=i.tabid) else '' end)||"||
432"trim(case when i.part16>0 then (select ','||colname from "||trim(name)||":syscolumns where colno=i.part16 and tabid=i.tabid) else '' end ) index_cols"||
433",i.nunique "||
434"from "||trim(name)||":systables t left join "||trim(name)||":sysindexes i on t.tabid=i.tabid "||
435"join (select tabname,sum(ti_nrows) as nrows from systabnames tn join systabinfo ti on ti.ti_partnum=tn.partnum where dbsname='"||trim(name)||"' "||
436"group by tabname) as tmpt "||
437"on t.tabname=tmpt.tabname "||
438"where t.tabid>99 "||
439"and t.tabtype='T' "||
440"order by 4 desc,1"
441from sysdatabases
442where name NOT IN ('sysmaster','sysuser','sysadmin','sysutils','sysha','syscdr','syscdcv1')
443and is_logging=1;
444EOF
445dbaccess sysmaster ${outpath}/tabstat.sql
446###################################################################################
447## onstat cmd
448###################################################################################
449echo "collect instance running status using onstat commands ......"
450onstat -b > ./${outpath}/onstat_b.unl
451onstat -C all > ./${outpath}/onstat_C_all.unl
452onstat -C > ./${outpath}/onstat_bigc.unl
453onstat -c > ./${outpath}/onstat_c.unl
454onstat -D > ./${outpath}/onstat_bigd.unl
455onstat -d > ./${outpath}/onstat_d.unl
456onstat -F > ./${outpath}/onstat_F.unl
457onstat -g act > ./${outpath}/onstat_g_act.unl
458onstat -g arc > ./${outpath}/onstat_g_arc.unl
459onstat -g ath > ./${outpath}/onstat_g_ath.unl
460onstat -g buf > ./${outpath}/onstat_g_buf.unl
461onstat -g cluster > ./${outpath}/onstat_g_cluster.unl
462onstat -g cmsm > ./${outpath}/onstat_g_cmsm.unl
463onstat -g cfg > ./${outpath}/onstat_g_cfg.unl
464onstat -g cfg diff > ./${outpath}/onstat_g_cfg_diff.unl
465onstat -g ckp > ./${outpath}/onstat_g_ckp.unl
466onstat -g con > ./${outpath}/onstat_g_con.unl
467onstat -g cpu > ./${outpath}/onstat_g_cpu.unl
468onstat -g dic > ./${outpath}/onstat_g_dic.unl
469onstat -g dis > ./${outpath}/onstat_g_dis.unl
470onstat -g dsc > ./${outpath}/onstat_g_dsc.unl
471onstat -g env > ./${outpath}/onstat_g_env.unl
472onstat -g glo > ./${outpath}/onstat_g_glo.unl
473onstat -g iof > ./${outpath}/onstat_g_iof.unl
474onstat -g iog > ./${outpath}/onstat_g_iog.unl
475onstat -g ioq > ./${outpath}/onstat_g_ioq.unl
476onstat -g iov > ./${outpath}/onstat_g_iov.unl
477onstat -g lmx > ./${outpath}/onstat_g_lmx.unl
478#onstat -g mem > ./${outpath}/onstat_g_mem.unl
479onstat -g mgm > ./${outpath}/onstat_g_mgm.unl
480onstat -g ntd > ./${outpath}/onstat_g_ntd.unl
481onstat -g ntt > ./${outpath}/onstat_g_ntt.unl
482onstat -g ntu > ./${outpath}/onstat_g_ntu.unl
483onstat -g osi > ./${outpath}/onstat_g_osi.unl
484onstat -g rea > ./${outpath}/onstat_g_rea.unl
485onstat -g seg > ./${outpath}/onstat_g_seg.unl
486onstat -g ses 0 > ./${outpath}/onstat_g_ses_0.unl
487onstat -g ses > ./${outpath}/onstat_g_ses.unl
488onstat -g smb s > ./${outpath}/onstat_g_smb_s.unl
489#onstat -g spi | sort -n -k 2 | tail -200 > ./${outpath}/onstat_g_spi.unl
490onstat -g sql > ./${outpath}/onstat_g_sql.unl
491onstat -g sql 0 > ./${outpath}/onstat_g_sql_0.unl
492#onstat -g ssc > ./${outpath}/onstat_g_ssc.unl
493#onstat -g stk >onstat_g_stk.unl
494#onstat -g sts >onstat_g_sts.unl
495onstat -g wai > ./${outpath}/onstat_g_wai.unl
496onstat -L > ./${outpath}/onstat_bigl.unl
497onstat -l > ./${outpath}/onstat_l.unl
498onstat -p > ./${outpath}/onstat_p.unl
499onstat -R > ./${outpath}/onstat_R.unl
500onstat -u > ./${outpath}/onstat_u.unl
501onstat -V > ./${outpath}/onstat_V.unl
502onstat -x > ./${outpath}/onstat_x.unl
503onstat -X > ./${outpath}/onstat_bigx.unl
504###################################################################################
505## system cmd
506###################################################################################
507echo ""
508echo "collect instance running status using system command ......"
509echo ""
510echo "collect cm memory ......"
511ps -aux |grep cmsm > ./${outpath}/cm_mem.unl
512echo ""
513echo "collect online.log last 50000 rows......"
514onlinefile=`onstat -m |grep 'Message Log File' | awk '{print $4}'`
515tail -50000 ${onlinefile} > ./${outpath}/online.log
516echo ""
517echo "collect current user env ......"
518env > ./${outpath}/env.unl
519echo ""
520echo "collect system cpu and memory using vmstat ......"
521vmstat 1 5 > ./${outpath}/vmstat.unl
522echo ""
523echo "##################################################################"
524echo "GBase 8s Database Health Check Finshed"
525echo "tar all of the output files in path: ${outpath}"
526echo "tar -cvf ${outpath}.tar ${outpath} "
527echo "##################################################################"
528###################################################################################
529## end of all
530###################################################################################