今天去客户那里巡检,客户提出为了提高数据库安全性考虑,须要改动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 验证方式的说明的更多相关文章

  1. 关于SQLNET.AUTHENTICATION_SERVICES= (NTS) 的解释

    原文转自:http://www.360doc.com/content/12/0207/12/3446769_184740592.shtml       标题所代表的意思为 使用操作系统本地验证,一般不 ...

  2. SQLNET.AUTHENTICATION_SERVICES操作系统认证登录的设定

    $ORACLE_HOME/network/admin/sqlnet.ora 如果使用了SQLNET.AUTHENTICATION_SERVICES=(NTS)则说明可以使用OS认证就,只要conn / ...

  3. [Oracle]Oracle Fail Safe 与 SQLNET.AUTHENTICATION_SERVICES关系

    现象: 在使用 OFS (Oracle Fail Safe)的环境中,把数据库的 SQLNET.AUTHENTICATION_SERVICES 从 NTS 改为 NONE之后,当从 Oracle Fa ...

  4. oracle: 浅谈sqlnet.ora文件的作用,及SQLNET.AUTHENTICATION_SERVICES设置

    关于sqlnet.ora的说明: *****************************************************FROM ORACLE11G DOCS*********** ...

  5. C# 中参数验证方式的演变

    一般在写方法的时候,第一步就是进行参数验证,这也体现了编码者的细心和缜密,但是在很多时候这个过程很枯燥和乏味,比如在拿到一个API设计文档的时候,通常会规定类型参数是否允许为空,如果是字符可能有长度限 ...

  6. SQLSERVER误删除了Windows登录用户验证方式使用Windows身份验证的解决方法

    SQLSERVER误删Windows登录用户验证方式使用Windows身份验证的解决方法 今天看到这篇文章:没有了SA密码,无法Windows集成身份登录,DBA怎么办? 想起来之前着急哥问我的一个问 ...

  7. 两系统用asp.net forms 身份验证方式实现跨域登录信息共享

    1.两个系统的 web.config 都配置为 forms 验证方式( system.web —> authentication 节点) 2.在两个系统的Web.config里配置相同的 sys ...

  8. Azure Service Bus 中的身份验证方式 Shared Access Signature

    var appInsights=window.appInsights||function(config){ function r(config){t[config]=function(){var i= ...

  9. jQuery validate 根据 asp.net MVC的验证提取简单快捷的验证方式(jquery.validate.unobtrusive.js)

    最近在学习asp.netMVC,发现其中的验证方式书写方便快捷,应用简单,易学好懂. 验证方式基于jQuery的validate 验证方式,也可以说是对jQuery validate的验证方式的扩展, ...

随机推荐

  1. 排查java.lang.OutOfMemoryError: GC overhead limit exceeded

    帮助客户排查java.lang.OutOfMemoryError: GC overhead limit exceeded错误记录: 具体网址: https://support.oracle.com/e ...

  2. javascript快速入门2--变量,小学生数学与简单的交互

    变量 对于变量的理解:变量是数据的代号.如同人的名字一样. var num;//在JavaScript中使用关键字var声明一个变量 在JavaScript中,使用上面的语法,就可以声明一个变量,以便 ...

  3. 10道典型的JavaScript面试题

    问题1: 作用域(Scope) 考虑以下代码: (function() { ; })(); console.log(b); 上述代码会打印出5.这个问题的陷阱就是,在立即执行函数表达式(IIFE)中, ...

  4. go 中的pacage 名称 和import {}中的名称

    参考: https://groups.google.com/forum/#!topic/golang-nuts/oawcWAhO4Ow Hi, Nan Xiao <xiaona...@gmail ...

  5. Memcachedclientutils类

    0.个人标签 我的CSDN博客地址: http://blog.csdn.net/caicongyang 1.依赖的jar包 commons-pool-1.5.6.jar slf4j-api-1.6.1 ...

  6. [转]2年SQL Server DBA调优方面总结

      2年SQL Server DBA调优方面总结 当2年dba 我觉得,有些东西需要和大家分享探讨,先书单. 书单 1.<深入解析SQL Server 2008 系列> 这个就是mssql ...

  7. 解决C#使用Microsoft.Office.Interop.Excel操作Excel后进程一直存在的问题

    This resolved the issue for me. Your code becomes: public Excel.Application excelApp = new Excel.App ...

  8. lua面向对象编程 《lua程序设计》 16章 笔记

    Lua中的table就是一种对象,即它拥有状态.拥有独立于其值的标识(self).table与对象一样具有独立于创建者和创建地的征集周期 什么叫对象拥有独立的生命周期? Account = {bala ...

  9. Visual Studio提示“无法启动IIS Express Web服务器”或者“无法连接Web服务器IIS Express ”的解决方法

    解决办法:找到程序根目录,删除隐藏的.vs文件夹即可. 问题原因:一般是项目拷贝或者系统设置变更所造成的.

  10. WPF入门教程系列三

    WPF之Binding的使用(一) 一.  前言 初学WPF经常被Binding搞得苦不堪言,Binding的重用性就不做介绍了,在WPF应用程序开发中Binding是一个非常重要的部分.WPF也是近 ...