IBM Data Server Drivers (Db2 Connect Client)

Steps to Create Traces for Different Db2 .NET Providers

By NAVEENKUMAR N L posted Sun August 08, 2021 12:10 PM

  
Scenario-1 .NET RUNTIME FULL FRAMEWORK (DB2DSDRIVER) FOR ON-PREMISE

Open Command Prompt in Administrator Privilege and go to installed directory (i.e., clidriver/bin) and then perform the below steps.

Ex:   E:\sqllib\bin       (Note:  DS Driver is installed at SQLLIB directory.)
    1. Turn Db2 trace on.

            db2trc  on  -f   c:\<foldername>\db2trc.dmp

    2. Reproduce the issue.
    3. Turn Db2 trace off.

            db2trc  off

    4. Format the contents of Db2 trace binary data file into text file.

            db2trc    flw   c:\< foldername >\db2trc.dmp       c:\< foldername >\db2trc.flw

            db2trc    fmt   c:\< foldername >\db2trc.dmp      c:\< foldername >\db2trc.fmt

            db2trc     fmt  -c   c:\< foldername >\db2trc.dmp    c:\< foldername >\db2trc.fmtc

      db2trc.flw, db2trc.fmt and db2trc.fmtc files created in the mentioned directory.

Scenario-2 .NET RUNTIME FULL FRAMEWORK PACKAGE FOR AZURE
  1. Create db2dsdriver.cfg file and add below lines then copy file to global cfg folder before deploying to azure and build the solution.

              <configuration>

                        <parameters>

                                   <parameter name="SwitchDb2trace" value="on -f D:\home\site\wwwroot\bin\clidriver\bin\db2trcAzr.dmp"/>

                                   <parameter name="TraceRefreshInterval" value="3"/>

                       </parameters>

             </configuration> 

    b. Steps to create db2dsdriver.cfg file in azure portal.

 Go to AppService>>click on deployed webapp>>click on AppServiceEditor (Preview) (available in Development Tools section) >> click on Go-> then new tab will open (Ex: https://<appname>.scm.azurewebsites.net/dev/wwwroot/ ) >> Click on Explorer>> WWWROOT> bin> clidriver> cfg. Create db2dsdriver.cfg file then add the lines mentioned in (a). 

    c. Steps to create traces.
    • Assume application is deployed to azure portal and above either (a) or (b) steps performed. Azure App service is stopped.
    • SwitchDb2trace value is on and dump file creating path mentioned.
    • Start the Azure AppService then open webapp and perform to re-create problem statement.
    • Now go to AppServiceEditor (Preview) and update the SwitchDb2trace value in db2dsdriver.cfg file as like below.

              <parameter name="SwitchDb2trace" value="off"/>

    • Wait few seconds and close the webapp and stop the Azure AppService.
    • Dump file is created at motioned folder.
    • Now create flw and fmt files. Open Azure Console in the same web app and change the directory path to “D:\home\site\wwwroot\bin\clidriver\bin” and perform below steps.
      • db2trc flw    db2trcAzr.dmp       db2trcAzr.flw
      • db2trc fmt   db2trcAzr.dmp       db2trcAzr.fmt
    • flow and fmt files are created at “D:\home\site\wwwroot\bin\clidriver\bin”.

Note:

  • Directly can create and update db2dsdriver.cfg file in azure portal.
Using console, create directory and can save all files for better analysis.
Scenario-3 WINDOWS CORE PACKAGE ON-PREMISE
  • Clean and build the project.
  • Open command prompt in administrative privilege.
  • Go to application bin folder >>clidriver>> bin and perform below steps.
  1. Turn Db2 trace on.

            db2trc  on  -f   c:\<foldername>\db2trc.dmp

    2.Reproduce the issue (Perform to create problem statement).
    3.  Turn Db2 trace off.

            db2trc  off

    4.Format the contents of Db2 trace binary data file into text file.

            db2trc    flw   c:\< foldername >\db2trc.dmp       c:\< foldername >\db2trc.flw

            db2trc    fmt   c:\< foldername >\db2trc.dmp      c:\< foldername >\db2trc.fmt

            db2trc     fmt  -c   c:\< foldername >\db2trc.dmp    c:\< foldername >\db2trc.fmtc

 Note: 
  1) .Net core 3.1 clidriver bin directory path is as

            “<Application path>\bin\x64\Debug\netcoreapp3.1\clidriver\bin”

  2) .Net 5.0 clidriver bin directory path is as

            “<Application path>\bin\x64\Debug\net5.0\clidriver\bin”

