日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Oracle 本地验证和密码文件

發(fā)布時(shí)間:2024/9/21 编程问答 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Oracle 本地验证和密码文件 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
oracle的密碼文件作用是進(jìn)行DBA權(quán)限的身份驗(yàn)證。 當(dāng)數(shù)據(jù)庫開啟到mount狀態(tài)時(shí),數(shù)據(jù)庫必須要具備一個(gè)很重要的密碼文件/口令文件,這個(gè)文件默認(rèn)是存放在$ORACLE_HOME/dbs下的,缺省名稱為orapw。如果密碼文件丟失了,那么數(shù)據(jù)庫啟動(dòng)到mount的時(shí)候就會(huì)出錯(cuò)。 密碼文件里面存放了sysdba/sysoper用戶的用戶名和口令: [oracle@localhost dbs]$ strings orapworcl ORACLE Remote Password file INTERNAL 6A75B1BBE50E66AB 4DE42795E66117AE 在數(shù)據(jù)庫沒有啟動(dòng)之前,數(shù)據(jù)庫的內(nèi)建用戶是無法通過數(shù)據(jù)庫本身來驗(yàn)證身份的,通過密碼文件, oracle就可以實(shí)現(xiàn)對用戶的驗(yàn)證,在數(shù)據(jù)庫未啟動(dòng)之前登錄,進(jìn)而啟動(dòng)數(shù)據(jù)庫。 密碼文件是可以通過orapwd工具重建的,所以在通常的備份策略中可以不必包含密碼文件。 oracle有兩種認(rèn)證方式:操作系統(tǒng)認(rèn)證(要求該用戶屬于本地DBA組,然后通過操作系統(tǒng)認(rèn)證登錄oracle,從而啟動(dòng)數(shù)據(jù)庫),密碼文件認(rèn)證 oracle使用哪種認(rèn)證方式?jīng)Q定在于兩個(gè)參數(shù): (1)remote_login_passwordfile=none|exclusive|shared none:不使用密碼文件認(rèn)證。如果選擇了這個(gè)值,就相當(dāng)于屏蔽了密碼文件的內(nèi)容了。 exclusive:要密碼文件認(rèn)證,自己獨(dú)占使用(默認(rèn)值) shared:要密碼文件認(rèn)證,不同實(shí)例dba用戶可以共享密碼文件 (2)位于$ORACLE_HOME/network/admin/sqlnet.ora SQLNET.AUTHENTICATION_SERVICES=none|all|nts none:關(guān)閉操作系統(tǒng)認(rèn)證,只能密碼認(rèn)證 all:用于linux/unix平臺(tái),關(guān)閉本機(jī)密碼文件認(rèn)證,采用操作系統(tǒng)認(rèn)證 nts:用于windows平臺(tái) 實(shí)驗(yàn): oracle服務(wù)器位于Linux操作系統(tǒng),客戶端位于windows操作系統(tǒng)。 首先,查看remote_login_passwordfile參數(shù)值: SYS@orcl 11-SEP-14>show parameter remote_login_passwordfileNAME 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 即使用密碼文件認(rèn)證方式,那么如果我們在本地使用sqlplus "/as sysdba"就會(huì)提示錯(cuò)誤信息: [oracle@localhost ~]$ sqlplus "/as sysdba" SQL*Plus: Release 11.2.0.1.0 Production on Fri Sep 12 22:45:56 2014Copyright (c) 1982, 2009, Oracle. All rights reserved.ERROR: ORA-01031: insufficient privileges 此時(shí)我們必須使用sys用戶名和密碼才可以登錄: [oracle@localhost ~]$ sqlplus "sys/sys as sysdba"SQL*Plus: Release 11.2.0.1.0 Production on Fri Sep 12 22:47:08 2014Copyright (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

進(jìn)入sqlnet.ora把SQLNET.AUTHENTICATION_SERVICES=none改成“=all”,存盤退出。

再次使用sqlplus "/as sysdba"登錄的時(shí)候使用的就是本地認(rèn)證: [oracle@localhost ~]$ sqlplus "/as sysdba"SQL*Plus: Release 11.2.0.1.0 Production on Fri Sep 12 22:49:51 2014Copyright (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這個(gè)工具來生成密碼文件。

首先看看orapwd的用法: [oracle@localhost ~]$ orapwd Usage: orapwd file= entries= force= ignorecase= nosysdba=wherefile - 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上的客戶端嘗試遠(yuǎn)程oracle: SQL> conn sys/sys@win as sysdba ERROR: ORA-01031: insufficient privileges 現(xiàn)在我們使用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 再次嘗試遠(yuǎn)程連接oracle: SQL> conn sys/sys@win as sysdba
connected.

看看這個(gè)密碼文件的內(nèi)容:

[oracle@localhost dbs]$ strings orapworcl ORACLE Remote Password file INTERNAL 6A75B1BBE50E66AB 4DE42795E66117AE

?


在數(shù)據(jù)庫中創(chuàng)建一個(gè)新的用戶并授予sysdba的權(quán)限: SYS@orcl 11-SEP-14>create user sunny identified by sunny;User created. SYS@orcl 11-SEP-14>grant sysdba to sunny;Grant succeeded.

再去看看orapworcl的內(nèi)容,發(fā)現(xiàn)多了sunny這個(gè)用戶的信息:

[oracle@localhost dbs]$ strings orapworclORACLE Remote Password file INTERNAL 6A75B1BBE50E66AB 4DE42795E66117AE SUNNY 53801465943A91BE 也可以通過動(dòng)態(tài)性能視圖v$pwfile_users查看有哪些用戶是擁有sysdba權(quán)限的: SYS@orcl 11-SEP-14>select * from v$pwfile_users;USERNAME SYSDB SYSOP SYSAS ------------------------------ ----- ----- ----- SYS TRUE TRUE FALSE SUNNY TRUE FALSE FALSE

?

轉(zhuǎn)載于:https://www.cnblogs.com/priestess-zhao/p/8183447.html

總結(jié)

以上是生活随笔為你收集整理的Oracle 本地验证和密码文件的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。