oracle本地驗證和密碼檔案
oracle的密碼檔案作用是進行DBA許可權的身份驗證。
當資料庫開啟到mount狀態時,資料庫必須要具備一個很重要的密碼檔案/口令檔案,這個檔案預設是存放在$ORACLE_HOME/dbs下的,預設名稱為orapw<sid>。如果密碼檔案丟失了,那麼資料庫啟動到mount的時候就會出錯。
密碼檔案裡面存放了sysdba/sysoper使用者的使用者名稱和口令:
[oracle@localhost dbs]$ strings orapworcl
]\[Z
ORACLE Remote Password file
INTERNAL
6A75B1BBE50E66AB
4DE42795E66117AE
IL H
當資料庫開啟到mount狀態時,資料庫必須要具備一個很重要的密碼檔案/口令檔案,這個檔案預設是存放在$ORACLE_HOME/dbs下的,預設名稱為orapw<sid>。如果密碼檔案丟失了,那麼資料庫啟動到mount的時候就會出錯。
密碼檔案裡面存放了sysdba/sysoper使用者的使用者名稱和口令:
[oracle@localhost dbs]$ strings orapworcl
]\[Z
ORACLE Remote Password file
INTERNAL
6A75B1BBE50E66AB
4DE42795E66117AE
IL H
在資料庫沒有啟動之前,資料庫的內建使用者是無法透過資料庫本身來驗證身份的,透過密碼檔案,
oracle就可以實現對使用者的驗證,在資料庫未啟動之前登入,進而啟動資料庫。
密碼檔案是可以透過orapwd工具重建的,所以在通常的備份策略中可以不必包含密碼檔案。
oracle有兩種認證方式:作業系統認證(要求該使用者屬於本地DBA組,然後透過作業系統認證登入oracle,從而啟動資料庫),密碼檔案認證
oracle使用哪種認證方式決定在於兩個引數:
(1)remote_login_passwordfile=none|exclusive|shared
SYS@orcl 11-SEP-14>create user sunny identified by sunny;
User created.
oracle就可以實現對使用者的驗證,在資料庫未啟動之前登入,進而啟動資料庫。
密碼檔案是可以透過orapwd工具重建的,所以在通常的備份策略中可以不必包含密碼檔案。
oracle有兩種認證方式:作業系統認證(要求該使用者屬於本地DBA組,然後透過作業系統認證登入oracle,從而啟動資料庫),密碼檔案認證
oracle使用哪種認證方式決定在於兩個引數:
(1)remote_login_passwordfile=none|exclusive|shared
none:不使用密碼檔案認證。如果選擇了這個值,就相當於遮蔽了密碼檔案的內容了。
exclusive:要密碼檔案認證,自己獨佔使用(預設值)
shared:要密碼檔案認證,不同例項dba使用者可以共享密碼檔案
(2)位於$ORACLE_HOME/network/admin/sqlnet.ora
SQLNET.AUTHENTICATION_SERVICES=none|all|nts
none:關閉作業系統認證,只能密碼認證
all:用於linux/unix平臺,關閉本機密碼檔案認證,採用作業系統認證
nts:用於windows平臺
實驗:
oracle伺服器位於Linux作業系統,客戶端位於windows作業系統。
首先,檢視remote_login_passwordfile引數值:
SYS@orcl 11-SEP-14>show parameter remote_login_passwordfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
remote_login_passwordfile string EXCLUSIVE
找到$ORACLE_HOME/network/admin目錄下的sqlnet.ora,在檔案末尾加上:
SQLNET.AUTHENTICATION_SERVICES=NONE
#Purpose: Use parameter SDP.PF_INET_SDP to specify the protocol family or
# address family constant for the SDP protocol on your system.
#
#Supported since: 11.0
#
SQLNET.AUTHENTICATION_SERVICES=none
即使用密碼檔案認證方式,那麼如果我們在本地使用sqlplus "/as sysdba"就會提示錯誤資訊:
[oracle@localhost ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.1.0 Production on Fri Sep 12 22:45:56 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
ERROR:
ORA-01031: insufficient privileges
此時我們必須使用sys使用者名稱和密碼才可以登入:
[oracle@localhost ~]$ sqlplus "sys/sys as sysdba"
SQL*Plus: Release 11.2.0.1.0 Production on Fri Sep 12 22:47:08 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
進入sqlnet.ora把SQLNET.AUTHENTICATION_SERVICES=none改成“=all”,存檔退出。
再次使用sqlplus "/as sysdba"登入的時候使用的就是本地認證:
[oracle@localhost ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.1.0 Production on Fri Sep 12 22:49:51 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
另外,我們可以使用orapwd這個工具來生成密碼檔案。
首先看看orapwd的用法:
[oracle@localhost ~]$ orapwd
Usage: orapwd file=<fname> entries=<users> force=<y/n> ignorecase=<y/n> nosysdba=<y/n>
where
file - name of password file (required),
password - password for SYS will be prompted if not specified at command line,
entries - maximum number of distinct DBA (optional),
force - whether to overwrite existing file (optional),
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.
我們把位於$ORACLE_HOME/dbs目錄下的原orapworcl移到其它目錄。注意,remote_login_passwordfile=exclusive,且sqlnet.ora中SQLNET.AUTHENTICATION_SERVICES=none
在windows上的客戶端嘗試遠端oracle:
SQL> conn sys/sys@win as sysdba
ERROR:
ORA-01031: insufficient privileges
現在我們使用orapwd來重建密碼檔案:
[oracle@localhost dbs]$ orapwd file=$ORACLE_HOME/dbs/orapworcl password=sys entries=5
[oracle@localhost dbs]$ ls
hc_DBUA0.dat initorcl lkORCL peshm_DUMMY_0 spfileorcl.ora
hc_orcl.dat initorcl.ora orapworcl peshm_orcl_0
init.ora lkDUMMY peshm_DBUA0_0 snapcf_orcl.f
再次嘗試遠端連線oracle:
SQL> conn sys/sys@win as sysdba
已連線。
看看這個密碼檔案的內容:
[oracle@localhost dbs]$ strings orapworcl
]\[Z
ORACLE Remote Password file
INTERNAL
6A75B1BBE50E66AB
4DE42795E66117AE
在資料庫中建立一個新的使用者並授予sysdba的許可權:exclusive:要密碼檔案認證,自己獨佔使用(預設值)
shared:要密碼檔案認證,不同例項dba使用者可以共享密碼檔案
(2)位於$ORACLE_HOME/network/admin/sqlnet.ora
SQLNET.AUTHENTICATION_SERVICES=none|all|nts
none:關閉作業系統認證,只能密碼認證
all:用於linux/unix平臺,關閉本機密碼檔案認證,採用作業系統認證
nts:用於windows平臺
實驗:
oracle伺服器位於Linux作業系統,客戶端位於windows作業系統。
首先,檢視remote_login_passwordfile引數值:
SYS@orcl 11-SEP-14>show parameter remote_login_passwordfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
remote_login_passwordfile string EXCLUSIVE
SQLNET.AUTHENTICATION_SERVICES=NONE
#Purpose: Use parameter SDP.PF_INET_SDP to specify the protocol family or
# address family constant for the SDP protocol on your system.
#
#Supported since: 11.0
#
SQLNET.AUTHENTICATION_SERVICES=none
[oracle@localhost ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.1.0 Production on Fri Sep 12 22:45:56 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
ERROR:
ORA-01031: insufficient privileges
此時我們必須使用sys使用者名稱和密碼才可以登入:
[oracle@localhost ~]$ sqlplus "sys/sys as sysdba"
SQL*Plus: Release 11.2.0.1.0 Production on Fri Sep 12 22:47:08 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
進入sqlnet.ora把SQLNET.AUTHENTICATION_SERVICES=none改成“=all”,存檔退出。
再次使用sqlplus "/as sysdba"登入的時候使用的就是本地認證:
[oracle@localhost ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.1.0 Production on Fri Sep 12 22:49:51 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@localhost ~]$ orapwd
Usage: orapwd file=<fname> entries=<users> force=<y/n> ignorecase=<y/n> nosysdba=<y/n>
where
file - name of password file (required),
password - password for SYS will be prompted if not specified at command line,
entries - maximum number of distinct DBA (optional),
force - whether to overwrite existing file (optional),
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.
在windows上的客戶端嘗試遠端oracle:
SQL> conn sys/sys@win as sysdba
ERROR:
ORA-01031: insufficient privileges
[oracle@localhost dbs]$ orapwd file=$ORACLE_HOME/dbs/orapworcl password=sys entries=5
[oracle@localhost dbs]$ ls
hc_DBUA0.dat initorcl lkORCL peshm_DUMMY_0 spfileorcl.ora
hc_orcl.dat initorcl.ora orapworcl peshm_orcl_0
init.ora lkDUMMY peshm_DBUA0_0 snapcf_orcl.f
再次嘗試遠端連線oracle:
SQL> conn sys/sys@win as sysdba
已連線。
看看這個密碼檔案的內容:
[oracle@localhost dbs]$ strings orapworcl
]\[Z
ORACLE Remote Password file
INTERNAL
6A75B1BBE50E66AB
4DE42795E66117AE
SYS@orcl 11-SEP-14>create user sunny identified by sunny;
User created.
SYS@orcl 11-SEP-14>grant sysdba to sunny;
Grant succeeded.
Grant succeeded.
再去看看orapworcl的內容,發現多了sunny這個使用者的資訊:
[oracle@localhost dbs]$ strings orapworcl
]\[Z
ORACLE Remote Password file
INTERNAL
6A75B1BBE50E66AB
4DE42795E66117AE
SUNNY
53801465943A91BE
[oracle@localhost dbs]$ strings orapworcl
]\[Z
ORACLE Remote Password file
INTERNAL
6A75B1BBE50E66AB
4DE42795E66117AE
SUNNY
53801465943A91BE
也可以透過動態效能檢視v$pwfile_users檢視有哪些使用者是擁有sysdba許可權的:
SYS@orcl 11-SEP-14>select * from v$pwfile_users;
USERNAME SYSDB SYSOP SYSAS
------------------------------ ----- ----- -----
SYS TRUE TRUE FALSE
SUNNY TRUE FALSE FALSE
SYS@orcl 11-SEP-14>select * from v$pwfile_users;
USERNAME SYSDB SYSOP SYSAS
------------------------------ ----- ----- -----
SYS TRUE TRUE FALSE
SUNNY TRUE FALSE FALSE
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30345407/viewspace-2139241/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle 密碼檔案Oracle密碼
- Oracle:ASM & 密碼檔案OracleASM密碼
- oracle 開啟複雜密碼驗證Oracle密碼
- ORACLE密碼錯誤驗證延遲Oracle密碼
- Oracle資料庫密碼延遲驗證Oracle資料庫密碼
- 1.6.5.1. 準備使用密碼檔案進行身份驗證密碼
- 1.6.5.2. 通過密碼檔案驗證連線資料庫密碼資料庫
- 1.6.5. 使用密碼檔案認證密碼
- Oracle 12c的DG自動同步密碼檔案--ASM 新特性:共享密碼檔案Oracle密碼ASM
- ORACLE 11g的密碼錯誤延時驗證Oracle密碼
- jq驗證檔案
- ACCESS 密碼驗證/文字驗證中的小坑密碼
- django-驗證碼/靜態檔案處理Django
- 無密碼驗證:客戶端密碼客戶端
- JavaScript驗證碼生成和驗證效果JavaScript
- 賬戶、密碼格式···正則驗證密碼
- 強密碼驗證正規表示式密碼
- 1.7.3. 禁用和共享資料庫密碼檔案資料庫密碼
- JQuery表單驗證(包括:使用者名稱,手機號,密碼,確認密碼,驗證碼60s)jQuery密碼
- jQuery Validate驗證確認密碼是否相同jQuery密碼
- 使用Docker部署帶密碼驗證的RedisDocker密碼Redis
- jquery 驗證密碼一致性jQuery密碼
- 密碼安全和無密碼身份認證那些事兒密碼
- Flutter 密碼輸入框 驗證碼輸入框Flutter密碼
- 【密碼檔案】Oracle 18c orapwd 命令 OPW-00029: Password complexity failed密碼OracleAI
- Oracle優化案例-建立不成功的密碼檔案(二十七)Oracle優化密碼
- 重建共享(db或asm)密碼檔案 in Oracle 19c RAC-20220209ASM密碼Oracle
- 1.7. 建立和維護資料庫密碼檔案資料庫密碼
- 管理(002):建立密碼檔案示例密碼
- 管理(005):密碼檔案設定密碼
- iOS釋出證書.p12檔案無密碼解決辦法及匯出帶密碼的新.p12檔案方法iOS密碼
- PDF檔案有限制密碼,該如何編輯檔案?密碼
- swift 郵箱、密碼、手機號、身份證驗證正則Swift密碼
- squid 反向代理且需要賬號、密碼驗證UI密碼
- 直播系統app原始碼,shiro簡單的密碼加鹽與密碼驗證APP原始碼密碼
- jQuery Validate驗證上傳檔案大小jQuery
- python怎麼驗證檔案是否存在Python
- Oracle資料檔案和臨時檔案的管理Oracle
- rsync同步和備份檔案到本地