Scenario-4 WINDOWS CORE PACKAGE IN AZURE CLOUD
  1. Create db2dsdriver.cfg file and add below lines then copy file to global cfg folder before deploying to azure and build the solution.

           <configuration>

                      <parameters>

                                 <parameter name="SwitchDb2trace" value="on -f D:\home\site\wwwroot\clidriver\bin\db2trcAzr.dmp"/>

                                 <parameter name="TraceRefreshInterval" value="3"/>

                      </parameters>

           </configuration>

    2.  Steps to create db2dsdriver.cfg file in azure portal.

Go to AppService>>click on deployed webapp>>click on AppServiceEditor (Preview) (available in Development Tools section) >> click on Go-> then new tab will open (Ex: https://<appname>.scm.azurewebsites.net/dev/wwwroot/ ) >> Click on Explorer>> WWWROOT> clidriver> cfg. Create db2dsdriver.cfg file then add the lines mentioned in (step 1).

     3.  Steps to create traces.

    • Assume application is deployed to azure portal and above either (step-1) or (step-2) are performed. Azure App service is stopped.
    • SwitchDb2trace value is on and dump file creating path mentioned.
    • Start the Azure AppService then open webapp and perform to re-create problem statement.
    • Now go to AppServiceEditor (Preview) and update the SwitchDb2trace value in db2dsdriver.cfg file as like below.

                  <parameter name="SwitchDb2trace" value="off"/>

    • Wait few seconds and close the webapp and stop the Azure AppService.
    • Dump file is created at motioned folder.
    • Now create flw and fmt files. Open Azure Console in the same web app and change the directory path to “D:\home\site\wwwroot\clidriver\bin” and perform below steps.
      • db2trc flw    db2trcAzr.dmp       db2trcAzr.flw
      • db2trc fmt   db2trcAzr.dmp       db2trcAzr.fmt
    • flow and fmt files are created at “D:\home\site\wwwroot\clidriver\bin”.

Note:

  • Directly can create and update db2dsdriver.cfg file in azure portal.
Using console, create directory and can save all files for better analysis.
Scenario-5 WINDOWS NANO DRIVER PACKAGE IN DOCKER

Run the docker image in interactive mode and open one more command prompt to run below lines in the mentioned directory (\app\clidriver\bin).

            db2trc  on  -f   db2trc.dmp

            dotnet  <application.dll>  (Run the Application and create problem statement)

            db2trc  off

            db2trc  db2trc.dmp  db2trc.flw

            db2trc fmt  db2trc.dmp  db2trc.fmt

            db2trc fmt -c db2trc.dmp db2trc.fmtc

Note: Here app is working directory in docker.

Create batch (Trace.bat) file, copy to docker file location and use ‘Pause’ statement in that batch file. Call this batch file in the docker file.

            ENTRYPOINT ["CMD", "Trace.bat"]

Scenario-6 LINUX ON-PREMISE

Login to Linux machine and change the directory to application path 

            <Application path>/bin/Debug/netcoreapp3.1 /clidriver/adm

  1. Turn Db2 trace on.

            ./db2trc  on  -f   db2trc.dmp

    2. Reproduce the issue.
    3.Turn Db2 trace off.

            ./db2trc  off

    4. Creating flw, fmt and fmtc file.

            ./db2trc    flw    db2trc.dmp       db2trc.flw

            ./db2trc    fmt   db2trc.dmp      db2trc.fmt

            ./db2trc     fmt   db2trc.dmp     db2trc.fmtc

Scenario-7 LINUX PACKAGE IN DOCKER

Run the docker image in interactive mode and open one more command prompt to run below lines. Go to /app/clidriver/adm path and follow below steps.

            ./db2trc  on  -f   db2trc.dmp

            dotnet  <application.dll>   (Run the Application and create problem statement)

            ./db2trc  off

            ./db2trc  flow  db2trc.dmp   db2trc.flw

            ./db2trc fmt  db2trc.dmp  db2trc.fmt

            ./db2trc fmt -c db2trc.dmp  db2trc.fmtc

 

Note: Here app is working directory in docker.

Create shell (Trace.sh) file, copy to docker file location and use ‘read ’statement in that shell file. Call this shell file in the docker file and follow as below.

            RUN dos2unix  ./Trace.sh

            ENTRYPOINT ["CMD", "./Trace.sh "]

0 comments
13 views

Permalink