Vous êtes sur la page 1sur 4

Case Studies on DB2

Case 1 : Create tables and load Data 1. Create a database and few tablespaces 2. Create below tables TableA AC1 integer AC2 char(5) AC3 varchar(10) AC4 date AC5 ti esta p AC! integer

"ni# inde$ % AC1 &econdar' inde$ % AC2 and AC4

Table( (C1 integer (C2 char(5) (C3 ()*( (C4 C)*(

"ni# cl+stered inde$ % (C1 &econdar' inde$ % (C2

3. 5. 4o a e$plain of the pac.age and chec. 1ebind the pac. 3. Create a <4C table Table4 the tables +sing a . Create a trigger which will insert a row in TA()-C (2ew table) when a row is deleted fro TA()-A 2.ll+strate the *2 delete cascade3restrict 3set 2")) options.oin . Case 3 : Triggers and Stored procedure 1.nsert 10 records each 4. Create a TableC li. e$plain again Case 4 : Range Partitioned table and Vie s 1. Create a &5 which will insert a record to TableA and then read all the rows fro TableA and displa' the res+lt set &elect 6 fro TableA where AC! 78so e val+e9 3. the table stat+s 4. . Create a file of 2/3 0 records for TableA and load replace the data Case 2 : Referential integrity 1. Create an inde$ on TableA 3 AC! 5. Create a view to select AC1:AC2 and (C1:(C2 fro 3. . 41*5 1. between TA()-A and TA()-( 2. )oad replace the child table and chec.e tableA b+t a 1ange partitioned table based on AC1 val+es and load data 2. 1+nstats on TableA !.age and r+n advise 4. Create 1. -$port data and i port it bac.

Ta.+p 2. 2.+p 1estore the database to a new database in a new path onitor onitor Case 1) : *uto+atic Storage Check the current status of your database Check the Current Status of Your Table Spaces Enable Automatic Storage for Database Create tablespaces with automatic storage disabled Enable Automatic Storage for Table Spaces Online Enable Automatic Storage for Table Spaces via edirect estore Document the difference between the above mentioned methods . 1+n offline reorg and tableA and 3. Ta. Case ( : Database Redirected restore 1. 1estore the database and roll forward to point in ti e Case & : Tablespace le'el Bac$up and Restore 1.Case ! : Reorg 1.e a offline bac. 1+n online inde$ reorg for TableA 2.e a offline bac. 1estore the database Case % : #nline Bac$up and restore 1.+p 2. Ta. 1+n online reorg for tableA and Case " : #ffline Bac$up and restore 1. Ta.nitiate a online tablespace bac.+p 4.e an online bac.e an online bac. 1estore the tablespace and rollforward till 5oint in ti e. 1estore the database and roll forward to end of logs 3.+p 2. .

+p . Create a table with identit' col+ n 2.Case 11 : Event monitor Create!monitor and read the output for event monitor by restricting the ma" files generated to be limited to #$% Create a table and load data into it Create event monitor for that table Check if the event monitor is enabled and is functioning fine &erform D'( operations on that table after enabling event monitor )et the results of the logs generated by the event monitor% Turn off the event monitor once the *ob is done% epeat the same steps by creating event monitor for statements and transactions% Case 12 : Enabling and disabling rotating diagnostic logging. =rite a script which will create a file and insert 100 records 2. Case 13 : Perform schema copy using AD !"#C$P%#&C'E A procedure and db2move utility for schema of your choice Create a table with a user created schema and load data into it Copy the present source schema to a different target schema using both the above utilities% +t needs to be done on both same D. =rite a script which will do reorg3r+nstats on a table and ta.nsert few records. .dentity colu+ns 1. =rite a script which will load the file created b' step 1 to a table 3.e a bac. 3. Case 1( : Create a non unicode D) and then convert to unicode D) * code set UTF-8+ Case 1! : . 1eset the identit' col+ n Case 1" : Script 1. as well as different D.