本文小编为大家详细介绍“Oracle19c的参数sec_case_sensitive_logon与ORA-01017错误问题怎么解决”,内容详细,步骤清晰,细节处理妥当,希望这篇“Oracle19c的参数sec_case_sensitive_logon与ORA-01017错误问题怎么解决”文章能帮助大家解决疑惑,下面跟着小编的思路慢慢深入,一起来学习新知识吧。
Oracle的参数sec_case_sensitive_logon是Oracle 11g开始被引入。这个参数主要是为了控制密码的大小写敏感问题。
sec_case_sensitive_logon=true表示密码区分大小写。
sec_case_sensitive_logon=false表示密码不区分大小写。
从Oracle 12c开始,参数sec_case_sensitive_logon被弃用了。但是为了向下兼容,即使在Oracle 19c中,这个参数依然保留了。这个参数在Oracle 12c(确切的说是12.2以及后续版本)和19c中不能设置为false,因为它和SQLNET.ALLOWED_LOGON_VERSION_SERVER=12或者SQLNET.ALLOWED_LOGON_VERSION_SERVER=12a不兼容。这是因为用于此模式的更安全的密码版本仅支持区分大小写的密码检查。简单点来说,就是这种环境下,这种设置会冲突。官方文档[1]的阐述如下所示:
Note the following implications of setting the value to 12 or 12a: • A value of FALSE for the SEC_CASE_SENSITIVE_LOGON Oracle instance initialization parameter must not be used because password case insensitivity requires the use of the 10G password version. If the SEC_CASE_SENSITIVE_LOGON Oracle instance initialization parameter is set to FALSE, then user accounts and secure roles become unusable because Exclusive Mode excludes the use of the 10G password version. The SEC_CASE_SENSITIVE_LOGON Oracle instance initialization parameter enables or disables password case sensitivity. However, since Exclusive mode is enabled by default in this release, disabling the password case sensitivity is not supported. Note: • The use of the Oracle instance initialization parameter SEC_CASE_SENSITIVE_LOGON is deprecated in favor of setting the SQLNET.ALLOWED_LOGON_VERSION_SERVER parameter to 12 to ensure that passwords are treated in a case-sensitive fashion. • Disabling password case sensitivity is not supported in Exclusive mode (when SQLNET.ALLOWED_LOGON_VERSION_SERVER is set to 12 or 12a.) • Releases of OCI clients earlier than Oracle Database 10g cannot authenticate to the Oracle database using password-based authentication. • If the client uses Oracle Database 10g, then the client will receive an ORA-03134: Connections to this server version are no longer supported error message. To allow the connection, set the SQLNET.ALLOWED_LOGON_VERSION_SERVER value to 8. Ensure the DBA_USERS.PASSWORD_VERSIONS value for the account contains the value 10G. It may be necessary to reset the password for that account.
下面我们来构造一个例子,看看这个参数sec_case_sensitive_logon的影响
SQL> select banner_full from v$version; BANNER_FULL ---------------------------------------------------------------------------------------------------- Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.3.0.0.0 1 row selected. SQL> show parameter sec_case_sensitive_logon; NAME TYPE VALUE -------------------------- ----------- ------------------------------ sec_case_sensitive_logon boolean TRUE SQL> alter user system identified by "system#1245"; User altered. SQL> SET LINESIZE 1080; SQL> SET PAGESIZE 36; SQL> COL USERNAME FOR A24; SQL> COL ACCOUNT_STATUS FOR A16; SQL> COL DEFAULT_TABLESPACE FOR A16; SQL> COL TEMPORARY_TABLESPACE FOR A10; SQL> COL PROFILE FOR A10; SQL> COL LOCK_DATE FOR A20; SQL> COL EXPIRY_DATE FOR A20; SQL> COL PASSWORD_VERSIONS FOR A12; SQL> SELECT USERNAME 2 , ACCOUNT_STATUS 3 , DEFAULT_TABLESPACE 4 , TEMPORARY_TABLESPACE 5 , PROFILE 6 , TO_CHAR(LOCK_DATE,'YYYY-MM-DD HH24:MI:SS') AS LOCK_DATE 7 , TO_CHAR(EXPIRY_DATE,'YYYY-MM-DD HH24:MI:SS') AS EXPIRY_DATE 8 , PASSWORD_VERSIONS 9 FROM DBA_USERS 10 WHERE USERNAME=UPPER('&USERNAME') 11 ORDER BY EXPIRY_DATE; Enter value for username: system old 10: WHERE USERNAME=UPPER('&USERNAME') new 10: WHERE USERNAME=UPPER('system') USERNAME ACCOUNT_STATUS DEFAULT_TABLESPA TEMPORARY_ PROFILE LOCK_DATE EXPIRY_DATE PASSWORD_VER ---------- ---------------- ---------------- ---------- ---------- --------------- -------------------- ------------ SYSTEM OPEN SYSTEM TEMP DEFAULT 2023-10-22 17:25:09 11G 12C SQL> alter system set sec_case_sensitive_logon=false scope=both; System altered. SQL>
然后我们在另外一个窗口使用system账号登陆数据库
$ sqlplus system/system#1245 SQL*Plus: Release 19.0.0.0.0 - Production on Tue Apr 25 17:16:28 2023 Version 19.3.0.0.0 Copyright (c) 1982, 2019, Oracle. All rights reserved. ERROR: ORA-01017: invalid username/password; logon denied
如果我们将参数设置sec_case_sensitive_logon为true(这个参数调整后可以立即生效,不用重启),
SQL> show user; USER is "SYS" SQL> alter system set sec_case_sensitive_logon=true scope=both; System altered. SQL>
然后验证如下所示所示,一切正常,所以如果你遇到ORA-01017这个错误,而且数据库版本为12c/19c,如果你确认你密码是正确的,那么检查一下这个参数。
$sqlplus system/system#1245 SQL*Plus: Release 19.0.0.0.0 - Production on Tue Apr 25 17:20:28 2023 Version 19.3.0.0.0 Copyright (c) 1982, 2019, Oracle. All rights reserved. Last Successful login time: Tue Apr 25 2023 09:54:37 +08:00 Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.3.0.0.0 SQL>
下面我们再来测试一下,在参数sec_case_sensitive_logon为false的情况,我们控制密码版本来解决ORA-01017这个错误
SQL> show user; USER is "SYS" SQL> show parameter sec_case_sensitive_logon; NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ sec_case_sensitive_logon boolean FALSE SQL>
修改sqlnet.ora这个参数文件,设置下面参数:
SQLNET.ALLOWED_LOGON_VERSION_CLIENT = 10 SQLNET.ALLOWED_LOGON_VERSION_SERVER = 10
修改sqlnet.ora参数文件后,必须重新登陆SQLPlus后(如果使用之前的SQLPlus连接也不会生效),执行下面脚本
SQL> alter user system identified by "system#1245"; User altered. SQL> SET LINESIZE 1080; SQL> SET PAGESIZE 36; SQL> COL USERNAME FOR A16; SQL> COL ACCOUNT_STATUS FOR A16; SQL> COL DEFAULT_TABLESPACE FOR A16; SQL> COL TEMPORARY_TABLESPACE FOR A10; SQL> COL PROFILE FOR A10; SQL> COL LOCK_DATE FOR A20; SQL> COL EXPIRY_DATE FOR A20; SQL> COL PASSWORD_VERSIONS FOR A12; SQL> SELECT USERNAME 2 , ACCOUNT_STATUS 3 , DEFAULT_TABLESPACE 4 , TEMPORARY_TABLESPACE 5 , PROFILE 6 , TO_CHAR(LOCK_DATE,'YYYY-MM-DD HH24:MI:SS') AS LOCK_DATE 7 , TO_CHAR(EXPIRY_DATE,'YYYY-MM-DD HH24:MI:SS') AS EXPIRY_DATE 8 , PASSWORD_VERSIONS 9 FROM DBA_USERS 10 WHERE USERNAME=UPPER('&USERNAME') 11 ORDER BY EXPIRY_DATE; Enter value for username: system old 10: WHERE USERNAME=UPPER('&USERNAME') new 10: WHERE USERNAME=UPPER('system') USERNAME ACCOUNT_STATUS DEFAULT_TABLESPA TEMPORARY_ PROFILE LOCK_DATE EXPIRY_DATE PASSWORD_VER ---------------- ---------------- ---------------- ---------- ---------- -------------------- -------------------- ------------ SYSTEM OPEN SYSTEM TEMP DEFAULT 2023-10-23 09:21:27 10G 11G 12C 1 row selected. SQL>
此时验证system账号登陆,则不会报ORA-01017这个错误了。
$ sqlplus system/system#1245 SQL*Plus: Release 19.0.0.0.0 - Production on Wed Apr 26 09:22:18 2023 Version 19.3.0.0.0 Copyright (c) 1982, 2019, Oracle. All rights reserved. Last Successful login time: Tue Apr 25 2023 17:20:29 +08:00 Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.3.0.0.0 SQL>
注意:最好使用其他账号验证测试,这里仅仅是为了偷懒,使用测试环境的system账号测试验证。
读到这里,这篇“Oracle19c的参数sec_case_sensitive_logon与ORA-01017错误问题怎么解决”文章已经介绍完毕,想要掌握这篇文章的知识点还需要大家自己动手实践使用过才能领会,如果想了解更多相关内容的文章,欢迎关注亿速云行业资讯频道。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。