标签:des style blog http tar com
在Oracle 10g下,默认情况下,密码是不区分大小写的。这个是由于密码文件的默认参数有关。
C:\Users\Administrator.DavidDai>orapwd
Usage: orapwd file=<fname>entries=<users> force=<y/n> ignorecase=<y/n>nosysdba=<y/n>
where
file - name of password file (required),
password - password for SYS will be prompted if not specified at commandline,
entries - maximum number of distinct DBA (optional),
force - whether to overwrite existing file (optional),
ignorecase - passwords are case-insensitive (optional),
nosysdba - whether to shut out the SYSDBA logon (optional Database Vaultonly).
There must be no spaces around the equal-to (=) character.
这个是口令文件创建命令的参数说明, 这里我们看一个参数:
ignorecase - passwords are case-insensitive (optional),
注意:
这个参数用来指定大小写是否敏感,而默认情况是insentive, 即不敏感,所以对于Oracle10g的数据库,默认情况下,密码是不区分大小写的。但是在Oracle 10g中,我们无法使用这个参数,在后续的测试用有说明。
虽然口令文件里只保存具有SYSDBA和OPER权限的用户,但是其他用户也会受影响。
这里我们在Oracle 10g上做一个测试,为了避免OS认证的影响,我们这里可以禁用OS认证。
http://blog.csdn.net/tianlesoftware/article/details/4698293
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise EditionRelease 10.2.0.5.0 - 64bi
PL/SQL Release 10.2.0.5.0 - Production
CORE 10.2.0.5.0 Production
TNS for Linux: Version 10.2.0.5.0 -Production
NLSRTL Version 10.2.0.5.0 - Production
--创建2个测试用户:
SQL> create user dave1 identified byDavE;
User created.
SQL> create user dave2 identified byDavE;
User created.
SQL> grant connect,resource to dave1;
Grant succeeded.
SQL> grant connect,resource to dave2;
Grant succeeded.
SQL> grant sysdba,sysoper to dave1;
Grant succeeded.
SQL> select * from v$pwfile_users;
USERNAME SYSDB SYSOP
------------------------------ ----- -----
SYS TRUE TRUE
DAVE1 TRUE TRUE
SQL> conn dave1/dave;
Connected.
SQL> conn dave2/dave;
Connected.
SQL> conn dave1/dAVe;
Connected.
SQL> conn dave1/dave1;
ERROR:
ORA-01017: invalid username/password; logondenied
Warning: You are no longer connected toORACLE.
从这里可以看出,在Oracle 10g下,密码是不分大小写。
--这里我们可以继续测试:
我们将sysdba 权限从dave1用户revoke,然后测试:
SQL> conn / as sysdba;
Connected.
SQL> revoke sysdba,sysoper from dave1;
Revoke succeeded.
SQL> select * from v$pwfile_users;
USERNAME SYSDB SYSOP
------------------------------ ----- -----
SYS TRUE TRUE
我们继续使用dave1进行测试:
SQL> conn dave1/dave;
Connected.
SQL> conn dave1/dave1;
ERROR:
ORA-01017: invalid username/password; logondenied
Warning: You are no longer connected toORACLE.
从这里我们可以看出,只是简单的revoke 并不能解决问题,我们重建一个口令文件,然后测试一下看看:
rac2:/u02/app/oracle/product/10.2.0/db_1/dbs>orapwd file=orapwanqing password=oracle force=y;
SQL> conn dave1/dave;
Connected.
--还是可以继续使用,不分大小写
把DB 重启一下看看:
SQL> shutdown immediate
ORA-01031: insufficient privileges
SQL> conn / as sysdba;
Connected.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 583008256 bytes
Fixed Size 2097984 bytes
Variable Size 159386816 bytes
Database Buffers 415236096 bytes
Redo Buffers 6287360 bytes
Database mounted.
Database opened.
SQL> conn dave1/dave;
Connected.
所以我们重建口令文件不能解决问题。所以在Oracle 10g中,密码是不区分大小写的,这种现状,在Oracle 11g里才得到真正的改善。
我们可以在Oracle 10g中验证一下:
rac2:/u02/app/oracle/product/10.2.0/db_1/dbs>orapwd file=orapwanqing password=oracle force=y ignorecase=y
Usage: orapwdfile=<fname> entries=<users> force=<y/n>ignorecase=<y/n> nosysdba=<y/n>
where
file - name of password file (required),
password - password for SYS will beprompted if not specified at command line,
entries - maximum number of distinct DBA(optional),
force - whether to overwrite existing file(optional),
ignorecase - passwords are case-insensitive(optional),
nosysdba - whether to shut out the SYSDBAlogon (optional Database Vault only).
There must be no spaces around the equal-to(=) character.
这里我们设置了ingroecase参数之后,orapwd命令无法正常运行。
因此,可以看出,ignorecase是oracle 11g中真正新增的功能,其在Oracle 11g中才可以使用。该参数用于设置sysdba或sysoper权限通过密码文件登陆时是否区分大小写。
在Oracle 11g中,Oracle开始区分密码大小写,这个由参数:SEC_CASE_SENSITIVE_LOGON决定,官网对这个参数的说明:
http://docs.oracle.com/cd/E11882_01/server.112/e25513/initparams221.htm
Property |
Description |
Parameter type |
Boolean |
Default value |
true |
Modifiable |
ALTER SYSTEM |
Range of values |
true | false |
Basic |
No |
SEC_CASE_SENSITIVE_LOGON enables ordisables password case sensitivity in the database.
Values:
(1)true
Database logonpasswords are case sensitive.
(2)false
Database logonpasswords are not case sensitive.
用户如果是从Oracle 10g导入的,那么PASSWORD_VERSIONS的值就是“10G”,维护区分大小写的密码不依赖于 SEC_CASE_SENSITIVE_LOGON参数设置。假设SEC_CASE_SENSITIVE_LOGON参数被设置为TRUE,密码立即变为大小写敏感。
SQL> select * from v$version whererownum=1;
BANNER
-------------------------------------------------------------------------------
Oracle Database 11g Enterprise EditionRelease 11.2.0.1.0 - 64bit Production
SQL> show parameter password_versions
SQL>
C:\Users\Administrator.DavidDai>orapwd
Usage: orapwd file=<fname>entries=<users> force=<y/n> ignorecase=<y/n>nosysdba=<y/n>
where
file - name of password file (required),
password - password for SYS will be prompted if not specified at commandline,
entries - maximum number of distinct DBA (optional),
force - whether to overwrite existing file (optional),
ignorecase - passwords are case-insensitive (optional),
nosysdba - whether to shut out the SYSDBA logon (optional Database Vaultonly).
There must be no spaces around the equal-to (=) character.
orapwd工具的ignorecase参数允许你控制在密码文件中的密码是否大小写敏感,它的默认值是“n”,即默认大小写敏感。如果特权用户(SYSDBA和SYSOPER)是从之前的数据库版本中导入的,它们的密码也会包括在密码文件中,这些用户将会保留大小写敏感的密码,直到密码被修改。
如果指定ignorecase=y,则Oracle会忽略密码验证时密码的大小写。
SQL> show parameter sec_case_sensitive_logon
NAME TYPE
VALUE
------------------------------------ -----------
------------------------------
sec_case_sensitive_logon boolean
TRUE
--创建测试用户:
SQL> create user dave identified byDavE;
User created.
SQL> grant connect,resource to dave;
Grant succeeded.
SQL> conn dave/dave;
ERROR:
ORA-01017: invalid username/password; logondenied
Warning: You are no longer connected toORACLE.
SQL> conn dave/DavE;
Connected.
--这里区分大小写
--修改参数:
SQL> conn / as sysdba;
Connected.
SQL> alter system set sec_case_sensitive_logon=false;
System altered.
SQL> show parametersec_case_sensitive_logon
NAME TYPE VALUE
----------------------------------------------- -------
sec_case_sensitive_logon boolean FALSE
SQL> conn dave/dave;
Connected.
--禁用sec_case_sensitive_logon 就不区分大小写了。
在上面我们是通过sec_case_sensitive_logon 来设置的,这里我们通过口令文件参数来进行设置。
在Oracle 11g中,口令文件的ignorecase 参数用于设置sysdba或sysoper权限通过密码文件登陆时是否区分大小写。默认情况下,ignorecase 参数是区分大小写的。
注意这里的ingorecase 参数仅仅是在密码文件中创建大小写敏感的密码。
先禁用OS 认证,具体操作参考:
http://blog.csdn.net/tianlesoftware/article/details/4698293
SQL>show parametersec_case_sensitive_logon
NAME TYPE VALUE
----------------------------------------------- ------
sec_case_sensitive_logon boolean TRUE
C:\Users\Administrator.DavidDai>orapwdfile=D:\app\Administrator\product\11.2.0\dbhome_1\database\pwdDAVE.orapassword=OraclE force=y ignorecase=y
--测试ignorecase参数对赋予sysdba 权限用户的影响:
C:\Users\Administrator.DavidDai>
SQL> conn / as sysdba
Connected.
SQL> create user dave1 identified byDavE;
User created.
SQL> grant connect,resource to dave1;
Grant succeeded.
SQL> conn dave1/dave;
ERROR:
ORA-01017: invalid username/password; logondenied
Warning: You are no longer connected toORACLE.
SQL> conn dave1/DavE;
Connected.
--这里也必须使用正确的密码,包括大小写。
SQL> conn / as sysdba;
Connected.
SQL> grant sysdba,sysoper to dave1;
Grant succeeded.
SQL> select * from v$pwfile_users;
USERNAME SYSDB SYSOP SYSAS
------------------------------ ----- ----------
SYS TRUE TRUE FALSE
DAVE1 TRUE TRUE FALSE
SQL> conn dave1/DavE;
Connected.
SQL> conn dave1/dave;
ERROR:
ORA-01017: invalid username/password; logondenied
Warning: You are no longer connected to ORACLE.
--通过这个测试我们可以看出,在创建口令文件时对后来赋予sysdba 权限的用户来说,没有影响,不能指定其是否忽略大小写。
--测试SYS 用户:
我们创建口令文件时就是争对这个这个用户的。
SQL> conn sys/oracle as sysdba;
Connected.
SQL> conn sys/OraclE as sysdba;
Connected.
SQL> conn sys/dave as sysdba;
ERROR:
ORA-01017: invalid username/password; logondenied
Warning: You are no longer connected toORACLE.
--这里SYS 用户成功忽略了大小写问题。
通过以上的2个测试,可以得出结论:
(1) sec_case_sensitive_logon参数可以指定用户的口令是否区分大小写。
(2) 口令文件中的ignorecase 参数仅仅争对创建时是否区分大小写,简言之,只能争对SYS用户。
通过前面的说明,可以看到Oracle 10g与11g中对密码出的验证策略不同,所以如果在不同版本库之间建DBLINK,那么密码也就会成为一个问题,可能出现密码不对的问题,具体的注意事项如下:
(1)11g连接到11g:
创建数据库连接时,密码必须与远程数据库用户的密码大小写一致。
(2)11g连接到11g以前的数据库:
创建数据流连接时用的密码大小写随意,因为远程数据库会忽略大小写的。
(3)11g以前的数据库连接到11g:
将远程用户的密码修改为大写,或者用引号括起来,只有这样才能通过11g以前的数据库验证。
http://blog.csdn.net/tianlesoftware/article/details/7383110
[转]Oracle 10g/11g 密码策略 用户口令 大小写敏感,布布扣,bubuko.com
[转]Oracle 10g/11g 密码策略 用户口令 大小写敏感
标签:des style blog http tar com
原文地址:http://www.cnblogs.com/gispf/p/3779689.html