查看: 4754|回复: 2

Oracle 11g中recyclebin参数的微小变化

[复制链接]
论坛徽章:
112
2008新春纪念徽章
日期:2008-02-13 12:43:03马上有车
日期:2014-02-19 11:55:14马上有房
日期:2014-02-19 11:55:14马上有钱
日期:2014-02-19 11:55:14马上有对象
日期:2014-02-19 11:55:14马上加薪
日期:2014-02-19 11:55:14马上有车
日期:2014-11-03 12:40:39沸羊羊
日期:2015-03-04 14:43:432015年新春福章
日期:2015-03-06 11:57:31慢羊羊
日期:2015-03-09 16:15:39
跳转到指定楼层
1#
发表于 2009-2-20 16:40 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
在Oracle 11g中,recyclebin参数发生了微小的变化.
This supported parameter was introduced in Oracle 10.2.0
VersionParameter NameData TypeSession ModifiableSystem Modifiable
10.2.0recyclebinStringTRUEIMMEDIATE
11.1.0recyclebinStringTRUEDEFERRED

从文档上我们可以看到这个变化说明,到了11g中,这个参数在session依然可以理解修改并影响当前的session,但如果是在系统一级修改的话,那么就要加deferred参数,对当前已经连接的sesion没有影响,但新连接的session将受到影响
SQL> select name,isses_modifiable,issys_modifiable from v$parameter where name='recyclebin';

NAME        ISSES_MODIFIABLE ISSYS_MODIFIABLE
----------- ---------------- ----------------
recyclebin  TRUE             DEFERRED
SQL>

下面做一个测试看看:
一开始,我用study用户分别发起2个session连接到到我的ora11g数据库上
SESSION 1
Connected to Oracle Database 11g Enterprise Edition Release 11.1.0.6.0
Connected as study

SQL> show parameter recyclebin
NAME           TYPE        VALUE
-------------- ----------- --------------
recyclebin     string      ON

SQL> alter system set recyclebin=off;
alter system set recyclebin=off

ORA-02096: 此选项的指定初始化参数不可修改

SQL> alter session set recyclebin=off;
Session altered

SQL> create table zrp(no int);
Table created

SQL> drop table zrp;
Table dropped

SQL> flashback table zrp to before drop;

flashback table zrp to before drop

ORA-38305: 对象不在回收站中

可以看到,在system一级,不加DEFERRED参数是不允许修改的,但在session一级可以修改.
SQL> alter system set recyclebin=off DEFERRED;
System altered

SQL>

SESSION 2
说明:在session 1中发出alter system set recyclebin=off DEFERRED;命令的时候,我的session 2已经连接到了ora11g上.在这个session中,我们用来体会
alter system set recyclebin=off DEFERRED;
命令对当前已经连接的session不影响

C:\Documents and Settings\zhangrp>sqlplus study/study

SQL*Plus: Release 11.1.0.6.0 - Production on 星期五 2月 20 16:20:50 2009

Copyright (c) 1982, 2007, Oracle. All rights reserved.

连接到:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> show parameter recyclebin
NAME           TYPE        VALUE
-------------- ----------- --------------
recyclebin     string      ON

SQL> create table test_2(no int);
表已创建。

SQL> drop table test_2;
表已删除。

SQL> flashback table test_2 to before drop;
闪回完成。

SQL> desc test_2
名称         是否为空? 类型
------------ --------- -----------
NO                     NUMBER(38)

SESSION 3

在session 1中完成alter system set recyclebin=off DEFERRED;命令以后,我们再发起一个新的连接,看看是不是对新的连接生效:
Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.

C:\Documents and Settings\zhangrp>sqlplus study/study

SQL*Plus: Release 11.1.0.6.0 - Production on 星期五 2月 20 16:23:46 2009

Copyright (c) 1982, 2007, Oracle. All rights reserved.


连接到:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> show parameter recyclebin
NAME           TYPE        VALUE
-------------- ----------- --------------
recyclebin     string      OFF

 
通过测试,可以看出,一切都是按照预期的行为发生的.

http://tomszrp.itpub.net/post/11835/478940
论坛徽章:
1
2012新春纪念徽章
日期:2012-01-04 11:56:44
2#
发表于 2011-12-30 12:30 | 只看该作者
11g修改recylebin参数提示如下错误
alter system set recyclebin=off scope=both;
r system set recyclebin=off scope=both
                            *
行出现错误:
02096: 此选项的指定初始化参数不可修改

顶楼主好帖子

使用道具 举报

回复
论坛徽章:
289
蛋疼蛋
日期:2013-03-29 13:46:58优秀写手
日期:2013-12-24 06:00:12福特
日期:2014-02-17 17:30:59生肖徽章:兔
日期:2012-05-24 19:03:36SQL极客
日期:2013-12-09 14:13:35ITPUB季度 技术新星
日期:2014-02-24 11:00:06IT宝贝
日期:2014-08-27 10:32:17马上加薪
日期:2014-08-05 09:18:33SQL数据库编程大师
日期:2016-01-13 10:30:43玉石琵琶
日期:2014-03-04 16:46:07
3#
发表于 2011-12-30 13:28 | 只看该作者

使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表