多多色-多人伦交性欧美在线观看-多人伦精品一区二区三区视频-多色视频-免费黄色视屏网站-免费黄色在线

國內(nèi)最全IT社區(qū)平臺 聯(lián)系我們 | 收藏本站
阿里云優(yōu)惠2
您當(dāng)前位置:首頁 > 互聯(lián)網(wǎng) > 關(guān)于 SQLNET.AUTHENTICATION_SERVICES 驗證方式的說明

關(guān)于 SQLNET.AUTHENTICATION_SERVICES 驗證方式的說明

來源:程序員人生   發(fā)布時間:2014-09-08 15:18:42 閱讀次數(shù):3528次
今天去客戶那里巡檢,客戶提出為了提高數(shù)據(jù)庫安全性考慮,需要修改sys/system密碼,并通過數(shù)據(jù)庫驗證方式來取代默認(rèn)的操作系統(tǒng)方式,現(xiàn)在我來把這兩種驗證方式總結(jié)一下。


操作系統(tǒng)驗證,即通過操作系統(tǒng)賬戶的權(quán)限訪問數(shù)據(jù)庫,舉個例子,如果已經(jīng)擁有了windows下的系統(tǒng)管理員administrator的權(quán)限,那么當(dāng)采用該方式驗證的話,無需輸入用戶/密碼就可以訪問,比如:sqlplus / as sysdba;哪怕是任意輸入的用戶名和密碼,也無所謂,比如:sqlplus abc/efg as sysdba;


C:Documents and SettingsAdministrator>sqlplus / as sysdba


SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 8月 28 21:02:25 2014


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




連接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options


SQL> exit
從 Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options 斷開


C:Documents and SettingsAdministrator>sqlplus abc/efg as sysdba


SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 8月 28 21:02:33 2014


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




連接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options


SQL>


當(dāng)然,這僅限于sys用戶,對于其他用戶,哪怕是system,也是必須輸入用戶名和密碼才能訪問數(shù)據(jù)庫的


C:Documents and SettingsAdministrator>sqlplus system/123456


SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 8月 28 21:05:07 2014


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


ERROR:
ORA-01017: 用戶名/口令無效; 登錄被拒絕




請輸入用戶名:


我的環(huán)境中,默認(rèn)sys和system用戶的密碼都是"oracle",數(shù)據(jù)庫sys用戶的密碼,是存放在PWD<SID>.ora中的(Unix/Linux中為oraPW<SID>),想知道sys用戶是否有密碼,可以通過以下語句查詢:
SQL> select * from v$pwfile_users;


USERNAME                       SYSDB SYSOP
------------------------------ ----- -----
SYS                            TRUE  TRUE


顯然,對于采用操作系統(tǒng)驗證來訪問數(shù)據(jù)庫,安全性還是有一定隱患的,通常在大公司,SA和DBA都是分權(quán)管理的,如果數(shù)據(jù)庫因為采用了操作系統(tǒng)驗證方式,而使SA可以隨意訪問數(shù)據(jù)庫那也是不太合適的。基于這種場景,那么我們就可以采用數(shù)據(jù)庫驗證方式來限制sys用戶必須輸入正確的用戶名和密碼才能夠訪問數(shù)據(jù)庫。這樣的話,當(dāng)SA沒有DBA的sys密碼,就無法訪問數(shù)據(jù)庫了。


在windows中,是通過sqlnet.ora這個文件來實現(xiàn)驗證機制控制的,當(dāng)你裝完數(shù)據(jù)庫并用netca創(chuàng)建了監(jiān)聽,就會生成這個文件,通常默認(rèn)是以下內(nèi)容:
# This file is actually generated by netca. But if customers choose to 
# install "Software Only", this file won't exist and without the native 
# authentication, they will not be able to connect to the database on NT.


SQLNET.AUTHENTICATION_SERVICES = (NTS)


