简体   繁体   中英

getting intermittent ORA-12545 error

I am running a monitoring site developed in yii framework using xampp on a windows server machine to check the health of databases. Normally everything works fine but sometimes it gives me the following error:

Code: 12545|Message: CDbConnection failed to open the DB connection: SQLSTATE[HY000]: pdo_oci_handle_factory: ORA-12545: Connect failed because target host or object does not exist (ext\pdo_oci\oci_driver.c:635)

I check ping and everything is fine, tns_ping is working, other users can logon to database and use it. but i get the above error.

PHP Version 5.5.28 Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production Oracle Instant Client - 11.2.0.1.0 Windows Server 2012 R2 Standard PDO Driver for OCI 8 and later enabled

Query used to check if we can connect to database and query it select count(*) from dual

any help will be appreciated

I assume you are using yii 1 but nevertheless you should try those steps in fixing the error:

  1. In most cases defining the database in your main.php fixes the problem, so try adding: 'connectionString'=>'oci:dbname=mydb',

  2. Disable those extensions: php_pdo_oci8.dll and php_oci8.dll in your php.ini file and leave only the needed one for your environment: php_pdo_oci.dll.

  3. Definitely update your Oracle to 10 or above because according to my experience and some internet forums Oracle client 9 can make some troubles with php 5.1 or above. Not in every scenario but I think it's worth the update.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM