ORA-28040 No Matching Authentication Protocol - Client Security Guide
ORA-28040: No Matching Authentication Protocol
Section titled “ORA-28040: No Matching Authentication Protocol”Error Overview
Section titled “Error Overview”Error Text: ORA-28040: No matching authentication protocol
This error occurs when Oracle client and server cannot agree on a compatible authentication protocol. It’s commonly seen when connecting from older Oracle clients to newer Oracle Database versions, or when security policies restrict certain authentication methods. This error became more prominent with Oracle’s enhanced security requirements in recent versions.
Understanding Authentication Protocols
Section titled “Understanding Authentication Protocols”Oracle Authentication Methods
Section titled “Oracle Authentication Methods”Oracle supports several authentication protocols with different security levels:
-
Password-based Authentication
- O3LOGON (Oracle 10g and later) - More secure
- O5LOGON (Oracle 11g and later) - Enhanced security
- Legacy protocols (Pre-10g) - Less secure, often disabled
-
Strong Authentication
- Kerberos - Network authentication protocol
- PKI - Public Key Infrastructure
- RADIUS - Remote Authentication Dial-In User Service
-
Protocol Versions
- 12c - SQLNET.ALLOWED_LOGON_VERSION_SERVER/CLIENT
- 11g - SEC_CASE_SENSITIVE_LOGON
- 10g - Enhanced password verification
Root Causes
Section titled “Root Causes”1. Client-Server Version Mismatch
Section titled “1. Client-Server Version Mismatch”- Older Oracle client connecting to newer database
- Database security policies blocking older protocols
- Client doesn’t support newer authentication methods
2. Security Policy Configuration
Section titled “2. Security Policy Configuration”- SQLNET.ALLOWED_LOGON_VERSION set too restrictively
- SEC_CASE_SENSITIVE_LOGON parameter conflicts
- Authentication protocol explicitly disabled
3. Network Configuration Issues
Section titled “3. Network Configuration Issues”- sqlnet.ora settings blocking protocols
- Firewall or network security appliances interfering
- Missing or misconfigured authentication adapters
4. Password Policy Conflicts
Section titled “4. Password Policy Conflicts”- Case-sensitive password settings
- Password verification function requirements
- Expired or locked authentication methods
Diagnostic Queries
Section titled “Diagnostic Queries”Check Database Version and Configuration
Section titled “Check Database Version and Configuration”-- Database version and authentication settingsSELECT * FROM v$version;
-- Check authentication parametersSHOW PARAMETER sec_case_sensitive_logon;SHOW PARAMETER sec_max_failed_login_attempts;
-- Check allowed logon versions (12c+)SELECT name, value, descriptionFROM v$parameterWHERE name LIKE '%logon%version%' OR name LIKE '%auth%'ORDER BY name;
-- User authentication informationSELECT username, account_status, authentication_type, password_versions, created, expiry_dateFROM dba_usersWHERE username = 'TARGET_USER';
Analyze Connection Attempts
Section titled “Analyze Connection Attempts”-- Check recent authentication failuresSELECT username, timestamp, action_name, returncode, client_program_name, client_identifierFROM dba_audit_trailWHERE action_name = 'LOGON' AND returncode = 28040 AND timestamp > SYSDATE - 1ORDER BY timestamp DESC;
-- Current session authentication infoSELECT username, osuser, program, machine, authentication_type, network_protocolFROM v$sessionWHERE username IS NOT NULLORDER BY logon_time DESC;
Check Network Configuration
Section titled “Check Network Configuration”-- Check listener services and protocolsSELECT name, pdb, network_name, con_idFROM v$servicesORDER BY name;
-- Active listener endpointsSELECT endpoint, protocol, service_nameFROM v$dispatcherUNION ALLSELECT '(local)' as endpoint, 'bequeath' as protocol, 'local connection' as service_nameFROM dual;
Resolution Strategies
Section titled “Resolution Strategies”1. Client-Side Solutions
Section titled “1. Client-Side Solutions”Update sqlnet.ora (Client)
Section titled “Update sqlnet.ora (Client)”# Client sqlnet.ora location examples:# $ORACLE_HOME/network/admin/sqlnet.ora# $TNS_ADMIN/sqlnet.ora
# Allow older authentication (temporary fix)SQLNET.ALLOWED_LOGON_VERSION_CLIENT = 8
# For Oracle 19c clients connecting to older databasesSQLNET.ALLOWED_LOGON_VERSION_CLIENT = 10
# Enable specific authentication methodsSQLNET.AUTHENTICATION_SERVICES = (ALL)SQLNET.FALLBACK_AUTHENTICATION = TRUE
Client Configuration Examples
Section titled “Client Configuration Examples”# For Oracle 12c+ client connecting to 11g databaseSQLNET.ALLOWED_LOGON_VERSION_CLIENT = 10SQLNET.ALLOWED_LOGON_VERSION_SERVER = 10
# For mixed environment compatibilitySQLNET.AUTHENTICATION_SERVICES = (BEQ, NTS, KERBEROS5)SQLNET.KERBEROS5_CONF = /etc/krb5.confSQLNET.KERBEROS5_REALMS = /etc/krb5.realms
2. Server-Side Solutions
Section titled “2. Server-Side Solutions”Database Parameter Changes
Section titled “Database Parameter Changes”-- Allow older client versions (use carefully)ALTER SYSTEM SET sec_case_sensitive_logon = FALSE SCOPE=BOTH;
-- For 12c+ databases, allow older logon versionsALTER SYSTEM SET sqlnet_allowed_logon_version_server = 10 SCOPE=BOTH;ALTER SYSTEM SET sqlnet_allowed_logon_version_client = 10 SCOPE=BOTH;
-- Check current settingsSHOW PARAMETER sec_case_sensitive_logon;SHOW PARAMETER sqlnet_allowed_logon_version;
Server sqlnet.ora Configuration
Section titled “Server sqlnet.ora Configuration”# Server-side sqlnet.ora ($ORACLE_HOME/network/admin/sqlnet.ora)
# Allow compatible authentication versionsSQLNET.ALLOWED_LOGON_VERSION_SERVER = 10SQLNET.ALLOWED_LOGON_VERSION_CLIENT = 10
# Enable multiple authentication methodsSQLNET.AUTHENTICATION_SERVICES = (ALL)
# For debugging authentication issuesDIAG_ADR_ENABLED = OFFLOG_DIRECTORY_SERVER = /u01/oracle/logsLOG_FILE_SERVER = server.logTRACE_DIRECTORY_SERVER = /u01/oracle/tracesTRACE_FILE_SERVER = server.trcTRACE_LEVEL_SERVER = 16
3. User Account Solutions
Section titled “3. User Account Solutions”Reset User Authentication
Section titled “Reset User Authentication”-- Check user password versionsSELECT username, DECODE(password, 'EXTERNAL', 'EXTERNAL', DECODE(password, NULL, 'NONE', 'PASSWORD')) as auth_type, password_versionsFROM sys.user$WHERE name = 'TARGET_USER';
-- Reset password to generate compatible hashALTER USER target_user IDENTIFIED BY new_password;
-- For case-sensitive password issuesALTER USER target_user IDENTIFIED BY "CaseSensitivePassword";
-- Unlock account if locked due to failed attemptsALTER USER target_user ACCOUNT UNLOCK;
Create Compatible User Profile
Section titled “Create Compatible User Profile”-- Create or modify profile for compatibilityCREATE PROFILE compatible_profile LIMIT PASSWORD_LIFE_TIME UNLIMITED PASSWORD_VERIFY_FUNCTION NULL FAILED_LOGIN_ATTEMPTS 10 PASSWORD_LOCK_TIME 1;
-- Assign profile to userALTER USER target_user PROFILE compatible_profile;
4. Network Configuration
Section titled “4. Network Configuration”Listener Configuration
Section titled “Listener Configuration”# listener.ora configuration for compatibilitySID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = mydb.domain.com) (ORACLE_HOME = /u01/app/oracle/product/19.0.0/dbhome_1) (SID_NAME = mydb) ) )
LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = server.domain.com)(PORT = 1521)) (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) ) )
# Enable authentication debuggingLOGGING_LISTENER = ONLOG_DIRECTORY_LISTENER = /u01/oracle/logsLOG_FILE_LISTENER = listener.logTRACE_DIRECTORY_LISTENER = /u01/oracle/tracesTRACE_FILE_LISTENER = listener.trcTRACE_LEVEL_LISTENER = 16
TNS Configuration
Section titled “TNS Configuration”# tnsnames.ora entry with authentication optionsMYDB = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = server.domain.com)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = mydb.domain.com) (FAILOVER_MODE = (TYPE = SELECT) (METHOD = BASIC) (RETRIES = 180) (DELAY = 5) ) ) (SECURITY = (SSL_SERVER_CERT_DN = "CN=server.domain.com,OU=IT,O=Company,C=US") (AUTHENTICATION_SERVICES = (TCPS)) ) )
Troubleshooting Steps
Section titled “Troubleshooting Steps”1. Enable Diagnostic Tracing
Section titled “1. Enable Diagnostic Tracing”# Client-side tracingexport TNS_ADMIN=/path/to/adminecho "TRACE_LEVEL_CLIENT = 16" >> $TNS_ADMIN/sqlnet.oraecho "TRACE_DIRECTORY_CLIENT = /tmp/trace" >> $TNS_ADMIN/sqlnet.oraecho "TRACE_FILE_CLIENT = client.trc" >> $TNS_ADMIN/sqlnet.ora
# Connect and check trace filesqlplus user/pass@mydb# Review /tmp/trace/client.trc for authentication details
2. Test Authentication Methods
Section titled “2. Test Authentication Methods”-- Test connection with different methodsCONNECT user/password@mydbCONNECT user/"password"@mydb -- Case-sensitiveCONNECT /@mydb -- OS authenticationCONNECT user@mydb -- External authentication
3. Verify Network Connectivity
Section titled “3. Verify Network Connectivity”# Test basic connectivitytelnet server.domain.com 1521nc -v server.domain.com 1521
# Test TNS resolutiontnsping mydb
# Check listener statuslsnrctl statuslsnrctl services
Security Best Practices
Section titled “Security Best Practices”1. Gradual Security Migration
Section titled “1. Gradual Security Migration”-- Phase 1: Allow both old and new protocolsALTER SYSTEM SET sqlnet_allowed_logon_version_server = 10;
-- Phase 2: Update all clients-- Upgrade Oracle client software to compatible versions
-- Phase 3: Tighten securityALTER SYSTEM SET sqlnet_allowed_logon_version_server = 12;
-- Phase 4: Enable case-sensitive passwordsALTER SYSTEM SET sec_case_sensitive_logon = TRUE;
2. Authentication Policy Template
Section titled “2. Authentication Policy Template”-- Create secure password profileCREATE PROFILE secure_profile LIMIT PASSWORD_LIFE_TIME 90 PASSWORD_GRACE_TIME 7 PASSWORD_REUSE_TIME 365 PASSWORD_REUSE_MAX 10 FAILED_LOGIN_ATTEMPTS 5 PASSWORD_LOCK_TIME 1 PASSWORD_VERIFY_FUNCTION ora12c_strong_verify_function;
-- Apply to usersALTER USER application_user PROFILE secure_profile;
3. Monitoring Authentication
Section titled “3. Monitoring Authentication”-- Create authentication monitoring viewCREATE OR REPLACE VIEW v_auth_failures ASSELECT username, timestamp, action_name, returncode, client_program_name, client_identifier, os_username, userhost, terminalFROM dba_audit_trailWHERE action_name = 'LOGON' AND returncode IN (1017, 28040, 28000) AND timestamp > SYSDATE - 30;
-- Check for authentication patternsSELECT returncode, COUNT(*) as failure_count, MIN(timestamp) as first_failure, MAX(timestamp) as last_failureFROM v_auth_failuresGROUP BY returncodeORDER BY failure_count DESC;
Version-Specific Solutions
Section titled “Version-Specific Solutions”Oracle 19c/21c to 11g
Section titled “Oracle 19c/21c to 11g”# Client sqlnet.oraSQLNET.ALLOWED_LOGON_VERSION_CLIENT = 10SQLNET.AUTHENTICATION_SERVICES = (ALL)
Oracle 12c Client to 19c Database
Section titled “Oracle 12c Client to 19c Database”-- Database parameterALTER SYSTEM SET sqlnet_allowed_logon_version_client = 11;
Mixed Environment Configuration
Section titled “Mixed Environment Configuration”# Flexible sqlnet.ora for mixed environmentsSQLNET.ALLOWED_LOGON_VERSION_SERVER = 10SQLNET.ALLOWED_LOGON_VERSION_CLIENT = 10SQLNET.AUTHENTICATION_SERVICES = (BEQ, NTS, ALL)SQLNET.FALLBACK_AUTHENTICATION = TRUE
Related Errors
Section titled “Related Errors”- ORA-01017 - Invalid username/password
- ORA-28000 - Account locked
- ORA-28001 - Password expired
- ORA-12154 - TNS could not resolve name
- ORA-12514 - TNS listener does not know of service
Emergency Response
Section titled “Emergency Response”Quick Workaround
Section titled “Quick Workaround”-- Immediate fix (less secure)ALTER SYSTEM SET sec_case_sensitive_logon = FALSE;ALTER SYSTEM SET sqlnet_allowed_logon_version_server = 8;
Permanent Solution Steps
Section titled “Permanent Solution Steps”- Identify client versions in environment
- Plan authentication strategy based on security requirements
- Test compatibility in non-production environment
- Implement gradual migration to newer authentication
- Monitor and adjust settings as needed
Emergency sqlnet.ora
Section titled “Emergency sqlnet.ora”# Temporary compatibility settingsSQLNET.ALLOWED_LOGON_VERSION_SERVER = 8SQLNET.ALLOWED_LOGON_VERSION_CLIENT = 8SQLNET.AUTHENTICATION_SERVICES = (ALL)SQLNET.FALLBACK_AUTHENTICATION = TRUE
# Enable detailed loggingDIAG_ADR_ENABLED = OFFLOG_DIRECTORY_CLIENT = /tmp/oracle_logsLOG_FILE_CLIENT = client.logTRACE_DIRECTORY_CLIENT = /tmp/oracle_tracesTRACE_FILE_CLIENT = client.trcTRACE_LEVEL_CLIENT = 16
The key to resolving ORA-28040 is balancing security requirements with client compatibility while planning a migration path to more secure authentication methods.