DB2 Row generator

Sometimes you need a mechanism to generate rows. For example when you need to create a demonstration table . Recursive CTE’s (Common Table Expression) might be your friend   WITH engine (rownum) AS (select 1 as rownum from sysibm.sysdummy1 union all select rownum + 1 AS rownum from engine where rownum<10) SELECT rownum FROM engine; …

Basic Backups with DB2

Introduction To me the most important thing as a DBA is making sure the data in a database is safe. This means…when there is some sort of failure, you must be completely sure that your backups are working properly. Actually more important then making the backups is making sure you can restore your backups. What …

DB2 commands

Starting the database [db2inst1@bloemkool ~]$ db2start 01/11/2022 14:57:48 0 0 SQL1063N DB2START processing was successful. SQL1063N DB2START processing was successful. [db2inst1@bloemkool ~]$ Stopping the database [db2inst1@bloemkool ~]$ db2stop 01/11/2022 14:58:43 0 0 SQL1064N DB2STOP processing was successful. SQL1064N DB2STOP processing was successful. [db2inst1@bloemkool ~]$ Stopping the database when there are connections/applications in the database.At first …

Basic Rman Configuration

A basic rman configuration (backups to disk): RMAN> show all; RMAN configuration parameters for database with db_unique_name TINUS are: CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 31 DAYS; CONFIGURE BACKUP OPTIMIZATION ON; CONFIGURE DEFAULT DEVICE TYPE TO DISK; CONFIGURE CONTROLFILE AUTOBACKUP ON; CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO ‘/u04/backups/tinus/%F’; CONFIGURE DEVICE TYPE …

Sierpinsky

Sierpinsky Triangle A Sierpinsky trianlge looks like: The above example is not to much developed….but you will get the idea. A Siepinsky triangle can be constructed the following way: Draw a triangle and color it completely black In every black triganle you see in the image do the following Create a white triangle by choosing …

Recursive SQL in DB2

Problem Playing around in DB2 I wanted to know how to create a hiearchical query. This because I wanted to create view for explain plans, a bit resembling the explain plans which oracle provides. First step is understanding how to make the recursive SQL’s The setup: drop table relations; create table relations (id int, parent …