关于 SQLNET.AUTHENTICATION_SERVICES 验证方式的说明
今天去客户那里巡检,客户提出为了提高数据库安全性考虑,须要改动sys/systempassword,并通过数据库验证方式来代替默认的操作系统方式,如今我来把这两种验证方式总结一下。
操作系统验证。即通过操作系统账户的权限訪问数据库。举个样例,假设已经拥有了windows下的系统管理员administrator的权限,那么当採用该方式验证的话,无需输入用户/password就能够訪问,比方:sqlplus / as sysdba;哪怕是随意输入的username和password。也无所谓,比方: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,也是必须输入username和password才干訪问数据库的
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: username/口令无效; 登录被拒绝
请输入username:
我的环境中。默认sys和system用户的password都是"oracle"。数据库sys用户的password,是存放在PWD<SID>.ora中的(Unix/Linux中为oraPW<SID>),想知道sys用户是否有password,能够通过下面语句查询:
SQL> select * from v$pwfile_users;
USERNAME SYSDB SYSOP
------------------------------ ----- -----
SYS TRUE TRUE
显然。对于採用操作系统验证来訪问数据库,安全性还是有一定隐患的,通常在大公司,SA和DBA都是分权管理的,假设数据库由于採用了操作系统验证方式。而使SA能够任意訪问数据库那也是不太合适的。基于这种场景,那么我们就能够採用数据库验证方式来限制sys用户必须输入正确的username和password才干够訪问数据库。
这种话。当SA没有DBA的syspassword,就无法訪问数据库了。
在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用户也无需再验证password了
假设设置成(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: 验证服务无法初始化
请输入username:
如,下面这段描写叙述:
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, Oracle. All rights reserved.
ERROR:
ORA-01031: 权限不足
请输入username: sys as sysdba
输入口令: --此处输入正确的password“oracle”
连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL>
--断开连接。把(NONE)改为(NTS)直接连接
SQL> disc
从 Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options 断开
SQL> conn abc/123 as sysdba
ERROR:
ORA-01031: 权限不足
因为没有退出SQLPLUS,刚才改的(NTS)还未生效,可见sqlnet.ora文件是在进入SQLPLUS时才去读取的
--仍然保持(NTS)。退出SQLPLUS后又一次登陆
SQL> exit
C:\Documents and Settings\Administrator>sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 8月 28 21:54:52 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>
如今又是操作系统验证了
注意,假设改成(NONE)以后。当使用RMAN时,system用户就不能操作了,输入正确的password也不行,仅仅有sys用户并输入password才干够,測试例如以下:
--设置为(NTS)的时候登陆RMAN
C:\Documents and Settings\Administrator>rman target /
恢复管理器: Release 10.2.0.1.0 - Production on 星期四 8月 28 22:02:07 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
连接到目标数据库: ORCL10G (DBID=1041171248)
RMAN> exit
恢复管理器完毕。
C:\Documents and Settings\Administrator>rman target system/oracle
恢复管理器: Release 10.2.0.1.0 - Production on 星期四 8月 28 22:02:33 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
连接到目标数据库: ORCL10G (DBID=1041171248)
RMAN> exit
恢复管理器完毕。
--改动为(NONE)后。再用password登陆一次RMAN
C:\Documents and Settings\Administrator>rman target system/oracle
--注意,这里password是正确的
恢复管理器: Release 10.2.0.1.0 - Production on 星期四 8月 28 22:03:06 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00554: 内部恢复管理器程序包初始化失败
RMAN-04005: 目标数据库中存在错误:
ORA-01031: 权限不足
C:\Documents and Settings\Administrator>rman target /
恢复管理器: Release 10.2.0.1.0 - Production on 星期四 8月 28 22:08:47 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00554: 内部恢复管理器程序包初始化失败
RMAN-04005: 目标数据库中存在错误:
ORA-01031: 权限不足
C:\Documents and Settings\Administrator>rman target sys/oracle
恢复管理器: Release 10.2.0.1.0 - Production on 星期四 8月 28 22:03:16 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
连接到目标数据库: ORCL10G (DBID=1041171248)
RMAN>
非常显然,在採用数据库身份验证以后,system用户被禁止使用RMAN了,仅仅有拥有数据库最高权限的sys用户,才干登陆RMAN。并且必须是输入password的方式登陆
总结:
在windows下,SQLNET.AUTHENTICATION_SERVICES必须设置为NTS才干使用OS认证,不设置(如,把该行语句加#凝视符号)或者设置为其它不论什么值都不能使用OS认证。
主要是下面几种情况:
1. sqlnet.ora文件为空,或用#凝视掉 --基于Oraclepassword文件验证
2. SQLNET.AUTHENTICATION_SERVICES = (NTS) --基于操作系统验证
3. SQLNET.AUTHENTICATION_SERVICES = (NONE) --基于Oraclepassword文件验证
4. SQLNET.AUTHENTICATION_SERVICES = (NONE,NTS) --基于操作系统验证(前后顺序颠倒也一样)
注意:默认情况下,Unix/Linux下的sqlnet.ora文件是没有SQLNET.AUTHENTICATION_SERVICES參数的,似乎连sqlnet.ora这个文件也没有,这和windows有非常大的不同
此时是操作系统验证和Oraclepassword验证并存,假设加上SQLNET.AUTHENTICATION_SERVICES这个參数后。无论是设置为(NONE)、(NTS)或(NONE,NTS),都是基于Oraclepassword验证。
关于 SQLNET.AUTHENTICATION_SERVICES 验证方式的说明的更多相关文章
- 关于SQLNET.AUTHENTICATION_SERVICES= (NTS) 的解释
原文转自:http://www.360doc.com/content/12/0207/12/3446769_184740592.shtml 标题所代表的意思为 使用操作系统本地验证,一般不 ...
- SQLNET.AUTHENTICATION_SERVICES操作系统认证登录的设定
$ORACLE_HOME/network/admin/sqlnet.ora 如果使用了SQLNET.AUTHENTICATION_SERVICES=(NTS)则说明可以使用OS认证就,只要conn / ...
- [Oracle]Oracle Fail Safe 与 SQLNET.AUTHENTICATION_SERVICES关系
现象: 在使用 OFS (Oracle Fail Safe)的环境中,把数据库的 SQLNET.AUTHENTICATION_SERVICES 从 NTS 改为 NONE之后,当从 Oracle Fa ...
- oracle: 浅谈sqlnet.ora文件的作用,及SQLNET.AUTHENTICATION_SERVICES设置
关于sqlnet.ora的说明: *****************************************************FROM ORACLE11G DOCS*********** ...
- C# 中参数验证方式的演变
一般在写方法的时候,第一步就是进行参数验证,这也体现了编码者的细心和缜密,但是在很多时候这个过程很枯燥和乏味,比如在拿到一个API设计文档的时候,通常会规定类型参数是否允许为空,如果是字符可能有长度限 ...
- SQLSERVER误删除了Windows登录用户验证方式使用Windows身份验证的解决方法
SQLSERVER误删Windows登录用户验证方式使用Windows身份验证的解决方法 今天看到这篇文章:没有了SA密码,无法Windows集成身份登录,DBA怎么办? 想起来之前着急哥问我的一个问 ...
- 两系统用asp.net forms 身份验证方式实现跨域登录信息共享
1.两个系统的 web.config 都配置为 forms 验证方式( system.web —> authentication 节点) 2.在两个系统的Web.config里配置相同的 sys ...
- Azure Service Bus 中的身份验证方式 Shared Access Signature
var appInsights=window.appInsights||function(config){ function r(config){t[config]=function(){var i= ...
- jQuery validate 根据 asp.net MVC的验证提取简单快捷的验证方式(jquery.validate.unobtrusive.js)
最近在学习asp.netMVC,发现其中的验证方式书写方便快捷,应用简单,易学好懂. 验证方式基于jQuery的validate 验证方式,也可以说是对jQuery validate的验证方式的扩展, ...
随机推荐
- AtomicInteger类的简单应用
AtomicInteger,一个提供原子操作的Integer的类.在Java语言中,++i和i++操作并不是线程安全的,在使用的时候,不可避免的会用到synchronized关键字.而AtomicIn ...
- RegexHelper
ylbtech-Unitity-cs: RegexHelper 验证帮助类 1.A,效果图返回顶部 1.B,源代码返回顶部 1.B.1,RegexMail #region RegexMail pu ...
- CMD一键获取cpu信息
windows + R 输入cmd打开CMD 输入wmic cpu get Name 获取cpu名称-即物理cpu数 cpu get NumberOfCores获取cpu核心数 cpu get Num ...
- grpc(3):使用 golang 开发 grpc 服务端和client
1,关于grpc-go golang 能够能够做grpc的服务端和client. 官网的文档: http://www.grpc.io/docs/quickstart/go.html https://g ...
- go 中goroutine 的使用
一.多线程定义: 所谓的多线程,multithreading.有多线程能力的计算机因有硬件支持而能够在同一时间执行多于一个线程,进而提升整体处理性能.具有这种能力的系统包括对称多处理机.多核心处理器以 ...
- Drawing-Order-Of-meshes-and-sprites
Sprite 和 Mesh Render 共存 [CanEditMultipleObjects] [CustomEditor(typeof(MeshRenderer))] public class M ...
- Zend Framework(一) windows8.1下配置zend framework1.12
windows8.1下配置zend framework1.12配置步骤: 1. 下载 zend framework1.12库 2. 创建zend frameworkproject 2 ...
- android js 互相调用
代码地址如下:http://www.demodashi.com/demo/13107.html android js 互相调用 第二版 支持js匿名函数接收 支持js json对象接收 支持js函数返 ...
- rabbitmqctl 报错
RabbitMQ 安装成功后,cmd dos命令进入RabbitMQ的安装路径,如 E:\Program Files\RabbitMQ Server\rabbitmq_server-3.6.10\sb ...
- ansible 简单用法
ansible批量复制文件到服务器 ansible -i /etc/ansible/hosts.test test -m copy -a "src=/tmp/test dest=/usr/b ...