也就是說,默認(rèn)就是采用操作系統(tǒng)驗證的,也許Oracle認(rèn)為,擁有了SA權(quán)限,就擁有了系統(tǒng)最高權(quán)限,所以數(shù)據(jù)庫DBA的sys用戶也無需再驗證密碼了


如果設(shè)置成(NONE),就表示采用數(shù)據(jù)庫身份驗證,還可以設(shè)置成(NONE,NTS),其實這樣設(shè)也沒有意義了,只要括號中有NTS,就會采用操作系統(tǒng)驗證,NONE就沒有用了


這里要指出一點,有些文章中說還可以設(shè)置成(ALL),但我設(shè)計測試下來,如果設(shè)置成(ALL),會提示ERROR:
C:Documents and SettingsAdministrator>sqlplus / as sysdba


SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 8月 28 21:26:06 2014


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


ERROR:
ORA-12641: 驗證服務(wù)無法初始化


請輸入用戶名:


如,以下這段描述:
Use the parameter SQLNET.AUTHENTICATION_SERVICES to enable one or more authentication services.
If authentication has been installed,it is recommended that this parameter be set to either none or to one of the authentication methods.
 
NONE for no authentication methods. A valid username and password can be used to access the database.
ALL for all authentication methods
NTS for Windows NT native authentication(An authentication method that enables
a client single login access to a Windows NT server and a database running on the server)


雖然這里說到了有ALL,不過我親自測試過,確實不行,也許和版本有關(guān),我的版本是10.2.0.1 windows 32bit的


--修改為(NONE)后登陸
C:Documents and SettingsAdministrator>sqlplus / as sysdba


SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 8月 28 21:50:49 2014


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


ERROR:
ORA-01031: 權(quán)限不足




請輸入用戶名:  sys as sysdba
輸入口令: --此處輸入正確的密碼“oracle”


連接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL>


--斷開連接,把(NONE)改為(NTS)直接連接
SQL> disc
從 Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options 斷開
SQL> conn abc/123 as sysdba
ERROR:
ORA-01031: 權(quán)限不足



由于沒有退出SQLPLUS,剛才改的(NTS)還未生效,可見sqlnet.ora文件是在進入SQLPLUS時才去讀取的


--仍然保持(NTS),退出SQLPLUS后重新登陸
SQL> exit


C:Documents and SettingsAdministrator>sqlplus / as sysdba


SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 8月 28 21:54:52 2014


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




連接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options


SQL>


現(xiàn)在又是操作系統(tǒng)驗證了


注意,如果改成(NONE)以后,當(dāng)使用RMAN時,system用戶就不能操作了,輸入正確的密碼也不行,只有sys用戶并輸入密碼才可以,測試如下:


--設(shè)置為(NTS)的時候登陸RMAN
C:Documents and SettingsAdministrator>rman target /


恢復(fù)管理器: Release 10.2.0.1.0 - Production on 星期四 8月 28 22:02:07 2014


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


連接到目標(biāo)數(shù)據(jù)庫: ORCL10G (DBID=1041171248)


RMAN> exit




恢復(fù)管理器完成。


C:Documents and SettingsAdministrator>rman target system/oracle


恢復(fù)管理器: Release 10.2.0.1.0 - Production on 星期四 8月 28 22:02:33 2014


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


連接到目標(biāo)數(shù)據(jù)庫: ORCL10G (DBID=1041171248)


RMAN> exit




恢復(fù)管理器完成。


--修改為(NONE)后,再用密碼登陸一次RMAN
C:Documents and SettingsAdministrator>rman target system/oracle --注意,這里密碼是正確的


恢復(fù)管理器: Release 10.2.0.1.0 - Production on 星期四 8月 28 22:03:06 2014


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


RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00554: 內(nèi)部恢復(fù)管理器程序包初始化失敗
RMAN-04005: 目標(biāo)數(shù)據(jù)庫中存在錯誤:
ORA-01031: 權(quán)限不足


C:Documents and SettingsAdministrator>rman target /


