SQLSTATE[HY000]: OCISessionBegin: ORA-21561: OID generation failed

Camden S. picture Camden S. · Oct 29, 2013 · Viewed 8.7k times · Source

I'm receiving the following error when trying to do a PDO OCI SQL query on one of my web servers:

SQLSTATE[HY000]: OCISessionBegin: ORA-21561: OID generation failed

I've confirmed that the Oracle server is accessible from the machine and network configuration looks fine. Google returns very few, and not very helpful results.

Has anyone else run into this, or have any suggestions on how to resolve?

Answer

Mustafa Hussain picture Mustafa Hussain · Jan 24, 2014

I was facing the same issue. I was trying to connect to database on my localhost. This is how I solved it.

  • Get the hostname

    > hostname 
    localhost.idc.company.com
    
  • Add this name to /etc/hosts file

    127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4 localhost.idc.company.com