ITPub博客

首页 > 数据库 > Oracle > 自动tempfile恢复

自动tempfile恢复

原创 Oracle 作者:zzh_ds 时间:2017-05-07 11:33:04 0 删除 编辑
一:删除临时表空间数据文件
  1. [oracle@hu ~]$ sqlplus / as sysdba

  2. SQL*Plus: Release 11.2.0.4.0 Production on Sun May 7 10:54:18 2017

  3. Copyright (c) 1982, 2013, Oracle. All rights reserved.


  4. Connected to:
  5. Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
  6. With the Partitioning, OLAP, Data Mining and Real Application Testing options

  7. SQL>
  8. SQL>
  9. SQL> select file_name from dba_temp_files;

  10. FILE_NAME
  11. --------------------------------------------------------------------------------
  12. /u01/app/oracle/oradata/HU/temp01.dbf
  13. SQL> ! rm /u01/app/oracle/oradata/HU/temp01.dbf
  14. SQL> !ls /u01/app/oracle/oradata/HU/temp01.dbf
  15. ls: /u01/app/oracle/oradata/HU/temp01.dbf: No such file or directory

  16. SQL>


二:创建大表,并对大表进行排序
由于PGA空间有限,所以会使用临时表空间,由于临时表空间的数据文件已经丢失,故会报错
  1. SQL> create table bigtab as select * from dba_objects;

  2. Table created.

  3. SQL> insert into bigtab select * from bigtab;

  4. 86965 rows created.

  5. SQL> /

  6. 173930 rows created.

  7. SQL> /

  8. 347860 rows created.

  9. SQL> commit;

  10. Commit complete.


  11. SQL> select * from bigtab order by 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15;
  12. select * from bigtab order by 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
  13.               *
  14. ERROR at line 1:
  15. ORA-01116: error in opening database file 201
  16. ORA-01110: data file 201: '/u01/app/oracle/oradata/HU/temp01.dbf'
  17. ORA-27041: unable to open file
  18. Linux-x86_64 Error: 2: No such file or directory
  19. Additional information: 3

  20. SQL>


三:重启数据库之后,会自动重建临时数据文件
  1. SQL> shutdown immediate
  2. Database closed.
  3. Database dismounted.
  4. ORACLE instance shut down.
  5. SQL> startup
  6. ORACLE instance started.

  7. Total System Global Area 830930944 bytes
  8. Fixed Size 2257800 bytes
  9. Variable Size 536874104 bytes
  10. Database Buffers 289406976 bytes
  11. Redo Buffers 2392064 bytes
  12. Database mounted.
  13. Database opened.
  14. SQL> !ls /u01/app/oracle/oradata/HU/temp01.dbf
  15. /u01/app/oracle/oradata/HU/temp01.dbf

  16. SQL>


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/31399171/viewspace-2138615/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2016-09-29

  • 博文量
    61
  • 访问量
    47809