How to stop the connection with a cached server without stopping the rest of the connections

I have a redis that caches an oracle database and a postgre database. I need to stop the connection with Oracle but keep the connection with Postgre without stopping the service and without changing the configuration, that is, in real time. What can I do ?.
I should also be able to reconnect to Oracle, in the same way.
How can it be done programatly?
Which client library do you recommend that allows this capacity?