Creating the DB2 (DB2 certified DB2 Training) database (Database training database certification) should be a knowledge that every DB2 user needs to know, and here's how to create a DB2 database in the AIX (AIX certification exam IBM AIX Training) environment. If you're having trouble creating a DB2 database, you might want to take a look.
View Environment Variables Db2set
If you find that Db2codepage is not 819 in Db2set, perform
Here is the code snippet:
Db2set db2codepage=819
DB2 CREATE DATABASE test05 On/home/db2inst1
DB2 Connect to test05 user Db2inst1 using DB2
Create a buffer pool and table space corresponding to the pagesize size
Here is the code snippet:
DB2 CREATE Bufferpool USER8 SIZE 8K PAGESIZE
DB2 CREATE Bufferpool USER16 SIZE PAGESIZE K
DB2 CREATE Bufferpool USER32 SIZE PAGESIZE + K
Db2stop force (can be stopped first with: Db2stop, DB2 terminate)
Db2start
DB2 Connect to test05 user Db2inst1 using DB2
DB2 "CREATE REGULAR tablespace ts_user8 PAGESIZE 8K MANAGED by SYSTEM USING (' fsms_8k_1 ') bufferpool USER8"
DB2 "CREATE REGULAR tablespace ts_user16 PAGESIZE 16K MANAGED by SYSTEM USING (' fsms_16k_1 ') bufferpool USER16"
DB2 "CREATE REGULAR tablespace ts_user32 PAGESIZE 32K MANAGED by SYSTEM USING
Create a temporary tablespace (for buffering query results or staging tables)
Here is the code snippet:
DB2 CREATE Bufferpool TMPBUF8 SIZE 10000 PAGESIZE 8K
DB2 "CREATE temporary tablespace tempts_user8 PAGESIZE 8K MANAGED by
Pay permission to the relevant user
Here is the code snippet:
DB2 GRANT Dbadm,createtab,bindadd,connect,load on the DATABASE to USER Easymis
DB2 GRANT use of tablespace Ts_user8 to Easymis
DB2 GRANT use of tablespace ts_user16 to Easymis
DB2 GRANT use of tablespace ts_user32 to Easymis
Start creating tables, creating them (this is how you create tables and views directly, if you use Db2move, then you don't)
Here is the code snippet:
DB2 Connect to test05 user Easymis using Easymis
Db2-f Dbstruct.sql >crttab.log
Db2-f View.sql >crtviw.log
Restore the Db2move backed up database (the procedure for backup is described in the db2move later)
Here is the code snippet:
Db2move test05 import-l/home/db2inst1/wk/test04
DB2-TVF view.sql >crtview.log #如果脚本是db2look, command Terminator is semicolon, line end no special symbol
DB2 UPDATE DB CFG for easytest USING applheapsz 1024
These are the steps to create a DB2 database in an AIX environment.
How to create a DB2 database in an AIX environment