http://database./art/200608/29669.htm以下的文章主要向大家讲述的是DB2入门实验(Working with Instances and Databases )的正确操作流程,相信如果你对DB2入门实验(Working with Instances and Databases )的正确操作流程有兴趣了解的话,会在以后的学习或是工作中带来很大的帮助。
站在用户的角度思考问题,与客户深入沟通,找到茂名网站设计与茂名网站推广的解决方案,凭借多年的经验,让设计与互联网技术结合,创造个性化、用户体验好的作品,建站类型包括:成都网站制作、成都网站设计、企业官网、英文网站、手机端网站、网站推广、域名与空间、雅安服务器托管、企业邮箱。业务覆盖茂名地区。
Working, Databases, Instances, 入门, 实验Working, Databases, Instances, DB2入门, 实验
按照以下步骤完成,使用了db 2 express 9
- DB2 Migration Workshop
- LAB 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. (启动DB2的命令行窗口)
(在本次实验中,我使用的是DB2 express 9在安装过程中自动创建的DB2admin帐户登陆)
- Start > Programs > IBM DB2 > Command Line Tools > Command Window
- (or simply, DB2cmd)
- Linux: Login to the operating system as user DB2inst1(linux下需要使用DB2inst1登陆)
2. When DB2 is installed, no database exists. Create the SAMPLE database provided by DB2.
- DB2sampl
(在DB2 express9该数据库已经存在)
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 9已经可以自动创建系统帐户作为它自身的数据库帐户。
连接到数据库simple:
- DB2 connect to sample
5. See all connections that currently exist for the current instance
显示所有的运行在当前数据库实例上的DB2入门应用程序
- 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
using
8. View the tables that currently exist in the SAMPLE database
- DB2 list tables (显示用户创建的表)
- or
- DB2 list tables for all(显示所有的tables包括用户和系统的)
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 (
)
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
可连接并且已经被关闭,以上的相关内容就是对DB2入门实验(Working with Instances and Databases )的介绍,望你能有所收获。
【编辑推荐】
当前标题:对DB2入门实验的正确操作流程的描述
URL标题:http://www.shufengxianlan.com/qtweb/news23/128673.html
网站建设、网络推广公司-创新互联,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联