標籤:
此技術使用與作業系統使用者同樣的名稱建立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$只是為了向前相容。
下面,我們來實驗一下。
一、建立作業系統使用者
[[email protected] ~]# useradd test
二、建立Oracle使用者並授予相應的許可權
SQL> create user ops$test identified externally;
SQL> grant create session to ops$test;
三、用test使用者登入資料庫
[[email protected] ~]$ /u01/app/oracle/product/11.2.0.4/db_1/bin/sqlplus /Error 6 initializing SQL*PlusSP2-0667: Message file sp1<lang>.msb not foundSP2-0750: You may need to set ORACLE_HOME to your Oracle software directory
報以上錯誤,根據提示,我們為ORACLE_HOME設定響應的值
在/home/test/.bash_profile中添加如下值:
export ORACLE_BASE=/u01/app/oracleexport ORACLE_HOME=$ORACLE_BASE/product/11.2.0.4/db_1
重新用test使用者登入資料庫
[[email protected] ~]$ /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 2015Copyright (c) 1982, 2013, Oracle. All rights reserved.ERROR:ORA-12162: TNS:net service name is incorrectly specifiedEnter user-name:
又報TNS:net service name is incorrectly specified錯誤。
懷疑沒有指定響應的SID,在/home/test/.bash_profile中添加如下值:
export ORACLE_SID=orcl
重新用test使用者登入
[[email protected] ~]$ /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 2015Copyright (c) 1982, 2013, Oracle. All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - ProductionWith the Partitioning, Automatic Storage Management, OLAP, Data Miningand Real Application Testing optionsSQL> show userUSER is "OPS$TEST"
終於成功登入!
Oracle作業系統身分識別驗證