Oracle重建临时表空间

  1. [oracle@hd58 ~]$ sqlplus / as sysdba  
  2.   
  3. SQL*Plus: Release 11.2.0.3.0 Production on Wed Jun 27 11:58:25 2012  
  4.   
  5. Copyright (c) 1982, 2011, Oracle.  All rights reserved.  
  6.   
  7.   
  8. Connected to:  
  9. Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production  
  10. With the Partitioning, OLAP, Data Mining and Real Application Testing options  
  11.   
  12. SYS@JOY:~>col PROPERTY_VALUE format a15  
  13. SYS@JOY:~>col DESCRIPTION format a37  
  14. SYS@JOY:~>select PROPERTY_VALUE,DESCRIPTION from database_properties where property_name='DEFAULT_TEMP_TABLESPACE';  
  15.   
  16. PROPERTY_VALUE  DESCRIPTION  
  17. --------------- -------------------------------------  
  18. TEMP            Name of default temporary tablespace  
  19.   
  20. SYS@JOY:~>select username,temporary_tablespace from dba_users where rownum < 10;  
  21.   
  22. USERNAME                       TEMPORARY_TABLESPACE  
  23. ------------------------------ ------------------------------  
  24. MGMT_VIEW                      TEMP  
  25. SYS                            TEMP  
  26. SYSTEM                         TEMP  
  27. DBSNMP                         TEMP  
  28. SYSMAN                         TEMP  
  29. SCOTT                          TEMP  
  30. HR                             TEMP  
  31. OUTLN                          TEMP  
  32. FLOWS_FILES                    TEMP  
  33.   
  34. 9 rows selected.  
  35.   
  36. SYS@JOY:~>select name from v$tempfile;  
  37.   
  38. NAME  
  39. --------------------------------------------------------------------------------  
  40. /opt/app/oracle/oradata/JOY/temp01.dbf  
  41.   
  42. SYS@JOY:~>  

 

当前默认temp tablespace是temp,对应数据文件是/opt/app/oracle/oradata/JOY/temp01.dbf 
创建新临时表空间并切换

 

  1. SYS@JOY:~>create temporary tablespace temp02 tempfile '/opt/app/oracle/oradata/JOY/temp02.dbf' size 10m autoextend on next 2m maxsize unlimited;  
  2.   
  3. Tablespace created.  
  4.   
  5. SYS@JOY:~>alter tablespace temp02 add tempfile '/opt/app/oracle/oradata/JOY/temp02_01.dbf' size 10m autoextend on next 2m maxsize unlimited;  
  6.   
  7. Tablespace altered.  
  8.   
  9. SYS@JOY:~>alter database default temporary tablespace temp02;  
  10.   
  11. Database altered.  
  12.   
  13. SYS@JOY:~>select PROPERTY_VALUE,DESCRIPTION from database_properties where property_name='DEFAULT_TEMP_TABLESPACE';  
  14.   
  15. PROPERTY_VALUE  DESCRIPTION  
  16. --------------- -------------------------------------  
  17. TEMP02          Name of default temporary tablespace  
  18.   
  19. SYS@JOY:~>drop tablespace temp including contents and datafiles;  
  20.   
  21. Tablespace dropped.  
  22.   
  23. SYS@JOY:~>select username,temporary_tablespace from dba_users where rownum < 10;  
  24.   
  25. USERNAME                       TEMPORARY_TABLESPACE  
  26. ------------------------------ ------------------------------  
  27. MGMT_VIEW                      TEMP02  
  28. SYS                            TEMP02  
  29. SYSTEM                         TEMP02  
  30. DBSNMP                         TEMP02  
  31. SYSMAN                         TEMP02  
  32. SCOTT                          TEMP02  
  33. HR                             TEMP02  
  34. OUTLN                          TEMP02  
  35. FLOWS_FILES                    TEMP02  
  36.   
  37. 9 rows selected.  
  38.   
  39. SYS@JOY:~>select name from v$tempfile;  
  40.   
  41. NAME  
  42. --------------------------------------------------------------------------------  
  43. /opt/app/oracle/oradata/JOY/temp02.dbf  
  44. /opt/app/oracle/oradata/JOY/temp02_01.dbf  
  45.   

转载:http://blog.csdn.net/staricqxyz/article/details/8308017

原文地址:https://www.cnblogs.com/future2012lg/p/3188809.html