Avatar of marrowyung
marrowyung
 asked on

DB2 log setup and configuration

hi,

as MySQL configuration only allow one db log for ALL user DB. how about DB2 ? it should has one or more log file for EACH user database inside, right?
LinuxDatabasesDB2

Avatar of undefined
Last Comment
marrowyung

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Tomas Helgi Johannsson

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
NerdsOfTech

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Tomas Helgi Johannsson

Hi!

Note that even though I said that there is one transaction log per database in any DBMS (including DB2 ) then this transaction-log (logtream) is often divided physically in to multiple files for speed and "easy" log-management.
Configurations of the size of each physical logfile and how many logfiles should be created physically on disk by default and in continuous fashion should be configured and sized according to how big the workload will be and should be big enough to handle multiple simultaneous UOW of any size.
In DB2 you can have up to 256 primary logfiles allocated on disk and infinate secondary logfiles ( locsecond = -1 ). However that needs some configuration on archiving methods and overflow storage configurations.
Otherwise logprimary+logsecond <= 256 logfiles.
See here for further info and those links that NerdsOfTech provided.
Logfilz is the size of each logfile and should be big enough as I said to store multiple logrecords and multiple simultaneous UOW.

Regards,
    Tomas Helgi
marrowyung

ASKER
"Note that even though I said that there is one transaction log per database in any DBMS (including DB2 ) then this transaction-log (logtream) is often divided physically in to multiple files for speed and "easy" log-management. "

in MySQL it is not . please correct me if I am wrong.

"In DB2 you can have up to 256 primary logfiles allocated on disk and infinate secondary logfiles ( locsecond = -1 ). However that needs some configuration on archiving methods and overflow storage configurations. "

in DB2, more than one log file can also be use at the same time to off load the loading of log writing?
Tomas Helgi Johannsson

Hi!

By design then MySQL/MariaDB has one transaction-log (the bin-log ) per mysql instance. That is every database under that instance relies on that bin-log.
This design is also on DB2 on z/OS where there is one transaction-log per subsystem (instance). This design, that is one transaction log per instance, as is on DB2 z/OS, MySQL and MariaDB, puts that transaction log in the highest critical category of the whole system and needs to be protected against any loss or corruption to be able to do recovery to point in time for any database and/or table in that particular database in the instance.

 However DB2 on LUW is designed in such way that every database has it's own transaction log so if one transaction log corrupts  by missing log-files or corrupt physical files then that will not affect other databases under that particular DB2 instance.

Regards,
      Tomas Helgi
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
marrowyung

ASKER
"By design then MySQL/MariaDB has one transaction-log (the bin-log ) per mysql instance. That is every database under that instance relies on that bin-log. "

this is what I meant !

" However DB2 on LUW is designed in such way that every database has it's own transaction log so if one transaction log corrupts  by missing log-files or corrupt physical files then that will not affect other databases under that particular DB2 instance.
"
so DB2 still better and we need additional configuration for it?
Tomas Helgi Johannsson

Hi!

>so DB2 still better and we need additional configuration for it?
It depends on what your requirements are for the database system at whole. :)
The DB2 database logs are put by default in the same path as the database itself with a default size of 1000 (4k pages)   but you can easilly configure numbers of primary/secondary logfiles, logfilesize and logpath using the db2 commands.
The command (in *nix)
db2 get db cfg for databasename | grep LOG

Open in new window

lists all log config variables for the database of your choice.

Regards,
    Tomas Helgi
marrowyung

ASKER
"The DB2 database logs are put by default in the same path as the database itself with a default size of 1000 (4k pages)"

tks.

"but you can easilly configure numbers of primary/secondary logfiles, logfilesize and logpath using the db2 commands.
The command (in *nix)"

tks. it should be easily configurable .
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
marrowyung

ASKER
tks all.