简体   繁体   中英

Spring Batch - ORA 12516 SQLState 66000 - TNS:Listener could not available handler with matching protocol stack

When I run Spring batch to process more than 100 records, I am get following error,

 "Listener Refused the connection with the following error: ORA-12516,  
  TNS:Listener could not available handler with matching protocol stack". 

But when I run the batch to process less than 50 records, it works fine.

In my batch's before step of my reader, I query DB to get records.

eg If I get 100 records from DB, Using Loop, I extract a particular field from each record and using the particular fields i will query to another table. So the second query run for 100 times inside the for loop.

In Logs, I can see the batch runs for a while (queries some records inside for loop) and then it throws the error.

Please help me to solve this.

Changed my data source bean from

<bean id="dataSource"
    class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="${database.driverClassName}" />
    <property name="url" value="${database.url}" />
    <property name="username" value="${database.username}" />
    <property name="password" value="${database.password}" />
</bean>

to this

<bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
  <property name="driverClassName" value="${database.driverClassName}" />
    <property name="url" value="${database.url}" />
    <property name="username" value="${database.username}" />
    <property name="password" value="${database.password}" />
    <property name="connectionProperties"   value="initialSize=1,maxTotal=10" />
</bean> 

OnlyGod Team -

Oracle database server's value for "PROCESSES" has been configured too low you can resolve it by steps

  1. Launch 'SQL Plus'

  2. Logon as 'system'

  3. Type the following command (to check that the database is using spfile):

     show parameter spfile 
  4. Assuming that it shows that you ARE using spfile, then type the following command:

     alter system set PROCESSES=300 scope = spfile 
  5. Obtain some downtime (nobody using the databases) and restart the Oracle database server (or simply the relevant Oracle database) or you can edit it in notepad++

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