oracle密码文件

来源:互联网 发布:微信做淘宝客 编辑:程序博客网 时间:2024/06/06 20:53

一.概念

密码文件主要进行DBA权限的身份认证,具有sysdba,sysoper权限的用户被称为dba用户。默认情况下sysdba角色中存在sys用户,sysoper角色中存在system用户。

二.存放位置

$ORACLE_HOME/dbs/orapw<sid>

密码文件的查找顺序为orapw<sid>àorapwàfailure

三.oracle的两种认证方式

1.使用与操作系统集成的身份认证

2.使用oracle数据库的密码文件进行身份认证

认证方式的两个参数

a. remote_login_passwordfile=none|exclusive|shared

位于$ORACLE_HOME/dbs/spfile<sid>参数文件中

   None:不使用密码文件远程认证

   Exclusive:要密码文件认证,自己独占使用(默认值)

SQL> show parameter remote_login

 

NAME                                 TYPE        VALUE

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

remote_login_passwordfile            string      EXCLUSIVE

b.$ORACLE_HOME/network/admin/sqlnet.ora

SQLNET.AUTHENTICATION_SERVICES=none| all |ntf(windows)

  None:关闭操作系统认证,密码认证

  All:本机密码文件认证,操作系统认证,远程不可以使用密码文件认证

  Nts:用于windows平台

 

测试验证场景:

1.      remote_login_passwordfile=exclusive,且无sqlnet.ora

a.操作系统认证,登录成功

[oracle@redhat5 admin]$ sqlplus / as sysdba

这里需要注意的一点是,使用sqlplus sys/** as sysdba登录时,不论用户名和密码是否正确都可以正常登录,此时登录是使用的特殊的操作系统认证。甚至当用户名不为sys时比如说[oracle@redhat5 admin]$ sqlplus scott/o as sysdba 也可以正常登录,登录后的用户为”sys”

b.      本地密码文件认证,登录成功

已经实现赋sysdba的权限给scott用户,密码文件中已经存放scott的密码信息

SQL>select * from v$pwfile_users;

 

USERNAME                       SYSDB SYSOP SYSAS

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

SYS                            TRUE  TRUE FALSE

TEST                           TRUE  FALSE FALSE

SCOTT                          TRUE  FALSE FALSE

[oracle@redhat5 admin]$ sqlplus scott/oracle;

C.  远程登录成功

[oracle@redhat5dbs]$ sqlplus sys/oracle@orcl as sysdba

2.      remote_login_passwordfile=exclusive,在sqlnet.ora中追加

SQLNET.AUTHTICATION_SERVICES=none

a.      操作系统认证失败

[oracle@redhat5 admin]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.3.0 Production onThu Jan 21 04:30:15 2016

 

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

 

ERROR:

ORA-01031: insufficient privileges

b.      本地密码文件认证成功

[oracle@redhat5 admin]$ sqlplus sys/oracleas sysdba

 

SQL*Plus: Release 11.2.0.3.0 Production onThu Jan 21 04:31:52 2016

 

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

 

 

Connected to:

Oracle Database 11g Enterprise EditionRelease 11.2.0.3.0 - 64bit Production

With the Partitioning, OLAP, Data Miningand Real Application Testing options

但是需要注意的一点是,此时再使用sqlplus sys/**的方式就不能登陆了,因为操作系统禁用,只能使用正确的密码登录进行密码文件认证。

[oracle@redhat5 admin]$ sqlplus sys/test assysdba

 

SQL*Plus: Release 11.2.0.3.0 Production onThu Jan 21 04:33:31 2016

 

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

 

ERROR:

ORA-01017: invalid username/password; logondenied

c.      远程密码文件认证成功

[oracle@redhat5 admin]$ sqlplussys/oracle@orcl as sysdba

 

SQL*Plus: Release 11.2.0.3.0 Production onThu Jan 21 04:36:29 2016

 

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

 

 

Connected to:

Oracle Database 11g Enterprise EditionRelease 11.2.0.3.0 - 64bit Production

With the Partitioning, OLAP, Data Miningand Real Application Testing options

3.      remote_login_passewordfile=exclusive,将sqlnet.authentication_services的值改为all

a.      操作系统认证成功

[oracle@redhat5 admin]$ sqlplus sys/1 assysdba

b.      本地密码文件认证成功

[oracle@redhat5 admin]$ sqlplusscott/oracle;

c.      远程密码文件登录失败

[oracle@redhat5 admin]$ sqlplussys/oracle@orcl as sysdba

4.      remote_login_passwordfile=none且无sqlnet.ora文件

a.      操作系统认证成功

b.      本地密码文件认证成功

c.      远程密码文件登录失败

5.      remote_login_passwordfile=none,且sqlnet.ora中

sqlnet.authentication_services的值改为NONE

三种方式均不能正常登录

四.密码文件的建立:orapwd

orapwd file=orapw<sid> password=oracleforce=y

force表示允许覆盖

esle补充一个视图

select * from v$psfile_users;

可以查看那些用户是sysdba,那些用户是sysope

0 0
原创粉丝点击