Oracle recyclebin介紹
近日為某客戶做資料庫巡檢,發現資料庫recycle bin中有幾千個被刪除的物件,於是建議客戶清理recycle bin中的物件,釋放空間,客戶問這些物件佔用空間嗎?存放在哪裡的?
這些被刪除的物件當然是存放在硬碟上的,官方方檔介紹recycle bin 如下:
The recycle bin is actually a data dictionary table containing information about dropped objects. Dropped tables and any associated objects such as indexes,
constraints, nested tables, and the likes are not removed and still occupy space. They continue to count against user space quotas, until specifically purged
from the recycle bin or the unlikely situation where they must be purged by the database because of tablespace space constraints
recycle bin事實上是一個資料字典表,包含被刪除物件的資訊,例如:表、索引、約束等,recycle bin中被刪除的物件不會被remove,仍然佔用空間。
Each user can be thought of as having his own recycle bin, since unless a user has the SYSDBA privilege, the only objects that the user has access to in the
recycle bin are those that the user owns. A user can view his objects in the recycle bin using the following statement:SELECT * FROM RECYCLEBIN;
每個使用者都有自己的recycle bin,物件的擁有者都可以訪問自己的recycle bin,除非具有sysdba許可權,可以透過select * from recyclebin查詢,預設recycle bin是開啟的。
1、禁用recycle bin:
ALTER SESSION SET recyclebin = OFF;
ALTER SYSTEM SET recyclebin = OFF;
2、開啟recycle bin:
ALTER SESSION SET recyclebin = ON;
ALTER SYSTEM SET recyclebin = ON;
測試:
1、建立表空間
SYS@jzh>create tablespace recycle datafile '/u01/app/oracle/oradata/jzh/recycle' size 10M;
Tablespace created.
2、建立用與測試表
SYS@jzh>create user test identified by test default tablespace recycle;
User created.
SYS@jzh>grant dba to test;
Grant succeeded.
SYS@jzh>conn test/test
Connected.
TEST@jzh>create table test as select * from dba_objects;
Table created.
3、刪除test表
TEST@jzh>select * from recyclebin;
no rows selected
TEST@jzh>drop table test;
Table dropped.
TEST@jzh>select OBJECT_NAME,ORIGINAL_NAME,OPERATION,TYPE,DROPTIME from recyclebin;
OBJECT_NAME ORIGINAL_NAME OPERATION TYPE DROPTIME
------------------------------ -------------------------------- --------- ------------------------- -------------------
BIN$GJ+BrKeuDfDgU28BqMAPIg==$0 TEST DROP TABLE 2015-06-16:16:39:03
4、查詢test使用者下物件
TEST@jzh>select * from tab;
TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
BIN$GJ+BrKeuDfDgU28BqMAPIg==$0 TABLE
5、查詢物件BIN$GJ+BrKeuDfDgU28BqMAPIg==$0所在表空間,大小等資訊
TEST@jzh>select SEGMENT_NAME,SEGMENT_TYPE,TABLESPACE_NAME,BYTES,BLOCKS from user_segments where segment_name='BIN$GJ+BrKeuDfDgU28BqMAPIg==$0';
SEGMENT_NAME SEGMENT_TYPE TABLESPACE_NAME BYTES BLOCKS
--------------------------------------------------------------------------------- ------------------ ------------------------------ ---------- ----------
BIN$GJ+BrKeuDfDgU28BqMAPIg==$0 TABLE RECYCLE 8716288 1064
以上可以看出BIN$GJ+BrKeuDfDgU28BqMAPIg==$0物件依然儲存在recycle表空間,大小為8716288位元組,共1064個blocks
總結:1、被drop之後的表依然儲存在原位置,大小無變化,佔用空間;
2、在原位置被drop的物件被標記為可覆蓋;
3、當原表空間無free的空間時,該位置就會被覆蓋;
這些被刪除的物件當然是存放在硬碟上的,官方方檔介紹recycle bin 如下:
The recycle bin is actually a data dictionary table containing information about dropped objects. Dropped tables and any associated objects such as indexes,
constraints, nested tables, and the likes are not removed and still occupy space. They continue to count against user space quotas, until specifically purged
from the recycle bin or the unlikely situation where they must be purged by the database because of tablespace space constraints
recycle bin事實上是一個資料字典表,包含被刪除物件的資訊,例如:表、索引、約束等,recycle bin中被刪除的物件不會被remove,仍然佔用空間。
Each user can be thought of as having his own recycle bin, since unless a user has the SYSDBA privilege, the only objects that the user has access to in the
recycle bin are those that the user owns. A user can view his objects in the recycle bin using the following statement:SELECT * FROM RECYCLEBIN;
每個使用者都有自己的recycle bin,物件的擁有者都可以訪問自己的recycle bin,除非具有sysdba許可權,可以透過select * from recyclebin查詢,預設recycle bin是開啟的。
1、禁用recycle bin:
ALTER SESSION SET recyclebin = OFF;
ALTER SYSTEM SET recyclebin = OFF;
2、開啟recycle bin:
ALTER SESSION SET recyclebin = ON;
ALTER SYSTEM SET recyclebin = ON;
測試:
1、建立表空間
SYS@jzh>create tablespace recycle datafile '/u01/app/oracle/oradata/jzh/recycle' size 10M;
Tablespace created.
2、建立用與測試表
SYS@jzh>create user test identified by test default tablespace recycle;
User created.
SYS@jzh>grant dba to test;
Grant succeeded.
SYS@jzh>conn test/test
Connected.
TEST@jzh>create table test as select * from dba_objects;
Table created.
3、刪除test表
TEST@jzh>select * from recyclebin;
no rows selected
TEST@jzh>drop table test;
Table dropped.
TEST@jzh>select OBJECT_NAME,ORIGINAL_NAME,OPERATION,TYPE,DROPTIME from recyclebin;
OBJECT_NAME ORIGINAL_NAME OPERATION TYPE DROPTIME
------------------------------ -------------------------------- --------- ------------------------- -------------------
BIN$GJ+BrKeuDfDgU28BqMAPIg==$0 TEST DROP TABLE 2015-06-16:16:39:03
4、查詢test使用者下物件
TEST@jzh>select * from tab;
TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
BIN$GJ+BrKeuDfDgU28BqMAPIg==$0 TABLE
5、查詢物件BIN$GJ+BrKeuDfDgU28BqMAPIg==$0所在表空間,大小等資訊
TEST@jzh>select SEGMENT_NAME,SEGMENT_TYPE,TABLESPACE_NAME,BYTES,BLOCKS from user_segments where segment_name='BIN$GJ+BrKeuDfDgU28BqMAPIg==$0';
SEGMENT_NAME SEGMENT_TYPE TABLESPACE_NAME BYTES BLOCKS
--------------------------------------------------------------------------------- ------------------ ------------------------------ ---------- ----------
BIN$GJ+BrKeuDfDgU28BqMAPIg==$0 TABLE RECYCLE 8716288 1064
以上可以看出BIN$GJ+BrKeuDfDgU28BqMAPIg==$0物件依然儲存在recycle表空間,大小為8716288位元組,共1064個blocks
總結:1、被drop之後的表依然儲存在原位置,大小無變化,佔用空間;
2、在原位置被drop的物件被標記為可覆蓋;
3、當原表空間無free的空間時,該位置就會被覆蓋;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10271187/viewspace-1703350/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle10g 的Recyclebin簡介Oracle
- Oracle Recyclebin - purgeOracle
- recyclebin in ORACLE 10Oracle
- oracle recyclebin詳解Oracle
- oracle recyclebin和flashbackOracle
- oracle10g recyclebinOracle
- recyclebin for oracle 10gOracle 10g
- ORACLE OWI介紹Oracle
- ORACLE ORION介紹Oracle
- oracle VPD介紹Oracle
- ORACLE鎖介紹Oracle
- Oracle ACE 介紹Oracle
- oracle job 介紹Oracle
- Oracle Spatial 介紹Oracle
- Oracle10g的recyclebinOracle
- Oracle DRM原理介紹Oracle
- Oracle ADR介紹Oracle
- Oracle BBED 工具介紹Oracle
- Oracle RAC 概念介紹Oracle
- 【轉】Oracle ASM介紹OracleASM
- ORACLE函式介紹Oracle函式
- ORACLE TSPITR 介紹Oracle
- Oracle dblink介紹Oracle
- Oracle Data Guard 介紹Oracle
- Oracle biee 中文介紹Oracle
- Oracle Data Integrator 介紹...Oracle
- Oracle DBV 工具 介紹Oracle
- Oracle 常用HINT介紹Oracle
- 介紹oracle外部表Oracle
- Oracle x$table介紹Oracle
- ORACLE 檢視介紹Oracle
- 【Oracle】Opatch 工具介紹Oracle
- 【Oracle】Oracle logminer功能介紹Oracle
- 【RECYCLEBIN】Oracle回收站詳解Oracle
- oracle10g recyclebin 詳解Oracle
- 清除oracle的recyclebin回收站Oracle
- How to maintain Oracle10g RecyclebinAIOracle
- 「Oracle」Oracle高階查詢介紹Oracle