Troubleshoot the [Errno 111] Connection refused error for Oracle plugins

Troubleshoot the [Errno 111] Connection refused error for Oracle plugins

When installing Oracle database monitoring plugins, you may encounter the following error:
DPY-6005: cannot connect to database. [Errno 111] Connection refused 
This error indicates that there is an error connecting to the Oracle database server.
Here are some steps to troubleshoot the issue. 
  1. Check the database port: Ensure that you are using the correct port number for the Oracle database. By default, Oracle databases use port 1521, but this might differ in your setup. Verify the correct port number and update your connection string accordingly.

  2. Verify the hostname: Ensure that you are connecting to the server where the Oracle database is running, and confirm that the hostname used in your connection string is correct.

  3. Check the network connectivity: Confirm there are no network issues between your application and the Oracle database server. Ping the server to check reachability. If firewalls or network restrictions exist, ensure they allow necessary communication.

  4. Verify the Oracle listener: The Oracle listener is responsible for establishing connections to the database. Ensure that the Oracle listener is running and configured correctly. You can check the status of the listener using the command below:
    lsnrctl status

    If the listener is not running, start it using the following command:
    lsnrctl start

  5. Validate the Oracle service name: Ensure that the service name or SID mentioned in your connection string is accurate. You can find the service name within the tnsnames.ora file located in the Oracle client installation directory. Confirm that the service name matches the one specified in your connection string.

  6. Verify database accessibility: Confirm that the Oracle Database is up and running. You can check the database status by logging in to the server and running the following command:
    sqlplus / as sysdba

    If you can connect to the database using SQL*Plus, then the database is accessible. If not, there may be an issue with the database itself that needs to be addressed.

  7. Check Oracle client installation: Confirm that the Oracle client is correctly installed on the machine where your application is running. Ensure that the essential Oracle client libraries are available and accessible to your application.

  8. Review error logs: Check the Oracle database server's error logs for any specific error messages related to the connection issue. The logs may provide additional information to help diagnose the problem.
Note that the above steps to resolve the issue may vary based on your Oracle configuration.
Once you've made changes based on the checks above, restart the Site24x7 server monitoring agent or re-register the plugin. Within five minutes, you should be able to view performance metrics in Site24x7.