1.About check_mk metric:ORA_IYOA_Tablespace_Check
This is a custom monitoring metric on check_mk platform,
the threshold is defined in /usr/lib/check_mk_oracle/MAIN/conf/perf_ORCL_tablespace.json
[oracle@IDPCN-IYCost conf]$ cat perf_ORCL_tablespace.json
{"target_info":[{
"perf_min":"0",
"chk_interval":5000,
"output_cmd":"echo",
"post_action":"",
"perf_crit":"98",
"chk_cmd":"sh run_tablespace.sh",
"perf_max":"0",
"chk_result_separator":";",
"perf_warn":"95",
"database":"ORCL"
}]}
[oracle@IDPCN-IYCost conf]$
notice the two threshold value:“perf_warn”:“95”,“perf_crit”:“98”, mean tablespace usage ratio arrival 95% or 98%, will trigger the warning or critical alarm respectively
2.solution:
2.1check whether the failures times are more than threshold value,notice the failures column
select tablespace_name, usedsize, freesize , autosize,used_per
from
(
select /* + RULE */ allsize.tablespace_name,allsize.usedsize , allsize.freesize, NVL(aut.autosize ,0) autosize,
Round((allsize.usedsize -allsize.freesize) * 100 / (usedsize + NVL(aut.autosize ,0)) ) used_per
FROM
(SELECT df.tablespace_name tablespace_name ,
ROUND(df.bytes / (1024 * 1024 * 1024),2) usedsize,
ROUND(SUM(fs.bytes) / (1024 * 1024 * 1024 ),2) freesize,
Nvl(Round(SUM(fs.bytes) * 100 / df.bytes),1) pused,
Round((df.bytes - SUM(fs.bytes)) * 100 / df.bytes) pfree
FROM dba_free_space fs,
(SELECT tablespace_name,SUM(bytes) bytes
FROM dba_data_files GROUP BY tablespace_name) df
WHERE fs.tablespace_name (+) = df.tablespace_name
AND df.tablespace_name NOT IN ('SYSAUX','SYSTEM','UNDOTBS2','UNDOTBS1' )
GROUP BY df.tablespace_name,df.bytes ) allsize,
(SELECT tablespace_name , ROUND(SUM((MAXBYTES-USER_BYTES)/(1024*1024*1024)),2) autosize
from dba_data_files
WHERE AUTOEXTENSIBLE ='YES' GROUP BY tablespace_name ) aut
where aut.tablespace_name (+) = allsize.tablespace_name
order by used_per desc
)
where rownum <= 1
output:
in the case, used_per was 100% for SAMPLE_DATA tablespace, which will trigger critical alarm.
2.2 check the space usage of datafile in tablespace
select file_name,tablespace_name,maxbytes/1024/1024 maxbytes_mb,bytes/1024/1024 size_mb,autoextensible from dba_data_files where tablespace_name='CPSQST_DATA'
output:
tablespace and data file in oracle 10g have the following characteristics:
1.a tablespace can accommodate up to 1022 files
2. maximum up to 32GB space for single file.
3. datafile can autoextent up to maxsize
2.3so in the case,you can:
2.3.1.add maxsize, of course you need to confirm actual available space in os before this.
[oracle@hq_testDB ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 22G 18G 2.6G 88% /
/dev/sda1 99M 22M 72M 24% /boot
tmpfs 2.0G 16K 2.0G 1% /dev/shm
/dev/sdb1 79G 71G 3.9G 95% /u1
/dev/sdc1 79G 60G 16G 80% /u2
/dev/sdd1 168G 142G 17G 90% /u3
/dev/sde 114G 97G 11G 91% /u4
/dev/sdf 394G 371G 3.2G 100% /u5
in the case, file_id 16 and 17 were located in /u1, but unfortunately only 3.9G available,maybe you need to add harddisk, but here I will ignore the annoyance of space warning,so only can add up to 3.9G space to tablespace in /u1,here I will try add 1GB
alter database datafile 17 autoextend on maxsize 1G
2.3.2.add datafile in tablespace. only /u2 has most available space ,so I will add new datafile to here,for conveniency managment, it is recommended that you create same folder hierarchy as other datafile in tablespace, this is also advice from oracle(OMF standard)
[oracle@hq_testDB u2]$ mkdir -p /u2/oradata/sample_data
[oracle@hq_testDB u2]$ chmod -R 775 /u2/oradata/sample_data
next, you can add datafile to sample_data tablespace
alter tablespace sample_data add datafile '/u2/oradata/sample_data/sample_data03.dbf' size 50M autoextend on maxsize 1G
confirm again
select file_id,file_name,tablespace_name,maxbytes/1024/1024 maxsize_mb,bytes/1024/1024 usedsize_mb,autoextensible from dba_data_files where tablespace_name='SAMPLE_DATA'
here,the size for fild_id 17 was added to 1024MB by step 2.3.1, and also added a new datafile with 1GB space by step 2.3.2