#!/bin/sh
1
source /home/oracle/.bash_profile
2
export con_user='sqlplus -s system/oracle'
3
f_check_tablespaces(){
4
a='tablespace used value:'
5
tablespace_usedprc=`$con_user << eof
6
set colsep' ';
7
set feedback off;
8
set heading off;
9
set pagesize 0;
10
set termout off;
11
set trimout on;
12
set trimspool on;
13
select a.tablespace_name||':'||
14
round((1 - (a.free_mb b.free_mb) / a.total_mb) * 100,
2)
15
from (select tablespace_name,
16
round(sum(case
17
when autoextensible = 'no' then
18
bytes
19
when autoextensible = 'yes' then
20
maxbytes
21
end) / 1024 / 1024,
22
2) total_mb,
23
round(sum(case
24
when maxbytes - bytes >= 0 then
25
maxbytes - bytes
26
when maxbytes - bytes < 0 then
27
0
28
end) / 1024 / 1024,
29
2) free_mb
30
from dba_data_files
31
group by tablespace_name) a
32
inner join (select dfs.tablespace_name,
33
sum(dfs.bytes / 1024 / 1024) free_mb
34
from dba_free_space dfs
35
group by dfs.tablespace_name) b
36
文档被以下合辑收录
评论