Chinaunix首页 | 论坛 | 博客
  • 博客访问: 984837
  • 博文数量: 584
  • 博客积分: 2293
  • 博客等级: 大尉
  • 技术积分: 3045
  • 用 户 组: 普通用户
  • 注册时间: 2006-03-28 11:15
文章分类

全部博文(584)

文章存档

2012年(532)

2011年(47)

2009年(5)

我的朋友

分类:

2012-04-13 13:27:45

默认情况下,数据库只运行本地服务器上的操作系统验证:

SQL> SELECT * FROM GLOBAL_NAME;

GLOBAL_NAME
------------------------------------------------------------------------------------
TESTRAC

SQL> SELECT * FROM V$VERSION;

BANNER
----------------------------------------------------------------
Oracle Database10gEnterpriseEdition Release10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE    10.2.0.4.0      Production
TNS for Solaris: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production

SQL> SHOW PARAMETER OS_AUTH

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
os_authent_prefix                    string      ops$
remote_os_authent                    boolean     FALSE
SQL> CREATE USER OPS$ORACLE IDENTIFIED EXTERNALLY;

用户已创建。

SQL> GRANT CONNECT TO OPS$ORACLE;

授权成功。

SQL> HOST
$ sqlplus /

SQL*Plus: Release10.2.0.4.0 - Production on星期五917 00:13:25 2010

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.


连接到:
Oracle Database10gEnterprise Edition Release10.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options

SQL> SHOW USER
USER
"OPS$ORACLE"

建立了OPS$ORACLE用户后,本地可以使用操作系统验证方式登陆,但是远端服务器无法使用同样的方法登陆:

[oracle@bjtest ~]$ sqlplus /nolog

SQL*Plus: Release11.2.0.1.0 Production on星期五917 08:53:57 2010

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

SQL> SET SQLP 'SQL112> '
SQL112>CONN/@172.25.198.223/TESTRAC
ERROR:
ORA-01017: invalid username/password; logon denied

如果修改REMOTE_OS_AUTHENT参数:

SQL> EXIT
Oracle Database10gEnterprise Edition Release10.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
断开

$ exit

SQL> ALTER SYSTEM SET REMOTE_OS_AUTHENT = TRUE SCOPE = SPFILE;

系统已更改。

SQL> SHUTDOWN IMMEDIATE
数据库已经关闭。
已经卸载数据库。
ORACLE
例程已经关闭。
SQL> STARTUP
ORACLE
例程已经启动。

Total System Global Area 1258291200 bytes
Fixed Size                  2040280 bytes
Variable Size             318774824 bytes
Database Buffers          922746880 bytes
Redo Buffers               14729216 bytes
数据库装载完毕。
数据库已经打开。

利用远端服务器再次尝试操作系统验证登陆:

SQL112> CONN /@172.25.198.223/TESTRAC
已连接。
SQL112> SELECT * FROM GLOBAL_NAME;

GLOBAL_NAME
--------------------------------------------------------------------------------
TESTRAC

SQL112> HOST id
uid=500(oracle) gid=500(oinstall) groups=500(oinstall),501(dba)

需要说明的是,这个参数开启后,存在很大的安全隐患,远端服务器只要根据数据库中存在的外部用户来创建用户,就可以登陆到数据库中,因此除非必要,否则不建议开启这个参数。

摘自yangtingkun大师的博客。

阅读(1123) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~