oracle 临时表空间开始备份功能,请看图 oracle删除临时表空间

3148℃ MABLE

oracle 临时表空间开始备份功能,请看图oracle删除临时表空间

如何释放oracle临时表空间

重新创建一个临时表空间,把原来的默认临时表空间drop掉(包括里面的临时数据文件)再重新建立

SQL> create temporary tablespace temp2

2 tempfile '/home/oracle/oracle/product/10.2.0/oradata/hatest/temp02.pdf' size 512M reuse

3 autoextend on next 640k maxsize unlimited;

Tablespace created.

SQL> alter database default temporary tablespace temp2;

Database altered.

SQL> drop tablespace temp including contents and datafiles;

Tablespace dropped.

(注意:由于临时表空间的数据文件比较大,所以这步可能会花费比较长的时间)

SQL> create temporary tablespace temp

2 tempfile '/home/oracle/oracle/product/10.2.0/oradata/hatest/temp01.pdf' size 512M reuse

3 autoextend on next 640K maxsize unlimited;

Tablespace created.

SQL> alter database default temporary tablespace temp;

Database altered.

SQL> drop tablespace temp2 including contents and datafiles;

Tablespace dropped.

SQL> exit

oracle临时表空间实际占用内存大小?

临时表应该是只有表的存在,使用的时候才会占用内存,当关闭或者提交时,就会自动清空数据,所以无论你怎么查占用空间都是不变的,使用的时候才会占用。

如何查看oracle临时表空间当前使用了多少空间的大小

1、查看临时表空间 (dba_temp_files视图)(v_$tempfile视图)

select tablespace_name,file_name,bytes/1024/1024 file_size,autoextensible from dba_temp_files;

select status,enabled, name, bytes/1024/1024 file_size from v_$tempfile;--sys用户查看

2、缩小临时表空间大小

alter database tempfile 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\TELEMT\TEMP01.DBF' resize 100M;

3、扩展临时表空间:

方法一、增大临时文件大小:

SQL> alter database tempfile ‘/u01/app/oracle/oradata/orcl/temp01.dbf’ resize 100m;

方法二、将临时数据文件设为自动扩展:

SQL> alter database tempfile ‘/u01/app/oracle/oradata/orcl/temp01.dbf’ autoextend on next 5m maxsize unlimited;

方法三、向临时表空间中添加数据文件:

SQL> alter tablespace temp add tempfile ‘/u01/app/oracle/oradata/orcl/temp02.dbf’ size 100m;

4、创建临时表空间:

SQL> create temporary tablespace temp1 tempfile ‘/u01/app/oracle/oradata/orcl/temp11.dbf’ size 10M;

5、更改系统的默认临时表空间:

--查询默认临时表空间

select * from database_properties where property_name='DEFAULT_TEMP_TABLESPACE';

--修改默认临时表空间

alter database default temporary tablespace temp1;

所有用户的默认临时表空间都将切换为新的临时表空间:

select username,temporary_tablespace,default_ from dba_users;

--更改某一用户的临时表空间:

alter user scott temporary tablespace temp;

6、删除临时表空间

删除临时表空间的一个数据文件:

SQL> alter database tempfile ‘/u01/app/oracle/oradata/orcl/temp02.dbf’ drop;

删除临时表空间(彻底删除):

SQL> drop tablespace temp1 including contents and datafiles cascade constraints;

7、查看临时表空间的使用情况(GV_$TEMP_SPACE_HEADER视图必须在sys用户下才能查询)

GV_$TEMP_SPACE_HEADER视图记录了临时表空间的使用大小与未使用的大小

dba_temp_files视图的bytes字段记录的是临时表空间的总大小

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

ORDER BY B.TABLESPACE, B.SEGFILE#, B.SEGBLK#, B.BLOCKS;

希望能帮到您!

oracle 怎么在存储过程中创建一个临时表,在里面插入数据,再查找这个临时表的所有数据,最后drop这个表。

不知道楼主的需求如何

一般没必要创建临时表,处理数据后又它drop。

存储过程中要用到的表应该会经常用到。就让它存在吧,用完用 truncate table 清理数据就可以了。

空表不会占很多资源。 我们就是这样做的。