用户操作
[即时聊天] [发私信] [加为好友]
topsjavaID:topsjava
10612次访问,排名10515(1)好友0人,关注者0
topsjava的文章
原创 11 篇
翻译 0 篇
转载 30 篇
评论 3 篇
最近评论
china dragonfly:学习了,谢谢哦
wnj:支持原创!
efan101:我是初学者,非常有用,谢谢了!
文章分类
收藏
    相册
    存档
    软件项目交易
    订阅我的博客
    XML聚合  FeedSky
    订阅到鲜果
    订阅到Google
    订阅到抓虾
    订阅到BlogLines
    订阅到Yahoo
    订阅到GouGou
    订阅到飞鸽
    订阅到Rojo
    订阅到newsgator
    订阅到netvibes

    转载 DB2 命令行处理器(CLP)中的常用命令收藏

    新一篇: 提高商业智能环境中 DB2 查询性能 | 旧一篇: oracle 和db2 的一些异同点

    简介

    方括号中的参数是可选参数,尖括号中的内容表示变量。例如,CONNECT 的语法是:

    connect to <dbname>

    [ [user <userid>] using <pwd>]

    这意味着,通过 CONNECT 命令以 user1 身份使用密码 mypass 与数据库 sample 连接可以有下列形式:

    Connect to sample

    Connect to sample user user1

    Connect to sample user user1 using mypass

    实例

    CLP 命令

    描述

    db2start

    启动数据库管理器实例。

    db2stop

    停止数据库管理器实例。

    get dbm cfg

    返回数据库管理器配置设置。

    get dbm cfg show detail

    显示数据库管理器参数的当前值和延迟值(从 V8 起)。

    1update dbm cfg using <p> <v>

    将数据库管理器配置参数 <p> 更新为值 <v>

    get instance

    返回 DB2INSTANCE 环境变量的值。

    list active databases

    列出活动的数据库和连接数。

    list application [show detail]

    返回关于当前连接的应用程序的信息。

    force application (h1 [,h2,..,hn])

    根据句柄号与特定应用程序断开连接。

    force application all

    断开所有应用程序与数据库的连接。

    attach to <node> user <userid> using <pwd>

    以用户 <userid> 通过使用密码 <pwd> 与标识为 <node> 的远程实例连接。

     数据库

    create database <dbname>

    创建名为 <dbname> 的数据库。

    activate database <dbname>

    显式地激活数据库。

    deactivate database <dbname>

    显式地使数据库失效。

    connect to <dbname>
    [ [user <userid>] using <pwd>]

    根据需要,显式地以用户 <userid> 和密码 <pwd> 与数据库 <dbname> 连接。

    1update dbm cfg using <p> <v>

    将数据库管理器配置参数 <p> 更新为值 <v>

    connect reset

    断开与当前数据库的连接。

    get db cfg show detail

    显示数据库配置参数的当前值和延迟值(仅适用于 V8)。

    get db cfg for <dbname>

    返回数据库 <dbname> 的数据库配置设置。

    update db cfg for <dbname> using <p> <v>

    将数据库 <dbname> 的数据库配置参数 <p> 更新为值 <v>

    list tables[for {user | all | system | schema <schemaname>}][show detail]

    列出数据库中的表。如果没有指定任何参数,则缺省情况是列出当前用户的表。

    describe table <tablename>

    显示一个表或视图的列信息。

    list tablespaces [show detail]

    显示表空间的标识、名称、类型、内容和状态。

    list tablespace containers for <tablespace_id> [show detail]

    显示用 <tablespace_id> 指定的表空间的容器信息。

    quiesce tablespaces for table <tablename> reset

    将表空间的状态复位成正常(normal)。

    连接性

    catalog [admin] <protocol> node …

    为协议 <protocol> 在节点目录中创建一项。

    list [admin] node directory

    返回节点目录的内容。

    catalog database <dbname>…

    为数据库 <dbname> 在数据库目录中创建一项。

    list database directory [on <path>]

    返回数据库目录的内容。

    性能

    get monitor switches

    返回会话监控开关的状态。

    update monitor switches using <monitor> <on|off>

    <monitor> 设置会话监控开关的状态。

    reset monitor all

    复位性能监控程序值。

    get snapshot for dbm

    返回实例级别的性能信息。

    get snapshot for all on <dbname>

    为数据库 <dbname> 在数据库级别返回所有性能信息。

    get snapshot for dynamic sql on <dbname>

    返回动态 SQL 高速缓存的内容。

    runstats on table <tbschema>.<tbname>

    收集表 <tbname> 的统计信息。表名必须是用 <dbschema> 全限定的。

    reorgchk on table all

    确定是否需要对表进行重组。这对于对所有表自动执行 runstats 很有用。

    reorg table <tablename>

    通过重构行来消除碎片数据并压缩信息,对表进行重组。

    管理

    export

    将数据库数据抽取到一个平面文件中。

    import

    通过使用 IMPORT 实用程序,将数据导入到数据库。

    load query table <tbname>
    [to local-message-file][nosummary | summaryonly] [showdelta]

    返回 LOAD 实用程序的进度。

    backup database <dbname> [to <path>]

    执行数据库备份。

    restore database <dbname> [from <path>]

    执行数据库恢复。

    get health snapshot for dbm

    返回实例的正常快照信息(仅适用于 V8)。

    get health snapshot for all on <dbname>

    返回数据库 <dbname> 的所有正常快照(仅适用于 V8)。

     管理服务器

    get admin cfg

    返回管理服务器的配置设置。

    update admin cfg using <p> <v>

    将管理服务器配置参数 <p> 更新为值 <v>

    应用程序开发

    get routine into <filename> from [specific] procedure <routine-name>[hide body]

    SQL 过程抽取成二进制文件。

    put routine from <filename> [owner <newowner>[use registers]]

    从二进制文件部署 SQL 过程。

     

    发表于 @ 2007年06月13日 12:25:00|评论(loading...)|编辑

    新一篇: 提高商业智能环境中 DB2 查询性能 | 旧一篇: oracle 和db2 的一些异同点

    评论:没有评论。

    发表评论  


    登录
    Csdn Blog version 3.1a
    Copyright © topsjava