Skip to content

Session License Limits (vlicense.sql)

This script provides Oracle license and session limit information by:

  • Displaying maximum session limits configured
  • Showing current session usage
  • Indicating warning thresholds
  • Tracking high-water marks for capacity planning
  • Reporting user license limits
rem vlicense.sql
rem
ttitle 'Sessions Summary'
rem
col sessions_max heading 'MAX|SESSIONS'
col sessions_warning heading 'WARNING|SESSIONS'
col sessions_current heading 'CURRENT|SESSIONS'
col sessions_highwater heading 'HIGHWATER|SESSIONS'
col users_max heading 'MAX|USERS'
rem
select sessions_max,
sessions_warning,
sessions_current,
sessions_highwater,
users_max
from v$license;
SQL> @vlicense.sql
  • SELECT on V$LICENSE
Sessions Summary
MAX WARNING CURRENT HIGHWATER MAX
SESSIONS SESSIONS SESSIONS SESSIONS USERS
--------- --------- --------- --------- ---------
472 378 156 245 0
  • MAX SESSIONS: Maximum number of concurrent sessions allowed
  • WARNING SESSIONS: Warning threshold for session count
  • CURRENT SESSIONS: Current number of active sessions
  • HIGHWATER SESSIONS: Highest number of sessions reached since startup
  • MAX USERS: Maximum named users (0 = unlimited)
  • SESSIONS: Derived from PROCESSES parameter
  • PROCESSES: Maximum number of OS processes
  • Calculation: SESSIONS = (1.1 * PROCESSES) + 5
  • Warning Threshold: Usually 80% of maximum sessions
  • Critical Level: Approaching maximum sessions
  • Capacity Planning: Use highwater mark for planning
  1. Capacity Monitoring

    • Monitor current session usage
    • Track peak session counts
    • Plan for growth
  2. License Compliance

    • Verify license limits
    • Monitor user connections
    • Ensure compliance with Oracle licensing
  3. Performance Analysis

    • Correlate session counts with performance
    • Identify peak usage periods
    • Plan connection pooling
-- Count active sessions by type
SELECT status, type, COUNT(*) session_count
FROM v$session
GROUP BY status, type
ORDER BY status, type;
-- Find user sessions
SELECT username, COUNT(*) session_count
FROM v$session
WHERE username IS NOT NULL
GROUP BY username
ORDER BY session_count DESC;
-- Check related parameters
SELECT name, value, description
FROM v$parameter
WHERE name IN ('processes','sessions','license_max_sessions',
'license_sessions_warning','license_max_users')
ORDER BY name;
  • Current > 80% of Max: Monitor closely
  • Current > 90% of Max: Consider action
  • Current = Max: New connections will fail
  • Growing Trend: May need parameter increase
  • Stable Pattern: Normal operational range
  • Spikes: Investigate application behavior
-- Increase PROCESSES (requires restart)
ALTER SYSTEM SET processes=600 SCOPE=SPFILE;
-- SESSIONS will be calculated automatically
-- Check calculated SESSIONS value
SELECT name, value
FROM v$parameter
WHERE name IN ('processes','sessions');
  1. Connection Pooling

    • Implement application connection pools
    • Reuse connections efficiently
    • Configure appropriate pool sizes
  2. Session Cleanup

    • Kill idle sessions if necessary
    • Implement connection timeouts
    • Monitor long-running sessions
  • MAX USERS: Set based on license agreement
  • Concurrent Sessions: May exceed named users
  • Compliance: Ensure proper licensing
  • Unlimited Users: MAX USERS = 0
  • Session Limits: Based on hardware capacity
  • No User Restrictions: Focus on performance
-- Check if approaching limits
SELECT
CASE
WHEN sessions_current > sessions_max * 0.9 THEN 'CRITICAL'
WHEN sessions_current > sessions_warning THEN 'WARNING'
ELSE 'OK'
END AS status,
sessions_current,
sessions_max,
ROUND(sessions_current/sessions_max*100,1) AS pct_used
FROM v$license;
-- Create monitoring table
CREATE TABLE session_usage_history (
check_time DATE,
current_sessions NUMBER,
max_sessions NUMBER,
highwater_sessions NUMBER
);
-- Insert current values
INSERT INTO session_usage_history
SELECT SYSDATE, sessions_current, sessions_max, sessions_highwater
FROM v$license;

ORA-00020: Maximum Number of Processes Exceeded

Section titled “ORA-00020: Maximum Number of Processes Exceeded”
  • Check current process usage
  • Increase PROCESSES parameter
  • Restart database instance
  1. Identify Heavy Users

    • Find users with many sessions
    • Check for connection leaks
    • Review application design
  2. Session Analysis

    • Check for idle sessions
    • Monitor session duration
    • Implement session timeouts