- 浏览: 1547889 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (532)
- 软件设计师 (7)
- PSP (5)
- NET MD (9)
- Hibernate (8)
- DIY (51)
- Work (43)
- GAME (24)
- 未分类 (44)
- iPod (6)
- MySQL (39)
- JSP (7)
- 日语能力考试 (36)
- 小说 (4)
- 豆包网 (23)
- 家用电脑 (7)
- DB2 (36)
- C/C++ (18)
- baby (9)
- Linux (13)
- thinkpad (23)
- OA (1)
- UML (6)
- oracle (24)
- 系统集成 (27)
- 脑梗塞 (6)
- 车 (8)
- MainFrame (8)
- Windows 7 (13)
- 手机 (8)
- git (12)
- AHK (2)
- COBOL (2)
- Java (9)
最新评论
-
安静听歌:
... ...
UUID做主键,好还是不好?这是个问题。 -
lehehe:
http://www.haoservice.com/docs/ ...
天气预报 -
lehehe:
[url http://www.haoservice.com/ ...
天气预报 -
liubang201010:
监控TUXEDO 的软件推荐用这个,专业,权威.并能提供报警和 ...
(转载)Tuxedo中间件简介 -
tinkame:
Next[j] =-1 当j=0时;=Max{k|0<k ...
KMP字符串模式匹配详解
borlanzy 发表于 2007-11-27 10:14
db2经典实验内容,希望大家赶快动手!(第2部)
DB2 Migration WorkshopLAB 1 – Working with Instances and Databases (Solution)
Expected duration: 45 mins
This lab will help you solidify concepts of instances and databases. It is to be completed BEFORE the presentation “DB2 Instances and Databases”.
The following commands are demonstrated:
db2icrt ACTIVATE DB FORCE APPLICATION
db2idrop DEACTIVATE DB GET CONNECTION STATE
db2ilist CONNECT LIST APPLICATIONS
db2start CONNECT RESET LIST DB DIRECTORY
db2stop CREATE DATABASE LIST TABLES
db2admin start DROP DATABASE
db2admin stop DESCRIBE TABLE
Prerequisites:
· DB2 Version 8 Server has been installed
Highly Recommended: Before each step in this lab, locate the demonstrated command in the CLP quick reference and mark it with an asterix (*). This will help you get familiar with the DB2 CLP cheat sheet.
Note: On Linux/UNIX, you can switch users (su) without logging out by using:
su – .. to switch to root user (dash is important!)
su – [userid] .. to switch to non-root user (dash is important!)
exit .. to exit switch back
1. Windows: Launch the DB2 Command Window.
Start > Programs > IBM DB2 > Command Line Tools > Command Window
(or simply, db2cmd)
Linux: Login to the operating system as user db2inst1
2. When DB2 is installed, no database exists. Create the SAMPLE database provided by DB2.
db2sampl
3. Verify that a database now exists. Show the contents of the database directory:
db2 list db directory
Fill in the following information from the database directory:
Database alias SAMPLE
Directory entry type Indirect
4. DB2 does not have database users. Instead, DB2 uses userIDs and passwords defined at the operating system (or network authentication facilities) to authenticate users. Connect to the SAMPLE database using the userID logged into the operating system.
db2 connect to sample
5. See all connections that currently exist for the current instance
db2 list applications
Fill in the following information:
Application name: db2bp.exe
Application handle: 2 (your answer may vary)
Database name: SAMPLE
6. Disconnect from the database:
db2 connect reset
7. Connect to the SAMPLE database using a specific userID and password.
db2 connect to sample user <userid> using <password>
8. View the tables that currently exist in the SAMPLE database
db2 list tables
or
db2 list tables for all
9. From the output of list tables, you should see that a table called EMPLOYEE exists. Find out the structure of EMPLOYEE
db2 describe table employee
What is the maximum length of JOB column? 8 characters
What is the data type for the Salary Column? DECIMAL(9,2)
The above two questions are indented to show how data type lengths from the output of DESCRIBE TABLE are interpreted differently for numeric and character types.
10. Attempt to stop the instance. You should get an error because connections still exist.
db2stop
What is the SQLCODE associated with the error message? SQL1025N
11. To stop the instance, we have to get rid of the current connections. In this step, forcibly disconnect all applications.
db2 force applications all
db2stop
note: you can also force applications by application handle using:
force application (<handle>)
12. By using FORCE APPLICATION, you have terminated your own connection. Attempt to SELECT from the employee table.
db2 “select * from employee”
You should get the error code SQL1224N. Check your connection state.
db2 get connection state
13. To solidify the concept of instances and databases, we’ll create a second instance and create a database in it. Create a new instance:
Windows: You need to be a user with administrative privileges
db2icrt db2inst2 –u db2admin,<db2admin’s password>
Note: There is no space after the comma
Linux: Switch to root user (su - ). You’ll also need to create a user to “own” the instance
useradd db2inst2
passwd db2inst2
/opt/IBM/db2/V8.1/instance/db2icrt –u db2fenc1 db2inst2
14. Verify that the new instance exists
db2ilist
15. Your current instance is DB2 (on windows) or db2inst1 (on Linux). Change your context to the new instance.
Windows: set the DB2INSTANCE environment variable to db2inst2
set DB2INSTANCE=db2inst2
Linux: Switch to user db2inst2.
su – db2inst2
16. Verify that your current instance is db2inst2
db2 get instance
17. By default, a newly created instance will not be started. Start the new instance
db2start
18. The default database configuration is not optimal for any significant use. Use DB2’s AUTOCONFIGURE feature to tune the database:
db2 connect to test
db2 autoconfigure using mem_percent 25 workload_type simple tpm 10 is_populated no num_local_apps 10 num_remote_apps 10 apply db and dbm > autoconfig.txt
Use a text editor to review output in autoconfig.txt
Stop and restart the instance for all changes to take effect:
db2 terminate
db2stop
db2start
19. Create a new database called TEST in the db2inst2 instance
db2 create database TEST
Note: you can also use “db” in place of “database”
Take a look at the database directory again. How many entries do you see? one
What happened to the SAMPLE database we created earlier?
After creating a second instance and switching to it in step 16, we changed to a totally distinct database server context. The SAMPLE database exists in the first instance only. Therefore, after creating the TEST database, there still only the TEST database is listed in the database directory
20. Once a database created, database global memory (most of which is buffer pool memory) is not allocated until the first connection or an explicit activation. If a database is not explicitly activated, the first connection incurs the full cost of resource allocation for the database and all resources are released when the last application disconnects. To prevent this, for production databases, we recommend that you explicitly activate the database. In this step, practice database activation and deactivation.
Optional: launch windows task manager (or vmstat on Linux) to watch global memory allocation in action.
db2 activate db test
db2 deactivate db test
21. To clean up, drop the TEST database and stop the instance.
db2 drop database test
db2stop
Note: you can use “db” in place of “database”
22. Drop the instance
Windows: You must a local administrator user
db2idrop db2inst2
Linux: switch to root user
/opt/IBM/db2/V8.1/instance/db2idrop db2inst2
userdel –r db2inst2
23. The DB2 Admin server is a background process the facilitates remote database and instance administration and automatic task scheduling. Just for fun, stop and start the admin server.
Linux: You may have to source the db2admin user’s dasprofile file first:
. /home/dasusr1/das/dasprofile
db2admin stop
db2admin start
////////**************************************//////
各位朋友,本人拥有以下正版软件:
(1)IBM Websphere application Server 企业版(可以支持集群和多CPU) ver:5.1 /v6.0
for Windows2000、2003,AIX,HP-UX and Solaris 等各个操作系统
(2)IBM Websphere application Server - Express (不支持集群、支持2CPU) ver:6.0
for Windows2000、2003,AIX,HP-UX and Solaris 等各个操作系统
(3) DB2通用数据库企业服务器版 ver:8.2/v9.0(可以支持集群和多CPU)
for Windows2000、2003,AIX,HP-UX and Solaris 等各个操作系统
如果有意请和我联系,以上每套的价格是220元,我的联系方式是:[email]borlanzy@126.com[/email],我提供国内的刻盘和邮寄。
////////**************************************//////
weili163 发表于 2007-12-5 15:12
多谢老大共享!!!!bajie2004 发表于 2008-3-20 23:03
回复 #2 weili163 的帖子
多谢老大共享页: [1]
查看完整版本: db2经典实验内容,希望大家赶快动手!(第2部)
发表评论
-
(转)浅谈IBM DB2的数据库备份与恢复
2011-11-23 16:41 1855http://bzhang.mild.blog.163.com ... -
(转)DB2备份恢复数据库步骤
2011-11-23 16:23 956http://tech.it168.com/ibmtec ... -
(转)DB2 SQL Error: SQLCODE=-964, SQLSTATE=57011的原因及解决方法
2011-11-07 15:03 9649http://blog.sina.com.cn/s ... -
(转)DB2解决“数据库日志已满”操作 SQLCODE=-964
2011-11-07 14:49 2699http://www.db2china.ne ... -
(转)用哪个DB2命令查看DB2 instance是启动还是停止的?
2011-09-30 13:25 3656http://bbs.chinaunix.net/thre ... -
(转)论 LOAD 与 IMPORT 中的 codepage 转换
2011-07-11 14:55 1169http://www.ibm.com/develo ... -
(转)DB2导出数据库表结构和数据
2011-07-11 14:19 1576http://hi.baidu.com/mylovecha ... -
(转)DB2 9 中基于字符的字符串函数
2011-06-16 11:32 1440http://www.ibm.com/develo ... -
(转)db2look:生成 DDL 以便重新创建在数据库中定义的对象
2011-05-31 14:56 1653http://blog.csdn.net/hrfdotnet/ ... -
(转)【俊哥儿张】DB2:学习 DB2LOOK 命令
2011-05-31 14:54 1418http://space.itpub.net/770528 ... -
(转)Recreate optimizer access plans using db2look
2011-05-31 14:53 1278http://www.ibm.com/develo ... -
(转)DB2中ALTER TABLE为什么需要REORG操作?
2011-05-12 13:10 1692http://www.flatws.cn/article/ ... -
(转)DB2 3.2.2 表空间维护
2011-05-11 12:53 1188http://book.51cto.com/art/2 ... -
(转)DB2 数据类型
2011-05-11 12:52 4012http://hi.baidu.com/uvvv/blog ... -
(转)DB2 Basics: Table spaces and buffer pools
2011-05-06 15:29 1483http://www.ibm.com/develo ... -
(转)SQL1092N "USER" does not have the authority to perform therequested command -
2011-03-23 17:39 5490http://dbaspot.com/foru ... -
(转)DB2 sqlstate 57016 原因码 "7"错误详解
2011-03-07 17:38 1505http://www.db2china.net/clu ... -
(转)在英语 OS 上设置 DB2 UDB 版本 8 中的混合字节字符集(MBCS)数据库
2011-02-16 16:25 1611http://www.ibm.com/develo ... -
(转)DB2 CODEPAGE List
2011-02-15 15:15 1434http://www.db2china.net/hom ... -
(转)快速参考: DB2 命令行处理器(CLP)中的常用命令
2010-11-11 10:44 978http://www.ibm.com/develo ...
相关推荐
### 知识点详解 #### 1. DB2数据库与z/OS系统环境 在同济大学提供的DB2实验手册中,首先...通过手册中的实验步骤和描述,学习者可以系统地学习DB2数据库管理的知识,并且通过动手实践,培养解决实际问题的综合技能。
DB2实验报告主要涵盖了IBM的DB2数据库管理系统的学习与实践内容。DB2是业界广泛使用的、高度可扩展的关系型数据库系统,尤其在企业级应用中占据重要地位。本实验报告旨在帮助用户深入理解DB2的基本操作、数据管理、...
该实验教程详细描述了DB2实验的的认识与了解哦~!
**二、实验内容与步骤** 1. **客户端连接`sample`数据库** - 首先,进入DB2CMD环境。 - 使用`db2 get instance`命令检查当前实例,如果需要切换实例,可执行`set db2instance=db2`。 - 通过`DB2SET DB2COMM=...
### DB2日志分析方法——db2diag.log文件内容解析 #### 一、db2diag.log文件概述 在IBM DB2 UDB(Universal Database)环境中,`db2diag.log` 文件是一个非常重要的诊断日志文件,它记录了数据库运行过程中产生的...
### DB2经典讲解:快速入门DB2 #### 连接数据与数据库操作 DB2(Database 2)是由IBM开发的一款关系型数据库管理系统。对于初学者来说,掌握基本的数据库操作是十分重要的。本篇文章将从创建数据库、连接数据库、...
【DB2重点解析 第1章db2概述】 DB2,作为IBM公司的一款旗舰级数据库管理系统,自1983年首次推出以来,已经走过了超过30年的历程,以其高度的稳定性、安全性以及高效的性能获得了业界的广泛认可。在各个版本的迭代中...
- **《macrozeng:第一次DB2调优》**: 介绍了作者第一次尝试优化DB2数据库性能的经历和所获得的经验教训。 - **《leo:我与她(DB2)》**: 描述了作者与DB2之间的深厚情感以及如何通过DB2解决实际工作中的问题。 ...
1. **db2jcc4.jar** - 这个文件是DB2 Universal JDBC Driver的第四版本,提供了对Java Card Connector Component (JC3)的支持。它包含了与DB2数据库通信所需的所有类和接口,使得Java应用程序可以通过JDBC(Java ...
db2 资源 DB2+V9.ppt DB2培训文档(2).ppt DB2培训文档.ppt DB2 Load 实例大全.doc db2 导入导出.doc DB2.doc DB2_730(共128题).doc DB2+技巧.doc DB2安装手册 V0.02.doc DB2试题.doc DB2数据库用户手册(专业排版0...
2、《DB2数据库实战手册》顾名思义是一本以实战教程为主的书籍,内容涵盖了16期DB2入门开窍版和专家坐诊版块中绝大多数典型问题; 3、《DB2数据库实战手册》除了实战内容以外,还包括了DB2的发展历史,DB2的体系结构...
DB2 用户手册 官方 中文 PDF DB2 V9 第二部分 db2dmc90_数据移动使用程序指南和参考.pdf db2f0c90_系统监视器指南和参考.pdf db2hac90_数据恢复和高可用行指南与参考.pdf ...db2m2c90_参考消息:第二卷.pdf
- 第 2 章、第 6 章、第 9 章:这部分内容可能会深入探讨 DB2 的内部工作机制,如数据存储结构、事务处理机制以及诊断工具的使用。 4. **通过改善锁提高应用程序并发性**:这个主题直接关乎数据库系统的并发性能,...
根据提供的文件信息,这里将为大家总结并推荐几本学习IBM DB2数据库的书籍。这些书籍在互联网上可以找到相应的电子版资源,对于想要深入学习DB2数据库管理与应用的读者来说,是非常有价值的参考资料。 ### 1. 《DB2...
本实验将深入介绍DB2 UDB的基础知识,并通过实际操作来帮助你掌握数据库的使用。 1. **安装与配置** 在开始实验前,你需要下载并安装DB2 UDB Express-C V9.7。安装过程包括接受许可协议、选择安装类型(默认推荐...
Linux 环境 DB2 客户端安装 DB2 是 IBM 公司开发的一种关系型数据库管理系统,广泛应用于企业级应用中。安装 DB2 客户端是连接 DB2 服务器的必要步骤。本文将详细介绍在 RedHat 5.9 企业版环境下安装 DB2 客户端的...
2. **Common.jar**:这个文件包含了DB2 JDBC驱动所需的通用类和库,是驱动程序正常运行的基础。 3. **db2qgjava.jar**:此文件可能包含了DB2 Query Governor的Java实现,Query Governor是一种性能管理工具,可以...
2、《DB2数据库实战手册》除了实战内容以外,还包括了DB2的发展历史,DB2的体系结构,DB2 在不同操作系统下的安装与初步配置,读者能根据教程建立数据库、表空间和表等数据库对象并掌握相关知识和技能。 3、《DB2...