Sunteți pe pagina 1din 6

DB2 Import / Export / Load Utility

Note: There 3 file types DB2 uses: DEL, IXF, WSF. IXF is used for creating tables. Export
export to brian_output.del of del select * from siebel.eim_prod_ship(columnName1,columnName2,etc) Import import from brian_input.del of del insert into siebel.eim_prod_ship(columnName1,columnName2,etc) import from C:\filename.ixf of ixf commitcount 1000 replace_create into schemaName.tableName LOAD FROM C:\students.del OF DEL MESSAGES C:\load.msg INSERT INTO college.students; LOAD FROM tools.IXF OF IXF MESSAGES load.msg REPLACE INTO shop.tools STATISTICS YES WITH DISTRIBUTION AND DETAILED INDEXES ALL COPY YES TO d:\backups; NOTE: If you get an error "generated always" use the option "modified by identityignored" example: import from eim_order_itemPG.ixf OF ixf modified by identityignored create into siebel.eim_order_item

Truncate Tables
1. 2. telnet <db server> login: <login> password: <password> 3. connect to <database> Note: This command must be run from the command line on the server. The file "/dev/null" is a default file on the server. This command must be lowercase. IMPORT FROM /DEV/NULL OF DEL REPLACE INTO TABLENAME import from /dev/null of del replace into siebel.eim_account

REORG Table
NOTE: When ever you truncate a table with the import from /dev/null command make sure you run the REORG cmd after the truncate REORG TABLE TABLENAME

RUNSTATS
NOTE: NEVER runstats aftr you truncate a table This cmd runstats on both the table and indexes. runstats on table siebel.eim_order_item and indexes all shrlevel change

MONITOR DB2

list application list applications show detail

DB Configuration
NOTE:

get db cfg for <db name> |pg PG stands for page, so it puts the results to a page

Describe Table Help


? <cmd> example: ? describe

describe table <table name> show detail

FETCH FIRST N ROWS ONLY DEBUGGING HELP

example: select name from s_prod_int fetch first 5 rows only

If you are trying to insert to a table and you get an error message on a specific columnno. Try the following command to tell you the exact column name which is has a problem with the insert. example:
SELECT * FROM SYSIBM.SYSCOLUMNS where tbname = 'EIM_ACCOUNT' and colno = '?'

SYSTEM STATISTICS
The system sstatistics are stored in the schema SYSSTAT.
select * from sysstat.tables

DECRIBE TABLE and INDEXES


This command can only be used through the command line.

DESCRIBE TABLE EIM_ORDER_ITEM SHOW DETAIL DESCRIBE INDEXES FOR TABLE EIM_ORDER_ITEM SHOW DETAIL

Database Configuration File


From the command line: db2 get db cfg for sbltest |more

Database Performance Monitoring


If you have a stored procedure or any application process that is running poorly, you need to take multiple snapshots of the db as the process runs. A good practice is 1 snapshot before the proces, 1 snapshot in the middle of the process, and 1 snapshot at the end of the process. 1. First thing you need to do is get the db mgr and db configuration parameters db2 get db cfg for SBLTEST > /tmp/DBcfg_SBLTEST.txt db2 get dbm cfg > /tmp/dbmcfg.txt 2. The 2nd thing you need to do is turn on the db monitor in order to get a snapshot for a component. db2 update monitor switches using bufferpool on lock on uow on table on statement on sort on 3. Get a print out to confirm the monitor sswitches are on db2 get monitor switches > /tmp/SBLTEST.before.txt Reset the db monitor so that you get a true reading db2 reset monitor for database SBLTEST

4.

5. Run the following cmd before, during, and after the process. Make sure you run them from the command line and not the db2 command line, so that you can print the information to a file. db2 get snapshot for bufferpools on SBLTEST > /tmp/SBLTEST.bufferpool1.txt db2 get snapshot for locks on SBLTEST > /tmp/SBLTEST.locks1.txt db2 get snapshot for tables on SBLTEST > /tmp/SBLTEST.tables1.txt db2 get snapshot for tablespaces on SBLTEST > /tmp/SBLTEST.tablespaces1.txt db2 get snapshot for applications on SBLTEST > /tmp/SBLTEST.application1.txt db2 get snapshot for all on SBLTEST > /tmp/SBLTEST.db1.txt db2 get snapshot for dbm > /tmp/SBLTEST.dbm1.txt 6. This steps just states that after your initial snapshot you need to kcik of the process you are trying to monitor ex: start process "SVP Build Tree" ex: call stored procedure()

