电脑知识|欧美黑人一区二区三区|软件|欧美黑人一级爽快片淫片高清|系统|欧美黑人狂野猛交老妇|数据库|服务器|编程开发|网络运营|知识问答|技术教程文章 - 好吧啦网

您的位置:首頁技術(shù)文章
文章詳情頁

撥云見日 正確認(rèn)識password file的作用

瀏覽:157日期:2022-08-07 13:43:52
許多人都知道,在數(shù)據(jù)庫沒有正式啟動前,數(shù)據(jù)庫的內(nèi)建用戶是無法通過數(shù)據(jù)庫來驗(yàn)證身份的,但口令文件中存放sysdba/sysoper用戶的用戶名及口令卻允許用戶通過口令文件驗(yàn)來證,它可以在數(shù)據(jù)庫未啟動之前登錄,然后再啟動數(shù)據(jù)庫。

(假如沒有口令文件,在數(shù)據(jù)庫未啟動之前就只能通過操作系統(tǒng)認(rèn)證)

在我們使用Rman時(shí),許多情況下需要在nomount,mount等狀態(tài)下對數(shù)據(jù)庫進(jìn)行處理,因此這就要求sysdba權(quán)限如果屬于本地DBA組,才可以通過操作系統(tǒng)認(rèn)證登錄。

(假如是遠(yuǎn)程sysdba登錄,需要通過passwordfile認(rèn)證)

1.remote_login_passwordfile = NONE

在此處我們需要停用口令文件驗(yàn)證,因?yàn)镺racle不允許遠(yuǎn)程SYSDBA/SYSOPER身份登錄。

local:

[oracle@jumper oracle]$ sqlplus '/ as sysdba'

SQL*Plus: Release 9.2.0.3.0 - Production on Thu Apr 15 09:58:45 2004

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

Connected to:

Oracle9i Enterprise Edition Release 9.2.0.3.0 - Production

With the Partitioning, OLAP and Oracle Data Mining options

JServer Release 9.2.0.3.0 - Production

SQL> alter user sys identified by oracle;

User altered.

SQL> show parameter pass

NAME TYPE VALUE

--------------------- ----------- ------------------------------

remote_login_passwordfile string NONE

remote:

E:Oracleora92bin>sqlplus /nologSQL*Plus: Release 9.2.0.4.0 -

Production on 星期四 4月 15 09:39:22 2004Copyright (c) 1982, 2002, Oracle

Corporation. All rights reserved.SQL> connect sys/oracle@hsjf as

sysdbaERROR:ORA-01017: invalid username/password; logon denied

大家可以發(fā)現(xiàn),此處是無法通過口令文件驗(yàn)證的。

2.remote_login_passwordfile = exclusive

SQL> alter system set remote_login_passwordfile=exclusive scope=spfile;

System altered.

SQL> startup force;

ORACLE instance started.

Total System Global Area 131142648 bytes

Fixed Size 451576 bytes

Variable Size 104857600 bytes

Database Buffers 25165824 bytes

Redo Buffers 667648 bytes

Database mounted.

Database opened.

SQL> show parameter pass

NAME TYPE VALUE

------------------------------ ----------- --------------

remote_login_passwordfile string EXCLUSIVE

SQL> alter user sys identified by oracle;

User altered.

remote:

E:Oracleora92bin>sqlplus /nologSQL*Plus: Release 9.2.0.4.0 -

Production on 星期四 4月 15 09:47:11 2004Copyright (c) 1982, 2002, Oracle

Corporation. All rights reserved.SQL> connect sys/oracle@hsjf as

sysdba已連接。SQL> show userUSER 為'SYS'SQL>

此處等同于通過口令文件驗(yàn)證登錄。

3.繼續(xù)測試

假如此時(shí)我們刪除passwdfile,sysdba/sysoper將會無法認(rèn)證,從而無法登錄數(shù)據(jù)庫。

Server:

SQL> !

[oracle@jumper oracle]$ cd $ORACLE_HOME/dbs

[oracle@jumper dbs]$ ls orapwhsjf

orapwhsjf

