Chinaunix首页 | 论坛 | 博客
  • 博客访问: 50443
  • 博文数量: 67
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 380
  • 用 户 组: 普通用户
  • 注册时间: 2015-01-05 15:57
文章分类
文章存档

2015年(67)

我的朋友

分类: LINUX

2015-01-27 10:12:34

此技术使用与操作系统用户同样的名称创建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//product/11.2.0.4/db_1/bin/sqlplus /
Error 6 initializing SQL*Plus
SP2-0667: Message file sp1.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 Appliion Testing options
SQL> show user
USER is "OPS$TEST"

终于成功登录!

  • 本文来自:
阅读(340) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~