oracle表空单清理常用代码段整理
复制代码 代码如下:
select 'drop table '||segment_name ||';' from dba_segments where tablespace_name='TEMPTABS' and segment_name like 'TT%' and segment_name not like '%_FILE';#将系统UNDO表空间指向undotbs2
SQL>SELECT
group by tablespace_name
, ( select tablespace_name, sum(bytes_cached) bytes
#确保所有在UNDOTBS1的undo segment都已offline
#删除临时表空间temp02
[code]
, NVL(s.current_users, 0) current_users
AND d.tablespace_name = t.tablespace_name(+)
sqlplus '/as sysdba'
#重启数据库
SQL>@q_tbsFREE
FROM
AND d.extent_management like 'LOCAL'
, ( select tablespace_name, sum(bytes) bytes
, NVL(a.bytes, 0) tablespace_size
1.查询表空间使用情况:
#将系统UNDO表空间指回undotbs1
或者删除表
WHERE
复制代码 代码如下:
sqlplus system/manager@topprodSQL>drop tablespace undotbs2 including contents and datafiles;
复制代码 代码如下:
#删除原来的临时表空间tempfrom dba_temp_files
SQL>alter system set undo_tablespace=undotbs2 scope=both;
#创建一个UNDO表空间undotbs2,用作临时替换
SQL>startup
) t
SQL>create tablespace temptabs datafile '/u2/oradb/oradata/topprod/temptabs.dbf' size 4096M autoextend on next 100M;
SQL>drop tablespace temptabs including contents and datafiles;
sqlplus system/manager@topprod
3.清理UNDO表空间:(在无用户连接的状况下操作,最好在清理之前重启一下数据库)
SQL>drop tablespace temp including contents and datafiles;
) a
d.tablespace_name tablespace_name
, v$sort_segment s
, d.status tablespace_status
AND d.contents like 'TEMPORARY';
SQL>drop tablespace undotbs1 including contents and datafiles;
#创建一个临时表空间temp02,用作临时替换
4.增加系统表空间:
AND d.tablespace_name = s.tablespace_name(+)
SQL>alter system set undo_tablespace=undotbs1 scope=both;
SQL>drop tablespace temp02 including contents and datafiles;
#删除TEMPTABS表空间
复制代码 代码如下:
SQL>alter database default temporary tablespace temp02;from v$temp_extent_pool
#将系统临时表空间指回temp
#删除UNDO表空间undotbs2
sys.dba_tablespaces d
2.清理TEMP临时表空间:(在无用户连接的状况下操作,最好在清理之前重启一下数据库)
3.清理TEMPTABS表空间:
SQL>shutdown immediate
sqlplus '/as sysdba'
SQL>create undo tablespace undotbs1 datafile '/u2/oradb/oradata/topprod/undotbs01.dbf' size 4096M;
#删除原来的UNDO表空间undotbs1
d.tablespace_name = a.tablespace_name(+)
复制代码 代码如下:
SQL>create temporary tablespace temp tempfile '/u2/oradb/oradata/topprod/temp01.dbf' size 4096M autoextend on next 100M;, TRUNC(NVL(t.bytes / a.bytes * 100, 0)) used_pct
SQL>alter database default temporary tablespace temp;
, NVL(t.bytes, 0) used
#创建新的临时表空间undotbs1
SQL> select SEGMENT_NAME ,STATUS ,TABLESPACE_NAME from dba_rollback_segs;
SQL>startup
#将系统临时表空间指向temp02
#重启数据库
SQL>create undo tablespace undotbs2 datafile '/u2/oradb/oradata/topprod/undotbs02.dbf' size 10M autoextend on next 10M;
SQL>create temporary tablespace temp02 tempfile '/u2/oradb/oradata/topprod/temp02.dbf' size 10M autoextend on next 10M;
alter tablespace SYSTEM add datafile '/u2/oradb/oradata/topprod/system02.dbf' size 2000M autoextend on next 10M;
复制代码 代码如下:
2.查询temp使用方法:SQL>shutdown immediate
alter tablespace SYSAUX add datafile '/u2/oradb/oradata/topprod/sysaux02.dbf' size 2000M autoextend on next 10M;
相关热词: oracle
本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!
本文地址: https://www.juheyunku.com/sql/oracle/3568.shtml
相关文章
热门TAG
命令 权重 外链 企业网站 白帽 php 织梦教程 dedecms修改内容 javascript 织梦 功能 标签 调用 详解 服务器 网站流量 实例解析 Dedecms 织梦cms HTML tags标签 python jquery教程 jquery windows SEO优化 蜘蛛 搜索引擎 网站收录 JSP最新文章
-
Window下Oracle Database 11g 发行
时间:2020-12-29
-
Oracle如何实现like多个值的
时间:2020-12-29
-
maven添加oracle依赖失败问题
时间:2020-12-29
-
OracleRAC基本概念及入门
时间:2020-12-29
-
Azure File Storage 基本用法
时间:2020-12-26
-
Oracle 权限(grant revoke)
时间:2020-12-26
-
Azure Queue Storage 基本用法
时间:2020-12-26
-
如何对比迁移前后的Orac
时间:2020-12-26
热门文章
-
Azure Queue Storage 基本用法 Azure Storage 之
时间:2020-12-26
-
Oracle存储过程编程详解
时间:2020-12-07
-
win10下oracle 11g安装图文教程
时间:2020-12-25
-
oracle 数据库学习 基本结构介绍
时间:2020-12-13
-
Azure File Storage 基本用法 Azure Storage 之 F
时间:2020-12-26
-
windows使用sqlpus连接oracle 数据库的教程图
时间:2020-12-25
-
Window下Oracle Database 11g 发行版2安装教程
时间:2020-12-29
-
Oracle解锁的方式介绍
时间:2020-12-14
-
linux下oracle设置开机自启动实现方法
时间:2020-12-13
-
Oracle学习记录之使用自定义函数和触发器
时间:2020-12-07
