client端普通用户os验证过程:
1、保证参数remote_os_authent=true
SQL> show parameter remote_os_authent
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
remote_os_authent boolean TRUE
SQL>
2、在server端保证sqlnet.ora中
SQLNET.AUTHENTICATION_SERVICES= (none)
必须是none,我测试client端SQLNET.AUTHENTICATION_SERVICES的
设置无关紧要
3、注意参数os_authent_prefix的值,如果os_authent_prefix有值
,不为null,则创建用户时也要加上os_authent_prefix的前缀
SQL> show parameter os_authent_prefix
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
os_authent_prefix string OPS$
4、在clinet端确定username:
C:>set username
USERNAME=user
此时client端的username是user
5、在db中创建外部验证的用户,确定这个用户名其实非常关键,我们可以通过
audit功能准确的确定client端使用外部验证时的用户名:
SQL> show parameter audit_trail
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
audit_trail string DB
SQL> audit session whenever not successful;
审计已成功。
SQL> select os_username,username from dba_audit_session;
OS_USERNAM USERNAME
---------- ------------------------------
user OPS$USER
SQL>
这里通过审计记录的结果发现os_username是user,但是username却是
OPS$USER,而OPS$USER正是我们创建外部用户所需要的用户名:
6、创建外部用户,注意大小写,我发现大写可以,小写不好用:
SQL> create user "ops$user" identified by externally;
用户已创建。
SQL> grant connect to "ops$user";
授权成功。
client端:
C:>sqlplus /@a
SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 5月 21 12:39:09 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
ERROR:
ORA-01017: 用户名/口令无效; 登录被拒绝
--==================================================
SQL> create user "OPS$USER" identified by externally;
用户已创建。
SQL> grant connect to "OPS$USER";
授权成功。
client端:
C:>sqlplus /@a
SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 5月 21 12:40:11 2009
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> show user
USER "OPS$USER"
SQL>
7.不需要在server端的注册表中设置环境变量auth_prefix_domain=false
8.server端os认证和client端os认证冲突,因为server端os认证要求
SQLNET.AUTHENTICATION_SERVICES= (nts)而client端os认证要求SQLNET.AUTHENTICATION_SERVICES= (none)
9.sys用户在client端如何实现os认证呢?
暂时是我的疑问,为什么只好用了一次:
C:>sqlplus /@a as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 5月 21 12:54:28 2009
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> show parameter db_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_name string ORCL
SQL> select host_name from v$instance;
HOST_NAME
----------------------------------------------------------------
XYS
SQL> exit
从 Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options 断开
C:>sqlplus /@a
SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 5月 21 12:55:48 2009
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:>sqlplus /@a as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 5月 21 12:55:55 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
ERROR:
ORA-01031: 权限不足
请输入用户名:
ERROR:
ORA-01017: 用户名/口令无效; 登录被拒绝
C:>
C:>
C:>sqlplus /@a as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 5月 21 12:56:19 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
ERROR:
ORA-01031: 权限不足
请输入用户名:
ERROR:
ORA-01017: 用户名/口令无效; 登录被拒绝
请输入用户名:
ERROR:
ORA-01017: 用户名/口令无效; 登录被拒绝
SP2-0157: 在 3 次尝试之后无法连接到 ORACLE, 退出 SQL*Plus
C:>sqlplus /@a
SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 5月 21 12:56:21 2009
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 断开
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/19602/viewspace-1022346/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/19602/viewspace-1022346/