最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

Oracle数据库表空间容量调整脚本

来源:动视网 责编:小采 时间:2020-11-09 13:50:32
文档

Oracle数据库表空间容量调整脚本

Oracle数据库表空间容量调整脚本:(表空间缩容脚本)] --1、获取需要释放空间的表空间信息(包含oracle database自有表空间) --drop table system.tbs_detail; create table system.tbs_detail as select a.tablespace_name, a.bytes/1024/1024 S
推荐度:
导读Oracle数据库表空间容量调整脚本:(表空间缩容脚本)] --1、获取需要释放空间的表空间信息(包含oracle database自有表空间) --drop table system.tbs_detail; create table system.tbs_detail as select a.tablespace_name, a.bytes/1024/1024 S


(表空间缩容脚本)] --1、获取需要释放空间的表空间信息(包含oracle database自有表空间) --drop table system.tbs_detail; create table system.tbs_detail as select a.tablespace_name, a.bytes/1024/1024 Sum_MB, (a.bytes-b.bytes)/1024/1024 used_MB, b

  (表空间缩容脚本)]

  --1、获取需要释放空间的表空间信息(包含oracle database自有表空间)

  --drop table system.tbs_detail;

  create table system.tbs_detail as select

  a.tablespace_name,

  a.bytes/1024/1024 "Sum_MB",

  (a.bytes-b.bytes)/1024/1024 "used_MB",

  b.bytes/1024/1024 "free_MB",

  round(((a.bytes-b.bytes)/a.bytes)*100,2) "percent_used"

  from

  (select tablespace_name,sum(bytes) bytes from dba_data_files group by tablespace_name) a,

  (select tablespace_name,sum(bytes) bytes,max(bytes) largest from dba_free_space group by tablespace_name) b

  where a.tablespace_name=b.tablespace_name

  order by ((a.bytes-b.bytes)/a.bytes) desc;

  --select * from system.tbs_detail order by "Sum_MB" desc,"free_MB" desc;

  --2、获取需要释放空间的应用表空间数据文件使用情况

  --drop table system.datafile_space;

  create table system.datafile_space as

  select a.TABLESPACE_NAME,

  a.FILE_NAME,

  a.BYTES / 1024 / 1024 total,

  b.sum_free / 1024 / 1024 free

  from dba_data_files a,

  (select file_id, sum(bytes) sum_free

  from dba_free_space

  group by file_id) b

  where a.FILE_ID = b.file_id

  and a.TABLESPACE_NAME in (select tablespace_name

  from system.tbs_detail

  where (tablespace_name like '%CQLT%' or

  tablespace_name like '%CQST%'

  or tablespace_name like 'TS%' or tablespace_name like 'IDX%'

  or tablespace_name like '%HX%')

  and "Sum_MB" > 100);

  --select * from system.datafile_space;

  --3、生成数据文件大小重置脚本,,在每个数据文件当前实际使用空间大小基础上增加 100m 空间

  select 'alter database datafile ''' || file_name || ''' resize ' ||

  round(to_number(total - free + 100),0) || ' M;'

  from system.datafile_space;

  --查看 ASM 磁盘组使用情况

  sqlplus / as sysdba <

  set feed off

  set linesize 200

  set pagesize 200

  set echo off

  spool /home/oracle/check_log/chktbs.log append

  select name,state,type,total_mb,free_mb from v$asm_diskgroup;

  spool off

  quit

  EOF

文档

Oracle数据库表空间容量调整脚本

Oracle数据库表空间容量调整脚本:(表空间缩容脚本)] --1、获取需要释放空间的表空间信息(包含oracle database自有表空间) --drop table system.tbs_detail; create table system.tbs_detail as select a.tablespace_name, a.bytes/1024/1024 S
推荐度:
标签: 空间 调整 容量
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top