Course materials may not be reproduced in whole or in part without the prior written permission of IBM. 5.1 © Copyright IBM Corporation 2008 DB2 9 Fundamentals (Exam 730) Classroom Resources Part 3: Accessing DB2 data
© Copyright IBM Corporation 2008 Unit objectives After completing this unit, you should understand how to: Create a DB2 database on your own Catalog it for use by other users Examine and manipulate the objects within that database
© Copyright IBM Corporation 2008 Certification Exam (730) objectives Ability to identify DB2 objects Knowledge of basic characteristics and properties of DB2 objects Given a DDL SQL statement, knowledge to identify results (ability to create objects)
© Copyright IBM Corporation 2008 What makes up a DB2 database? A DB2 database is made up of a collection of objects The database contains many of the following physical and logical objects: –Tables, views, indexes, schemas –Locks, triggers, stored procedures, packages –Buffer pools, log files, table spaces
© Copyright IBM Corporation 2008 DB2 object hierarchy
© Copyright IBM Corporation 2008 Default table space containers with Automatic Storage inst20 C CAT DSS dbauto NODEnnnn CREATE DATABASE DSS ON /dbauto DBPATH ON /database DB2INSTANCE=inst20 T T T C LRG C TMP USERSPACE1 SYSCATSPACE (Catalog Partition Only) TEMPSPACE1
© Copyright IBM Corporation 2008 Creating your first database
© Copyright IBM Corporation 2008 Control Center
© Copyright IBM Corporation 2008 Create Database Wizard
© Copyright IBM Corporation 2008 CREATE DATABASE syntax
© Copyright IBM Corporation 2008 CREATE DATABASE examples CREATE DATABASE sales1 ON /dbsales1 –Database Path: /dbsales1 –Automatic Storage Path: /dbsales1 CREATE DATABASE sales2 AUTOMATIC STORAGE no ON /dbsales2 –Database Path: /dbsales2 –Automatic Storage not enabled CREATE DATABASE sales3 ON /dbauto3 DBPATH ON /dbsales3 –Database Path: /dbsales3 –Automatic Storage Path: /dbauto3 CREATE DATABASE sales4 AUTOMATIC STORAGE yes ON /dbauto41,/dbauto42,/dbauto43 DBPATH ON /dbsales4 –Database Path: /dbsales4 –Automatic Storage Paths: /dbauto41, /dbauto42 and /dbauto43
© Copyright IBM Corporation 2008 Database Configuration
© Copyright IBM Corporation 2008 CREATE TABLESPACE syntax (1 of 2)
© Copyright IBM Corporation 2008 CREATE TABLESPACE syntax (2 of 2) on-db-partitions-clause: TO db-partition-number1 db-partition-number2 ( ), ON DBPARTITIONNUM DBPARTITIONNUMS system-containers:, USING | on-db-partitions-clause | 'container-string' ( ) database-containers: USING | on-db-partitions-clause | | container-clause | container-clause: FILE DEVICE 'container-string' num-pages integer ( ), K M G AUTORESIZE YES NO INITIALSIZE int K M G MAXSIZE int K M G NONE INCREASESIZE int K M G perc size-attributes:
© Copyright IBM Corporation 2008 Cataloging your DB2 database CATALOG DB database-name DATABASE AS -- alias AT NODE -- nodename ON path drive CLIENT SERVER_ENCRYPT KERBEROS TARGET PRINCIPAL--principalname DATA_ENCRYPT GSSPLUGIN SERVER AUTHENTICATION WITH -- "comment-string"
© Copyright IBM Corporation 2008 Configuration Assistant (1 of 2)
© Copyright IBM Corporation 2008 Configuration Assistant (2 of 2)
© Copyright IBM Corporation 2008 Manipulating DB2 objects with the Control Center Menu bar Control bar Objects pane Contents pane Contents pane Tool bar Details
© Copyright IBM Corporation 2008 Unit summary Having completed this unit, you should understand how to: Create a DB2 database on your own Catalog it for use by other users Examine and manipulate the objects within that database