PowerShell for DB2 DBAs – Part 1

You may also like...

5 Responses

  1. Glenn Brennan says:

    I am having difficulty get DB2 Data Server Provider for .NET installed.

    When using the GetFactory(IBM.Data.DB2)…. I get
    Exception calling “GetFactory with “1” argument(S): “Unable to find the
    requested .Net Framework Data Provider. It may not be installed.”
    What am I missing on getting the piece installed?

    $factory = [System.Data.Common.DbProviderFactories]::GetFactory(IBM.

    • Luke Numrych says:

      Assuming that you have installed an IBM .NET client on your system by installing one of: IBM DB2 Database Server, Client, Runtime Client, or the Data Server Driver (dsdriver) packages, this is most likely due to a failed DB2 .NET client registration. Please verify the output of the following command:
      [System.Data.Common.DbProviderFactories]::GetFactoryClasses() | Format-Table -Property InvariantName, Description -Autosize
      In the output you should see, among others, the following entries:

      IBM.Data.DB2 – the one you need
      IBM.Data.DB2.#.#.# (where #.#.# is dependent on the version of the DB2 .NET client you have installed in your system)

      If you do not have a client installed, you can get one from http://www-01.ibm.com/support/docview.wss?uid=swg21385217 (Download initial Version 10.5 clients and drivers).
      If you have installed the client, yet you do not see the factory in the output, you will need to re-register it, or if all else fails, re-install it. You can consult the following support pages for help on re-registering the client:
      http://www-01.ibm.com/support/docview.wss?uid=swg21429586 (How to register .NET provider after installation of DB2)
      http://www-01.ibm.com/support/docview.wss?uid=swg21618434 (Setup Recommendations for Running Applications on Windows 8 or Windows Server 2012″)

  2. Glenn Brennan says:

    Thank you for your quick response. This DB2 application is Tivoli Storage Manager. It appears that the DB2 installation that is provided by TSM does not include the client. I am not sure if it is possible or allowed to install the DB2 client.

    PS C:\offlinereorg> [System.Data.Common.DbProviderFactories]::GetFactoryClasses() |
    Format-Table -Property InvariantName, Description -Autosize

    InvariantName Description
    ————- ———–
    System.Data.Odbc .Net Framework Data Provider for Odbc
    System.Data.OleDb .Net Framework Data Provider for OleDb
    System.Data.OracleClient .Net Framework Data Provider for Oracle
    System.Data.SqlClient .Net Framework Data Provider for SqlServer

    PS C:\offlinereorg> db2level
    DB21085I This instance or install (instance name, where applicable: “SERVER1”)
    uses “64” bits and DB2 code release “SQL10055” with level identifier
    Informational tokens are “DB2 v10.5.500.111”, “special_33893”, “IP23628_33893”,
    and Fix Pack “5”.
    Product is installed at “C:\PROGRA~1\Tivoli\TSM\db2” with DB2 Copy Name

    • Luke Numrych says:

      Unfortunately, I have no experience with TSM, and I do not know how does it install DB2. It would be best if you could consult an expert.
      However, the DB2 Data Server Driver package is a no-fee license as far as I know, so it should follow that if your DB2 Server installation that came with TSM includes .NET drivers (there is a pretty good chance it does) you could just register them. To do so, verify whether the bin directory under “C:\PROGRA~1\Tivoli\TSM\db2″ contains the program db2lswtch, and try registering the client as described in http://www-01.ibm.com/support/docview.wss?uid=swg21429586 (How to register .NET provider after installation of DB2).
      Failing that, you could install the Data Server Driver package separately on the system, but consult TSA support first to verify the validity of this solution.
      Failing that, and provided that your “SERVER1” instance is enabled for remote access, you could install the Data Server Driver package on another system, and access the instance and the database remotely from that system via PowerShell/.NET DB2 Data Provider.

  1. August 11, 2015

    […] PowerShell for DB2 DBAs – Part 1 […]

Leave a Reply

Your email address will not be published. Required fields are marked *