[oracle@jumper dbs]$ mv orapwhsjf orapwhsjf.bak

[oracle@jumper dbs]$

Remote:

E:Oracleora92bin>sqlplus /nolog

SQL*Plus: Release 9.2.0.4.0 - Production on 星期四 4月 15 09:50:14 2004

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

SQL> connect sys/oracle@hsjf as sysdba

ERROR:

ORA-01031: insufficient privileges

SQL>

這實(shí)際上就是無法通過口令文件驗(yàn)證身份

4.假如丟失了passwdfile

假如你使用passwdfile后卻意外丟失,那么此時(shí)將不能啟動數(shù)據(jù)庫。

SQL> startup force;

ORACLE instance started.

Total System Global Area 131142648 bytes

Fixed Size 451576 bytes

Variable Size 104857600 bytes

Database Buffers 25165824 bytes

Redo Buffers 667648 bytes

ORA-01990: error opening password file '/opt/oracle/product/9.2.0/dbs/orapw'

ORA-27037: unable to obtain file status

Linux Error: 2: No such file or directory

Additional information: 3

我們可以通過orapwd重建口令文件來解決此問題

此處我們恢復(fù)口令文件就可以了

SQL> !

[oracle@jumper oracle]$ mv $ORACLE_HOME/dbs/orapwhsjf.bak orapwhsjf

[oracle@jumper oracle]$ exit

exit

SQL> alter database open;

Database altered.

SQL>

5. remote_login_passwordfile = shared

Oracle9i文檔說明:

SHARED

More than one database can use a password file. However, the only user recognized by the password file is SYS.

--多個(gè)數(shù)據(jù)庫可以共享一個(gè)口令文件,但是只可以識別一個(gè)用戶:SYS

SQL> select * from v$pwfile_users;

USERNAME SYSDB SYSOP

------------------------------ ----- -----

SYS TRUE TRUE

SQL> grant sysdba to eygle;

grant sysdba to eygle

*

ERROR at line 1:

ORA-01994: GRANT failed: cannot add users to public password file

SQL> show parameter password

NAME TYPE VALUE

---------------------- ----------- ----------------------------

remote_login_passwordfile string SHARED

大家可以發(fā)現(xiàn),此時(shí)的口令文件中是不能添加用戶的。

很多人可能會問:口令文件的缺省名稱是orapw,如何才能共享?

其實(shí)Oracle數(shù)據(jù)庫在啟動時(shí),首先查找的是orapw的口令文件,假如該文件不存在,則開始查找,orapw的口令文件。如果口令文件命名為orapw,多個(gè)數(shù)據(jù)庫就可以共享。

再來看一下測試:

[oracle@jumper dbs]$ sqlplus '/ as sysdba'

SQL*Plus: Release 9.2.0.3.0 - Production on Tue Jul 6 09:40:34 2004

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

Connected to:

Oracle9i Enterprise Edition Release 9.2.0.3.0 - Production

With the Partitioning, OLAP and Oracle Data Mining options

JServer Release 9.2.0.3.0 - Production

SQL> shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> !

[oracle@jumper dbs]$ ls

hsjf initdw.ora inithsjf.ora init.ora lkHSJF orapwhsjf spfilehsjf.ora

[oracle@jumper dbs]$ mv orapwhsjf orapwhsjf.bak

[oracle@jumper dbs]$ exit

exit

SQL> startup

ORACLE instance started.

Total System Global Area 235999908 bytes

Fixed Size 451236 bytes

Variable Size 201326592 bytes

Database Buffers 33554432 bytes

Redo Buffers 667648 bytes

ORA-01990: error opening password file '/opt/oracle/product/9.2.0/dbs/orapw'

--它是最后查找的文件

ORA-27037: unable to obtain file status

Linux Error: 2: No such file or directory

Additional information: 3

建立orapw口令文件,此時(shí)可以打開數(shù)據(jù)庫。

SQL> !

[oracle@jumper dbs]$ ls

hsjf initdw.ora inithsjf.ora init.ora lkHSJF orapwhsjf.bak spfilehsjf.ora

[oracle@jumper dbs]$ cp orapwhsjf.bak orapw

