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"

终于成功登录!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值