 Get the more restrictive lock first. For example, if session 1 gets a share lock and session 2 gets an exclusive lock on the same object, get the exclusive lock first. Or use the same session to access the object.