今天看书偶尔看到以受限模式(restrict)打开资料库,或者把数据库处于受限模式,这样可以很方便地在特殊情况对数据库进行操作。所谓受限就是只有拥有权限的人才能访问数据库。
使数据库处于受限模式,有以下二种方法
1) STARTUP RESTRICT
2) ALTER SYSTEM ENABLE RESTRICTED SESSION;
对于第二种情况,只能使发布命令后的登陆生效,因此如果对于这种情况,一般会杀掉前面已经登陆的进程!
[@more@]SYS@HUIYI>shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SYS@HUIYI>startup restrict; ORACLE instance started. Total System Global Area 135338868 bytes Fixed Size 453492 bytes Variable Size 113246208 bytes Database Buffers 20971520 bytes Redo Buffers 667648 bytes Database mounted. Database opened. D:>sqlplus scott/tiger SQL*Plus: Release 9.2.0.1.0 - Production on Mon Mar 26 20:13:08 2007 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved. ERROR: ORA-01035: ORACLE only available to users with RESTRICTED SESSION privilege -- 给SCOTT赋权 SYS@HUIYI>grant restricted session to scott; Grant succeeded. D:>sqlplus scott/tiger SQL*Plus: Release 9.2.0.1.0 - Production on Mon Mar 26 20:19:10 2007 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved. Connected to: Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production With the Partitioning, OLAP and Oracle Data Mining options JServer Release 9.2.0.1.0 - Production SCOTT@HUIYI>select * from session_privs where privilege like 'RES%'; PRIVILEGE ---------------------------------------- RESTRICTED SESSION SYS@HUIYI>startup force; ORACLE instance started. Total System Global Area 135338868 bytes Fixed Size 453492 bytes Variable Size 113246208 bytes Database Buffers 20971520 bytes Redo Buffers 667648 bytes Database mounted. Database opened. SYS@HUIYI>revoke restricted session from scott; Revoke succeeded. SYS@HUIYI>alter system enable restricted session; System altered. D:>sqlplus scott/tiger SQL*Plus: Release 9.2.0.1.0 - Production on Mon Mar 26 20:35:59 2007 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved. ERROR: ORA-01035: ORACLE only available to users with RESTRICTED SESSION privilege -- 取消受限 SYS@HUIYI>alter system disable restricted session; System altered. D:>sqlplus scott/tiger SQL*Plus: Release 9.2.0.1.0 - Production on Mon Mar 26 20:37:51 2007 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved. Connected to: Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production With the Partitioning, OLAP and Oracle Data Mining options JServer Release 9.2.0.1.0 - Production SCOTT@HUIYI>
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8799875/viewspace-906977/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/8799875/viewspace-906977/
本文介绍如何通过两种方式设置数据库为受限模式,即使用STARTUP RESTRICT命令启动数据库或使用ALTER SYSTEM ENABLE RESTRICTED SESSION命令。受限模式下,仅授权用户可访问数据库。
1454

被折叠的 条评论
为什么被折叠?