恢復(fù)管理器: Release 10.2.0.1.0 - Production on 星期四 8月 28 22:08:47 2014


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


RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00554: 內(nèi)部恢復(fù)管理器程序包初始化失敗
RMAN-04005: 目標(biāo)數(shù)據(jù)庫中存在錯誤:
ORA-01031: 權(quán)限不足


C:Documents and SettingsAdministrator>rman target sys/oracle


恢復(fù)管理器: Release 10.2.0.1.0 - Production on 星期四 8月 28 22:03:16 2014


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


連接到目標(biāo)數(shù)據(jù)庫: ORCL10G (DBID=1041171248)


RMAN>


很顯然,在采用數(shù)據(jù)庫身份驗證以后,system用戶被禁止使用RMAN了,只有擁有數(shù)據(jù)庫最高權(quán)限的sys用戶,才能登陸RMAN,而且必須是輸入密碼的方式登陸


總結(jié):


在windows下,SQLNET.AUTHENTICATION_SERVICES必須設(shè)置為NTS才能使用OS認(rèn)證,不設(shè)置(如,把該行語句加#注釋符號)或者設(shè)置為其他任何值都不能使用OS認(rèn)證。
主要是以下幾種情況:
1. sqlnet.ora文件為空,或用#注釋掉              --基于Oracle密碼文件驗證
2. SQLNET.AUTHENTICATION_SERVICES = (NTS)       --基于操作系統(tǒng)驗證
3. SQLNET.AUTHENTICATION_SERVICES = (NONE)      --基于Oracle密碼文件驗證
4. SQLNET.AUTHENTICATION_SERVICES = (NONE,NTS)  --基于操作系統(tǒng)驗證(前后順序顛倒也一樣)


注意:默認(rèn)情況下,Unix/Linux下的sqlnet.ora文件是沒有SQLNET.AUTHENTICATION_SERVICES參數(shù)的,似乎連sqlnet.ora這個文件也沒有,這和windows有很大的不同
此時是操作系統(tǒng)驗證和Oracle密碼驗證并存,如果加上SQLNET.AUTHENTICATION_SERVICES這個參數(shù)后,不管是設(shè)置為(NONE)、(NTS)或(NONE,NTS),都是基于Oracle密碼驗證。




生活不易,碼農(nóng)辛苦
如果您覺得本網(wǎng)站對您的學(xué)習(xí)有所幫助,可以手機掃描二維碼進行捐贈
程序員人生
------分隔線----------------------------
分享到:
------分隔線----------------------------
關(guān)閉
程序員人生
主站蜘蛛池模板: 日本一道dvd在线中文字幕 | www视频在线观看com | japanesexxxxx护士 japanesexxx在线播放 | 国产精品v欧美精品v日韩 | 久爱免费观看在线网站 | 欧美xxxx做受欧美精品 | 日韩欧美久久一区二区 | 九月丁香激情综合婷婷玉立 | 欧洲区二区三区四区 | 在线a级 | 日韩老女人| 久久国产精品1区2区3区网页 | 亚洲国产精品乱码在线观看97 | 天堂在线视频观看 | 欧洲freexxxx性 | 亚洲成a人v欧美综合天 | 久久麻豆亚洲精品 | 亚洲视频免费播放 | 啪啪欧美 | 久久一级 | 一区二区三区在线播放视频 | 亚洲日韩欧美综合 | 国产成人免费手机在线观看视频 | 六九视频在线观看 | 国产欧美国产精品第一区 | 亚洲不卡在线观看 | 一级特黄aa毛片免费观看 | 在线观看亚洲一区 | 黄色录像大片毛片aa | 久久国产精品-久久精品 | 国内精品一区二区 | 最新激情网站 | 日本天堂在线播放 | 国产一区二区在线不卡 | 国产精品精品视频 | 成年人免费网站视频 | jizz亚洲日本 | 久久国产精品-久久精品 | 午夜dj在线观看免费视频www | 精品欧美| 中文字幕第30页 |