亚洲精品久久久中文字幕-亚洲精品久久片久久-亚洲精品久久青草-亚洲精品久久婷婷爱久久婷婷-亚洲精品久久午夜香蕉

您的位置:首頁技術文章
文章詳情頁

撥云見日 正確認識password file的作用

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

(假如沒有口令文件,在數據庫未啟動之前就只能通過操作系統認證)

在我們使用Rman時,許多情況下需要在nomount,mount等狀態下對數據庫進行處理,因此這就要求sysdba權限如果屬于本地DBA組,才可以通過操作系統認證登錄。

(假如是遠程sysdba登錄,需要通過passwordfile認證)

1.remote_login_passwordfile = NONE

在此處我們需要停用口令文件驗證,因為Oracle不允許遠程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

大家可以發現,此處是無法通過口令文件驗證的。

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>

此處等同于通過口令文件驗證登錄。

3.繼續測試

假如此時我們刪除passwdfile,sysdba/sysoper將會無法認證,從而無法登錄數據庫。

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>

這實際上就是無法通過口令文件驗證身份

4.假如丟失了passwdfile

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

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重建口令文件來解決此問題

此處我們恢復口令文件就可以了

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.

--多個數據庫可以共享一個口令文件,但是只可以識別一個用戶: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

大家可以發現,此時的口令文件中是不能添加用戶的。

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

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

再來看一下測試:

[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口令文件,此時可以打開數據庫。

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>

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

繼續回到試驗中:

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 時

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方式啟動以后,實例名稱信息就會被寫入口令文件.

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

這也就是說,數據庫只在啟動過程中才讀取口令文件,數據庫運行過程中并不鎖定該文件,類似于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用戶,這個文件就不能被其它Exclusive的實例共享。

仔細了解過后,我們可以發覺,口令文件對于其他用戶來說其實就是啟到了一個sudo的作用。

6.重建口令文件

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

[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.

標簽: word
主站蜘蛛池模板: 992tv快乐视频在线啪啪免费 | 国内精品久久久久影院6 | 美女白丝超短裙被输出动态图 | 特级淫片aaaa毛片aa视频 | 污污网站免费入口链接 | 一级做人爰a全过程免费视频 | 高清影院|精品秒播3 | 国产在线一区在线视频 | 国精产品一区一区三区 | 免费一级欧美大片视频在线 | 亚洲欧美一区二区三区九九九 | 欧美精品国产日韩综合在线 | 黄色毛片网| 午夜激情福利视频 | 免费看国产一级特黄aa大片 | 99视频在线观看高清 | 亚洲午夜国产片在线观看 | 97超级碰碰碰久久久观看 | 樱花aⅴ一区二区三区四区 樱花草在线社区www韩国 | 91视频免费观看 | 在线视频亚洲欧美 | 国产自在自线2021 | 99久久久国产精品免费播放器 | 黄色一级视频在线播放 | 18岁免费网站 | 婷婷六月在线 | 亚洲欧美另类视频 | 欧美一级高清片在线 | 嫩草在线视频www免费观看 | 久青青| 天天更新天天久久久更新影院 | 激情动态视频 | 午夜在线精品不卡国产 | 欧美毛片免费观看 | 日韩中文字幕电影在线观看 | 免费xxxxx大片观看 | 国产超级乱淫视频播放 | 亚洲精品一区二区久久 | 久久亚洲综合中文字幕 | 日韩免费视频播播 | 一级毛片免费看 |