Skip to content
Snippets Groups Projects
Commit 59850cb3 authored by jurgenhaas's avatar jurgenhaas
Browse files

Add script to retrieve sizes of databases

parent f68247d2
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
sqlplus -S sys/root as sysdba < ora_get_sizes.sql
set colsep '|'
set echo off
set feedback off
set linesize 1000
set pagesize 0
set sqlprompt ''
set trimspool on
set headsep off
select nvl(b.tablespace_name,
nvl(a.tablespace_name,'UNKNOWN'))
tablespace_name,
kbytes_alloc kbytes,
kbytes_alloc-nvl(kbytes_free,0)
size_alloc_bytes,
round(((kbytes_alloc-nvl(kbytes_free,0))/ kbytes_alloc)*200) used_chart,
to_char(((kbytes_alloc-nvl(kbytes_free,0))/ kbytes_alloc)*100,
'999G999G999G999G999G999G990D00') ||'%' used,
data_files
from ( select sum(bytes)/1024/1024 Kbytes_free,
max(bytes)/1024/1024 largest,
tablespace_name
from sys.dba_free_space
group by tablespace_name ) a,
( select sum(bytes)/1024/1024 Kbytes_alloc,
tablespace_name,
count(*) data_files
from sys.dba_data_files
group by tablespace_name ) b
where a.tablespace_name (+) = b.tablespace_name;
......@@ -12,6 +12,8 @@
- 'cadmin_list_databases.sh'
- 'cadmin_list_databases.sql'
- 'sqlplus.sh'
- 'ora_get_sizes.sh'
- 'ora_get_sizes.sql'
- name: "Create Directory"
file:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment