Oracle身份认证方式
Oracle对于普通账户和超级管理员(指sysdba和sysoper)的认证机制不一样,前者是通过数据字典,后者主要是通过操作系统验证和密码文件验证。因此一般提到操作系统认证或密码文件认证,针对的都是超级管理员的认证。
操作系统认证
对于操作系统认证,其实蛮简单的,只需要将该用户添加到dba(针对sysdba权限)或oper(针对sysoper权限)组中,就可以使用 "sqlplus / as sysdba"方式登陆
在Linux环境下,可通过以下命令添加属组:usermod -g dba test -->>test是用户名
能否使用操作系统身份认证,取决于$ORACLE_HOME/network/admin/sqlnet.ora中SQLNET.AUTHENTICATION_SERVICES的取值。
SQLNET.AUTHENTICATION_SERVICES = none | all | ntf(windows)
none : 表示关闭操作系统认证,只能密码认证。
all : 操作系统认证和密码认证均可。
nts : 用于windows平台。
当 SQLNET.AUTHENTICATION_SERVICES = none时,会报以下错误:
[oracle@node1 admin]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Fri Jan 9 23:14:18 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
ERROR:
ORA-01017: invalid username/password; logon denied
若用密码登陆则没有问题
[oracle@node1 admin]$ sqlplus sys/oracle as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Fri Jan 9 23:17:31 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
SQL>
密码文件认证
这种方式在实际环境中较为普遍,利用的是orapwd工具创建密码文件。
在密码文件认证中,有一个参数十分重要:remote_login_passwordfile,该参数有三个值,默认为exclusive
none----不使用密码文件认证
exclusive---需要密码文件认证 自己独占使用
shared ---需要密码文件认证 不同实例dba用户可以共享密码文件
密码文件的默认位置为:$ORACLE_HOME/dbs
密码文件的查找顺序:orapw<sid> --> orapw --> Failure
所以在创建密码文件时filename只能为orapw<sid>或者orapw
外部认证(External Authentication)
若对用户采用外部认证,则只有用户的账号由Oracle管理,密码和用户登录的认证则通过外部服务来管理。外部认证常见的有操作系统认证和网络认证。
外部认证之操作系统身份验证
此技术使用与操作系统用户同样的名称创建Oracle用户,但前面加上了os_authent_prefix参数指定的字符串,默认为ops$,下面我们来看看官档对该参数的说明:
OS_AUTHENT_PREFIX specifies a prefix that Oracle uses to authenticate users attempting to connect to the server. Oracle concatenates the value of this parameter to the beginning of the user's operating system account name. When a connection request is attempted, Oracle compares the prefixed username with Oracle usernames in the database.
The default value of this parameter is OPS$ for backward compatibility with previous versions. However, you might prefer to set the prefix value to "" (a null string), thereby eliminating the addition of any prefix to operating system account names.
可见,用ops$只是为了向前兼容。
下面,我们来实验一下。
一、创建操作系统用户
[root@node1 ~]# useradd test
二、创建Oracle用户并授予相应的权限
SQL> create user ops$test identified externally;
SQL> grant create session to ops$test;
三、用test用户登录数据库
[test@node1 ~]$ /u01/app/oracle/product/11.2.0.4/db_1/bin/sqlplus /
Error 6 initializing SQL*Plus
SP2-0667: Message file sp1<lang>.msb not found
SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory
报以上错误,根据提示,我们为ORACLE_HOME设置相应的值
在/home/test/.bash_profile中添加如下值:
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0.4/db_1
重新用test用户登录数据库
[test@node1 ~]$ /u01/app/oracle/product/11.2.0.4/db_1/bin/sqlplus /
SQL*Plus: Release 11.2.0.4.0 Production on Sat Jan 10 01:14:53 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
ERROR:
ORA-12162: TNS:net service name is incorrectly specified
Enter user-name:
又报TNS:net service name is incorrectly specified错误。
怀疑没有指定相应的SID,在/home/test/.bash_profile中添加如下值:
export ORACLE_SID=orcl
重新用test用户登录
[test@node1 ~]$ /u01/app/oracle/product/11.2.0.4/db_1/bin/sqlplus /
SQL*Plus: Release 11.2.0.4.0 Production on Sat Jan 10 01:18:22 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
SQL> show user
USER is "OPS$TEST"
终于成功登录!
这个是在本地环境下的操作系统认证,即test与oracle数据库在同一个主机上。
倘若不在同一个主机上,必须将remote_os_authent设置为TRUE。
外部认证之网络认证
Network authentication is performed using Oracle Advanced Security, which can be configured to use a third-party service such as Kerberos. If you are using Oracle Advanced Security as your only external authentication service, then the REMOTE_OS_AUTHENT parameter setting is irrelevant, becauseOracle Advanced Security only allows secure connections.
关于外部认证,我们来看看官方文档的说明
1> More choices of authentication mechanism are available, such as smart cards, fingerprints, Kerberos, or the operating system.
2> Many network authentication services, such as Kerberos support single sign-on, enabling users to have fewer passwords to remember.
3> If you are already using some external mechanism for authentication, such as one of those listed earlier, then there may be less administrative overhead to use that mechanism with the database as well.
Easy Connect
[oracle@node3 ~]$ sqlplus system/oracle@192.168.2.12:1521/sz.being.com
其中,192.168.2.12是数据库所在主机的IP,1521是数据库所在主机的监听端口,sz.being.com是数据库提供的服务名
总结:
1> 操作系统认证优先于密码文件认证。譬如在oracle用户下,我用sqlplus 123/456 as sysdba也可登录到数据库中,即便123不是数据库用户。
2> 与Oracle数据库在同一主机上的用户,只需要知道用户和密码即可登录数据库,譬如在test1用户下,执行sqlplus scott/tiger和sqlplus sys/oracle as sysdba均可登录到数据库,前者是通过数据字典进行验证,后者通过密码文件进行验证。
参考文档:
1. Database Administrator Authentication
2. Administering Authentication
Oracle身份认证方式的更多相关文章
- api接口对于客户端的身份认证方式以及安全措施
转载 基于http协议的api接口对于客户端的身份认证方式以及安全措施 由于http是无状态的,所以正常情况下在浏览器浏览网页,服务器都是通过访问者的cookie(cookie中存储的jsession ...
- oracle登陆认证方式
转自:http://blog.itpub.net/14359/viewspace-683064/ 案例: 1,发现此时操作系统认证不成功: C:\Users\Administrator.WIN-201 ...
- 接口测试 requests的身份认证方式
requests提供多种身份认证方式,包括基本身份认证.netrc 认证.摘要式身份认证.OAuth 1 认证.OAuth 2 与 OpenID 连接认证.自定义认证.这些认证方式的应用场景是什么呢? ...
- ASP.NET MVC5+ORACLE 身份认证
菜鸟来的,刚接触mvc,看到mvc5上默认带有identity身份验证的东西,公司用的oracle数据库,便想着东西能不能支持oracle数据库,折腾了半天弄出下面的东西来,有些东西可能不太准确,望大 ...
- 基于http协议的api接口对于客户端的身份认证方式以及安全措施
由于http是无状态的,所以正常情况下在浏览器浏览网页,服务器都是通过访问者的cookie(cookie中存储的jsessionid)来辨别客户端的身份的,当客户端进行登录服务器也会将登录信息存放在服 ...
- (转)基于http协议的api接口对于客户端的身份认证方式以及安全措施
由于http是无状态的,所以正常情况下在浏览器浏览网页,服务器都是通过访问者的cookie(cookie中存储的 jsessionid)来辨别客户端的身份的,当客户端进行登录服务器也会将登录信息存放在 ...
- oracle的认证方式
使用as sysdba是使用操作系统验证方式,不需要输入密码
- 基于前后端分离的身份认证方式——JWT
什么是JWT JWT--Json web token 是为了在网络应用环境间传递声明而执行的一种基于JSON的开放标准,可实现无状态.分布式的Web应用授权. 现在一般都用redis来出来token做 ...
- oracle 认证方式
Oracle登录的时候有两种认证方式,一种是“操作系统认证”,一种是“口令文件认证”.1.当采取操作系统认证的时候,在本地用任何用户都可以以sysdba登陆:(默认方式)2.当采取口令文件认证的时候, ...
随机推荐
- WCF android调用
http://www.cnblogs.com/cg6811568/archive/2013/05/23/3095119.html
- java.lang.OutOfMemoryError: Java heap space解决方法
引起java.lang.OutOfMemoryError: Java heap space异常,可能是由JAVA的堆栈设置太小的原因 根据网上的答案大致有以下两种解决方法: 1.在D:/apache- ...
- c#后台进行窗体切换的方法
Response.Redirect("http://localhost:60896/WebForm2.aspx");
- 织梦CMS实现多条件筛选功能
用织梦实现筛选的功能,其实主要就是运用到了织梦的高级搜索功能,然后用ajax去post替换掉本来的结果就可以了. 其实筛选的话,主要有两个问题需要解决,一个是前台的筛选实现,一个是后台根据前台的点击, ...
- wrHDL编译中软核代码初始化及编译耗时长的问题
问题的提出整个WR的ISE工程比较大,编译时间很长,导致开发效率低.通过分析发现,ISE在综合的时候大量的时间都花在了初始化DPRAM上.调研发现Xilinx提供了BMM文件和DATA2MEM工具,可 ...
- [转载]iOS9 使用CoreLocation
在iOS8之前,只要 #import <CoreLocation/CoreLocation.h>引入CoreLocation.framework. @property (nonatomic ...
- winform 子报表数据源赋值
this.reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource(&qu ...
- savepoint原理
保存点 在MySQL中, 保存点SAVEPOINT属于事务控制处理部分.利用SAVEPOINT可以回滚指定部分事务,从而使事务处理更加灵活和精细.SAVEPOINT相关的SQL语句如下 SAVEPOI ...
- 分享工作中遇到的问题积累经验 事务日志太大导致insert不进数据
分享工作中遇到的问题积累经验 事务日志太大导致insert不进数据 今天开发找我,说数据库insert不进数据,叫我看一下 他发了一个截图给我 然后我登录上服务器,发现了可疑的地方,而且这个数据库之前 ...
- 微软正式发布Visual Studio 2013 Update 3 (2013.3) RTM
昨天微软的Visual Studio 2013 Update 3(Visual Studio 2013.3)正式发布(RTM)了,做为微软认证金牌合作的葡萄城控件,我们组织力量第一时间进行翻译.分享给 ...