温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

REMOTE_LOGIN_PASSWORDFILE参数的三种取值对系统有哪些影响

发布时间:2021-11-10 16:11:30 来源:亿速云 阅读:143 作者:iii 栏目:关系型数据库

这篇文章主要讲解了“REMOTE_LOGIN_PASSWORDFILE参数的三种取值对系统有哪些影响”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“REMOTE_LOGIN_PASSWORDFILE参数的三种取值对系统有哪些影响”吧!

在某些情况下可以使用REMOTE_LOGIN_PASSWORDFILE参数增强系统的安全性,所谓提高安全性就是禁止以SYSDBA或SYSOPER特权用户从客户端登陆到数据库系统中。这是一种牺牲管理便捷性为前提的。需酌情使用。

1. 参考信息

官方文档中有关REMOTE_LOGIN_PASSWORDFILE参数的描述:

http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/initparams179.htm#REFRN10184

2. REMOTE_LOGIN_PASSWORDFILE参数默认值及其行为特性分析

1)REMOTE_LOGIN_PASSWORDFILE参数的默认值是EXCLUSIVE

sys@ora10g> show parameter REMOTE_LOGIN_PASSWORDFILE

NAME                       TYPE VALUE

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

remote_login_passwordfile string EXCLUSIVE

2)尝试将SYSDBA特权授予给普通用户secooler

sys@ora10g> grant sysdba to secooler;

grant sysdba to secooler

*

ERROR at line 1:

ORA-01994: GRANT failed: password file missing or disabled

此处报错是由于密码文件丢失导致的,因为授予sysdba权限需要调整密码文件。

3)手工创建丢失的密码文件

ora10g@secdb /home/oracle$ cd $ORACLE_HOME/dbs

ora10g@secdb /oracle/app/oracle/product/10.2.0/db_1/dbs$

ora10g@secdb /oracle/app/oracle/product/10.2.0/db_1/dbs$ orapwd file=orapwora10g password=oracle entries=10

4)再次尝试SYSDBA授权成功

sys@ora10g> grant sysdba to secooler;

Grant succeeded.

5)密码文件的变化

此时在密码文件中记录了这个授权的信息。

ora10g@secdb /oracle/app/oracle/product/10.2.0/db_1/dbs$ strings orapwora10g

]\[Z

ORACLE Remote Password file

INTERNAL

AB27B53EDC5FEF41

8A8F025737A9097A

SECOOLER

034E4342BB2D437D

最后两行信息即是新增的内容。

6)客户端连接性测试

$ sqlplus secooler/secooler@ora10g as sysdba

SQL*Plus: Release 10.2.0.3.0 - Production on 星期二 12月 21 21:48:34 2010

Copyright (c) 1982, 2006, Oracle.? All Rights Reserved.

连接到:

Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production

With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine options

SQL> show user;

USER 为 "SYS"

SQL>

注意,此处我们虽然使用的是普通用户secooler登录的数据库,但真实的用户名是SYS。因此我们便可以使用这种方法来管理数据库,这就是便捷所在。

7)人为移除密码文件测试

如果此时我们将密码文件删除,客户端将没有办法再以sysdba权限连接到数据库

$ sqlplus secooler/secooler@ora10g as sysdba

SQL*Plus: Release 10.2.0.3.0 - Production on 星期二 12月 21 21:53:50 2010

Copyright (c) 1982, 2006, Oracle.? All Rights Reserved.

ERROR:

ORA-01031: insufficient privileges

请输入用户名:

因此,通过REMOTE_LOGIN_PASSWORDFILE参数和密码文件共同实现了客户端以SYSDBA权限登录系统的目的。

3. REMOTE_LOGIN_PASSWORDFILE参数NONE值及其行为特性分析

1)调整参数REMOTE_LOGIN_PASSWORDFILE为NONE

sys@ora10g> alter system set remote_login_passwordfile=none scope=spfile;

System altered.

sys@ora10g> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

sys@ora10g> startup;

ORACLE instance started.

Total System Global Area  835104768 bytes

Fixed Size                  2257840 bytes

Variable Size             549456976 bytes

Database Buffers          281018368 bytes

Redo Buffers                2371584 bytes

Database mounted.

Database opened.

sys@ora10g> show parameter REMOTE_LOGIN_PASSWORDFILE

NAME                       TYPE VALUE

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

remote_login_passwordfile string NONE

2)调整后,客户端将无法发起连接

$ sqlplus secooler/secooler@ora10g as sysdba

SQL*Plus: Release 10.2.0.3.0 - Production on 星期二 12月 21 22:00:02 2010

Copyright (c) 1982, 2006, Oracle. All Rights Reserved.

ERROR:

ORA-01017: invalid username/password; logon denied

请输入用户名:

3)SYSDBA权限的授予与回收亦是被禁止的

(1)授权测试

sys@ora10g> grant sysdba to secooler;

grant sysdba to secooler

*

ERROR at line 1:

ORA-01994: GRANT failed: password file missing or disabled

注意,此处的报错原因是不是因为密码文件不存在,与前面曾经提到的报错信息有区别。

(2)回收测试

sys@ora10g> revoke sysdba from secooler;

Revoke succeeded.

此处虽然提示权限回收成功,但是实际上并没有生效,是无效操作。证明之。

<1>在此基础上调整参数为EXCLUSIVE

sys@ora10g> alter system set remote_login_passwordfile=EXCLUSIVE scope=spfile;

System altered.

sys@ora10g> startup force;

ORACLE instance started.

Total System Global Area  835104768 bytes

Fixed Size                  2257840 bytes

Variable Size             549456976 bytes

Database Buffers          281018368 bytes

Redo Buffers                2371584 bytes

Database mounted.

Database opened.

<2>此时客户端依然能够成功登陆

$ sqlplus secooler/secooler@172.17.193.211ora10g as sysdba

SQL*Plus: Release 10.2.0.3.0 - Production on 星期二 12月 21 22:06:05 2010

Copyright (c) 1982, 2006, Oracle.? All Rights Reserved.

连接到:

Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production

With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine options

SQL> show user

USER 为 "SYS"

SQL>

SQL> show parameter REMOTE_LOGIN_PASSWORDFILE

NAME                                 TYPE        VALUE

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

remote_login_passwordfile            string      EXCLUSIVE

结论:因此证明了当REMOTE_LOGIN_PASSWORDFILE参数为NONE时回收SYSDBA权限是无效的。

4.REMOTE_LOGIN_PASSWORDFILE参数SHARED值及其行为特性分析

1)调整参数REMOTE_LOGIN_PASSWORDFILE为SHARED

sys@ora10g> alter system set remote_login_passwordfile=shared scope=spfile;

System altered.

sys@ora10g> startup force;

ORACLE instance started.

Total System Global Area  835104768 bytes

Fixed Size                  2257840 bytes

Variable Size             549456976 bytes

Database Buffers          281018368 bytes

Redo Buffers                2371584 bytes

Database mounted.

Database opened.

sys@ora10g>  show parameter remote_login_passwordfile

NAME                                 TYPE        VALUE

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

remote_login_passwordfile            string      SHARED

2)此时客户端的连接是不受限制的,连接通畅

$ sqlplus secooler/secooler@ora10g as sysdba

SQL*Plus: Release 10.2.0.3.0 - Production on 星期二 12月 21 22:08:04 2010

Copyright (c) 1982, 2006, Oracle.? All Rights Reserved.

连接到:

Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production

With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine options

SQL>

SQL> show user

USER 为 "SYS"

3)此时服务器端授予和回收SYSDBA权限是不被允许的

sys@ora10g> grant sysdba to secooler;

grant sysdba to secooler

*

ERROR at line 1:

ORA-01999: password file cannot be updated in SHARED mode

sys@ora10g> revoke sysdba from secooler;

revoke sysdba from secooler

*

ERROR at line 1:

ORA-01999: password file cannot be updated in SHARED mode

5.小结

在此总结一下在REMOTE_LOGIN_PASSWORDFILE参数取不同值时的行为特性。REMOTE_LOGIN_PASSWORDFILE参数可以有三种取值:EXCLUSIVE(默认)、NONE和SHARED。

1)当取值为EXCLUSIVE时

   允许客户端以SYSDBA或SYSOPER权限登录到数据库实例中完成数据库管理操作;

   允许授予和回收SYSDBA或SYSOPER权限。

2)当取值为NONE时

   禁止客户端以SYSDBA或SYSOPER权限登录到数据库实例中完成数据库管理操作;

   禁止授予和回收SYSDBA或SYSOPER权限。

3)当取值为SHARED时

   允许客户端以SYSDBA或SYSOPER权限登录到数据库实例中完成数据库管理操作;

   禁止授予和回收SYSDBA或SYSOPER权限。

以上便是参数REMOTE_LOGIN_PASSWORDFILE在不同取值情况下对系统的影响(本文是以SYSDBA特权为例,SYSOPER特权相同)。每一种取值都有其自己的应用场景。我们需要做的是根据不同的场景做出相应的取舍。

感谢各位的阅读,以上就是“REMOTE_LOGIN_PASSWORDFILE参数的三种取值对系统有哪些影响”的内容了,经过本文的学习后,相信大家对REMOTE_LOGIN_PASSWORDFILE参数的三种取值对系统有哪些影响这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是亿速云,小编将为大家推送更多相关知识点的文章,欢迎关注!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI