如何进行对REMOTE

51次阅读
没有评论

共计 4947 个字符,预计需要花费 13 分钟才能阅读完成。

本篇文章给大家分享的是有关如何进行对 REMOTE_LOGIN_PASSWORDFILE 参数的探讨,丸趣 TV 小编觉得挺实用的,因此分享给大家学习,希望大家阅读完这篇文章后可以有所收获,话不多说,跟着丸趣 TV 小编一起来看看吧。

密码文件,是仅用来限制具有 sysdba 或者 sysoper 权限的用户以远程的方式连接数据库的密码校验文件。如果不存在密码文件或者密码文件丢失,那么以 sysdba 或者 sysoper 权限的用户将无法登陆并返回错误:

[oracle@home2 dbs]$ mv orapwthinkbase orapwthinkbase.bak

[oracle@home1 ~]$ sqlplus sys/oracle@thinkbase as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Wed Sep 20 16:39:39 2017

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

ERROR:
ORA-01031: insufficient privileges

重新创建或者恢复密码文件,用户才能重新连接:

[oracle@home2 dbs]$ mv orapwthinkbase.bak orapwthinkbase

[oracle@home1 ~]$ sqlplus sys/oracle@thinkbase as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Wed Sep 20 17:06:28 2017

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

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 – Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SYS@thinkbase  

而 REMOTE_LOGIN_PASSWORDFILE 参数是对密码文件使用的限定,下面就对 REMOTE_LOGIN_PASSWORDFILE 参数的各项参数进行探讨

REMOTE_LOGIN_PASSWORDFILE = NONE
当 REMOTE_LOGIN_PASSWORDFILE 参数为 NONE 时,密码文件被禁用,用户无法以管理员级别用户远程登录到数据库,如下:

SYS@thinkbase show parameter pass

NAME                                 TYPE        VALUE
———————————— ———– ——————————
remote_login_passwordfile            string      EXCLUSIVE

SYS@thinkbase alter system set remote_login_passwordfile=NONE scope=spfile;

System altered.

SYS@thinkbase startup force;
ORACLE instance started.

Total System Global Area  941600768 bytes
Fixed Size                  1348860 bytes
Variable Size             549456644 bytes
Database Buffers          385875968 bytes
Redo Buffers                4919296 bytes
Database mounted.
Database opened.
SYS@thinkbase show parameter pass

NAME                                 TYPE        VALUE
———————————— ———– ——————————
remote_login_passwordfile            string      NONE

[oracle@home1 ~]$ sqlplus sys/oracle@thinkbase as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Wed Sep 20 17:10:01 2017

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

ERROR:
ORA-01017: invalid username/password; logon denied
需要留意到设置 REMOTE_LOGIN_PASSWORDFILE 参数为 NONE,与密码文件缺失时用户登录的返回错误差异,实际上“ORA-01017: invalid username/password; logon denied”此时表达的是密码文件被禁用了。

REMOTE_LOGIN_PASSWORDFILE = EXCLUSIVE(系统默认值)
此参数下数据库可以添加系统管理员级别的用户,可以允许使用 alter user 命令修改 sys 用户的密码,并将此类修改记录到密码文件当中。

SYS@thinkbase show parameter pass

NAME                                 TYPE        VALUE
———————————— ———– ——————————
remote_login_passwordfile            string      NONE
SYS@thinkbase grant sysdba to hr;
grant sysdba to hr
*
ERROR at line 1:
ORA-01994: GRANT failed: password file missing or disabled

SYS@thinkbase alter system set remote_login_passwordfile=exclusive scope=spfile;

System altered.

SYS@thinkbase startup force;
ORACLE instance started.

Total System Global Area  941600768 bytes
Fixed Size                  1348860 bytes
Variable Size             549456644 bytes
Database Buffers          385875968 bytes
Redo Buffers                4919296 bytes
Database mounted.
Database opened.

SYS@thinkbase show parameter pass

NAME                                 TYPE        VALUE
———————————— ———– ——————————
remote_login_passwordfile            string      EXCLUSIVE

SYS@thinkbase grant sysdba to hr;

Grant succeeded.

SYS@thinkbase alter user sys identified by oracle123;

User altered.

REMOTE_LOGIN_PASSWORDFILE = SHARED
SHARED 参数可以允许多个数据库共享一个口令文件, 但是只可以识别一个用户:SYS。但是 SHARED 参数下的密码文件不能被修改。也就是没法添加用户为系统管理员级别,也无法写入到密码文件中。

SYS@thinkbase show parameter pass

NAME                                 TYPE        VALUE
———————————— ———– ——————————
remote_login_passwordfile            string      EXCLUSIVE
SYS@thinkbase alter system set remote_login_passwordfile=shared scope=spfile;

System altered.

SYS@thinkbase startup force;
ORACLE instance started.

Total System Global Area  941600768 bytes
Fixed Size                  1348860 bytes
Variable Size             549456644 bytes
Database Buffers          385875968 bytes
Redo Buffers                4919296 bytes
Database mounted.
Database opened.
SYS@thinkbase show parameter pass

NAME                                 TYPE        VALUE
———————————— ———– ——————————
remote_login_passwordfile            string      SHARED

SYS@thinkbase grant sysdba to sh;
grant sysdba to sh
*
ERROR at line 1:
ORA-01999: password file cannot be updated in SHARED mode

SYS@thinkbase alter user sys identified by oracle;
alter user sys identified by oracle
*
ERROR at line 1:
ORA-28046: Password change for SYS disallowed
同时 oracle 建议如果既要给用户添加系统管理员级别权限又要使用 shared 模式,最好是先在 exclusive 模式下设置好管理员权限的用户,再将 REMOTE_LOGIN_PASSWORDFILE 参数修改为 shared 共享口令文件。

实验小结:
1. 密码文件类似于参数文件,只有在登录或者有信息要写入或者进行修改时才会用到,其他时候即使丢失也不会影响到数据库的运行。
2. 由于上面的特点,备份时候通常不会对密码文件进行备份,如果丢失也可以使用如下的语句重新创建密码文件:
[oracle@home2 dbs]$ orapwd
Usage: orapwd file= entries= force= ignorecase= nosysdba=

  where
    file – 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.

以上就是如何进行对 REMOTE_LOGIN_PASSWORDFILE 参数的探讨,丸趣 TV 小编相信有部分知识点可能是我们日常工作会见到或用到的。希望你能通过这篇文章学到更多知识。更多详情敬请关注丸趣 TV 行业资讯频道。

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-07-20发表,共计4947字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)