Oracle dbf (database datafile) continues to increase the solution to the problem

Oracle has been installed on the system disk. Recently, it has become larger and larger, so that the system is on the verge of collapse. After searching carefully, I found that a temporary file occupies a lot of space. The solution is as follows:
Step 1: alter database tempfile ' F:\oracle\product\10.1.0\oradata\orcl\TEMP01.DBF' drop; second step: alter tablespace temp add tempfile  'F:\oracle\product\10.1.0\oradata\orcl\TEMP01.DBF' size 2048M reuse autoextend on next 100M; Step 3: select d.file_name, d.file_id, d.tablespace_name, d.bytes from dba_temp_files d; Step 4: alter database tempfile 'F:\oracle\product\10.1.0 \oradata\orcl\TEMP01.DBF' autoextend off; (Just to solve small problems, not to go into details.) Normally, Oracle will automatically release after completing some sorting operations using TEMP tablespaces such as Select statement and create index Drop temporary segment a. But in some cases, we will encounter the situation that the temporary segment is not released, the TEMP table space is almost full, and even if we restart the database, the problem is still not solved. 









 


-------------------------------------------------- -------------------------------------------------- ------------------------------------
When checking the disk space of the aix5.3 system, a temporary table was found The temporary data file where the space is located has reached 20G, which has taken up 100%.

Because it is an official database server, the database cannot be restarted casually.

The following operations are performed using the sys superuser of the database

to re-shrink the data files of the temporary tablespace at the beginning

:

SQL> alter database tempfile

2 '/oracle/oms/oradata/temp/temp01.dbf' resize 10240M ;

The database reports an error, and the re-set space size cannot meet the needs.

It seems that a new temporary table space needs to be rebuilt to replace the current table space

1. First, check the default table space of the current database:

SQL>select * from database_properties  where property_name='DEFAULT_TEMP_TABLESPACE';

Confirm that the current temporary table space is TEMP

2, Check the size of the current temporary tablespace:

SQL>select file_name,tablespace_name,bytes/1024/1024 "MB",


SQL> create temporary tablespace temp02 tempfile '/oracle/oms/oradata/undo/temp02.dbf size 512M;

4. Replace the new temporary tablespace with the default temporary tablespace of the
database SQL> alter database default temporary tablespace temp02;

5. Confirm the default temporary table space of the current database

SQL>select * from database_properties where property_name='DEFAULT_TEMP_TABLESPACE';

confirm that temp02 is the default table space of the current database

6. Before deleting the temp temporary table space, run the operation in the temp temporary table space The sql statement is killed, such sql statements are mostly sorted statements

SQL>Select se.username,se.sid,se.serial#,su.extents,su.blocks*to_number(rtrim(p.value))as Space ,
tablespace,segtype,sql_text from v$sort_usage su,v$parameter p,v$session se,v$sql s
where p.name='db_block_size' and su.session_addr=se.saddr and s.hash_value=su.sqlhash
and s.address=su.sqladdr
order by se.username,se.sid;

After querying, kill these sql statements:

SQL>alter system kill session '524,778'; (if the SID of a running sql statement is 524 and serial# is 778),

confirm that there are no running sql statements in the temp temporary table space After that, you can delete the temp temporary table space data files.

7. Delete the temp temporary table space

SQL> drop tablespace temp including contents and datafiles;

this will soon delete the data files of the temporary table space.

8. Now the temp02 temporary table space occupies If the disk space of others is lost, the temporary table space needs to be re-established in the original position, and the temp temporary table space needs to be re-established.

SQL> create temporary tablespace temp2 tempfile '/oracle/oms/oradata/temp/temp01.dbf'

size 512M autoextend on maxsize 15G;
新建一个512M的自动扩展临时表空间,最大的扩展为15G。

查看新建的temp临时表空间是否正确:
SQL>select file_name,tablespace_name,bytes/1024/1024,maxbytes/1024/1024,autoextensible from dba_temp_files;

9、把新建的temp临时表空间却换成数据库的默认临时表空间
SQL> alter database default temporary tablespace temp;

10、确认目前数据库的默认临时表空间
SQL>select * from database_properties
where property_name='DEFAULT_TEMP_TABLESPACE';
确认temp为当前的数据库默认表空间

11、目前把原来的temp临时表空间变成了512M,把剩余的磁盘空间空了出来,temp02临时表空间就没有用了,删除temp02临时表空间
SQL> drop tablespace temp02 including contents and datafiles;

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327072492&siteId=291194637