oracle os_authent_prefix,os_authent_prefix参数详解

os_authent_prefix概述

通过操作系统用户认证的方式来直接访问Oracle数据库,简单来说,如果配置了该参数例如为'czm$',当数据库中存在用户'czm$hr',且对该用户启用了外部验证。那么在操作系统上以hr用户登录成功后,就可以直接sqlplus /以czm$hr用户登陆到Oracle数据库,无需sqlplus username/password输入访问Oracle数据库的用户名和密码。

实例如下

查看用户是否启用外部验证

SQL> show parameter os_authent_prefix

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

os_authent_prefix                    string        czm$

SQL> select USERNAME,PASSWORD from  dba_users where username='CZM$HR';

USERNAME                       PASSWORD

------------------------------ ------------------------------

CZM$HR                         EXTERNAL

以hr用户登录

[hr@dg1 ~]$ id

uid=502(hr) gid=504(hr) groups=500(oinstall),504(hr)

设置环境变量

[hr@dg1 ~]$ export ORACLE_SID=czmmiao

[hr@dg1 ~]$ export PATH=/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/oracle/bin:/home/oracle/bin:/u01/app/oracle/product/10.2.0/db_1/bin

[hr@dg1 ~]$ export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1

登录数据库

[hr@dg1 ~]$ sqlplus /

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Nov 7 17:11:10 2011

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

SQL> show user;

USER is "CZM$HR"

注意,当os_authent_prefix为空时,表示如果操作系统上存在与数据库用户同名的用户即可直接登录数据库。

示例如下

SQL> alter system set os_authent_prefix='' scope=spfile;

System altered.

SQL> alter user hr identified externally;

User altered.

SQL> startup force;

ORACLE instance started.

Total System Global Area  373293056 bytes

Fixed Size                  1219496 bytes

Variable Size             197133400 bytes

Database Buffers          171966464 bytes

Redo Buffers                2973696 bytes

Database mounted.

Database opened.

SQL> show parameter os_authent_prefix

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

os_authent_prefix                    string 用hr用户登录数据库

[hr@dg1 ~]$ sqlplus /

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Nov 7 17:14:26 2011

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

SQL> show user;

USER is "HR"

由于这种验证方式对安全性有较大隐患,Oracle不建议采用这种方式进行验证。

转载自:http://czmmiao.iteye.com/blog/1239822

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值