oracle 在受限模式下,受限模式

今天看书偶尔看到以受限模式(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>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值