您的位置:首页 > 博客中心 > 数据库 >

Oracle中password file的作用及说明 orapwd命令的使用

时间:2022-03-14 02:18

在数据库没有启动之前,数据库内建用户是无法通过数据库来验证身份的

口令文件中存放sysdba/sysoper用户的用户名及口令
允许用户通过口令文件验证,在数据库未启动之前登陆
从而启动数据库

如果没有口令文件,在数据库未启动之前就只能通过操作系统认证.

使用Rman,很多时候需要在nomount,mount等状态对数据库进行处理
所以通常要求sysdba权限如果属于本地DBA组,可以通过操作系统认证登陆
如果是远程sysdba登陆,需要通过passwordfile认证.

1.remote_login_passwordfile = NONE

此时停用口令文件验证,Oracle数据库不允许远程SYSDBA/SYSOPER身份登录
无法通过远程进行数据库起停等操作管理

local:

 

  • file:变量orapwmercury为‘orapw$ORACLE_SID‘格式,如sid为test则命令文件为orapwtest,这点必须按格式来,并且该文件要放置在$ORACLE_HOME/dbs/目录下。

  • password:变量lzx123为设定给sys用户的密码

  • entries:10表明可以有10个sysdba权限用户,不可超过10个,目前已经定义了sys一个。

  • 注:改动生效需要重启数据库。


    3、应用说明:

    orapwd命令是用来创建口令文件的,所以需要明白什么时候需要这个口令文件,执行下列命令查看

  • shared

    One or more databases can use the password file. The password file can containSYS as well as non-SYS users.

  • exclusive

    The password file can be used by only one database. The password file can containSYS as well as non-SYS users.

  • none

    Oracle ignores any password file. Therefore, privileged users must be authenticated by the operating system.

  • Notes:

    • When REMOTE_LOGIN_PASSWORDFILE is set to either exclusive orshared, but the password file does not exist, then the behavior is the same as settingREMOTE_LOGIN_PASSWORDFILE tonone.

    • If you change REMOTE_LOGIN_PASSWORDFILE to exclusive orshared fromnone, then ensure that the password file is in sync with the dictionary passwords. Seeor more information.

    **********************************************************************************************

    从描述中可以知道如果值是none的话,表明口令文件模式不起作用,必须用操作系统级的sysdba权限用户登录,如系统用户oracle。而没有指定值得话等同于none。因此如果要使用口令文件必须是exclusive或是shared模式,并且用orapwd命令创建,值得一提的是该口令文件指保存具有sysdba等超级权限的用户。

    注:假如你不能用sys加上口令登录,那就用系统用户oracle,使用sqlplus / as sysdba;登录到数据库(如不能登录,这里有个sqlnet.ora文件请查阅http://blog.csdn.net/lzx_bupt/article/details/6781332)。


    4、常见问题

    (1)尝试使用sysdba权限用户远程登录的时候提示,尤其是pl/sql使用 "sys/密码 as sysdba"登录时

    ORA-01031: insufficient privileges

    对该问题首要考虑就是1:口令文件的缺失,造成没有找到口令、2:REMOTE_LOGIN_PASSWORDFILE值没有指定或是指定了none。

    (2)select * from v$pwfile_users; 结果为 no rows select如

    [oracle@jumper oracle]$ orapwd Usage: orapwd file=<fname> password=<password> entries=<users>

    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.


    热门排行

    今日推荐

    热门手游