DB2 UDB Intro
Sources:

DB2 Information Center
http://publib.boulder.ibm.com/infocenter/db2help/index.jsp?
topic=/com.ibm....
Concepts

Components in every DB2 client/server instance:
  • DB2 environment variables
     DB2INSTANCE           current...
Db_resizeable           buffer pools resizable (yes or no)

Database
   - recovery log files
   - recovery history file
  ...
DECIMAL (max 31 digits)
       REAL
       DOUBLE
       CHAR
       VARCHAR
       LONG VARCHAR
       CLOB
       GRAPHI...
Client Configuration Assistant (CCA – replaced by Configuration Assistant?)
    Alternatives:
    • Discovery: known / sea...
- requires only JDBC listener at the server side
- database URL: jdbc:db2://<server>:<port>/<dbname>
Upcoming SlideShare
Loading in...5
×

notes.doc.doc

314

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
314
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

notes.doc.doc

  1. 1. DB2 UDB Intro Sources: DB2 Information Center http://publib.boulder.ibm.com/infocenter/db2help/index.jsp? topic=/com.ibm.db2.udb.doc/core/db2idxA.htm [Cho05] Chong et al: Understanding DB2, Learning Visually with Examples, IBM Press 2005 [Hir03] Kari Hirvonen, IBM: DB2:n Asennus, moniste 2003 [San01] Sanyal et al: DB2 Universal Database v7.1, Application Develoment Certification Guide, Prentice-Hall 2001 DB2 UDB Product Family DB2 Connect (needed for accessing remote databases on z/OS, OS/390, OS/400) DB2 UDB for LUW (Linux, Unix, Windows) DB2 UDB for z/OS DB2 UDB for OS/390 DB2 UDB for VM/VSE DB2 UDB for iSeries DB2 UDB for AS/400 V8.2 editions: DB2 UDB Everyplace (mobile) DB2 UDB Personal Edition (PE) DB2 UDB Express Edition DB2 UDB Workgroup Server Edition (WSE) DB2 UDB Enterprise Server Edition (ESE) DB2 UDB Data Warehouse Editions V9 editions DB2 UDB Express-C
  2. 2. Concepts Components in every DB2 client/server instance: • DB2 environment variables DB2INSTANCE current DB2 Instance • DB2 profile registry entries • DB2 node directory – entries for all remote DB2 servers registered by CATALOG <protocol> NODE <node name> REMOTE <server name or IP address> SERVER <port> • DB2 database manager configuration in the file db2systm • DB2 database directory – client side register of databases in remote nodes CATALOG DB <database name> [AS <alias>] AT NODE <node name> Database Administration Server (DAS) - Server side daemon serving remote GUI clients in accessing all instances in the server - (create: db2admin create) - start: db2admin start - get config: db2 get admin cfg - stop: db2admin stop - (dropping: db2admin drop) Instance (”database manager”) - independent database environment, collection of databases - database manager configuration file - start: db2start - listing: db2ilist - current: db2 get instance - stop: db2stop Configuration steps: db2 get dbm cfg db2 update dbm cfg using <parameter> <value> db2stop db2start V9 autoconfigure parameters (see the bolded values) Mem_percent percentage of dedicated memory (25) Workload_type simple | mixed | complex Num_stmts # statements per unit of work (25) Tpm transactions per minute (60) Admin_priority optimize for performance, recovery or both Num_local_apps # connected local applications ( 0 ) Num_remote_apps # connected remote applications ( 100 ) Isolation default isolation level (RR)
  3. 3. Db_resizeable buffer pools resizable (yes or no) Database - recovery log files - recovery history file - collection of nodegroups (partitions) - nodegroup is a collection of table spaces - system catalog tables - set of schemas - database configuration file db2 get db cfg for <database name> Table space - collection of containers (datafiles / disc partitions) - SMS: system-managed space • Simple to manage • A container is just a file system directory - DMS: database managed space • Better performance: • Table, LOBs and indexes can use separate table spaces • Space can be pre-allocated files or raw disc Page size: 4 kB, 8 kB, .. Extent: 2-256 pages (default 32) Default Table Spaces : SYSCATSPACE (SMS) for system catalog tables TEMPSPACE1(SMS) temporary storage for joining, sorts, etc USERSPACE1 - default for application tables and indexes Controlling Authorities SYSADM (system administration, instance creator by default) SYSCTRL (system control authority, “instance operator”) SYSMAINT (system maintenance) SYSMON DBADM (database administration) Schema objects - tables - indexes - long data - views - triggers Data types SMALLINT INTEGER BIGINT
  4. 4. DECIMAL (max 31 digits) REAL DOUBLE CHAR VARCHAR LONG VARCHAR CLOB GRAPHIC VARGRAPHIC LONG VARGRAPHIC DBCLOB BLOB XML DATE TIME TIMESTAMP Importing / Loading / Exporting Data db2 import from <file name> of <file type> <mode> into <table name> where <file type> is DEL delimited ASCII format ASC non- delimited ASCII format IXF integrated exchange format … <mode> is INSERT INSERT_UPDATE REPLACE REPLACE_CREATE (for IXF files only) db2 load from <file name> of <file type> <mode> into <table name> where <mode> is INSERT REPLACE RESTART TERMINATE db2 export to <file name> of <file type> <mode> <select statement> DB2 Client
  5. 5. Client Configuration Assistant (CCA – replaced by Configuration Assistant?) Alternatives: • Discovery: known / search (requires DAS running on the server) • Access profiles Create a profile using Control Center at the server and export the profile. Import the profile to client workstations using CCA. • DB2 catalog commands (advanced users) Client accesses database using a database alias name (default: the actual database name). CCA catalogs the DB2 server and the selected database. DB2 CLP (Command Line Processor) Setting the default instance SET DB2INSTANCE=<instance name> New CLP window: db2cmd [title <window name>] Conneting to a database CONNECT TO <database> USER <user> USING <password> Where <user> is a domain user having Connect authority to the <database> JDBC Listener db2jstart [port] JDBC connections JDBC Drivers at ..SQLLIBjavadb2java.zip Type II “application” driver - driver class: COM.ibm.db2.jdbc.app.DB2Driver - database URL: jdbc:db2:<db alias> Type III pure java “net” driver - driver class: COM.ibm.db2.jdbc.net.DB2Driver
  6. 6. - requires only JDBC listener at the server side - database URL: jdbc:db2://<server>:<port>/<dbname>

×