Is it possible that the Xquery plans are cleaned because of the databases are restarted?That's an interesting observation. But losing cache entries wouldn't occur like that in any way I can think of. A cached query plan has no connection/relation to database connections. The database connections are only open on the executing plan (which is cloned from the cached plan).
May be the JVM garbage collection is clearing the memory once all the db connections are closed?The query plan cache is (essentially) a HashMap. It is not SoftReferences that the JVM could clean up at will.
Also you have said that the Xquery cash one per Weblogic instance not one per dataspaceThe maximum number of entries is per dataspace. The cache entries are exist and are counted (separately) on each server - they are not summed across servers. So if you have max 100 cache entries, and you have three servers, you could have 100 + 100 + 100 cache entries across the three servers (but these could be only 100 distinct query plans). I think I was trying to get across that restarting a server or redeploying a dataspace on a server would clear all the cache entries on that server. But if you're not redeploying dataspaces or restarting servers, this is not relevant.