笔者在日常系统检查时,通过Oracle Enterprise Manager Console检查数据库表空间使用情况,发现系统表空间使用率100% ,而且每个用户所对应临时表空间为系统表空间。发现此情况后,为了不影响系统正常运行对此问题进行检查。
select tablespace_name,file_name,bytes/1024/1024 file_size,autoextensible from dba_temp_files; autoextensible 自动扩展列
select username,default_tablespace,temporary_tablespace from dba_users where username = 'SYSTEM';
select * from database_properties where property_name='DEFAULT_TEMP_TABLESPACE'
SELECT temp_used.tablespace_name,
total - used as "Free",
total as "Total",
round(nvl(total - used, 0) * 100 / total, 3) "Free percent"
FROM (SELECT tablespace_name, SUM(bytes_used) / 1024 / 1024 used
FROM GV$TEMP_SPACE_HEADER
GROUP BY tablespace_name) temp_used,
(SELECT tablespace_name, SUM(bytes) / 1024 / 1024 total
FROM dba_temp_files
GROUP BY tablespace_name) temp_total
WHERE temp_used.tablespace_name = temp_total.tablespace_name
create temporary tablespace oastemp tempfile ‘/dev/vgoracle/rdboastemp.dbf’ size 1024M;
create temporary tablespace eletemp tempfile ‘/dev/vgoracle/rdbeletemp.dbf’ size 500M;
create temporary tablespace tcmtemp tempfile ‘/dev/vgoracle/rdbtcmtemp.dbf’ size 500M;
并且指定对应的用户。
//建立一个中转临时表空间:
(1)>create temporary tablespace temp2
tempfile 'D:oracleoradatatesttemp2.dbf' size 512M
reuse autoextend on next 100M maxsize 2048M;
(2) >alter database default temporary tablespace temp2;
(3) >drop tablespace temp including contents and datafiles;
//重新建立一个新的临时表空间:
(1)>create temporary tablespace temp
tempfile 'D:oracleoradatatesttemp01.dbf' size 512M
reuse autoextend on next 100M maxsize 1024M;
(2) >alter database default temporary tablespace temp;//修改用户对应的表空间
(3) >drop tablespace temp2 including contents and datafiles;
1、将控制文件备份为二进制文件
SQL>alter database backup controlfile to 'i:oraclebackupcontrol.bkp';
2、将控制文件备份为文本文件(备份到oraclebaseadminsidudump目录下的跟踪文件中,将在跟踪文件中生成一个SQL脚本)
SQL>alter database backup controlfile to trace;
3、通过spfile生成pfile文件备份控制文件
SQL>create pfile='/pfile_backup.ora' from spfile='/home/oracle/product/10.2.0/db_1/dbs/spfileSID.ora';
相关阅读:
Oracle 临时表空间的管理与受损恢复
Oracle 临时表空间过大问题解决
解决ORA-14450:试图访问已经在使用的事务处理临时表
Oracle创建基于事务和基于会话的临时表及临时表建索引的实验
Oracle 临时表之临时表空间组(TTG)