运行create database
命令后,可以使用以下命令检查是否已创建数据库:
db2 list db directory
通过使用上述命令,只能检查数据库列表。无法确定数据库是限制性的还是非限制性的。
使用以下命令检查数据库是否具有限制性。
语法:
db2 get db cfg for <db_name> | grep -i restrict
示例:
假设要检查 xyz
数据库是否是限制性数据库:
db2 get db cfg for xyz | grep -i restrict
得到类似以下结果:
$ db2 get db cfg for xyz | grep -i restrict
restrict access = no
可以看到它不是限制性的。现在检查xyz2
是否是限制性数据库:
db2 get db cfg for xyz2 | grep -i restrict
得到类似以下结果:
$ db2 get db cfg for xyz | grep -i restrict
restrict access = yes
可以看到xyz2
是限制性数据库。
实例也称为数据库管理器。实例配置(数据库管理器配置)存储在名为db2system
的文件中,与数据库相关的配置存储在名称为“sqldbcon”的文件中。无法直接编辑这些文件。 这些文件只能使用调用api的工具进行编辑。
可以使用以下命令配置数据库管理器。
要获取实例数据库管理器的信息:
语法:
db2 get database manager configuration
## 或者
db2 get dbm cfg
得到类似下面的结果:
$ db2 get dbm cfg
database manager configuration
node type = enterprise server edition with local and remote clients
database manager configuration release level = 0x1400
cpu speed (millisec/instruction) (cpuspeed) = 1.180861e-07
communications bandwidth (mb/sec) (comm_bandwidth) = 1.000000e+02
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/ $m
current member resolved diagpath = /home/db2inst1/sqllib/db2dump/diag0000/
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
global instance memory (% or 4kb) (instance_memory) = automatic(519452)
member instance memory (% or 4kb) = global
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) = 65535
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) = h3
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) = db2c_db2inst1
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
maximum asynchronous tqs per query (federated_async) = 0
number of fcm buffers (fcm_num_buffers) = automatic(4096)
fcm buffer size (fcm_buffer_size) = 32768
number of fcm channels (fcm_num_channels) = automatic(2048)
fcm parallelism (fcm_parallelism) = automatic(4)
node connection elapse time (sec) (conn_elapse) = 10
max number of node connection retries (max_connretries) = 5
max time difference between nodes (min) (max_time_diff) = 60
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) =
current effective arch level (cur_eff_arch_lvl) = v:11 r:1 m:3 f:3 i:0 sb:0
current effective code level (cur_eff_code_lvl) = v:11 r:1 m:3 f:3 i:0 sb:0
keystore type (keystore_type) = none
keystore location (keystore_location) =
$
更新实例数据库管理器
语法:
db2 update database manager configuration
## 或者
db2 update dbm cfg
重置以前的配置
语法:
db2 reset database manager configuration
## 或者
db2 reset dbm cfg
获取数据库的信息
语法:
db2 get database configuration
## 或者
db2 get db cfg
更新数据库配置
语法:
db2 update database configuration
## 或者
db2 update db cfg
在数据库配置中重置先前配置的值
语法:
db2 reset database configuration
## 或者
db2 reset db cfg
检查当前活动数据库的大小
语法:
db2 "call get_dbsize_info(?,?,?,-1)"