how UDB reuse the Secondary Log Files

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • hank

    how UDB reuse the Secondary Log Files

    Hi All

    In the Circular Logging when the Primary Log file fill up, the
    database manager will creat a secondary log files for the transaction;
    when this transaction finished, the secondary log files still
    allocated in log directory; when all application disconnect from
    database or database reactive or database restart the secondary log
    files will be deleted from log directory. For each transaction log
    request, database manager always first look primary log, if it is no
    reuseable in primary log, then move to secondary log.

    My question is
    how database manager use the already allocated secondary log file?
    if one transaction log is using 10% of one secondary log file, and
    same time will another transaction log use the rest of 90% of same
    secondary log file?
    if one transaction log need to move to secondary log, does it use
    existed one or to allocate new one?

    Any help will be very useful


    Hank
  • Fan Ruo Xin

    #2
    Re: how UDB reuse the Secondary Log Files


    "hank" <gang36@hotmail .com> wrote in message
    news:8d54c48d.0 402021058.6985d 36a@posting.goo gle.com...[color=blue]
    > Hi All
    >
    > In the Circular Logging when the Primary Log file fill up, the
    > database manager will creat a secondary log files for the transaction;
    > when this transaction finished, the secondary log files still
    > allocated in log directory; when all application disconnect from
    > database or database reactive or database restart the secondary log
    > files will be deleted from log directory. For each transaction log
    > request, database manager always first look primary log, if it is no
    > reuseable in primary log, then move to secondary log.
    >
    > My question is
    > how database manager use the already allocated secondary log file?[/color]
    Just like db2 server use the primary log files[color=blue]
    > if one transaction log is using 10% of one secondary log file, and
    > same time will another transaction log use the rest of 90% of same
    > secondary log file?[/color]
    Either the log file is primary or secondary, they should be used by the all
    the transactions/agents. Let's say you have three primary log files log01,
    log02, log03. If db2 server find out when the log03 is full, but the log01
    still hold the active transactions, then db2 will allocate the secondary
    files and switch the current log file to the first secondary log file.[color=blue]
    > if one transaction log need to move to secondary log, does it use
    > existed one or to allocate new one?[/color]
    the existed one.[color=blue]
    >
    > Any help will be very useful
    >
    >
    > Hank[/color]


    Comment

    • hank

      #3
      Re: how UDB reuse the Secondary Log Files

      "Fan Ruo Xin" <fanruox@sbcglo bal.net> wrote in message news:<%4FTb.274 $Gr6.89@newssvr 26.news.prodigy .com>...[color=blue]
      > "hank" <gang36@hotmail .com> wrote in message
      > news:8d54c48d.0 402021058.6985d 36a@posting.goo gle.com...[color=green]
      > > Hi All
      > >
      > > In the Circular Logging when the Primary Log file fill up, the
      > > database manager will creat a secondary log files for the transaction;
      > > when this transaction finished, the secondary log files still
      > > allocated in log directory; when all application disconnect from
      > > database or database reactive or database restart the secondary log
      > > files will be deleted from log directory. For each transaction log
      > > request, database manager always first look primary log, if it is no
      > > reuseable in primary log, then move to secondary log.
      > >
      > > My question is
      > > how database manager use the already allocated secondary log file?[/color]
      > Just like db2 server use the primary log files[color=green]
      > > if one transaction log is using 10% of one secondary log file, and
      > > same time will another transaction log use the rest of 90% of same
      > > secondary log file?[/color]
      > Either the log file is primary or secondary, they should be used by the all
      > the transactions/agents. Let's say you have three primary log files log01,
      > log02, log03. If db2 server find out when the log03 is full, but the log01
      > still hold the active transactions, then db2 will allocate the secondary
      > files and switch the current log file to the first secondary log file.[/color]

      So, does it mean in the high cocurrent and long running transaction
      processes, the database manage only can handle 126 tansaction in DB2
      UDB v7.2 and 256 in DB2 UDB v8.1?
      [color=blue][color=green]
      > > if one transaction log need to move to secondary log, does it use
      > > existed one or to allocate new one?[/color]
      > the existed one.[color=green]
      > >
      > > Any help will be very useful
      > >
      > >
      > > Hank[/color][/color]

      Comment

      • Fan Ruo Xin

        #4
        Re: how UDB reuse the Secondary Log Files


        "hank" <gang36@hotmail .com> wrote in message
        news:8d54c48d.0 402030919.640c7 6e9@posting.goo gle.com...[color=blue]
        > "Fan Ruo Xin" <fanruox@sbcglo bal.net> wrote in message[/color]
        news:<%4FTb.274 $Gr6.89@newssvr 26.news.prodigy .com>...[color=blue][color=green]
        > > "hank" <gang36@hotmail .com> wrote in message
        > > news:8d54c48d.0 402021058.6985d 36a@posting.goo gle.com...[color=darkred]
        > > > Hi All
        > > >
        > > > In the Circular Logging when the Primary Log file fill up, the
        > > > database manager will creat a secondary log files for the transaction;
        > > > when this transaction finished, the secondary log files still
        > > > allocated in log directory; when all application disconnect from
        > > > database or database reactive or database restart the secondary log
        > > > files will be deleted from log directory. For each transaction log
        > > > request, database manager always first look primary log, if it is no
        > > > reuseable in primary log, then move to secondary log.
        > > >
        > > > My question is
        > > > how database manager use the already allocated secondary log file?[/color]
        > > Just like db2 server use the primary log files[color=darkred]
        > > > if one transaction log is using 10% of one secondary log file, and
        > > > same time will another transaction log use the rest of 90% of same
        > > > secondary log file?[/color]
        > > Either the log file is primary or secondary, they should be used by the[/color][/color]
        all[color=blue][color=green]
        > > the transactions/agents. Let's say you have three primary log files[/color][/color]
        log01,[color=blue][color=green]
        > > log02, log03. If db2 server find out when the log03 is full, but the[/color][/color]
        log01[color=blue][color=green]
        > > still hold the active transactions, then db2 will allocate the secondary
        > > files and switch the current log file to the first secondary log file.[/color]
        >
        > So, does it mean in the high cocurrent and long running transaction
        > processes, the database manage only can handle 126 tansaction in DB2
        > UDB v7.2 and 256 in DB2 UDB v8.1?[/color]
        =========
        No. First, the active log file doesn't mean it is current log file. There
        may be a couple of active log files, when all the primary + secondary files
        is used, then you will get "log full". But there is only one current log
        file (it might be primary log file, or seconday log file). All the active
        transactions will write to the current log file. And db2 server will know
        which transaction corresponse which session.
        How many concurrent transactions can db2 server handle? This is not
        determined by the number of log files. This will be determined by the number
        of concurrent db2 agents, which will be the min(max_agents,
        max_application s), of course there is also os limits ....
        =========[color=blue]
        >[color=green][color=darkred]
        > > > if one transaction log need to move to secondary log, does it use
        > > > existed one or to allocate new one?[/color]
        > > the existed one.[color=darkred]
        > > >
        > > > Any help will be very useful
        > > >
        > > >
        > > > Hank[/color][/color][/color]


        Comment

        • hank

          #5
          Re: how UDB reuse the Secondary Log Files

          "Fan Ruo Xin" <fanruox@sbcglo bal.net> wrote in message news:<ajZTb.3$P Y.1@newssvr26.n ews.prodigy.com >...[color=blue]
          > "hank" <gang36@hotmail .com> wrote in message
          > news:8d54c48d.0 402030919.640c7 6e9@posting.goo gle.com...[color=green]
          > > "Fan Ruo Xin" <fanruox@sbcglo bal.net> wrote in message[/color]
          > news:<%4FTb.274 $Gr6.89@newssvr 26.news.prodigy .com>...[color=green][color=darkred]
          > > > "hank" <gang36@hotmail .com> wrote in message
          > > > news:8d54c48d.0 402021058.6985d 36a@posting.goo gle.com...
          > > > > Hi All
          > > > >
          > > > > In the Circular Logging when the Primary Log file fill up, the
          > > > > database manager will creat a secondary log files for the transaction;
          > > > > when this transaction finished, the secondary log files still
          > > > > allocated in log directory; when all application disconnect from
          > > > > database or database reactive or database restart the secondary log
          > > > > files will be deleted from log directory. For each transaction log
          > > > > request, database manager always first look primary log, if it is no
          > > > > reuseable in primary log, then move to secondary log.
          > > > >
          > > > > My question is
          > > > > how database manager use the already allocated secondary log file?[/color][/color]
          > Just like db2 server use the primary log files[color=green][color=darkred]
          > > > > if one transaction log is using 10% of one secondary log file, and
          > > > > same time will another transaction log use the rest of 90% of same
          > > > > secondary log file?
          > > > Either the log file is primary or secondary, they should be used by the[/color][/color]
          > all[color=green][color=darkred]
          > > > the transactions/agents. Let's say you have three primary log files[/color][/color]
          > log01,[color=green][color=darkred]
          > > > log02, log03. If db2 server find out when the log03 is full, but the[/color][/color]
          > log01[color=green][color=darkred]
          > > > still hold the active transactions, then db2 will allocate the secondary
          > > > files and switch the current log file to the first secondary log file.[/color]
          > >
          > > So, does it mean in the high cocurrent and long running transaction
          > > processes, the database manage only can handle 126 tansaction in DB2
          > > UDB v7.2 and 256 in DB2 UDB v8.1?[/color]
          > =========
          > No. First, the active log file doesn't mean it is current log file. There
          > may be a couple of active log files, when all the primary + secondary files
          > is used, then you will get "log full". But there is only one current log
          > file (it might be primary log file, or seconday log file). All the active
          > transactions will write to the current log file. And db2 server will know
          > which transaction corresponse which session.
          > How many concurrent transactions can db2 server handle? This is not
          > determined by the number of log files. This will be determined by the number
          > of concurrent db2 agents, which will be the min(max_agents,
          > max_application s), of course there is also os limits ....
          > =========[/color]
          Thank you for you response, but one log file become reuseable when it
          is not a current log file and not a active log file, if all log file
          is used now but not all fill up, which log file is reuseable? if not,
          where to allocate the log space for this transaction?
          [color=blue][color=green]
          > >[color=darkred]
          > > > > if one transaction log need to move to secondary log, does it use
          > > > > existed one or to allocate new one?[/color][/color]
          > the existed one.[color=green][color=darkred]
          > > > >
          > > > > Any help will be very useful
          > > > >
          > > > >
          > > > > Hank[/color][/color][/color]

          Comment

          • Fan Ruo Xin

            #6
            Re: how UDB reuse the Secondary Log Files


            "hank" <gang36@hotmail .com> wrote in message
            news:8d54c48d.0 402041012.19801 ad2@posting.goo gle.com...[color=blue]
            > "Fan Ruo Xin" <fanruox@sbcglo bal.net> wrote in message[/color]
            news:<ajZTb.3$P Y.1@newssvr26.n ews.prodigy.com >...[color=blue][color=green]
            > > "hank" <gang36@hotmail .com> wrote in message
            > > news:8d54c48d.0 402030919.640c7 6e9@posting.goo gle.com...[color=darkred]
            > > > "Fan Ruo Xin" <fanruox@sbcglo bal.net> wrote in message[/color]
            > > news:<%4FTb.274 $Gr6.89@newssvr 26.news.prodigy .com>...[color=darkred]
            > > > > "hank" <gang36@hotmail .com> wrote in message
            > > > > news:8d54c48d.0 402021058.6985d 36a@posting.goo gle.com...
            > > > > > Hi All
            > > > > >
            > > > > > In the Circular Logging when the Primary Log file fill up, the
            > > > > > database manager will creat a secondary log files for the[/color][/color][/color]
            transaction;[color=blue][color=green][color=darkred]
            > > > > > when this transaction finished, the secondary log files still
            > > > > > allocated in log directory; when all application disconnect from
            > > > > > database or database reactive or database restart the secondary[/color][/color][/color]
            log[color=blue][color=green][color=darkred]
            > > > > > files will be deleted from log directory. For each transaction log
            > > > > > request, database manager always first look primary log, if it is[/color][/color][/color]
            no[color=blue][color=green][color=darkred]
            > > > > > reuseable in primary log, then move to secondary log.
            > > > > >
            > > > > > My question is
            > > > > > how database manager use the already allocated secondary log file?[/color]
            > > Just like db2 server use the primary log files[color=darkred]
            > > > > > if one transaction log is using 10% of one secondary log file, and
            > > > > > same time will another transaction log use the rest of 90% of same
            > > > > > secondary log file?
            > > > > Either the log file is primary or secondary, they should be used by[/color][/color][/color]
            the[color=blue][color=green]
            > > all[color=darkred]
            > > > > the transactions/agents. Let's say you have three primary log files[/color]
            > > log01,[color=darkred]
            > > > > log02, log03. If db2 server find out when the log03 is full, but the[/color]
            > > log01[color=darkred]
            > > > > still hold the active transactions, then db2 will allocate the[/color][/color][/color]
            secondary[color=blue][color=green][color=darkred]
            > > > > files and switch the current log file to the first secondary log[/color][/color][/color]
            file.[color=blue][color=green][color=darkred]
            > > >
            > > > So, does it mean in the high cocurrent and long running transaction
            > > > processes, the database manage only can handle 126 tansaction in DB2
            > > > UDB v7.2 and 256 in DB2 UDB v8.1?[/color]
            > > =========
            > > No. First, the active log file doesn't mean it is current log file.[/color][/color]
            There[color=blue][color=green]
            > > may be a couple of active log files, when all the primary + secondary[/color][/color]
            files[color=blue][color=green]
            > > is used, then you will get "log full". But there is only one current log
            > > file (it might be primary log file, or seconday log file). All the[/color][/color]
            active[color=blue][color=green]
            > > transactions will write to the current log file. And db2 server will[/color][/color]
            know[color=blue][color=green]
            > > which transaction corresponse which session.
            > > How many concurrent transactions can db2 server handle? This is not
            > > determined by the number of log files. This will be determined by the[/color][/color]
            number[color=blue][color=green]
            > > of concurrent db2 agents, which will be the min(max_agents,
            > > max_application s), of course there is also os limits ....
            > > =========[/color]
            > Thank you for you response, but one log file become reuseable when it
            > is not a current log file and not a active log file,[/color]
            ====
            a log file become reuseable is when
            - no active transactions in this log file
            and
            - this log file is externalized (the corresponding data pages are written
            to disk)
            [color=blue]
            > if all log file is used now but not all fill up, which log file is[/color]
            reuseable?
            ===========
            For the non-recoverable database, DB2 server will switch the current log
            file to the next one only when the current log file full, i.e. when the
            current log file is filled up. (db2 internally will keep some space, which
            will be used for ROLLBACK the transactions, or backward phase during the
            CRASH RECOVERY.)
            [color=blue]
            > if not, where to allocate the log space for this transaction?[/color]
            ========
            If all the log files (primary + secondary) are filled up, and none of them
            can be reused, you will get "log full" error. db2 will rollback the
            transaction which caused the log full, this transact may not the longest
            one.
            [color=blue][color=green][color=darkred]
            > > >
            > > > > > if one transaction log need to move to secondary log, does it use
            > > > > > existed one or to allocate new one?[/color]
            > > the existed one.[color=darkred]
            > > > > >
            > > > > > Any help will be very useful
            > > > > >
            > > > > >
            > > > > > Hank[/color][/color][/color]


            Comment

            • hank

              #7
              Re: how UDB reuse the Secondary Log Files

              > ====[color=blue]
              > a log file become reuseable is when
              > - no active transactions in this log file
              > and
              > - this log file is externalized (the corresponding data pages are written
              > to disk)
              >[color=green]
              > > if all log file is used now but not all fill up, which log file is[/color]
              > reuseable?
              > ===========
              > For the non-recoverable database, DB2 server will switch the current log
              > file to the next one only when the current log file full, i.e. when the
              > current log file is filled up. (db2 internally will keep some space, which
              > will be used for ROLLBACK the transactions, or backward phase during the
              > CRASH RECOVERY.)
              >[color=green]
              > > if not, where to allocate the log space for this transaction?[/color]
              > ========
              > If all the log files (primary + secondary) are filled up, and none of them
              > can be reused, you will get "log full" error. db2 will rollback the
              > transaction which caused the log full, this transact may not the longest
              > one.
              >[/color]

              Thanks so much

              Hank

              Comment

              • Pierre Saint-Jacques

                #8
                Re: how UDB reuse the Secondary Log Files

                ARCHIVE LOG --- All transactions either rolled back or
                committed/externalized to table.
                ACTIVE LOG --- At least one transaction either in flight or
                committed/not-externalized.
                NEXT ACTIVE LOG --- File id of next log to be used and currently empty.

                Say:
                S0000001.log and S0000002.log are ARCHIVE, S0000003.log is FULL and ACTIVE
                and S0000004.log is NOT FULL and ACTIVE and Current; and S0000005.log is
                NEXT ACTIVE.
                If S000004 fills up and S0000003 is still ACTIVE then logging will happen in
                S0000005. If the situation does not change and S0000005 fills then S0000006
                will get allocated and so on.
                If you are in LOG RETAIN=RECOVERY and USEREXIT=ON then DB2 will have
                archived logs 1,2,3. In that case, DB2 will rename log 1 to log 5 instead
                of allocating a new one and reuse its space. It will do the same for log 2.
                You would now have log 3 and 4 and 5 (Old No. 1)ACTIVE and 6 (Old No.2) NEXT
                ACTIVE.
                If DB2 cannot rename and reuse, then it will allocate new files on demand.
                Your limit therefore for the log space in total becomes the file systems
                capacity.

                Now, if LOGSECOND is NOT set to -1 but to a positive integer, then the limit
                is: from the the first acitve (Log3), the space used cannot be more than the
                total number of files=Lofprimar y+logsecond. Assume they are set to 10 and
                15 respectively. Then if if Log3 is active and you have a very long running
                transaction and 3 stays active, you would get a log full condition when DB2
                attempts to open S0000028. The db will go automatically in crash restart
                mode.
                If LOGSECOND=-1, then DB2 will keep opening logs on demand until it runs out
                of file system space (This V8 only).
                HTH, Pierre.
                "hank" <gang36@hotmail .com> a écrit dans le message de
                news:8d54c48d.0 402041012.19801 ad2@posting.goo gle.com...[color=blue]
                > "Fan Ruo Xin" <fanruox@sbcglo bal.net> wrote in message[/color]
                news:<ajZTb.3$P Y.1@newssvr26.n ews.prodigy.com >...[color=blue][color=green]
                > > "hank" <gang36@hotmail .com> wrote in message
                > > news:8d54c48d.0 402030919.640c7 6e9@posting.goo gle.com...[color=darkred]
                > > > "Fan Ruo Xin" <fanruox@sbcglo bal.net> wrote in message[/color]
                > > news:<%4FTb.274 $Gr6.89@newssvr 26.news.prodigy .com>...[color=darkred]
                > > > > "hank" <gang36@hotmail .com> wrote in message
                > > > > news:8d54c48d.0 402021058.6985d 36a@posting.goo gle.com...
                > > > > > Hi All
                > > > > >
                > > > > > In the Circular Logging when the Primary Log file fill up, the
                > > > > > database manager will creat a secondary log files for the[/color][/color][/color]
                transaction;[color=blue][color=green][color=darkred]
                > > > > > when this transaction finished, the secondary log files still
                > > > > > allocated in log directory; when all application disconnect from
                > > > > > database or database reactive or database restart the secondary[/color][/color][/color]
                log[color=blue][color=green][color=darkred]
                > > > > > files will be deleted from log directory. For each transaction log
                > > > > > request, database manager always first look primary log, if it is[/color][/color][/color]
                no[color=blue][color=green][color=darkred]
                > > > > > reuseable in primary log, then move to secondary log.
                > > > > >
                > > > > > My question is
                > > > > > how database manager use the already allocated secondary log file?[/color]
                > > Just like db2 server use the primary log files[color=darkred]
                > > > > > if one transaction log is using 10% of one secondary log file, and
                > > > > > same time will another transaction log use the rest of 90% of same
                > > > > > secondary log file?
                > > > > Either the log file is primary or secondary, they should be used by[/color][/color][/color]
                the[color=blue][color=green]
                > > all[color=darkred]
                > > > > the transactions/agents. Let's say you have three primary log files[/color]
                > > log01,[color=darkred]
                > > > > log02, log03. If db2 server find out when the log03 is full, but the[/color]
                > > log01[color=darkred]
                > > > > still hold the active transactions, then db2 will allocate the[/color][/color][/color]
                secondary[color=blue][color=green][color=darkred]
                > > > > files and switch the current log file to the first secondary log[/color][/color][/color]
                file.[color=blue][color=green][color=darkred]
                > > >
                > > > So, does it mean in the high cocurrent and long running transaction
                > > > processes, the database manage only can handle 126 tansaction in DB2
                > > > UDB v7.2 and 256 in DB2 UDB v8.1?[/color]
                > > =========
                > > No. First, the active log file doesn't mean it is current log file.[/color][/color]
                There[color=blue][color=green]
                > > may be a couple of active log files, when all the primary + secondary[/color][/color]
                files[color=blue][color=green]
                > > is used, then you will get "log full". But there is only one current log
                > > file (it might be primary log file, or seconday log file). All the[/color][/color]
                active[color=blue][color=green]
                > > transactions will write to the current log file. And db2 server will[/color][/color]
                know[color=blue][color=green]
                > > which transaction corresponse which session.
                > > How many concurrent transactions can db2 server handle? This is not
                > > determined by the number of log files. This will be determined by the[/color][/color]
                number[color=blue][color=green]
                > > of concurrent db2 agents, which will be the min(max_agents,
                > > max_application s), of course there is also os limits ....
                > > =========[/color]
                > Thank you for you response, but one log file become reuseable when it
                > is not a current log file and not a active log file, if all log file
                > is used now but not all fill up, which log file is reuseable? if not,
                > where to allocate the log space for this transaction?
                >[color=green][color=darkred]
                > > >
                > > > > > if one transaction log need to move to secondary log, does it use
                > > > > > existed one or to allocate new one?[/color]
                > > the existed one.[color=darkred]
                > > > > >
                > > > > > Any help will be very useful
                > > > > >
                > > > > >
                > > > > > Hank[/color][/color][/color]

                Comment

                Working...