oracle表空间查看脚本


# !/bin/bash
echo - e " \ n \ n * * * * * * * * * ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~时间:“‘日期’+ % Y/% m/% d ,% T '”~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ * * * * * * * * *”在在/home/oracle/表空间。日志
出口路径=/opt/oracle/1102/db01/bin:
export ORACLE_HOME=$ PATH/opt/oracle/1102/db01/
sqlplus - s/nolog & lt; & lt; eof
康涅狄格州xx/xx@orcl
轴/home/oracle/tablespace。日志添加

设置行200;
设置反馈;
设置页大小50000;
坳a45成员;

选择a.tablespace_name a.summary, b.free, b.maxf“MAX_FREE_EXTENT b.free_exts“FREE_EXTENTS”,
,,,100 - b.free/a.summary * 100”%”
,,,,,,,从
,,,,,,,,,,(选择tablespace_name,总和(字节/1024/1024)“摘要”dba_data_files
,,,,,,,,,,,,,,集团通过tablespace_name),
,,,,,,,,,,,,,,,,,,(选择tablespace_name,总和(字节/1024/1024)“免费”,麦克斯(字节/1024/1024)
,,,,,,,,,,,,,,,,,,,,,“MAXF count (*) free_exts
,,,,,,,,,,,,,,,,,,,,,,,,,从由tablespace_name dba_free_space集团)b
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,a.tablespace_name=b。tablespace_name
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,order by 6 desc;
- col SQL_TEXT a50
,选择t.SQL_TEXT t.VERSION_COUNT, t。从v \ $ sqlarea t SHARABLE_MEM t.VERSION_COUNT> 6。
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,线轴,

eof
df - m祝辞在/home/oracle/表空间。日志

,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,退出;

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

将上述内容保存到/tmp/tablespace.sh中

然后通过crontab - l - u甲骨文命令新建计划任务如下:

1 * * * */bin/bash tmp/tablespace.sh

则每小时将会执行一次脚本,结果将会保存到家里/oracle/tablespace.log中

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

以上为在redhat6.4中验证


oracle表空间查看脚本