oracle 19c的参数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账号测试验证。更多相关信息也可以参考the new exclusive mode default for password-based authentication in oracle 12.2 conflicts with case-insensitive password configurations. all user login fails with ora-1017 after upgrade to 12.2 (doc id 2075401.1)[2]
参考资料
[1]
官方文档1:https://docs.oracle.com/en/database/oracle/oracle-database/19/netrf/parameters-for-the-sqlnet.ora.html#guid-1fa9d26c-4d97-4d1c-ab47-1ec234d924aa
[2]
doc id 2075401.1:https://support.oracle.com/epmos/faces/documentdisplay?_afrloop=249715360691380&id=2075401.1&_afrwindowmode=0&_adf.ctrl-state=1agoeyy4f0_80
关于oracle 19c的参数sec_case_sensitive_logon与ora-01017错误的文章就介绍至此,更多相关oracle 19c sec_case_sensitive_logon与ora-01017内容请搜索硕编程以前的文章,希望以后支持硕编程!
- Oracle数据库连接
- Oracle And子句
- Oracle Where子句
- Oracle Like子句
- Oracle LOCK TABLE语句(锁表)
- Oracle 级联删除外键
- Oracle Compose()函数
- Oracle Convert()函数
- Oracle Dump()函数
- Memcached 教程
- Linux Memcached 安装
- Memcached set 命令
- Memcached add 命令
- Memcached incr 与 decr 命令
- Memcached stats slabs 命令
- DB2服务器安装
- DB2数据类型
- DB2触发器
- DB2备份和恢复
- 12类Oracle日期函数超全面总结