Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
db2_bordel [2019/01/11 09:34] – andonovj | db2_bordel [2019/10/18 20:04] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 162: | Line 162: | ||
+ | ----- | ||
- | ===DB2 Tasks=== | + | ====DB2 Tasks==== |
In this task we: | In this task we: | ||
Line 310: | Line 311: | ||
--connection to database should be possible now | --connection to database should be possible now | ||
db2 connect to NEWDB | db2 connect to NEWDB | ||
+ | |||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | <sxh> | ||
+ | --excercise 5 | ||
+ | |||
+ | --create table | ||
+ | create table BANK(id SMALLINT not null,name varchar(20), | ||
+ | |||
+ | --insert data | ||
+ | insert into BANK values (1, ' | ||
+ | |||
+ | --export data | ||
+ | export to BANK.ixf of ixf " | ||
+ | |||
+ | --import table, using INSERT method records are added to existing | ||
+ | db2 import from BANK.ixf of ixf insert into BANK | ||
+ | |||
+ | --we have 12 rows | ||
+ | |||
+ | --import table, now using REPLACE, table is truncated before inserting | ||
+ | db2 import from BANK.ixf of ixf replace into BANK | ||
+ | |||
+ | --back to 6 rows | ||
+ | |||
+ | --verify you are running in archive log mode, if not switch to archive log mode | ||
+ | --db2 update db cfg using LOGARCHMETH DISK:/ | ||
+ | --db2 backup database SAMPLE | ||
+ | db2 get db cfg | grep LOGARCHMETH1 | ||
+ | |||
+ | --export DDL for table BANK | ||
+ | db2look -d SAMPLE -t BANK -e -o BANK.sql | ||
+ | |||
+ | --delete table | ||
+ | db2 drop table BANK | ||
+ | |||
+ | --recreate table by script generated by db2look command | ||
+ | db2 -tvf BANK.sql -l BANK.out | ||
+ | |||
+ | --load table using COPY NO | ||
+ | db2 load from BANK.ixf of ixf insert into BANK copy no | ||
+ | |||
+ | --with COPY NO tablespace is put to backup pending state, see status of USERSPACE1 tablespace | ||
+ | --You should find: State = 0x0020 | ||
+ | db2 list tablespaces | ||
+ | db2tbst 0x0020 | ||
+ | |||
+ | --perform tablespace level backup for tablespace USERSPACE1 | ||
+ | db2 " | ||
+ | |||
+ | --verify status of tablespace again, should be back in normal state | ||
+ | db2 list tablespaces | ||
+ | |||
+ | --see syntax of backup image, tablespace level backup are marked 3 in compare 0 for full backups | ||
+ | ls -latr *001 | ||
</ | </ |