Recommended Database Configuration for Siebel

Note: This is just a recommendation, depending on the individual database sizing and application customization there may need to be more tuning.

Database Configuration for Database SBLTEST Database configuration release level Database release level Database Database Database Database territory code page code set country code = 0x0900 = 0x0900 = = = = US 819 ISO8859-1 1

Dynamic SQL Query management Directory object name Discovery support for this database Default query optimization class Degree of parallelism Continue upon arithmetic exceptions Default refresh age Number of frequent values retained Number of quantiles retained Backup pending Database is consistent Rollforward pending Restore pending Multi-page file allocation enabled Log retain for recovery status User exit for logging status Data Data Data Data Data Links Links Links Links Links Token Expiry Interval (sec) Number of Copies Time after Drop (days) Token in Uppercase Token Algorithm

(DYN_QUERY_MGMT) = DISABLE (DIR_OBJ_NAME) = (DISCOVER_DB) = ENABLE (DFT_QUERYOPT) (DFT_DEGREE) (DFT_SQLMATHWARN) (DFT_REFRESH_AGE) (NUM_FREQVALUES) (NUM_QUANTILES) = = = = = = 3 ANY NO 0 10 20

= NO = NO = NO = NO = NO = NO = NO (DL_EXPINT) (DL_NUM_COPIES) (DL_TIME_DROP) (DL_UPPER) (DL_TOKEN) (DBHEAP) (CATALOGCACHE_SZ) (LOGBUFSZ) (UTIL_HEAP_SZ) (BUFFPAGE) (ESTORE_SEG_SZ) (NUM_ESTORE_SEGS) (LOCKLIST) = = = = = = = = = = = = = 60 1 1 NO MAC0 7429 5558 512 5000 1000 16000 0 5000

Database heap (4KB) Catalog cache size (4KB) Log buffer size (4KB) Utilities heap size (4KB) Buffer pool size (pages) Extended storage segments size (4KB) Number of extended storage segments Max storage for lock list (4KB)

Max appl. control heap size (4KB) Sort list heap (4KB) SQL statement heap (4KB) Default application heap (4KB) Package cache size (4KB) Statistics heap size (4KB) Interval for checking deadlock (ms) Percent. of lock lists per application Lock timeout (sec) Changed pages threshold Number of asynchronous page cleaners Number of I/O servers Index sort flag Sequential detect flag Default prefetch size (pages) Track modified pages Default number of containers Default tablespace extentsize (pages) Max number of active applications Average number of active applications Max DB files open per application Log file size (4KB) Number of primary log files Number of secondary log files Changed path to log files Path to log files /disk7/dblogs/db2inst1/SBLTEST/ First active log file

(APP_CTL_HEAP_SZ) = 512 (SORTHEAP) (STMTHEAP) (APPLHEAPSZ) (PCKCACHESZ) (STAT_HEAP_SZ) = = = = = 1000 8192 2500 2048 8000

(DLCHKTIME) = 10000 (MAXLOCKS) = 20 (LOCKTIMEOUT) = 300 (CHNGPGS_THRESH) (NUM_IOCLEANERS) (NUM_IOSERVERS) (INDEXSORT) (SEQDETECT) (DFT_PREFETCH_SZ) = = = = = = 60 4 15 YES YES 128

(TRACKMOD) = OFF = 1 (DFT_EXTENT_SZ) = 32 (MAXAPPLS) = 1000 (AVG_APPLS) = 20 (MAXFILOP) = 500 (LOGFILSIZ) (LOGPRIMARY) (LOGSECOND) (NEWLOGPATH) = 16000 = 25 = 100 = = = = = = = 1 80 OFF OFF

Group commit count (MINCOMMIT) Percent log file reclaimed before soft chckpt (SOFTMAX) Log retain for recovery enabled (LOGRETAIN) User exit for logging enabled (USEREXIT) Auto restart enabled Index re-creation time (RESTART) Default number of loadrec sessions Number of database backups to retain Recovery history retention (days) TSM TSM TSM TSM management class node name owner password

(AUTORESTART) = ON (INDEXREC) = SYSTEM (DFT_LOADREC_SES) = 1 (NUM_DB_BACKUPS) = 12 (REC_HIS_RETENTN) = 366 (TSM_MGMTCLASS) (TSM_NODENAME) (TSM_OWNER) (TSM_PASSWORD) = = = =

S-ar putea să vă placă și