db2 das 初學心得

imlihj2007發表於2011-11-29

ibm的東西對初學者 很好玩 aix和db2有個共同點 都有圖形與命令的轉換....但是細節工具技術很靈活 要慢慢的去突破

BACKUP DATABASE SAMPLE ONLINE TO "/home/db2inst2/arch" WITH 2 BUFFERS BUFFER 1024 PARALLELISM 1 WITHOUT PROMPTING;
BACKUP DATABASE SAMPLE TABLESPACE ( IBMDB2SAMPLEREL, USERSPACE1 ) ONLINE TO "/home/db2inst2/arch/db2inst2" WITH 2 BUFFERS BUFFER 1024 PARALLELISM 1 WITHOUT PROMPTING;
BACKUP DATABASE SAMPLE ONLINE INCREMENTAL TO "/home/db2inst2/arch" WITH 2 BUFFERS BUFFER 1024 PARALLELISM 1 WITHOUT PROMPTING;

RESTORE DATABASE SAMPLE FROM "/home/db2inst2" TAKEN AT 20111128030239 WITH 2 BUFFERS BUFFER 1024 PARALLELISM 1 WITHOUT PROMPTING;
db2look -d SAMPLE -u DB2FENC2 -e -l -x -c ;
EXPORT TO "/home/db2inst2/arch/data.dat" OF DEL MESSAGES "/home/db2inst2/arch/data.log" SELECT * FROM DB2INST2.EMPLOYEE;
CONNECT RESET;
EXPORT TO "D:data.dat" OF DEL MESSAGES "D:data.log" SELECT * FROM DB2INST2.EMPLOYEE;
CONNECT RESET;

IMPORT FROM "D:data.dat" OF DEL METHOD P (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14) MESSAGES "D:dat1a.log" INSERT INTO DB2INST2.EMPLOYEE (EMPNO, FIRSTNME, MIDINIT, LASTNAME, WORKDEPT, PHONENO, HIREDATE, JOB, EDLEVEL, SEX, BIRTHDATE, SALARY, BONUS, COMM);
CONNECT RESET;
db2look -d SAMPLE -t "CL_SCHED" -a -e -l -x -c ;


REORG TABLE DB2INST2.CUSTOMER ALLOW READ ACCESS ;
REORG TABLE DB2INST2.CUSTOMER INDEX SYSIBM.SQL111128013201340 ALLOW READ ACCESS USE TEMPSPACE1 INDEXSCAN LONGLOBDATA USE TEMPSPACE1;
CONNECT RESET;

RUNSTATS ON TABLE DB2INST2.EMPLOYEE ON ALL COLUMNS ALLOW WRITE ACCESS ;
COMMIT WORK;
CONNECT RESET;


CREATE BUFFERPOOL TESTBU IMMEDIATE SIZE 1000 PAGESIZE 4 K ;
CONNECT RESET;


CONNECT TO SAMPLE;
CREATE EVENT MONITOR test FOR DATABASE, TABLES, TABLESPACES, DEADLOCKS, BUFFERPOOLS, CONNECTIONS, TRANSACTIONS, STATEMENTS WRITE TO TABLE BUFFERSIZE 4 BLOCKED MANUALSTART ;
CONNECT RESET;


CREATE REGULAR TABLESPACE TESTDB PAGESIZE 4 K MANAGED BY AUTOMATIC STORAGE EXTENTSIZE 16 OVERHEAD 10.5 PREFETCHSIZE 16 TRANSFERRATE 0.14 BUFFERPOOL TESTBU DROPPED TABLE RECOVERY ON;
COMMENT ON TABLESPACE TESTDB IS 'zhushi';
CONNECT RESET;

[@more@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9879835/viewspace-1056618/,如需轉載,請註明出處,否則將追究法律責任。