DB2: To view database log for the last 5 mins

 In DB2 , the database log is called db2diag.log


Once logged in:

>db2diag -H 5m

 Examples:


      1. To display severe errors logged for the last 3 days, enter:


              db2diag -gi "level=severe" -H 3d


      2. To display log messages recorded during the last 30 minutes, enter:


              db2diag -H


         This command is equivalent to


              db2diag -H 30  or  db2diag -history 30m


      3. To display log messages recorded within two hours after midnight on

         April 10, 2003, enter:


              db2diag -H '+2h:2003-04-10'


      4. To display log messages recorded within two hours before midnight on

         April 10, 2003, enter:


              db2diag -H '-2h:2003-04-10' or db2diag -H '2h:2003-04-10'




Command parameters:


 -history [historyPeriod][:historyBegin] or -H [historyPeriod][:historyBegin]


      Displays the history of logged messages for a particular interval of

      time, historyPeriod, back from the last logged record or from the

      time, historyBegin, when history begins. By default, log messages are

      displayed for the last 30 min before the last record in the log


      The historyBegin variable, record's time stamp, is specified using the

      following format:


             YYYY-MM-DD-hh.mm.ss.nnnnnn

      where

           - YYYY specifies a year

           - MM specifies a month of a year (01 through 12)

           - DD specifies a day of a month (01 through 31)

           - hh specifies an hour of a day (00 through 23)

           - mm specifies a minute of an hour (00 through 59)

           - ss specifies a second of a minute (00 through 59)

           - nnnnnn specifies microseconds (UNIX) or milliseconds (Windows)




Comments

Popular posts from this blog

Oracle: To clean up WRI$_ADV_OBJECTS