ITPub博客

首页 > 应用开发 > IT综合 > 受限模式

受限模式

原创 IT综合 作者:HuiYiSky 时间:2007-03-26 20:30:46 0 删除 编辑

今天看书偶尔看到以受限模式(restrict)打开资料库,或者把数据库处于受限模式,这样可以很方便地在特殊情况对数据库进行操作。所谓受限就是只有拥有权限的人才能访问数据库。

使数据库处于受限模式,有以下二种方法

1) STARTUP RESTRICT

2) ALTER SYSTEM ENABLE RESTRICTED SESSION;

对于第二种情况,只能使发布命令后的登陆生效,因此如果对于这种情况,一般会杀掉前面已经登陆的进程!

[@more@]

-- STARTUP RESTRICT 方式

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
-- ALTER SYSTEM 方式
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博客 ” ,链接:https://blog.itpub.net/8799875/viewspace-906977/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: linux 清空文件
请登录后发表评论 登录
全部评论

注册时间:2007-12-14

  • 博文量
    39
  • 访问量
    338054