2种查看回收站的当前状态:(默认是打开的)
SQL> show parameter bin
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cursor_bind_capture_destination string memory+disk
recyclebin string on
SQL> SELECT Value FROM V$parameter WHERE Name = 'recyclebin';
VALUE
--------------------------------------------------------------------------------
ON
启动或者关闭回收站里的每个会话(session)和系统(system),代码如下:
ALTER SYSTEM SET recyclebin = ON;
ALTER SESSION SET recyclebin = ON;
ALTER SYSTEM SET recyclebin = OFF;
ALTER SESSION SET recyclebin = OFF;
注:执行ALTER SESSION SET recyclebin = OFF只适用于当前会话窗口,重新复制新窗口默认回收站依旧是打开的,测试如下:
SQL> ALTER SESSION SET recyclebin = OFF;
Session altered.
新开窗口:
[oracle@strong ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Jan 28 18:03:00 2018
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> show parameter bin
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cursor_bind_capture_destination string memory+disk
recyclebin string on
修改system系统级别的测试如下:
SQL> ALTER SYSTEM SET recyclebin = OFF;
ALTER SYSTEM SET recyclebin = OFF
*
ERROR at line 1:
ORA-02096: specified initialization parameter is not modifiable with this
option
报错:不允许这样操作
原因:回收站是数据文件里面的动态参数,需要添加spoce=spfile,重启数据库才能修改成功
测试如下:
SQL> alter system set recyclebin=off scope=spfile;
System altered.
[root@strong ~]# reboot
Broadcast message from root@strong
(/dev/pts/5) at 18:05 ...
The system is going down for reboot NOW!
[root@strong ~]# su - oracle
[oracle@strong ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Jan 18 18:10:29 2018
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> show parameter bin
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cursor_bind_capture_destination string memory+disk