Oracle cleans up all in-memory data source links

In the actual production process, you may encounter frequent changes to the Package Body of the Oracle database. If you use a middleware-level data source, you need to reload the data source to make the changed Package effective. There are two ways to do it. To invalidate the data source in memory and then reload it into memory, the methods are as follows:
First , stop the war package, that is, restart the application package, and restart the application package to definitely reload the data source.
Second , disconnect the data source of the middleware, and then redeploy and target it to the application war, which also realizes the process of reloading the data source into the memory.


If you don't want to do it at the application level. Then you can only do things at the database level. You can query all session connections in the Oracle background, and then manually kill all session connections. This also realizes that all connections of the application war package must be re-linked with Oracle.


The author here wants to introduce writing a piece of code in the application war to disconnect all connections to clear all connections in the memory, provided that the application war package uses the middleware Oracle database driver package, the code is as follows:
OracleConnectionCacheManager occm = ......
//Refresh all connections in cache
occm.refreshCache(cacheName, OracleConnectionCacheManager.REFRESH_ALL_CONNECTIONS);


[ Note ] The above code is a method in the Oracle database driver package, and other database driver packages do not know if there are similar methods.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326049964&siteId=291194637