SELECT count(*) FROM v$session s WHERE s.username IS NOT NULL AND NVL (s.osuser, 'x') <> 'SYSTEM' AND s.TYPE <> 'BACKGROUND';