Pregunta

Where does SYSTIMESTAMP come from in multi-server Oracle RAC environment?

I'm hoping that the SYSTIMESTAMP derives from a common location (master node?) as opposed to the server that is currently servicing the request.

Additional Detail:

We are using a timestamp to ensure that entries in a log table are recorded sequentially. Say, for example, we have two nodes in our RAC and they are 1 second off. Our app server inserts two log entries within, say, 0.03 seconds of each other. The first insert is serviced by Node1 and the second by Node2. If there is one second difference between the two nodes, the timestamp could potentially show the log entries occurring in the wrong order! (I would just use a sequence, but our sequences are cached for performance reasons... )

¿Fue útil?

Solución

Up to 11g I know Oracle used the local OS time as the system time in a RAC environment, and I never heard that it changed so I'm comfortable saying it's still in place.

You would sync all the servers together typically using NTP or another solution to ensure the time sync. Usually if your servers local time is out of sync even by 30 seconds or so, you will tend to see other issues such as Kerberos auth issues so it's unlikely they are far off from each other.

Otros consejos

If the resolution of your timestamps has to be in the milliseconds precision, I would not be too comfortable assuming that using NTP would solve the problem; you would probably have to sync very frequently and even then network latency, etc. could be an issue.

Since you are stating you are caching Oracle sequences due performance reasons, which is generally correct (and increase the cache size to much larger than the default of 20), what you can do is for just the sequences for determining the insert order is to define those sequences as NOCACHE ORDER. Yes, that will require additional locks, but that will guarantee what you want; fiddling with keeping server node times in sync may not be guaranteed.

From create sequence documentation

ORDER is necessary only to guarantee ordered generation if you are using Oracle Real Application Clusters.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a dba.stackexchange
scroll top