1 本地操作系统认证测试的基本环境:
操作系统:WINDOWS 7 32位
机器名:zangblpc
Oracle版本:oracle 10.2.0.3
SQLNET.ORA文件配置(windows7):SQLNET.AUTHENTICATION_SERVICES=(NTS)
数据库中REMOTE_OS_AUTHENT参数值为:false
用于测试的操作系统用户名:zbl
1.1 测试一
OSAUTH_PREFIX_DOMAIN变量为默认值TRUE,OS_AUTHENT_PREFIX参数为默认值OPS$(当然OS_AUTHENT_PREFIX也可改成任意你想用的参数值,如:REM$)。测试过程如下
C:\Users\Administrator>sqlplus / as sysdba
SQL*Plus: Release 10.2.0.3.0 - Production on星期一8月8 22:57:552011
Copyright (c) 1982, 2006, Oracle.
连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 -Production
With the Partitioning, OLAP and Data Mining options
SQL> set line 120
SQL> show parameter os_authent_prefix
NAME
------------------------------------ ---------------------------------------
os_authent_prefix
SQL>
SQL> create user "OPS$ZANGBLPC\ZBL" identifiedexternally;
用户已创建。
SQL> grant connect to "OPS$ZANGBLPC\ZBL";
授权成功。
SQL>
注意这里创建OPS$ZANGBLPC\ZBL用户时必须用双引号引起来,否则会报ORA-00911:无效字符的错误,这是因为这个里有特殊字符\,报错信息如下:
SQL> create user OPS$ZANGBLPC\ZBL identified externally;
create user OPS$ZANGBLPC\ZBL identified externally
第1行出现错误:
ORA-00911:无效字符
SQL>
这个时候在操作系统中切换登录到zbl用户下,运行sqlplus /或sqlplus /nolog,connect /
C:\Users\ZBL>sqlplus /
SQL*Plus: Release 10.2.0.3.0 - Production on星期一8月8 23:18:422011
Copyright (c) 1982, 2006, Oracle.
连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 -Production
With the Partitioning, OLAP and Data Mining options
SQL> show user
USER为"OPS$ZANGBLPC\ZBL"
SQL>
1.2 测试二
OSAUTH_PREFIX_DOMAIN变量为默认值TRUE,OS_AUTHENT_PREFIX参数为空值:
SQL> alter system set os_authent_prefix='' scope=spfile;
系统已更改。
SQL> startup force;
ORACLE例程已经启动。
Total System Global Area
FixedSize
VariableSize
DatabaseBuffers
RedoBuffers
数据库装载完毕。
数据库已经打开。
SQL> show parameter os_authent_prefix
NAME
------------------------------------ ----------------------------------------------------
os_authent_prefix
SQL> drop user "OPS$ZANGBLPC\ZBL" cascade;
用户已删除。
SQL> set wrap off
SQL>
USERNAME
------------------------------------------------------------
SYSTEM
SYS
ZBLTEST1
MGMT_VIEW
PWD_MGR
SYSMAN
ZBLTEST
DBSNMP
ASSET_MGR
ZBLCHINA
ZANGBLPCZBL
USERNAME
------------------------------------------------------------
ZJJCK
ZJGLK
ADMINISTRATOR
已选择14行。
SQL> create user "ZANGBLPC\ZBL" identified externally;
用户已创建。
SQL> grant connect to "ZANGBLPC\ZBL";
授权成功。
SQL>
这个时候在操作系统中切换登录到zbl用户下,运行sqlplus /或sqlplus /nolog,connect /
Microsoft Windows [版本6.1.7601]
版权所有(c) 2009 Microsoft Corporation。保留所有权利。
C:\Users\ZBL>sqlplus /
SQL*Plus: Release 10.2.0.3.0 - Production on星期一8月8 23:35:212011
Copyright (c) 1982, 2006, Oracle.
连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 -Production
With the Partitioning, OLAP and Data Mining options
SQL> show user
USER为"ZANGBLPC\ZBL"
SQL>
1.3 测试三
OSAUTH_PREFIX_DOMAIN变量为默认值FALSE,OS_AUTHENT_PREFIX参数为默认值OPS$(当然OS_AUTHENT_PREFIX也可改成任意你想用的参数值,如:REM$):
SQL> show parameter os_authent_prefix
NAME
------------------------------------ ----------------------------------------------------
os_authent_prefix
SQL> alter system set os_authent_prefix='OPS$'scope=spfile;
系统已更改。
SQL> startup force
ORACLE例程已经启动。
Total System Global Area
FixedSize
VariableSize
DatabaseBuffers
RedoBuffers
数据库装载完毕。
数据库已经打开。
SQL> show parameter os_authent_prefix
NAME
------------------------------------ ----------------------------------------------------
os_authent_prefix
SQL> drop user "ZANGBLPC\ZBL" CASCADE;
用户已删除。
SQL> select username from dba_users whereaccount_status='OPEN';
USERNAME
------------------------------------------------------------
SYSTEM
SYS
ZBLTEST1
MGMT_VIEW
PWD_MGR
SYSMAN
ZBLTEST
DBSNMP
ASSET_MGR
ZBLCHINA
ZANGBLPCZBL
USERNAME
------------------------------------------------------------
ZJJCK
ZJGLK
ADMINISTRATOR
已选择14行。
SQL> create user ops$zbl identified externally;
用户已创建。
SQL> grant connect to ops$zbl;
授权成功。
SQL>
这个时候在操作系统中切换登录到zbl用户下,运行sqlplus /或sqlplus /nolog,connect /
Microsoft Windows [版本6.1.7601]
版权所有(c) 2009 Microsoft Corporation。保留所有权利。
C:\Users\ZBL>sqlplus /
SQL*Plus: Release 10.2.0.3.0 - Production on星期一8月8 23:53:072011
Copyright (c) 1982, 2006, Oracle.
连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 -Production
With the Partitioning, OLAP and Data Mining options
SQL> show user
USER为"OPS$ZBL"
SQL>
1.4 测试四
OSAUTH_PREFIX_DOMAIN变量为默认值FALSE,OS_AUTHENT_PREFIX参数为空值:
SQL> show parameter os_authent_prefix
NAME
------------------------------------ ----------------------------------------------------
os_authent_prefix
SQL> alter system set os_authent_prefix='' scope=spfile;
系统已更改。
SQL> startup force
ORACLE例程已经启动。
Total System Global Area
FixedSize
VariableSize
DatabaseBuffers
RedoBuffers
数据库装载完毕。
数据库已经打开。
SQL> drop user ops$zbl cascade;
用户已删除。
SQL> select username from dba_users whereaccount_status='OPEN';
USERNAME
------------------------------------------------------------
SYSTEM
SYS
PWD_MGR
ZBLTEST1
SYSMAN
DBSNMP
MGMT_VIEW
ASSET_MGR
ZBLCHINA
ZJJCK
ZJGLK
已选择11行。
SQL> show parameter os_authent_prefix
NAME
------------------------------------ ----------------------------------------------------
os_authent_prefix
SQL> create user zbl identified externally;
用户已创建。
SQL> grant connect to zbl;
授权成功。
SQL>
这个时候在操作系统中切换登录到zbl用户下,运行sqlplus /或sqlplus /nolog,connect /
Microsoft Windows [版本6.1.7601]
版权所有(c) 2009 Microsoft Corporation。保留所有权利。
C:\Users\ZBL>sqlplus /
SQL*Plus: Release 10.2.0.3.0 - Production on星期二8月9 00:03:272011
Copyright (c) 1982, 2006, Oracle.
连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 -Production
With the Partitioning, OLAP and Data Mining options
SQL> show user
USER为"ZBL"
SQL>
2 远程操作系统认证测试的基本环境
数据库所在的主机的操作系统:WINDOWS 7 32位
客户端所在主机的操作系统:Oracle Enterpris Linux 5.5 x86-64
数据库主机机器名:zangblpc
Oracle数据库版本:Oracle 10.2.0.3
Oracel Client数据库版本:Oracle 10.2.0.5
SQLNET.ORA文件配置(数据库端):SQLNET.AUTHENTICATION_SERVICES= (NTS)
数据库中REMOTE_OS_AUTHENT参数值为:true
用于测试的操作系统用户名:zbl
数据库的监听地址为172.19.3.24,端口为1521
2.1 测试一
OSAUTH_PREFIX_DOMAIN变量为默认值FALSE,OS_AUTHENT_PREFIX参数为空值:
SQL> show parameter os_authent_prefix
NAME
------------------------------------ ----------------------------------------------------
os_authent_prefix
SQL> alter system set os_authent_prefix='' scope=spfile;
系统已更改。
SQL> startup force
ORACLE例程已经启动。
Total System Global Area
FixedSize
VariableSize
DatabaseBuffers
RedoBuffers
数据库装载完毕。
数据库已经打开。
SQL> drop user ops$zbl cascade;
用户已删除。
SQL> select username from dba_users whereaccount_status='OPEN';
USERNAME
------------------------------------------------------------
SYSTEM
SYS
PWD_MGR
ZBLTEST1
SYSMAN
DBSNMP
MGMT_VIEW
ASSET_MGR
ZBLCHINA
ZJJCK
ZJGLK
已选择11行。
SQL> show parameter os_authent_prefix
NAME
------------------------------------ ----------------------------------------------------
os_authent_prefix
SQL> create user zbl identified externally;
用户已创建。
SQL> grant connect to zbl;
授权成功。
SQL>
在Oracle Client机器上创建zbl用户:
[root@amdocs43 ~]# useradd -g dba -G oinstall zbl
[root@amdocs43 ~]# passwd zbl
Changing password for user zbl.
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@amdocs43 ~]# ping 172.19.3.24
PING 172.19.3.24 (172.19.3.24) 56(84) bytes of data.
64 bytes from 172.19.3.24: icmp_seq=1 ttl=128 time=0.220 ms
64 bytes from 172.19.3.24: icmp_seq=2 ttl=128 time=0.206 ms
64 bytes from 172.19.3.24: icmp_seq=3 ttl=128 time=0.290 ms
64 bytes from 172.19.3.24: icmp_seq=4 ttl=128 time=0.188 ms
--- 172.19.3.24 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time3001ms
rtt min/avg/max/mdev = 0.188/0.226/0.290/0.038 ms
[root@amdocs43 ~]#
这个时候在Linux主机中以zbl用户登录(当然这台机机需要已经安装了OracleClient),在客户机的$ORACLE_HOME/network/admin/tnsnames.ora文件里添加如下内容:
MYDB =
[zbl@amdocs43 ~]$ tnsping mydb
TNS Ping Utility for Linux: Version 10.2.0.5.0 - Production on09-AUG-2011 10:22:26
Copyright (c) 1997,
Used parameter files:
/oracle/product/10.2/db/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL =TCP)(HOST = 172.19.3.24)(PORT = 1521)) (CONNECT_DATA = (SERVER =DEDICATED) (SERVICE_NAME = mydb)))
OK (10 msec)
[zbl@amdocs43 ~]$
运行sqlplus /@mydb或sqlplus /nolog,connect /@mydb
[zbl@amdocs43 ~]$ whoami
zbl
[zbl@amdocs43 ~]$ sqlplus /@mydb
SQL*Plus: Release 10.2.0.5.0 - Production on Tue Aug 9 10:36:362011
Copyright (c) 1982, 2010, Oracle.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 -Production
With the Partitioning, OLAP and Data Mining options
SQL> show user
USER is "ZBL"
SQL> quit
Disconnected from Oracle Database 10g Enterprise Edition Release10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options
[zbl@amdocs43 ~]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.5.0 - Production on Tue Aug 9 11:02:222011
Copyright (c) 1982, 2010, Oracle.
SQL> connect /@mydb
Connected.
SQL> show user
USER is "ZBL"
SQL>