NSA (nimsoft scripting agent) : Error: Fail to load Oracle DLL
search cancel

NSA (nimsoft scripting agent) : Error: Fail to load Oracle DLL

book

Article ID: 185387

calendar_today

Updated On:

Products

DX Unified Infrastructure Management (Nimsoft / UIM)

Issue/Introduction

My Lua script is trying access UIM database running on oracle but getting the following error. The script is running on a robot server with nsa.exe.
Oracle instant client is installed on the server and LD_LIBRARY_PATH is setup but still getting this error. Please help me to jump over this hurdle.


======Starting Database Connection==========
Feb 18 11:51:24:098 nsa: [0x002F71D0] Database provider is 'Oracle', serviceName
'PMON_WAS'
Feb 18 11:51:24:192 nsa: Error: Fail to load Oracle DLL

Feb 18 11:51:24:192 nsa: [ndbOracleOpen] starting OCIEnv: 0x00000000 OCIAu
thInfo: 0x00000000 OCISvcCtx: 0x00000000
Feb 18 11:51:24:192 nsa: [ndbOracleOpen] OCIEnvCreate...
Feb 18 11:51:24:192 nsa: [ndbOracleOpen]- Error: ndbOracleOpen OCI_ERROR - NULL
handle. Unable to extract detailed diagnostic information
OCIEnv: 0x00000000 OCIAuthInfo: 0x00000000 OCISvcCtx: 0x00000000

Environment

Release : Any DX UIM 

Component : UIM - NIMSOFT SCRIPT AGENT

Resolution

1- Install oracle 12.x 32 bit client including ODBC drivers
2- Validate the Oracle driver appears in the windows 32 bit ODBC administrator


3- Used the following code:
print("Start database connection 1")
-- Connect to the database
local oracle_server = "oracle server hostname or IP"
local oracle_user = "oracle user"
local oracle_pwd = "oracle user password"
local oracle_service = "oracle service name (as returned by "select * from global_name;")
local oracle_port = "1521"
local oracle_database= "CA_UIM"
local database_driver = "Oracle in OraClient12Home1_32bit"



if oracle_pwd ~= "" then
    -- Build connection string
       local cs = "Driver={"..database_driver.."};Dbq=//"..oracle_server..":"..oracle_port.."/"..oracle_service..";Uid="..oracle_user..";Pwd="..oracle_pwd..""
      print (cs)
    local rc = database.open(cs,false)
      print(rc)
    if rc == NIME_OK then
        local rs = database.query ("SELECT * FROM CA_UIM.CM_COMPUTER_SYSTEM")
        printf ("Number of QoS objects: %d",#rs)
            for i=1,#rs do
               print("Name Column has: " .. rs[i].NAME .. ", CS_ID Column has: " .. rs[i].CS_ID)
            end

 

    else
        print ("Failed to open database using the provided connection string!")
    end

 


    database.close()
end

 


4- Run the following command against the name of your file:


C:\Program Files (x86)\Nimsoft\sdk\nsa>nsa -d 5 example-oracle-operations.txt


Mar  2 11:11:44:861 nsa: SNMP Initialize, version 223 (5.7a), build date Mar 17 2015

Mar  2 11:11:44:861 nsa: SNMPInitialize - initializing critical sections
Mar  2 11:11:44:861 nsa: SNMPInitialize - initializing logging
logging:register: registering log type 5 with pri 7
Log handling defined - disabling stderr
Mar  2 11:11:44:877 nsa: registering logging callback at address: 0x411320
Mar  2 11:11:44:877 nsa: SNMPInitialize - calling init_snmp
Mar  2 11:11:44:893 nsa: ===> Starting: example-oracle-operations.txt
Start database connection 1
Driver={Oracle in OraClient12Home1_32bit};Dbq=//xxxxxxxx:1521/xxxxxxx;Uid=system;Pwd=nimsoft
Mar  2 11:11:44:893 nsa: [0x00837B90] Database provider is 'N/A', database 'N/A'
0
Number of QoS objects: 3
Name Column has: lvntest009204, CS_ID Column has: 3
Name Column has: lvntest009203, CS_ID Column has: 2
Name Column has: primaryrobot, CS_ID Column has: 1
Mar  2 11:11:45:158 nsa: ===> Completed: OK
Mar  2 11:11:45:174 nsa: nimEnd