database.sarang.net
UserID
Passwd
Database
DBMS
MySQL
PostgreSQL
Firebird
Oracle
ㆍInformix
Sybase
MS-SQL
DB2
Cache
CUBRID
LDAP
ALTIBASE
Tibero
DB 문서들
스터디
Community
공지사항
자유게시판
구인|구직
DSN 갤러리
도움주신분들
Admin
운영게시판
최근게시물
Informix Q&A 2548 게시물 읽기
No. 2548
유용한 query 첫번째..
작성자
작은거
작성일
2008-11-28 14:42
조회수
7,551

제가 다른 게시판에는 write 권한이 없어서 자꾸 이쪽에만 글을 올리게 되네여..ㅋㅋ

이번에는 informix 관리 시 유용하게 사용할 수 있는 쿼리 몇개를 올려드립니다.

How long has the user been connected

          select sid, username,
          dbinfo('UTC_TO_DATETIME',connected) conection_time,
          current - dbinfo('UTC_TO_DATETIME',connected)
          connected_since
          from syssessions
          order by 2,3;


How long has the user been idle

          SELECT s.sid, s.username, q.odb_dbname database,
          dbinfo('UTC_TO_DATETIME',s.connected) conection_time,
          dbinfo('UTC_TO_DATETIME',t.run_time) last_run_time,
          current - dbinfo('UTC_TO_DATETIME',t.run_time) idle_time
          FROM syssessions s, systcblst t,  sysrstcb r, sysopendb q
          WHERE t.tid = r.tid AND s.sid = r.sid AND s.sid = q.odb_sessionid
          ORDER BY 6 DESC;


How to link a session to a transaction

  select tx_id
     from systrans 
     where tx_addr =  select us_txp 
          from sysuserthreads 
          where us_sid = SESSIONID);


How to find the busy tables

  select systabnames.tabname,
          sysptntab.pf_isread,
          sysptntab.pf_iswrite,
          sysptntab.pf_isrwrite,
          sysptntab.pf_isdelete,
          sysptntab.pf_seqscans 
          from systabnames, sysptntab 
          where systabnames.partnum = sysptntab.partnum;


How long has the database engine been running
 
          select dbinfo('UTC_TO_DATETIME', sh_curtime)
          - dbinfo('UTC_TO_DATETIME', sh_boottime)
          from sysshmvals;


How to find the current SQL statement

  select sqs_statement 
          from syssqlstat
          where sqs_statement;
          or
          select sqx_sessionid,
          sqx_conbno,
          sqx_sqlstatement
          from syssqexplain,
          sysscblst 
          where sqx_sessionid = sid 
          order by 1,2 ;

[Top]
No.
제목
작성자
작성일
조회
2551crontab 관련 mail 질문입니다.
홍순범
2008-12-01
5861
2550informix에서 요일 월을 영문으로 받아오는 방법좀 가르쳐주세요.
난몰까
2008-11-30
6560
2549인포믹스 DB 툴 괜찮은거 없나요? [1]
나그네
2008-11-28
10573
2548유용한 query 첫번째..
작은거
2008-11-28
7551
2547인포믹스에서 not null -> null 로 변경하는 방법을 문의드립니다. [1]
김대훈
2008-11-13
6477
2546백업 관련해서 질문 드립니다. [2]
홍순범
2008-11-07
8872
2545SHMVIRTSIZE 값 증가시 onstat 연결 오류 [1]
이기웅
2008-11-01
7079
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2023 DSN, All rights reserved.
작업시간: 0.049초, 이곳 서비스는
	PostgreSQL v16.1로 자료를 관리합니다