如何进行对REMOTE_LOGIN_PASSWORDFILE参数的探讨-创新互联
本篇文章给大家分享的是有关如何进行对REMOTE_LOGIN_PASSWORDFILE参数的探讨,小编觉得挺实用的,因此分享给大家学习,希望大家阅读完这篇文章后可以有所收获,话不多说,跟着小编一起来看看吧。
创新互联主要从事网站制作、网站设计、网页设计、企业做网站、公司建网站等业务。立足成都服务晋江,十载网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:18980820575密码文件,是仅用来限制具有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参数的探讨,小编相信有部分知识点可能是我们日常工作会见到或用到的。希望你能通过这篇文章学到更多知识。更多详情敬请关注创新互联-成都网站建设公司行业资讯频道。
分享文章:如何进行对REMOTE_LOGIN_PASSWORDFILE参数的探讨-创新互联
分享网址:http://abwzjs.com/article/poihp.html