admin 管理员组文章数量: 1184232
2024年3月10日发(作者:三角函数边角关系图解)
DB2数据库命令简介
1.启动数据库
db2start
2.停止数据库
db2stop
3.连接数据库
db2connecttoo_yduserdb2usingpwd
4.读数据库管理程序配置
db2getdbmcfg
5.写数据库管理程序配置
db2updatedbmcfgusing参数名参数值
6.读数据库的配置
db2connecttoo_yduserdb2usingpwd
db2getdbcfgforo_yd
7.写数据库的配置
db2connecttoo_yduserdb2usingpwd
db2updatedbcfgforo_ydusing参数名参数值
8.关闭所有应用连接
db2forceapplicationall
db2forceapplicationID1,ID2,,,IdnMODEASYNC
(db2listapplicationfordbo_ydshowdetail)
9.备份数据库
db2forceapplicationall
db2backupdbo_ydtod:
(0)
(0)
db2backupdbo_0
10.恢复数据库
db2restoredbo_ydfromd:tod:
db2restoredbo_0tod:
11.绑定存储过程
db2connecttoo_yduserdb2usingpwd
db2bindc:
拷贝存储过程到服务器上的C:sqllibfunction目录中
12.整理表
db2connecttoo_yduserdb2usingpwd
db2reorgtableydd
db2runstatsontableyddwithdistributionandindexesall
13.导出表数据
db2exporttoc:elselect*fromdftz
db2exporttoc:xfselect*fromdftz
14.导入表数据
importfromc:
db2importtoc:elcommitcount5000messagesc:ertintodftz
db2importtoc:xfcommitcount5000messagesc:ertintodftz
db2importtoc:xfcommitcount5000insertintodftz
db2importtoc:xfcommitcount5000insert_updateintodftz
db2importtoc:xfcommitcount5000replaceintodftz
db2importtoc:xfcommitcount5000createintodftz(仅IXF)
db2importtoc:xfcommitcount5000replace_createintodftz(仅IXF)
15.执行一个批处理文件
db2-tf批处理文件名
(文件中每一条命令用;结束)
16.自动生成批处理文件
建文本文件:
select'runstatsontableDB2.'||tabname||'
withdistributionanddetailedindexesall;'
wheretabschema='DB2'andtype='T';
>
17.自动生成建表(视图)语句
在服务器上:C:sqllibmisc目录中
db2connecttoo_yduserdb2usingpwd
db2look-do_yd-udb2-e-p-cc:o_
18.其他命令
grantdbadmondatabasetouserbb
19select*fromczyxxfetchfirst1rowsonly
21.显示当前用户所有表
listtables
22.列出所有的系统表
listtablesforsystem
23.查看表结构
db2describeselect*
一、基础篇
1、db2connectto<数据库名>--连接到
本地
数据库名
db2connectto<数据库名>user<用户名>using<密码>--连接到
远端
数据库
2
、
db2forceapplicationall--
强迫所有应用断开数据库连接
3、db2backupdbdb2name<数据库名称>--备份整个数据库数据
db2restoredb
还原数据库
版权声明:本文标题:LINUX下的DB2命令 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.roclinux.cn/p/1710008749a553430.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论