- 最后登录
- 2023-8-16
- 在线时间
- 1686 小时
- 威望
- 2135
- 金钱
- 50532
- 注册时间
- 2011-10-12
- 阅读权限
- 200
- 帖子
- 5207
- 精华
- 39
- 积分
- 2135
- UID
- 2
|
9#
发表于 2012-5-10 19:36:18
ODM TEST:
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
SQL> conn maclean/maclean
Connected.
SQL> SQL>
SQL>
SQL>
SQL> create table drop_recycelbin as select * From dba_tables;
Table created.
SQL> drop table drop_recycelbin;
Table dropped.
SQL> select * from sys.recyclebin$;
OBJ# OWNER# ORIGINAL_NAME OPERATION TYPE#
---------- ---------- -------------------------------- ---------- ----------
TS# FILE# BLOCK# DROPTIME DROPSCN
---------- ---------- ---------- --------- ----------
PARTITION_NAME FLAGS RELATED BO PURGEOBJ
-------------------------------- ---------- ---------- ---------- ----------
BASE_TS# BASE_OWNER# SPACE CON# SPARE1 SPARE2 SPARE3
---------- ----------- ---------- ---------- ---------- ---------- ----------
81362 90 DROP_RECYCELBIN 0 1
4 4 140426 10-MAY-12 4380607
30 81362 81362 81362
112 0
SQL> select * from dba_recyclebin;
OWNER OBJECT_NAME
------------------------------ ------------------------------
ORIGINAL_NAME OPERATION TYPE
-------------------------------- --------- -------------------------
TS_NAME CREATETIME DROPTIME
------------------------------ ------------------- -------------------
DROPSCN PARTITION_NAME CAN CAN RELATED BASE_OBJECT
---------- -------------------------------- --- --- ---------- -----------
PURGE_OBJECT SPACE
------------ ----------
MACLEAN BIN$v7IAIdjrR2XgQ7IBqMBP6Q==$0
DROP_RECYCELBIN DROP TABLE
USERS 2012-05-10:12:19:09 2012-05-10:12:20:39
4380607 YES YES 81362 81362
81362 112
SQL> create table dup_recycle as select * from sys.recyclebin$;
Table created.
SQL> drop table recyclebin$;
Table dropped.
11.2 开始 recyclebin$ 的DDL 在dsqlddl.bsq 中
rem table used to store the dropped objects which are still not purged
create table recyclebin$
(
obj# number not null, /* original object number */
owner# number not null, /* owner user number */
original_name varchar2(32), /* Original Object Name */
operation number not null, /* Operation carried out */
/* 0 -> DROP */
/* 1 -> TRUNCATE (not supported) */
type# number not null, /* object type (see KQD.H) */
ts# number, /* tablespace number */
file# number, /* segment header file number */
block# number, /* segment header block number */
droptime date, /* time when object was dropped */
dropscn number, /* SCN of Tx which caused the drop */
partition_name varchar2(32), /* Name of the partition dropped */
/* NULL otherwise */
flags number, /* flags for undrop processing */
related number not null, /* obj one level up in heirarchy */
bo number not null, /* base object */
purgeobj number not null, /* obj to purge when purging this */
base_ts# number, /* Base objects Tablespace number */
base_owner# number, /* Base objects owner number */
space number, /* number of blocks used by the object */
con# number, /* con#, if index is due to constraint */
spare1 number,
spare2 number,
spare3 number
)
/
create index recyclebin$_obj on recyclebin$(obj#)
/
create index recyclebin$_ts on recyclebin$(ts#)
/
create index recyclebin$_owner on recyclebin$(owner#)
/
conn / as sysdba
SQL> rem table used to store the dropped objects which are still not purged
SQL> create table recyclebin$
2 (
3 obj# number not null, /* original object number */
4 owner# number not null, /* owner user number */
5 original_name varchar2(32), /* Original Object Name */
6 operation number not null, /* Operation carried out */
7 /* 0 -> DROP */
8 /* 1 -> TRUNCATE (not supported) */
9 type# number not null, /* object type (see KQD.H) */
10 ts# number, /* tablespace number */
11 file# number, /* segment header file number */
12 block# number, /* segment header block number */
13 droptime date, /* time when object was dropped */
14 dropscn number, /* SCN of Tx which caused the drop */
15 partition_name varchar2(32), /* Name of the partition dropped */
16 /* NULL otherwise */
17 flags number, /* flags for undrop processing */
18 related number not null, /* obj one level up in heirarchy */
19 bo number not null, /* base object */
20 purgeobj number not null, /* obj to purge when purging this */
21 base_ts# number, /* Base objects Tablespace number */
22 base_owner# number, /* Base objects owner number */
23 space number, /* number of blocks used by the object */
24 con# number, /* con#, if index is due to constraint */
25 spare1 number,
26 spare2 number,
27 spare3 number
28 )
29 /
create index recyclebin$_obj on recyclebin$(obj#)
/
create index recyclebin$_ts on recyclebin$(ts#)
Table created.
SQL> 2 /
create index recyclebin$_owner on recyclebin$(owner#)
/
Index created.
SQL> 2
Index created.
SQL> 2
Index created.
SQL> select * from sys.recyclebin$;
no rows selected
SQL> drop table MACLEAN."BIN$v7IAIdjrR2XgQ7IBqMBP6Q==$0" purge;
drop table MACLEAN."BIN$v7IAIdjrR2XgQ7IBqMBP6Q==$0" purge
*
ERROR at line 1:
ORA-38301: can not perform DDL/DML over objects in Recycle Bin
rename "BIN$v7IAIdjrR2XgQ7IBqMBP6Q==$0" to abc;
rename "BIN$v7IAIdjrR2XgQ7IBqMBP6Q==$0" to abc
*
ERROR at line 1:
ORA-38301: can not perform DDL/DML over objects in Recycle Bin
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
SQL> ALTER SYSTEM SET recyclebin = OFF scope=spfile;
System altered.
11gR2 中 recyclebin 参数 不在动态可修改, 需要重启实例
SQL> startup force;
ORACLE instance started.
Total System Global Area 939495424 bytes
Fixed Size 2233960 bytes
Variable Size 708839832 bytes
Database Buffers 222298112 bytes
Redo Buffers 6123520 bytes
Database mounted.
Database opened.
SQL> drop table MACLEAN."BIN$v7IAIdjrR2XgQ7IBqMBP6Q==$0" purge;
Table dropped.
Solution 1:
ALTER SYSTEM SET recyclebin = OFF scope=spfile;
reboot instance
drop table in recyclebin |
|