您好,登錄后才能下訂單哦!
這篇文章將為大家詳細(xì)講解有關(guān)Oracle密碼文件有什么用,小編覺(jué)得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。
--==============================
-- Oracle密碼文件
--==============================
/*
一、密碼文件
作用:主要進(jìn)行DBA權(quán)限的身份認(rèn)證
DBA用戶:具有sysdba,sysoper權(quán)限的用戶被稱為dba用戶。默認(rèn)情況下sysdba角色中存在sys用戶,sysoper角色中存在system用戶
二、Oracle的兩種認(rèn)證方式;
1.使用與操作系統(tǒng)集成的身份驗(yàn)證
2.使用Oracle數(shù)據(jù)庫(kù)的密碼文件進(jìn)行身份認(rèn)證
三、密碼文件的位置
Linux下的存放位置:$ORACLE_HOME/dbs/orapw$ORACLE_SID
即:ORACLE_HOME/dbs/orapw<sid>
Windows下的存放位置:$ORACLE_HOME/database/PWD%ORACLE_SID%.ora
密碼文件查找的順序
--->orapw<sid>--->orapw--->Failure
兩種認(rèn)證方式:類似于SQL server中的windows認(rèn)證和SQL server認(rèn)證
決定在兩個(gè)參數(shù)中
1.remote_login_passwordfile = none | exclusive |shared 位于$ORACLE_HOME/dbs/spfile$ORACLE_SID.ora參數(shù)文件中
none : 不使用密碼文件認(rèn)證
exclusive :要密碼文件認(rèn)證,自己獨(dú)占使用(默認(rèn)值)
shared :要密碼文件認(rèn)證,不同實(shí)例dba用戶可以共享密碼文件
2. $ORACLE_HOME/network/admin/sqlnet.ora
SQLNET.AUTHENTICATION_SERVICES = none | all | ntf(windows)
none : 表示關(guān)閉操作系統(tǒng)認(rèn)證,只能密碼認(rèn)證
all : 用于linux或unix平臺(tái),關(guān)閉本機(jī)密碼文件認(rèn)證,采用操作系統(tǒng)認(rèn)證,但遠(yuǎn)程<異機(jī)>可以使用密碼文件認(rèn)證
nts : 用于windows平臺(tái)
不同的組合
1 2
none none sys用戶無(wú)論是本機(jī)還是遠(yuǎn)程均不可用
四、演示:實(shí)驗(yàn)判斷當(dāng)前使用的是操作系統(tǒng)認(rèn)證還是密碼認(rèn)證
1.在sqlnet.ora中追加SQLNET.AUTHENTICATION_SERVICES = none
oracle@testdb admin]$ vi sqlnet.ora
SQLNET.AUTHENTICATION_SERVICES = none
~
"sqlnet.ora" [New] 1L, 39C written
[oracle@testdb admin]$
--使用操作系統(tǒng)登陸認(rèn)證,失敗
[oracle@testdb admin]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Dec 25 21:26:22 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
ERROR:
ORA-01017: 用戶名/口令無(wú)效; 登錄被拒絕
Enter user-name:
ERROR:
ORA-01017: invalid username/password; logon denied
Enter user-name:
ERROR:
ORA-01017: invalid username/password; logon denied
SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
[oracle@testdb admin]$
--改用密碼認(rèn)證登陸,成功。
[oracle@testdb admin]$ sqlplus sys/oracle as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Dec 25 21:27:04 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
2.將SQLNET.AUTHENTICATION_SERVICES的值改為all
[oracle@testdb admin]$ cat sqlnet.ora
SQLNET.AUTHENTICATION_SERVICES = all
[oracle@testdb admin]$
[oracle@testdb admin]$ cat tnsnames.ora
DBDB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.12)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = DBdb)
)
)
testdb =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.28)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = DBdb)
)
)
[oracle@testdb admin]$
DBDB是連接到遠(yuǎn)程的數(shù)據(jù)庫(kù)的tns
testdb是連接到本機(jī)數(shù)據(jù)庫(kù)的tns;
--使用操作系統(tǒng)登陸認(rèn)證,成功。
[oracle@testdb admin]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Dec 25 21:36:00 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@testdb admin]$
--使用本機(jī)密碼認(rèn)證,成功;
[oracle@testdb admin]$ sqlplus sys/oracle as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Dec 25 21:40:35 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
--使用本機(jī)密碼認(rèn)證加本機(jī)tns連接,失??;
[oracle@testdb admin]$ sqlplus sys/oracle@testdb as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Dec 25 21:36:17 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
ERROR:
ORA-12641: Authentication service failed to initialize
Enter user-name:
ERROR:
ORA-01017: invalid username/password; logon denied
--使用客戶端遠(yuǎn)程密碼連接方式連接本機(jī),成功:
C:\Users\Administrator>sqlplus system/oracle@192.168.56.28/DBdb
SQL*Plus: Release 11.2.0.1.0 Production on 星期二 12月 26 10:16:53 2017
Copyright (c) 1982, 2010, Oracle. All rights reserved.
連接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
--使用tns連接到其他數(shù)據(jù)庫(kù)的tns,成功;
[oracle@testdb admin]$ sqlplus sys/oracle@DBDB as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Dec 25 21:36:43 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
五、密碼文件的建立:orapwd */
[oracle@testdb ~]$ orapwd
Usage: orapwd file=<fname> password=<password> entries=<users> force=<y/n>
where
file - name of password file (mand), /*密碼文件的名字orapw<sid>*/
password - password for SYS will be prompted if not specified at command line, /*sys用戶的密碼*/
entries - maximum number of distinct DBA (optional), /*可以有多少個(gè)sysdba,sysoper權(quán)限用戶放到密碼文件中去,去掉重復(fù)記錄*/
/*注意entries中存放的個(gè)數(shù)但不是實(shí)際個(gè)數(shù),這個(gè)是二進(jìn)制數(shù)據(jù)*/
force - whether to overwrite existing file (optional),/*10g新增的參數(shù),默認(rèn)值為n ,y表示允許覆蓋*/
ignorecase - passwords are case-insensitive (optional),
nosysdba - whether to shut out the SYSDBA logon (optional Database Vault only).
There must be no spaces around the equal-to (=) character.
關(guān)于“Oracle密碼文件有什么用”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,使各位可以學(xué)到更多知識(shí),如果覺(jué)得文章不錯(cuò),請(qǐng)把它分享出去讓更多的人看到。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。