[oracle@jumper dbs]$ exit

exit

SQL> alter database open;

Database altered.

SQL> show parameter passw

NAME TYPE VALUE

------------------------------------ ----------- ---------------

remote_login_passwordfile string SHARED

SQL>

很多人可能會產(chǎn)生有這樣的疑問,多個(gè)Exclusive的數(shù)據(jù)庫是否可以共享一個(gè)口令文件(orapw)呢?

繼續(xù)回到試驗(yàn)中:

SQL> show parameter passwordNAME TYPE VALUE

------------------------------------ ----------- ---------------

remote_login_passwordfile string SHARED

[oracle@jumper dbs]$ strings orapw

][Z

ORACLE Remote Password file

INTERNAL

AB27B53EDC5FEF41

8A8F025737A9097A

注意這里僅記錄著INTERNAL/SYS的口令

REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE 時(shí)

SQL> alter system set remote_login_passwordfile=exclusive scope=spfile;System altered.

SQL> startup force;

ORACLE instance started.

Total System Global Area 235999908 bytes

Fixed Size 451236 bytes

Variable Size 201326592 bytes

Database Buffers 33554432 bytes

Redo Buffers 667648 bytes

Database mounted.

Database opened.

SQL> !

[oracle@jumper bin]$ cd $ORACLE_HOME/dbs

[oracle@jumper dbs]$ strings orapw

][Z

ORACLE Remote Password file

HSJF

INTERNAL

AB27B53EDC5FEF41

8A8F025737A9097A

[oracle@jumper dbs]$ exit

exit

注意此處,以EXCLUSIVE方式啟動以后,實(shí)例名稱信息就會被寫入口令文件.

如果此時(shí)有其它實(shí)例以Exclusive模式啟動仍然可以使用這個(gè)口令文件,口令文件中的實(shí)例名稱同時(shí)被改寫.

這也就是說,數(shù)據(jù)庫只在啟動過程中才讀取口令文件,數(shù)據(jù)庫運(yùn)行過程中并不鎖定該文件,類似于pfile/spfile文件.

SQL> select * from v$pwfile_users;USERNAME SYSDB SYSOP

------------------------------ ----- -----

SYS TRUE TRUE

SQL> grant sysdba to eygle;

Grant succeeded.

SQL> select * from v$pwfile_users;

USERNAME SYSDB SYSOP

------------------------------ ----- -----

SYS TRUE TRUE

EYGLE TRUE FALSE

SQL> !

[oracle@jumper bin]$ cd $ORACLE_HOME/dbs

[oracle@jumper dbs]$ strings orapw

][Z

ORACLE Remote Password file

HSJF

INTERNAL

AB27B53EDC5FEF41

8A8F025737A9097A

>EYGLE

B726E09FE21F8E83

注意:

在此處我們可以增加SYSDBA用戶,并且這些信息可以被寫入到口令文件。

如果我們在口令文件中增加了其他SYSDBA用戶,這個(gè)文件就不能被其它Exclusive的實(shí)例共享。

仔細(xì)了解過后,我們可以發(fā)覺,口令文件對于其他用戶來說其實(shí)就是啟到了一個(gè)sudo的作用。

6.重建口令文件

假如口令文件丟失,使用orapwd可以很方便的重建口令文件,詳細(xì)的語法如下:

[oracle@jumper oracle]$ orapwdUsage: orapwd file= password= entries= where

file - name of password file (mand),

password - password for SYS (mand),

entries - maximum number of distinct DBA and OPERs (opt),

There are no spaces around the equal-to (=) character.

標(biāo)簽: word
主站蜘蛛池模板: 干法制粒机_智能干法制粒机_张家港市开创机械制造有限公司 | 带压开孔_带压堵漏_带压封堵-菏泽金升管道工程有限公司 | 气动|电动调节阀|球阀|蝶阀-自力式调节阀-上海渠工阀门管道工程有限公司 | 安徽控制器-合肥船用空调控制器-合肥家电控制器-合肥迅驰电子厂 安徽净化板_合肥岩棉板厂家_玻镁板厂家_安徽科艺美洁净科技有限公司 | 二手Sciex液质联用仪-岛津气质联用仪-二手安捷伦气质联用仪-上海隐智科学仪器有限公司 | 冷藏车厂家|冷藏车价格|小型冷藏车|散装饲料车厂家|程力专用汽车股份有限公司销售十二分公司 | 结晶点测定仪-润滑脂滴点测定仪-大连煜烁 | 山东限矩型液力偶合器_液力耦合器易熔塞厂家-淄博市汇川源机械厂 | 生物颗粒燃烧机-生物质燃烧机-热风炉-生物颗粒蒸汽发生器-丽水市久凯能源设备有限公司 | 合金耐磨锤头_破碎机锤头_郑州市德勤建材有限公司 | 生产加气砖设备厂家很多,杜甫机械加气砖设备价格公道 | 酒瓶_酒杯_玻璃瓶生产厂家_徐州明政玻璃制品有限公司 | 泰来华顿液氮罐,美国MVE液氮罐,自增压液氮罐,定制液氮生物容器,进口杜瓦瓶-上海京灿精密机械有限公司 | 餐饮加盟网_特色餐饮加盟店_餐饮连锁店加盟 | 耳模扫描仪-定制耳机设计软件-DLP打印机-asiga打印机-fitshape「飞特西普」 | 低温柔性试验仪-土工布淤堵-沥青车辙试验仪-莱博特(天津)试验机有限公司 | 电销卡_北京电销卡_包月电话卡-豪付网络 | 成都珞石机械 - 模温机、油温机、油加热器生产厂家 | 合肥展厅设计-安徽展台设计-合肥展览公司-安徽奥美展览工程有限公司 | 直线模组_滚珠丝杆滑台_模组滑台厂家_万里疆科技 | 轻型地埋电缆故障测试仪,频响法绕组变形测试仪,静荷式卧式拉力试验机-扬州苏电 | 昆明化妆培训-纹绣美甲-美容美牙培训-昆明博澜培训学校 | 高压微雾加湿器_工业加湿器_温室喷雾-昌润空气净化设备 | 重庆网站建设,重庆网站设计,重庆网站制作,重庆seo,重庆做网站,重庆seo,重庆公众号运营,重庆小程序开发 | 防火窗_耐火窗_防火门厂家_防火卷帘门-重庆三乐门业有限公司 | 冷镦机-多工位冷镦机-高速冷镦机厂家-温州金诺机械设备制造有限公司 | hdpe土工膜-防渗膜-复合土工膜-长丝土工布价格-厂家直销「恒阳新材料」-山东恒阳新材料有限公司 ETFE膜结构_PTFE膜结构_空间钢结构_膜结构_张拉膜_浙江萬豪空间结构集团有限公司 | 东莞注册公司-代办营业执照-东莞公司注册代理记账-极刻财税 | 中开泵,中开泵厂家,双吸中开泵-山东博二泵业有限公司 | 十二星座查询(性格特点分析、星座运势解读) - 玄米星座网 | 北京租车牌|京牌指标租赁|小客车指标出租| 申江储气罐厂家,储气罐批发价格,储气罐规格-上海申江压力容器有限公司(厂) | 彩信群发_群发彩信软件_视频短信营销平台-达信通 | 真空泵维修保养,普发,阿尔卡特,荏原,卡西亚玛,莱宝,爱德华干式螺杆真空泵维修-东莞比其尔真空机电设备有限公司 | 森旺-A级防火板_石英纤维板_不燃抗菌板装饰板_医疗板 | 软文推广发布平台_新闻稿件自助发布_媒体邀约-澜媒宝 | 电缆隧道在线监测-智慧配电站房-升压站在线监测-江苏久创电气科技有限公司 | 液压扳手-高品质液压扳手供应商 - 液压扳手, 液压扳手供应商, 德国进口液压拉马 | SRRC认证_电磁兼容_EMC测试整改_FCC认证_SDOC认证-深圳市环测威检测技术有限公司 | 一级建造师培训_一建培训机构_中建云筑建造师培训网校 | 浙江上沪阀门有限公司|