一:临时表空间查询

--查看数据库表空间数据文件
select * from dba_data_files;
--查看数据库临时表空间文件
select * from dba_temp_files;
--查看数据库临时表空间使用情况
select * from dba_temp_free_space;
--查看占用临时表空间的session进程
SELECT sid,
       serial#,
       sql_address,
       machine,
       program,
       tablespace,
       segtype,
       contents
  FROM v$session se, v$sort_usage su
 WHERE se.saddr = su.session_addr
--杀掉进程
Alter system kill session 'sid,serial#'
--查看表空间实际使用大小(文件大小不代表全部使用)
select sum(t.BYTES)/1024/1024/1024 big from user_segments t where t.tablespace_name = 'ARMS_DATA';
--创建临时表空间
create temporary tablespace temp01 tempfile '/u01/app/oracle/oradata/orcl/temp02.dbf' size 1G autoextend on next 100m maxsize 4G;
--切换默认的临时表空间
alter database default temporary tablespace temp01;
--删除表空间(只有当此表空间不为默认时可执行)
drop tablespace TEMP including contents and  datafiles cascade constraint;
--清空当前用户垃圾回收站(会释放磁盘空间,但不会缩小表空间文件)
purge recyclebin;

 

posted on 2021-03-10 10:27  chunxiaozhang  阅读(153)  评论(0编辑  收藏  举报