12/12/95 Creating The Sample Database in DB2.6000 version 2 SPECIAL NOTICES Information in this document is correct to the best of our knowledge at the time of this writing. Please send feedback by fax to "AIXServ Information" at (512) 823-4009. Please use this information with care. IBM will not be responsible for damages of any kind resulting from its use. The use of this information is the sole responsibility of the customer and depends on the customer's ability to eval- uate and integrate this information into the customer's operational environment. ABOUT THIS DOCUMENT This document discusses how to create the sample Data Base in DB2.6000 version 2. It is applicable to AIX versions 3.2.5 and 4.1. This document is designed to walk you through creating the sample database for an instance, starting up DB2 and then shutting down DB2. These steps presuppose the existence of an instance. You will need to change the user and group names supplied in this document with your own. If you do not have an instance created you may want to request from your support center; "Making an Instance for DB2 (v1.1-1.2) on AIX", or "Making an Instance for DB2 (v2.1) on AIX", depending on which version of DB2 you are running. CREATING THE SAMPLE DATABASE 1. Login in as the instance owner. login: inst1 password inst1: (enter password) 2. Start the DB2 engine: $ db2start 3. Create the sample database. Type the command: $ db2sampl 4. Invoke the Command Line Processor. $ db2 The new prompt will look like: db2 => 5. Connect to a data base using the connect command: db2 => connect to sample Creating The Sample Database in DB2.6000 version 2 1 12/12/95 Database Connection Information Database product = DB2/6000 2.1.0 SQL authorization ID = INST1 Local database alias = SAMPLE Use the DB2 command set provided in your manuals. 6. Show the tables in the database by running: db2 => select name, creator from sysibm.systables Output is: NAME CREATOR ------------------ -------- ORG INST1 STAFF INST1 CHECKS SYSCAT COLCHECKS SYSCAT COLDIST SYSCAT COLUMNS SYSCAT CONSTDEP SYSCAT DATATYPES SYSCAT DBAUTH SYSCAT . . . . . . FUNCTIONS SYSSTAT INDEXES SYSSTAT TABLES SYSSTAT 63 record(s) selected Or run: db2 => list tables NAME CREATOR TYPE CTIME ------------------ -------- ---- -------------------------- ORG ALLAN T 1995-02-24-11.13.40.447666 STAFF ALLAN T 1995-02-24-11.13.41.018470 2 record(s) selected. 7. Disconnect using the command below: db2 => connect reset 8. Quit out of a DB2 session and return to the AIX command line using one of two commands: The 'quit' command will return you to a system prompt and leave you connected to a database. The 'terminate' command is the same as a 'quit' EXCEPT it will disconnect you from a a database. Creating The Sample Database in DB2.6000 version 2 2 12/12/95 NOTE: If you run a 'connect reset' and then a 'quit', it is the same thing as running a 'terminate'. DROPPING THE SAMPLE DATABASE NOTE: Replace the letters "DB" with the word "database" in the rest of this document. To get rid of the "sample" DB you will need to drop the database. 1. Drop the DB: $ db2 drop database sample DB20000I The DROP DATABASE command completed successfully. 2. Exit from db2. You will need to stop all DB2 processes and daemons using the 'db2stop' and 'terminate' commands. These commands assume that you have run the 'quit' command from the AIX inst1 owner's prompt. $ db2 force application all $ db2 terminate $ db2stop This will stop all DB2 processes and bring down the DB engine. FURTHER CONSIDERATIONS You will want to read through the "Administration Guide", prior to making your own DB. This document provides a start to understanding simple SQL statements and basic database administration (DBA). If at any time you run into a command which is not working or have question contact your support center for further assistance. Creating The Sample Database in DB2.6000 version 2 3 12/12/95 READER'S COMMENTS Please fax this form to (512) 823-4009, attention "AIXServ Informa- tion". You may also e-mail comments to: elizabet@austin.ibm.com. These comments should include the same customer information requested below. Use this form to tell us what you think about this document. If you have found errors in it, or if you want to express your opinion about it (such as organization, subject matter, appearance) or make sug- gestions for improvement, this is the form to use. If you need technical assistance, contact your local branch office, point of sale, or 1-800-CALL-AIX (for information about support offer- ings). These services may be billable. Faxes on a variety of sub- jects may be ordered free of charge from 1-800-IBM-4FAX. Outside the U.S. call 415-855-4329 using a fax machine phone. When you send comments to IBM, you grant IBM a nonexclusive right to use or distribute your comments in any way it believes appropriate without incurring any obligation to you. NOTE: If you have a problem report or item number, supplying that number may help us determine why a procedure did or did not work in your specific situation. Problem Report or Item #: Branch Office or Customer #: Be sure to print your name and fax number below if you would like a reply: Name: Fax Number: ______________________________________________________________________ ______________________________________________________________________ ______________________________________________________________________ ______________________________________________________________________ ______________________________________________________________________ ______________________________________________________________________ ______________________________________________________________________ ______________________________________________________________________ ______________________________________________________________________ ______________________________________________________________________ ______________________________________________________________________ ______________________________________________________________________ END OF DOCUMENT (sample.db.v2.dbs) Creating The Sample Database in DB2.6000 version 2 4