1) 查看数据库目录
# db2 list db directory
System Database Directory
Number of entries in the directory = 2
Database 1 entry:
Database alias = TESTDB
Database name = TESTDB
Local database directory = /home/db2inst1
Database release level = f.00
Comment =
Directory entry type = Indirect
Catalog database partition number = 0
Alternate server hostname =
Alternate server port number =
Database 2 entry:
Database alias = SAMPLE
Database name = SAMPLE
Local database directory = /home/db2inst1
Database release level = f.00
Comment =
Directory entry type = Indirect
Catalog database partition number = 0
Alternate server hostname =
Alternate server port number =
2) 查看版本
# db2level
DB21085I Instance "db2inst1" uses "64" bits and DB2 code release "SQL10010"
with level identifier "0201010E".
Informational tokens are "DB2 v10.1.0.0", "s120403", "LINUXAMD64101", and Fix
Pack "0".
Product is installed at "/opt/ibm/db2/V10.1".
3) 查看节点数
# db2_ps|wc -l
1
4) 查看数据库配置情况
$ db2set -all
[i] DB2COMM=TCPIP
[i] DB2AUTOSTART=YES
[g] DB2_COMPATIBILITY_VECTOR=MYS
[g] DB2SYSTEM=oracle
[g] DB2INSTDEF=db2inst1
[g] DB2ADMINSERVER=db2as
5) 查看许可证
$ db2licm -l
Product name: "DB2 Express-C"
License type: "Unwarranted"
Expiry date: "Permanent"
Product identifier: "db2expc"
Version information: "10.1"
Max number of CPUs: "2"
Max amount of memory (GB): "4"
Enforcement policy: "Soft Stop"
6) 查看数据库配置
$ db2 get dbm cfg
Database Manager Configuration
Node type = Database Server with local and remote clients
Database manager configuration release level = 0x0f00
CPU speed (millisec/instruction) (CPUSPEED) = 3.581944e-07
Max number of concurrently active databases (NUMDB) = 32
Federated Database System Support (FEDERATED) = NO
Transaction processor monitor name (TP_MON_NAME) =
Default charge-back account (DFT_ACCOUNT_STR) =
Java Development Kit installation path (JDK_PATH) = /home/db2inst1/sqllib/java/jdk64
Diagnostic error capture level (DIAGLEVEL) = 3
Notify Level (NOTIFYLEVEL) = 3
Diagnostic data directory path (DIAGPATH) = /home/db2inst1/sqllib/db2dump/
Current member resolved DIAGPATH = /home/db2inst1/sqllib/db2dump/
Alternate diagnostic data directory path (ALT_DIAGPATH) =
Current member resolved ALT_DIAGPATH =
Size of rotating db2diag & notify logs (MB) (DIAGSIZE) = 0
Default database monitor switches
Buffer pool (DFT_MON_BUFPOOL) = OFF
Lock (DFT_MON_LOCK) = OFF
Sort (DFT_MON_SORT) = OFF
Statement (DFT_MON_STMT) = OFF
Table (DFT_MON_TABLE) = OFF
Timestamp (DFT_MON_TIMESTAMP) = ON
Unit of work (DFT_MON_UOW) = OFF
Monitor health of instance and databases (HEALTH_MON) = OFF
SYSADM group name (SYSADM_GROUP) = DB2IADM1
SYSCTRL group name (SYSCTRL_GROUP) =
SYSMAINT group name (SYSMAINT_GROUP) =
SYSMON group name (SYSMON_GROUP) =
Client Userid-Password Plugin (CLNT_PW_PLUGIN) =
Client Kerberos Plugin (CLNT_KRB_PLUGIN) =
Group Plugin (GROUP_PLUGIN) =
GSS Plugin for Local Authorization (LOCAL_GSSPLUGIN) =
Server Plugin Mode (SRV_PLUGIN_MODE) = UNFENCED
Server List of GSS Plugins (SRVCON_GSSPLUGIN_LIST) =
Server Userid-Password Plugin (SRVCON_PW_PLUGIN) =
Server Connection Authentication (SRVCON_AUTH) = NOT_SPECIFIED
Cluster manager =
Database manager authentication (AUTHENTICATION) = SERVER
Alternate authentication (ALTERNATE_AUTH_ENC) = NOT_SPECIFIED
Cataloging allowed without authority (CATALOG_NOAUTH) = NO
Trust all clients (TRUST_ALLCLNTS) = YES
Trusted client authentication (TRUST_CLNTAUTH) = CLIENT
Bypass federated authentication (FED_NOAUTH) = NO
Default database path (DFTDBPATH) = /home/db2inst1
Database monitor heap size (4KB) (MON_HEAP_SZ) = AUTOMATIC(90)
Java Virtual Machine heap size (4KB) (JAVA_HEAP_SZ) = 2048
Audit buffer size (4KB) (AUDIT_BUF_SZ) = 0
Size of instance shared memory (4KB) (INSTANCE_MEMORY) = AUTOMATIC(381400)
Instance memory for restart light (%) (RSTRT_LIGHT_MEM) = AUTOMATIC(10)
Agent stack size (AGENT_STACK_SZ) = 1024
Sort heap threshold (4KB) (SHEAPTHRES) = 0
Directory cache support (DIR_CACHE) = YES
Application support layer heap size (4KB) (ASLHEAPSZ) = 15
Max requester I/O block size (bytes) (RQRIOBLK) = 32767
Workload impact by throttled utilities(UTIL_IMPACT_LIM) = 10
Priority of agents (AGENTPRI) = SYSTEM
Agent pool size (NUM_POOLAGENTS) = AUTOMATIC(100)
Initial number of agents in pool (NUM_INITAGENTS) = 0
Max number of coordinating agents (MAX_COORDAGENTS) = AUTOMATIC(200)
Max number of client connections (MAX_CONNECTIONS) = AUTOMATIC(MAX_COORDAGENTS)
Keep fenced process (KEEPFENCED) = YES
Number of pooled fenced processes (FENCED_POOL) = AUTOMATIC(MAX_COORDAGENTS)
Initial number of fenced processes (NUM_INITFENCED) = 0
Index re-creation time and redo index build (INDEXREC) = RESTART
Transaction manager database name (TM_DATABASE) = 1ST_CONN
Transaction resync interval (sec) (RESYNC_INTERVAL) = 180
SPM name (SPM_NAME) = oracle
SPM log size (SPM_LOG_FILE_SZ) = 256
SPM resync agent limit (SPM_MAX_RESYNC) = 20
SPM log path (SPM_LOG_PATH) =
TCP/IP Service name (SVCENAME) = 50000
Discovery mode (DISCOVER) = SEARCH
Discover server instance (DISCOVER_INST) = ENABLE
SSL server keydb file (SSL_SVR_KEYDB) =
SSL server stash file (SSL_SVR_STASH) =
SSL server certificate label (SSL_SVR_LABEL) =
SSL service name (SSL_SVCENAME) =
SSL cipher specs (SSL_CIPHERSPECS) =
SSL versions (SSL_VERSIONS) =
SSL client keydb file (SSL_CLNT_KEYDB) =
SSL client stash file (SSL_CLNT_STASH) =
Maximum query degree of parallelism (MAX_QUERYDEGREE) = ANY
Enable intra-partition parallelism (INTRA_PARALLEL) = NO
No. of int. communication buffers(4KB)(FCM_NUM_BUFFERS) = AUTOMATIC(1024)
No. of int. communication channels (FCM_NUM_CHANNELS) = AUTOMATIC(512)
db2start/db2stop timeout (min) (START_STOP_TIME) = 10
WLM dispatcher enabled (WLM_DISPATCHER) = NO
WLM dispatcher concurrency (WLM_DISP_CONCUR) = COMPUTED
WLM dispatcher CPU shares enabled (WLM_DISP_CPU_SHARES) = NO
WLM dispatcher min. utilization (%) (WLM_DISP_MIN_UTIL) = 5
Communication buffer exit library list (COMM_EXIT_LIST) =
7) 检查DB2实例是否启动
# ps -ef|grep db2sysc
db2inst1 4291 4289 0 22:25 ? 00:00:03 db2sysc
root 9235 3926 0 22:42 pts/0 00:00:00 grep db2sysc
8) 有无非法连接
$ db2 list applications show detail
SQL1611W No data was returned by Database System Monitor.
9) 查看日志
$ tail -n 500 /home/db2inst1/sqllib/db2dump/db2diag.log
2014-09-24-23.06.19.710657+480 I6377618E400 LEVEL: Event
PID : 17106 TID : 47254651511408 PROC : db2star2
INSTANCE: db2inst1 NODE : 000
HOSTNAME: oracle
FUNCTION: DB2 UDB, base sys utilities, DB2StartMain, probe:4747
MESSAGE : ZRC=0xFFFFFBFE=-1026
SQL1026N The database manager is already active.
DATA #1 :
Db2StartMain::sqlcode=0
2014-09-24-23.06.19.715816+480 I6378019E376 LEVEL: Warning
PID : 17106 TID : 47254651511408 PROC : db2star2
INSTANCE: db2inst1 NODE : 000
HOSTNAME: oracle
FUNCTION: DB2 UDB, base sys utilities, sqleReleaseStStLockFile, probe:12463
MESSAGE : Released lock on the file:
DATA #1 : String, 39 bytes
/home/db2inst1/sqllib/ctrl/db2stst.0000
2014-09-24-23.06.19.723347+480 I6378396E376 LEVEL: Warning
PID : 17104 TID : 47704909650672 PROC : db2start
INSTANCE: db2inst1 NODE : 000
HOSTNAME: oracle
FUNCTION: DB2 UDB, base sys utilities, sqleReleaseStStLockFile, probe:12463
MESSAGE : Released lock on the file:
DATA #1 : String, 39 bytes
/home/db2inst1/sqllib/ctrl/db2strst.lck
10) 查看系统用户资源
# ulimit -a
core file size (blocks, -c) 0
dataseg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 16000
max locked memory (kbytes, -l) 32
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 16000
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
11) 数据库备份是否正常
$ db2 list history backup all for sample
List History File for sample
Number of matching file entries = 4
Op ObjTimestamp+Sequence Type Dev Earliest Log Current Log Backup ID
-- --- ------------------ ---- --- ------------ ------------ --------------
B D 20140923222825001 F D S0000000.LOG S0000000.LOG
----------------------------------------------------------------------------
Contains 5 tablespace(s):
00001 SYSCATSPACE
00002 USERSPACE1
00003 IBMDB2SAMPLEREL
00004 IBMDB2SAMPLEXML
00005 SYSTOOLSPACE
----------------------------------------------------------------------------
Comment: DB2 BACKUP SAMPLE OFFLINE
Start Time: 20140923222825
End Time: 20140923222836
Status: A
----------------------------------------------------------------------------
EID: 31 Location: /home/db2inst1
Op ObjTimestamp+Sequence Type Dev Earliest Log Current Log Backup ID
-- --- ------------------ ---- --- ------------ ------------ --------------
B D 20140923223005000 N S0000000.LOG S0000000.LOG
----------------------------------------------------------------------------
----------------------------------------------------------------------------
Comment: DB2 BACKUP SAMPLE ONLINE
Start Time: 20140923223005
End Time: 20140923223006
Status: I
----------------------------------------------------------------------------
EID: 32 Location:
SQLCA Information