IBM DB2 Lab - ITFac. Lab 02: Getting started with DB2. Information Management Cloud Computing Center of Competence IBM Canada Lab



Similar documents
Welcome to: Overview of DB2 Universal Database

DB2 Security. Presented by DB2 Developer Domain

DB2 backup and recovery

Server Management. Presented by DB2 Developer Domain

ITG Software Engineering

Configuring an Alternative Database for SAS Web Infrastructure Platform Services

DB2 10 for LUW Upgrade Best Practices

IBM DB Backup and Recovery Hands-On Lab. Information Management Cloud Computing Center of Competence. IBM Canada Lab

Database Upgrade Guide Upgrading to Version 10.5 of IBM DB2 for Linux, UNIX, and Windows

Business Intelligence Tutorial: Introduction to the Data Warehouse Center

IBM DB2 for Linux, UNIX, and Windows. Deploying IBM DB2 Express-C with PHP on Ubuntu Linux

PAYMENTVAULT TM LONG TERM DATA STORAGE

Change Manager 5.0 Installation Guide

Continuous access to Read on Standby databases using Virtual IP addresses

Microsoft Windows PowerShell v2 For Administrators

IGEL Universal Management. Installation Guide

Quick Beginnings for DB2 Servers

IBM WebSphere Application Server V8.5 lab Basic Liberty profile administration using the job manager

About This Document 3. Integration and Automation Capabilities 4. Command-Line Interface (CLI) 8. API RPC Protocol 9.

CONNECTING TO DEPARTMENT OF COMPUTER SCIENCE SERVERS BOTH FROM ON AND OFF CAMPUS USING TUNNELING, PuTTY, AND VNC Client Utilities

Oracle Insurance Policy Administration

Installation Guidelines (MySQL database & Archivists Toolkit client)

Data Warehouse Center Administration Guide

The full setup includes the server itself, the server control panel, Firebird Database Server, and three sample applications with source code.

SQL EXPRESS INSTALLATION...

KonyOne Server Installer - Linux Release Notes

How to Set Up pgagent for Postgres Plus. A Postgres Evaluation Quick Tutorial From EnterpriseDB

IBM Business Monitor Version IBM Business Monitor Installation Guide

SysPatrol - Server Security Monitor

Deploying Business Objects Crystal Reports Server on IBM InfoSphere Balanced Warehouse C-Class Solution for Windows

Deploying Cisco Unified Contact Center Express Volume 1

CloudPortal Services Manager Version 11.0 CU2 Deployment Guide

Active Directory Integration for Greentree

Extending Remote Desktop for Large Installations. Distributed Package Installs

The SkySQL Administration Console

Installing T-HUB on multiple computers

Quick Start Guide. User Manual. 1 March 2012

Introduction. Before you begin. Installing efax from our CD-ROM. Installing efax after downloading from the internet

Setting up the Oracle Warehouse Builder Project. Topics. Overview. Purpose

DB2 - LDAP. To start with configuration of transparent LDAP, you need to configure the LDAP server.

Embarcadero DB Change Manager 6.0 and DB Change Manager XE2

EVALUATION ONLY. WA2088 WebSphere Application Server 8.5 Administration on Windows. Student Labs. Web Age Solutions Inc.

Documentum Business Process Analyzer and Business Activity Monitor Installation Guide for JBoss

DiskPulse DISK CHANGE MONITOR

Plesk 8.3 for Linux/Unix System Monitoring Module Administrator's Guide

WebSphere Business Monitor V7.0 Configuring a remote CEI server

Using a Remote SQL Server Best Practices

Administrator s Guide

Exam Name: IBM InfoSphere MDM Server v9.0

FileMaker 14. ODBC and JDBC Guide

Microsoft Enterprise Search for IT Professionals Course 10802A; 3 Days, Instructor-led

Cloud Services ADM. Agent Deployment Guide

Easy Setup Guide 1&1 CLOUD SERVER. Creating Backups. for Linux

IBM Sterling Control Center

SAP HANA Cloud Applications Partner Program Certification

Connection Broker Managing User Connections to Workstations and Blades, OpenStack Clouds, VDI, and more. Security Review

Authoring for System Center 2012 Operations Manager

GWAVA 5. Migration Guide for Netware GWAVA 4 to Linux GWAVA 5

Tivoli Endpoint Manager for Remote Control Version 8 Release 2. User s Guide

This module explains the Microsoft Dynamics NAV architecture and its core components.

Getting Started with DB2 Installation and Administration on Linux and Windows

DB2. Developing Java Applications. DB2 Version 9 SC

WebSphere Business Monitor V7.0 Business space dashboards

StreamServe Persuasion SP4

Migrating the Domain Configuration Repository During an Upgrade

Oracle Exam 1z0-102 Oracle Weblogic Server 11g: System Administration I Version: 9.0 [ Total Questions: 111 ]

SAS 9.4 In-Database Products

Configuring and Troubleshooting Internet Information Services in Windows Server 2008

Unity Error Message: Your voic box is almost full

Architecture and Mode of Operation

Outlook Profile Setup Guide Exchange 2010 Quick Start and Detailed Instructions

Falcon Install Guide

Oracle Essbase Integration Services. Readme. Release

Upgrading Software Using the Online Installer

Volume SYSLOG JUNCTION. User s Guide. User s Guide

