1.操作系统认证
对于操作系统认证,其实蛮简单的,
只需要将该用户添加到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
复制代码
2.密码文件认证
这种方式在实际环境中较为普遍,利用的是orapwd工具创建密码文件。
在密码文件认证中,有一个参数十分重要:remote_login_passwordfile,
该参数有三个值,默认为exclusive
none----不使用密码文件认证
exclusive---需要密码文件认证 自己独占使用
shared ---需要密码文件认证 不同实例dba用户可以共享密码文件
密码文件的默认位置为:$ORACLE_HOME/dbs
密码文件的查找顺序:orapw-sid --> orapw --> Failure
所以在创建密码文件时filename只能为orapw-sid或者orapw
复制代码
3.外部认证
若对用户采用外部认证,则只有用户的账号由Oracle管理,密码和用户登录的认证则通过外部服务来管理。外部认证常见的有操作系统认证和网络认证。
外部认证之操作系统身份验证
此技术使用与操作系统用户同样的名称创建Oracle用户,但前面加上了os_authent_prefix参数指定的字符串,默认为ops$,
实战实验:创建 OPS$cxwh用户,系统查询维护cxwh用户免密码登陆,
这样可以比较方便的用于监控oracle性能输出
SQL> show parameter os_authent_prefix;
NAME TYPE
------------------------------------ ---------------------------------
VALUE
------------------------------
os_authent_prefix string
ops$
参考命令如下:
SQL>create user OPS$cxwh identified externally;
SQL>grant connect to OPS$cxwh;
SQL>grant resource to OPS$cxwh;
SQL>grant select any dictionary to OPS$cxwh;
SQL>grant select any table to OPS$cxwh;
SQL>grant unlimited tablespace to OPS$cxwh;
复制代码