当前位置:操作系统 > Unix/Linux >>

recyclebin学习

recyclebin学习
 
views:
user_recyclebin   recyclebin
dba_recyclebin
SELECT object_name, original_name FROM dba_recyclebin
   WHERE owner = 'HR';
show recyclebin  ----------只能普通用户使用
SELECT * FROM "BIN$yrMKlZaVMhfgNAgAIMenRA==$0";
create table xxx as select * from "BIN$yrMKlZaVMhfgNAgAIMenRA==$0";

 

貌似可以重建已被drop的表
 
清除对象:
 hr.int_admin_emp ----》 BIN$jsleilx392mk2=293$0 
1. PURGE TABLE BIN$jsleilx392mk2=293$0;
2. PURGE TABLE int_admin_emp(ORIGINAL_NAME);
3. PURGE TABLESPACE example;------清除位于某tbs中的所有表
4. PURGE TABLESPACE example USER oe;
               ----清除所有位于某tbs,且属于mouuser的所有表
5. PURGE RECYCLEBIN;  ----清除当前用户所属对象
6. purge dba_recyclebin ;  ----sysdba权限用户清空recyclebin

 

 
恢复删除的对象:
SELECT object_name, original_name, createtime FROM recyclebin;    
OBJECT_NAME                    ORIGINAL_NAME   CREATETIME
------------------------------ --------------- -------------------BIN $yrMKlZaLMhfgNAgAIMenRA==$0 INT2_ADMIN_EMP  2006-02-05:21:05:52
BIN$yrMKlZaVMhfgNAgAIMenRA==$0 INT2_ADMIN_EMP  2006-02-05:21:25:13
BIN$yrMKlZaQMhfgNAgAIMenRA==$0 INT2_ADMIN_EMP  2006-02-05:22:05:53
FLASHBACK TABLE "BIN$yrMKlZaVMhfgNAgAIMenRA==$0" TO BEFORE DROP;
flashback table hr.EMP_1 to before drop;

 

恢复删除的依赖对象:
1、确定原来的对象名
SELECT OBJECT_NAME, ORIGINAL_NAME, TYPE FROM RECYCLEBIN;
OBJECT_NAME                    ORIGINAL_NAME             TYPE
------------------------------ ------------------------- --------
BIN$DBo9UChtZSbgQFeMiAdCcQ==$0 JHIST_JOB_IX              INDEX
BIN$DBo9UChuZSbgQFeMiAdCcQ==$0 JHIST_EMPLOYEE_IX         INDEX
BIN$DBo9UChvZSbgQFeMiAdCcQ==$0 JHIST_DEPARTMENT_IX       INDEX
BIN$DBo9UChwZSbgQFeMiAdCcQ==$0 JHIST_EMP_ID_ST_DATE_PK   INDEX
BIN$DBo9UChxZSbgQFeMiAdCcQ==$0 JOB_HISTORY               TABLE

 

 
2、查找已恢复的表的相关index
SELECT INDEX_NAME FROM USER_INDEXES WHERE TABLE_NAME = 'JOB_HISTORY';

INDEX_NAME
------------------------------
BIN$DBo9UChwZSbgQFeMiAdCcQ==$0
BIN$DBo9UChtZSbgQFeMiAdCcQ==$0
BIN$DBo9UChuZSbgQFeMiAdCcQ==$0
BIN$DBo9UChvZSbgQFeMiAdCcQ==$0

 

3、重命名index
ALTER INDEX "BIN$DBo9UChtZSbgQFeMiAdCcQ==$0" RENAME TO JHIST_JOB_IX;
ALTER INDEX "BIN$DBo9UChuZSbgQFeMiAdCcQ==$0" RENAME TO  JHIST_EMPLOYEE_IX;

 

 
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,