DB2数据库在linux *** 作系统的指令有哪些?

DB2数据库在linux *** 作系统的指令有哪些?,第1张

DB2数据库命令简介 1.启动数据库 DB2start 2.停止数据库 DB2stop DB2数据库在linux相关指令之3.连接数据库 DB2 connect to o_yd user DB2 using pwd 4.读数据库管理程序配置 DB2 get dbm cfg 5.写数据库管理程序配置 DB2 update dbm cfg using 参数名 参数值 6.读数据库的配置 DB2 connect to o_yd user DB2 using pwd DB2 get db cfg for o_yd 7.写数据库的配置 DB2 connect to o_yd user DB2 using pwd DB2 update db cfg for o_yd using 参数名 参数值 8.关闭所有应用连接 DB2 force application all DB2 force application ID1,ID2,,,Idn MODE ASYNC (DB2 list application for db o_yd show detail) 9.备份数据库 DB2 force application all DB2 backup db o_yd to d: (DB2 initialize tape on \.tape0) (DB2 rewind tape on \.tape0) DB2 backup db o_yd to \.tape0 10.恢复数据库 DB2 restore db o_yd from d: to d: DB2 restore db o_yd from \.tape0 to d: DB2数据库在linux相关指令之11.绑定存储过程 DB2 connect to o_yd user DB2 using pwd DB2 bind c:dfplus.bnd 拷贝存储过程到服务器上的C:sqllibfunction目录中 12.整理表 DB2 connect to o_yd user DB2 using pwd DB2 reorg table ydd DB2 runstats on table ydd with distribution and indexes all 13.导出表数据 DB2 export to c:dftz.txt of del select * from dftz DB2 export to c:dftz.ixf of ixf select * from dftz 14.导入表数据 import from c:123.txt of del insert into ylbx.czyxx DB2 import to c:dftz.txt of del commitcount 5000 messages c:dftz.msg insert into dftz DB2 import to c:dftz.ixf of ixf commitcount 5000 messages c:dftz.msg insert into dftz DB2 import to c:dftz.ixf of ixf commitcount 5000 insert into dftz DB2 import to c:dftz.ixf of ixf commitcount 5000 insert_update into dftz DB2 import to c:dftz.ixf of ixf commitcount 5000 replace into dftz DB2 import to c:dftz.ixf of ixf commitcount 5000 create into dftz (仅IXF) DB2 import to c:dftz.ixf of ixf commitcount 5000 replace_create into dftz (仅IXF) 15.执行一个批处理文件 DB2 -tf 批处理文件名 (文件中每一条命令用 ;结束) 16.自动生成批处理文件 建文本文件:temp.sql select 'runstats on table DB2.' || tabname || ' with distribution and detailed indexes all' from syscat.tables where tabschema='DB2' and type='T'DB2 -tf temp.sql>runstats.sql 17.自动生成建表(视图)语句 在服务器上:C:sqllibmisc目录中 DB2 connect to o_yd user DB2 using pwd DB2look -d o_yd -u DB2 -e -p -c c:o_yd.txt DB2数据库在linux相关指令之18.其他命令 grant dbadm on database to user bb 19select * from czyxx fetch first 1 rows only 20DB2look -d ylbx -u DB2admin -w -asd -a -e -o a.txt21. 显示当前用户所有表 list tables 22.列出所有的系统表 list tables for system 23.查看表结构 DB2 describe select * from user.tables (实习编辑:HJ)

要理解编目我先简单讲下DB2数据库体系结构DB2数据库大概念系统(节点)也主机下面实例实例下面数据库表空间数据库对象现假设有数据库服务器p570机器上有客户端windowslinux或任何平台上现想建立客户端服务器端连接具体步骤呢?

第步:

db2

catalog

tcpip

node

p570

remote

172.10.10.10

server

50000

上面条命令p570节点名(机器上必须唯)remote面服务器IP地址server远程服务器上实例对应端口号DB2通过种方式本地SQLNODIR文件把远程服务器信息记录下来所编目节点其实把远程服务器映射本地通过SQLNODIR记录能够找远程服务器和实例类似指向远程服务器和实例地址指针

第二步:

当把远程服务器IP地址实例编目下来第二步应该把该实例下数据库编目本地

db2

catalog

db

REMOTEDB

at

node

p570

条命令REMOTEDB远程实例下数据库p570我们第步编目节点名

条命令执行会本地SQLDBDIR文件记录远程数据库信息里编目数据库理解把远程服务器实例下数据库映射本地别名

上面客户端和服务器同台机器上通过编目节点编目数据库来实现客户端连接服务器上数据库目连接同台机器上时候要显示编目节点服务器上当我们创建实例时候有隐含把实例本地编目过程假设p570上创建实例名db2inst1其实有隐含

db2

catalog

local

node

db2inst1

instance

db2inst1

system

p570

ostype

aix步骤同样当db2inst1下创建数据库MYDB时候有隐含编目(catalog)数据库步骤:


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/yw/9029153.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-24
下一篇2023-04-24

发表评论

登录后才能评论

评论列表(0条)

    保存