设为首页 加入收藏

TOP

关于SQLNET.AUTHENTICATION_SERVICES验证方式的说明(一)
2015-07-24 10:45:29 来源: 作者: 【 】 浏览:2
Tags:关于 SQLNET.AUTHENTICATION_SERVICES 验证 方式 说明
今天去客户那里巡检,客户提出为了提高 数据库安全性考虑,需要修改sys/system密码,并通过数据库验证方式来取代默认的操作系统方式,现在我来把这两种验证方式总结一下。

操作系统验证,即通过操作系统账户的权限访问数据库,举个例子,如果已经拥有了windows下的系统管理员administrator的权限,那么当采用该方式验证的话,无需输入用户/密码就可以访问,比如:sqlplus / as sysdba;哪怕是任意输入的用户名和密码,也无所谓,比如:sqlplus abc/efg as sysdba;

C:\Documents and Settings\Administrator>sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 8月 28 21:02:25 2014

Copyright (c) 1982, 2005, Oracle. All rights reserved.

连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> exit
从 Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options 断开

C:\Documents and Settings\Administrator>sqlplus abc/efg as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 8月 28 21:02:33 2014

Copyright (c) 1982, 2005, Oracle. All rights reserved.

连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL>

当然,这仅限于sys用户,对于其他用户,哪怕是system,也是必须输入用户名和密码才能访问数据库的

C:\Documents and Settings\Administrator>sqlplus system/123456

SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 8月 28 21:05:07 2014

Copyright (c) 1982, 2005, Oracle. All rights reserved.

ERROR:
ORA-01017: 用户名/口令无效; 登录被拒绝

请输入用户名:

我的环境中,默认sys和system用户的密码都是"oracle",数据库sys用户的密码,是存放在PWD.ora中的(Unix/Linux中为oraPW),想知道sys用户是否有密码,可以通过以下语句查询:
SQL> select * from v$pwfile_users;

USERNAME SYSDB SYSOP
------------------------------ ----- -----
SYS TRUE TRUE

显然,对于采用操作 系统验证来访问数据库,安全性还是有一定隐患的,通常在大公司,SA和DBA都是分权管理的,如果数据库因为采用了操作系统验证方式,而使SA可以随意访问数据库那也是不太合适的。基于这种场景,那么我们就可以采用数据库验证方式来限制sys用户必须输入正确的用户名和密码才能够访问数据库。这样的话,当SA没有DBA的sys密码,就无法访问数据库了。

在windows中,是通过sqlnet.ora这个文件来实现验证机制控制的,当你装完数据库并用netca创建了监听,就会生成这个文件,通常默认是以下内容:
# This file is actually generated by netca. But if customers choose to
# install "Software Only", this file won't exist and without the native
# authentication, they will not be able to connect to the database on NT.

SQLNET.AUTHENTICATION_SERVICES = (NTS)

也就是说,默认就是采用操作系统验证的,也许Oracle认为,拥有了SA权限,就拥有了系统最高权限,所以数据库DBA的sys用户也无需再验证密码了

如果设置成(NONE),就表示采用数据库身份验证,还可以设置成(NONE,NTS),其实这样设也没有意义了,只要括号中有NTS,就会采用操作系统验证,NONE就没有用了

这里要指出一点,有些文章中说还可以设置成(ALL),但我设计测试下来,如果设置成(ALL),会提示ERROR:
C:\Documents and Settings\Administrator>sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 8月 28 21:26:06 2014

Copyright (c) 1982, 2005, Oracle. All rights reserved.

ERROR:
ORA-12641: 验证服务无法初始化

请输入用户名:

如,以下这段描述:
Use the parameter SQLNET.AUTHENTICATION_SERVICES to enable one or more authentication services.
If authentication has been installed,it is recommended that this parameter be set to either none or to one of the authentication methods.

NONE for no authentication methods. A valid username and password can be used to access the database.
ALL for all authentication methods
NTS for Windows NT native authentication(An authentication method that enables
a client single login access to a Windows NT server and a database running on the server)

虽然这里说到了有ALL,不过我亲自测试过,确实不行,也许和版本有关,我的版本是10.2.0.1 windows 32bit的

--修改为(NONE)后登陆
C:\Documents and Settings\Administrator>sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 8月 28 21:50:49 2014

Copyright (c) 1982, 2005,
首页 上一页 1 2 3 下一页 尾页 1/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇简单的存储过程的使用 下一篇Redis配置参数的热修改

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·在 Redis 中如何查看 (2025-12-26 03:19:03)
·Redis在实际应用中, (2025-12-26 03:19:01)
·Redis配置中`require (2025-12-26 03:18:58)
·Asus Armoury Crate (2025-12-26 02:52:33)
·WindowsFX (LinuxFX) (2025-12-26 02:52:30)