天天看點

altersystem set recyclebin = off 報錯 recyclebin 參數在11g和10g中的差別

在11g中altersystem set recyclebin = off 報錯recyclebin 參數在11g和10g中的差別

在Oracle 11g中,recyclebin參數發生了微小的變化.

This supported parameter was introduced inOracle 10.2.0

Version  ParameterName               Data Type             Session Modifiable             System Modifiable

10.2.0    recyclebin             String     TRUE      IMMEDIATE

11.1.0    recyclebin             String     TRUE      DEFERRED

從文檔上我們可以看到這個變化說明,到了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 EnterpriseEdition 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

SESSION 2

說明:在session 1中發出alter system set recyclebin=off DEFERRED;指令的時候,我的session 2已經連接配接到了ora11g上.在這個session中,我們用來體會

alter system set recyclebin=off DEFERRED;

指令對目前已經連接配接的session不影響

C:\Documents andSettings\zhangrp>sqlplus study/study

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

Copyright (c) 1982, 2007, Oracle. Allrights reserved.

連接配接到:

Oracle Database 11g Enterprise EditionRelease 11.1.0.6.0 - Production

With the Partitioning, OLAP, Data Miningand Real Application Testing options

SQL> create table test_2(no int);

表已建立。

SQL> drop table test_2;

表已删除。

SQL> flashback table test_2 to beforedrop;

閃回完成。

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-2001Microsoft Corp.

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

Copyright (c) 1982, 2007, Oracle. Allrights reserved. 

recyclebin     string     OFF

本文轉自pizibaidu 51CTO部落格,原文連結:http://blog.51cto.com/pizibaidu/1691940,如需轉載請自行聯系原作者