Video Administration Backup and Restore Procedures

Installing The SysAidTM Server Locally

Event Based Interface

SQL Server Training Course Content

Automated Process Center Installation and Configuration Guide for UNIX

OS/2: TELNET Access Method

Dynamic Workload Console User s Guide

Installation Guide v1.11 and Higher

AutoMate BPA Server 10 Installation Guide

Database Replication Error in Cisco Unified Communication Manager

ConcourseSuite 7.0. Installation, Setup, Maintenance, and Upgrade

Capture Pro Software FTP Server Output Format

WebSphere Business Monitor V6.2 Business space dashboards

MTS Remote Drive Service. Quick Start Guide

Database migration using Wizard, Studio and Commander. Based on migration from Oracle to PostgreSQL (Greenplum)

Backup Cisco ICM Database in Microsoft SQL 2000

Suite. How to Use GrandMaster Suite. Exporting with ODBC

Transcription:

Lab 02: Getting started with DB2 Information Management Cloud Computing Center of Competence IBM Canada Lab 1

1. Introduction This module is designed to introduce you to instances, databases, and to practice with DB2 commands, including connecting to a DB2 server. 2. Objectives By the end of this lab, you will be able to: Create a DB2 database Practice with DB2 commands Connect to a remote database 3. Suggested reading Getting started with DB2 Express-C ebook (Chapters 1, 3-7, 9): https://www.ibm.com/developerworks/wikis/display/db2/free+book- +Getting+Started+with+DB2+Express-C A free ebook that can quickly get you up to speed with DB2 4. Initial Steps 1. Start Command Line Processor: 2. Ensure that the DB2 Database Manager has been started by issuing the following command at the prompt: db2 => db2start Note: If you already logged, system have a message: 3. Throughout the lab, the SAMPLE database will be used to explore the features of DB2. To create the SAMPLE database we need to first remove the existing SAMPLE database by issuing the following command. db2 =>drop db sample 5. Working with DB2 Databases 5.1 First Steps 2

First Steps is a graphical tool that helps get you started with DB2. As part of the DB2 installation process, the First Steps panel is displayed allowing the user to generate a number of sample databases to work with: When creating the SAMPLE database, it is recommended that you select the XML and SQL objects and data option. This option will generate the database in UTF-8 (Unicode) format that will allow you to manipulate XML objects. If you do not select the XML option, you will not be able to add XML objects to your SAMPLE database. 5.2 Using the db2sampl command Connect to the sample database (discussed in further details later) and list the tablespaces for the database by issuing the following commands: db2 =>connect to sample db2 =>list tablespaces You should observe an output similar to the following: 3

6 Working with scripts 6.1 Creating a SQL Script 1) Create a SQL script with these characteristics: 2) Run the script from the DB2 Command Window or Linux Shell. You first need to connect to the SAMPLE database. 6.2 Using the CONNECT statement Before you can issue a SQL statement, you have to connect to a database. To connect to our sample database, enter the command: db2 => CONNECT TO sample USER db2inst1 USING password You can also connect to a database and have DB2 prompt you for the password by issuing the command: db2 => db2 CONNECT TO sample USER db2inst1 Or if the database you want to connect to is local, and you simply want to connect to it using the default user ID, issue the command: db2inst1@db2rules:~> db2 CONNECT TO sample 4

Anytime that you need to terminate the connection to the database, you can issue the TERMINATE command: db2 => db2 terminate 5.5.2 Cataloging a local DB2 Database So, why does a database have to be cataloged? Without this information, an application can't connect to a database! When you create a database, the database is automatically cataloged in the local and system database directories. Therefore, a local connection will work as we showed in the previous section. For a remote connection, that is, when the DB2 client and DB2 servers don t reside on the same system, then you must run catalog commands at the DB2 client. This is described in the next section. DB2 has multiple directories that are used to access databases. These directories allow DB2 to find databases known to it whether they are on the local system or a remote system. The system database directory contains a list and pointer indication where each of the known databases can be found. To put an entry into any of these directories, a CATALOG command is used. To remove an entry, the UNCATALOG command is used. To view the entries in the system databases directory, execute the command: db2 => db2 list database directory The output should be similar to the following: 7. Solutions 1) Create the database "DB101" with default values. db2=> create database db101 2) Connect to the database db2=> connect to db101 3) Turn off "Self tuning memory" for this database. db2=> update db cfg using SELF_TUNING_MEM off 4) Show the db cfg confirming that "Self tuning memory" is now off. db2=> get db cfg 5) Stop the instance. db2=> list applications db2=> force applications all 5

db2=> db2stop 6) Start the instance db2=> db2start 7) List the contents of the DB2 Profile Registry. You need to do this from the Linux shell or DB2 Command Window db2=> quit db2set -all 8) Catalog the TCPIP node db2=> catalog tcpip node mynode remote localhost server 50001 9) Catalog the database ensuring to point to the TCPIP node in the previous step db2=> catalog db sample as sample2 at node mynode 10) Test that you can connect. Note that you must input a userid/psw in the syntax since with this setup we are accessing the database using TCPIP which means DB2 thinks it s a remote database. db2=> connect to sample2 user db2inst1 using password 8. Summary This exercise introduced you to the objects that make up a DB2 database, and to the factors that affect how the database is created. You also learned how to review and change DB2 configuration parameters, and how to set up connectivity. 6