温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Oracle不正规操作导致drop表空间drop用户报错ora38301(记录,未解决)

发布时间:2020-08-08 11:37:16 来源:ITPUB博客 阅读:165 作者:PiscesCanon 栏目:关系型数据库
操作系统版本:
  1. [oracle@oracle trace]$ uname -a
  2. Linux oracle.example.com 2.6.32-431.el6.x86_64 #1 SMP Sun Nov 10 22:19:54 EST 2013 x86_64 x86_64 x86_64 GNU/Linux
  3. [oracle@oracle trace]$ lsb_release -a
  4. LSB Version:    :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
  5. Distributor ID: RedHatEnterpriseServer
  6. Description:    Red Hat Enterprise Linux Server release 6.5 (Santiago)
  7. Release:        6.5
  8. Codename:       Santiago

数据库版本:
  1. SYS@proc> select * from v$version where rownum=1;

  2. BANNER
  3. --------------------------------------------------------------------------------
  4. Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

环境构造:
  1. SYS@proc> create table t(id int);

  2. Table created.

  3. SYS@proc> insert into t values(1);

  4. 1 row created.

  5. SYS@proc> insert into t select * from t;

  6. 1 row created.

  7. SYS@proc> /

  8. 2 rows created.

  9. ...省略相同步骤...

  10. SYS@proc>/

  11. 1048576 rows created.
  12.  
  13. SYS@proc> commit;

  14. Commit complete.

  15. SYS@proc> select BYTES/1024/1024 mb from dba_segments where owner='SYS' and segment_name='T';

  16.         MB
  17. ----------
  18.         25

  1. SYS@proc> create tablespace abc datafile '/u01/app/oracle/oradata/proc/abc01.dbf' size 26m;

  2. Tablespace created.

  3. SYS@proc> create user km identified by oracle account unlock;

  4. User created.

  5. SYS@proc> grant connect,create table to km;

  6. Grant succeeded.

  7. SYS@proc> alter user km quota 26m on abc;

  8. User altered.

  9. SYS@proc> select AUTOEXTENSIBLE from dba_data_files where tablespace_name='ABC';

  10. AUT
  11. ---
  12. NO

  1. SYS@proc> create table km.t tablespace abc as select * from t;
  2. create table km.t tablespace abc as select * from t
  3. *
  4. ERROR at line 1:
  5. ORA-01652: unable to extend temp segment by 128 in tablespace ABC


  6. SYS@proc> col file_name for a50
  7. SYS@proc> select file_name from dba_data_files;

  8. FILE_NAME
  9. --------------------------------------------------
  10. /u01/app/oracle/oradata/proc/test01.dbf
  11. /u01/app/oracle/oradata/proc/example01.dbf
  12. /u01/app/oracle/oradata/proc/users01.dbf
  13. /u01/app/oracle/oradata/proc/abc01.dbf
  14. /u01/app/oracle/oradata/proc/sysaux01.dbf
  15. /u01/app/oracle/oradata/proc/system01.dbf
  16. /u01/app/oracle/oradata/proc/undotbs2_1.dbf
  17. /u01/app/oracle/oradata/proc/undotbs2_2.dbf

  18. 8 rows selected.

  19. SYS@proc> alter database datafile '/u01/app/oracle/oradata/proc/abc01.dbf' resize 30m;

  20. Database altered.

  21. SYS@proc> create table km.t tablespace abc as select * from t;

  22. Table created.

  23. SYS@proc> conn km/oracle
  24. Connected.

  25. KM@proc> drop table t;

  26. Table dropped.

  27. KM@proc> show recycle;
  28. ORIGINAL NAME    RECYCLEBIN NAME                OBJECT TYPE   DROP TIME
  29. ---------------- ------------------------------ ------------ -------------------
  30. T                BIN$Q38bmJwFDYXgU28cqMDtew==$0 TABLE        2016-12-13:07:03:11
  31. KM@proc> conn / as sysdba
  32. Connected.
  33. SYS@proc> delete from recyclebin$--不正规操作,正确应该在km用户下执行purge table t或者purge table "BIN$Q38bmJwFDYXgU28cqMDtew==$0"

  34. 1 row deleted.

  35. SYS@proc> commit;

  36. Commit complete.

  37. SYS@proc> conn km/oracle
  38. Connected.
  39. KM@proc> show recycle;
  40. KM@proc> conn / as sysdba
  41. Connected.
  42. SYS@proc> create table km.t tablespace abc as select * from t;

  43. create table km.t tablespace abc as select * from t
  44.                                                   *
  45. ERROR at line 1:
  46. ORA-01536: space quota exceeded for tablespace 'ABC'

  47. SYS@proc> alter user km quota unlimited on abc;

  48. User altered.

  49. SYS@proc> create table km.t tablespace abc as select * from t;
  50.  create table km.t tablespace abc as select * from t
  51. *
  52. ERROR at line 1:
  53. ORA-01652: unable to extend temp segment by 128 in tablespace ABC  --这里可以看出虽然在km用户执行show recycle已经是空的,但是真正的空间并没被释放。


  54. SYS@proc> drop tablespace abc including contents and datafiles;
  55. drop tablespace abc including contents and datafiles
  56. *
  57. ERROR at line 1:
  58. ORA-00604: error occurred at recursive SQL level 1
  59. ORA-38301: can not perform DDL/DML over objects in Recycle Bin


  60. SYS@proc> drop user km cascade;
  61. drop user km cascade
  62. *
  63. ERROR at line 1:
  64. ORA-00604: error occurred at recursive SQL level 1
  65. ORA-38301: can not perform DDL/DML over objects in Recycle Bin
 
正规清理回收站的表:

1、使用 PURGE TABLE original_table_name; 这里的 original_table_name 表示未 drop 以 前的名称
2、使用 PURGE TABLE recyclebin_object_name; 这里的 recyclebin_object_name 表示回 收站中的对象名称
3、使用 PURGE TABLESPACE tablespace_name 从指定的表空间中清除所有的丢弃对象
4、使用 PURGE TABLESPACE tablespace_name USER user_name 从回收站中清除属 于某个特定用户的所有丢弃对象。
5、DROP USER user_name cascade 直接删除指定用户及其所属的全部对象,也就是说, DROP USER 命令会绕过回收站进行直接删除。
6、使用 PURGE RECYCLEBIN 命令清除用户自己的回收站
7、PURGE DBA_RECYCLEBIN 从所有用户的回收站清除所有对象



假如发生了这个场景,应该怎么去解决?

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI