Getting Database information from OutSystems

OutSystems on Oracle (author: Marcel Lambrechts)

inSystems monitors

In this post I will provide some queries that you can use to get information on the OutSystems schemas in an Oracle database.

List inactive (unused) entity tables

It is pretty simple to get a list of all inactive entity (unused – the entity got removed from OutSystems) database tables.

SELECT esp.name ESPACE,
ent.name ENTITY,
ent.physical_table_name TABLE_NAME
FROM osadmin.ossys_espace esp
INNER JOIN osadmin.ossys_entity ent ON ent.espace_id = esp.id
WHERE ent.is_system = 0
AND ent.is_active = 0
ORDER BY esp.name, ent.name;

List orphaned table columns

To get a list of all orphan table columns (table columns that are not registered in OutSystems metadata anymore – happens when an entity attribute is renamed) that exist in any active OutSystems user table, use one of the following queries.

The query when executed as user OSADMIN:

SELECT esp.name ESPACE,
ent.name ENTITY,
tco.table_name,
tco.column_name
FROM ossys_espace esp
INNER JOIN ossys_entity ent ON ent.espace_id = esp.id
INNER JOIN user_tab_cols tco ON tco.table_name = UPPER(ent.physical_table_name)
WHERE tco.column_id IS NOT NULL
AND ent.is_system = 0
AND ent.is_active = 1
AND NOT EXISTS (SELECT 1
FROM ossys_entity_attr eat
WHERE eat.entity_id = ent.id
AND UPPER(eat.name) = tco.column_name)
ORDER BY esp.name, ent.name, tco.column_id;

The query when executed as a DBA user:

SELECT esp.name ESPACE,
ent.name ENTITY,
tco.table_name,
tco.column_name
FROM osadmin.ossys_espace esp
INNER JOIN osadmin.ossys_entity ent ON ent.espace_id = esp.id
INNER JOIN dba_tab_cols tco ON tco.table_name = UPPER(ent.physical_table_name)
WHERE tco.owner = ‘OSADMIN’
AND tco.column_id IS NOT NULL
AND ent.is_system = 0
AND ent.is_active = 1
AND NOT EXISTS (SELECT 1
FROM osadmin.ossys_entity_attr eat
WHERE eat.entity_id = ent.id
AND UPPER(eat.name) = tco.column_name)
ORDER BY esp.name, ent.name, tco.column_id;

Space used by inactive (unused) entities

Like described in one of my other posts (Adding/Changing/Deleting entities) on OutSystems, the platform does not physically remove a table from the database when you delete an entity. While the physical tables are never removed from the database, they will keep using space in the database, space that cannot be (re)used.

The following query will show you what tables are not used by OutSystems anymore (are inactive) and how much space they use in the database.

The query when executed as user OSADMIN:

WITH table_size AS (
SELECT tab.table_name,
SUM(seg.bytes)/1024/1024 size_mb
FROM user_tables tab, user_segments seg
WHERE tab.table_name = seg.segment_name
AND segment_type LIKE ‘TABLE%’
GROUP BY tab.table_name
), tab_indexes_size AS (
SELECT ind.table_name,
SUM(seg.bytes)/1024/1024 size_mb
FROM user_indexes ind, user_segments seg
WHERE ind.index_name = seg.segment_name
AND seg.segment_type LIKE ‘INDEX%’
GROUP BY ind.table_name
)
SELECT es.name espace,
en.name Entity,
UPPER(en.physical_table_name) unused_table,
NVL(ts.size_mb,0)+NVL(ise.size_mb,0) “Total size (MB)”,
NVL(ts.size_mb,0) “Table size (MB)”,
NVL(ise.size_mb,0) “Indexes (sum) size (MB)”
FROM ossys_entity en
INNER JOIN (ossys_espace) es ON (en.espace_id) = es.id
LEFT OUTER JOIN (table_size) ts ON UPPER(en.physical_table_name) = ts.table_name
LEFT OUTER JOIN (tab_indexes_size) ise ON UPPER(en.physical_table_name) = ise.table_name
WHERE UPPER(en.physical_table_name) LIKE ‘OSUSR_%’
AND en.is_active = 0
UNION ALL
SELECT es.name,
‘All Unused Entities’,
‘-‘,
SUM(NVL(ts.size_mb,0)+NVL(ise.size_mb,0)) “Total size (MB)”,
SUM(NVL(ts.size_mb,0)) “Table size (MB)”,
SUM(NVL(ise.size_mb,0)) “Indexes (sum) size (MB)”
FROM ossys_entity en
INNER JOIN (ossys_espace) es ON (en.espace_id) = es.id
LEFT OUTER JOIN (table_size) ts ON UPPER(en.physical_table_name) = ts.table_name
LEFT OUTER JOIN (tab_indexes_size) ise ON UPPER(en.physical_table_name) = ise.table_name
WHERE UPPER(en.physical_table_name) LIKE ‘OSUSR_%’
AND en.is_active = 0
GROUP BY es.name
ORDER BY 1 ASC, 3 DESC;

The query when executed as a DBA user:

WITH table_size AS (
SELECT tab.table_name, SUM(seg.bytes)/1024/1024 size_mb
FROM dba_tables tab, dba_segments seg
WHERE tab.table_name = seg.segment_name
AND segment_type LIKE ‘TABLE%’
AND tab.owner = ‘OSADMIN’
GROUP BY tab.table_name
), tab_indexes_size AS (
SELECT ind.table_name, SUM(seg.bytes)/1024/1024 size_mb
FROM dba_indexes ind, dba_segments seg
WHERE ind.index_name = seg.segment_name
AND ind.table_owner = seg.owner
AND seg.segment_type LIKE ‘INDEX%’
AND ind.table_owner = ‘OSADMIN’
GROUP BY ind.table_name
)
SELECT es.name espace,
en.name Entity,
UPPER(en.physical_table_name) unused_table,
NVL(ts.size_mb,0)+NVL(ise.size_mb,0) “Total size (MB)”,
NVL(ts.size_mb,0) “Table size (MB)”,
NVL(ise.size_mb,0) “Indexes (sum) size (MB)”
FROM osadmin.ossys_entity en
INNER JOIN (osadmin.ossys_espace) es ON (en.espace_id) = es.id
LEFT OUTER JOIN (table_size) ts ON UPPER(en.physical_table_name) = ts.table_name
LEFT OUTER JOIN (tab_indexes_size) ise ON UPPER(en.physical_table_name) = ise.table_name
WHERE UPPER(en.physical_table_name) LIKE ‘OSUSR_%’
AND en.is_active = 0
UNION ALL
SELECT es.name,
‘All Unused Entities’,
‘-‘,
SUM(NVL(ts.size_mb,0)+NVL(ise.size_mb,0)) “Total size (MB)”,
SUM(NVL(ts.size_mb,0)) “Table size (MB)”,
SUM(NVL(ise.size_mb,0)) “Indexes (sum) size (MB)”
FROM osadmin.ossys_entity en
INNER JOIN (osadmin.ossys_espace) es ON (en.espace_id) = es.id
LEFT OUTER JOIN (table_size) ts ON UPPER(en.physical_table_name) = ts.table_name
LEFT OUTER JOIN (tab_indexes_size) ise ON UPPER(en.physical_table_name) = ise.table_name
WHERE UPPER(en.physical_table_name) LIKE ‘OSUSR_%’
AND en.is_active = 0
GROUP BY es.name
ORDER BY 1 ASC, 3 DESC;

Share this

Contact

Heb je vragen of opmerkingen? Aarzel niet om contact op te nemen. Dat kan via de algemene contactgegevens, rechtstreeks met de genoemde contactpersoon op een van de detailpagina’s, of via onderstaande knop.

11 augustus 2026

From “Go wild” to actually relying on AI

As an Oracle Developer, I have done my best to avoid using AI for most of my work. I have been forced to use this for the company I am working for, and I must admit, it is incredibly powerful and quite amazing.

11 augustus 2026

Start Teun de Jong (OutSystems developer)

Low-code samen met AI is een uitstekende combi om applicaties sneller, beter en goedkoper te ontwikkelen. We zijn dan ook blij dat ons low-code team verder groeit met Teun de Jong, een ervaren en enthousiaste OutSystems developer.

Opdrachten uitgevoerd voor

Politie
TU Eindhoven
Stedin
Belastingdienst
VTTI
Rabobank
Arval BNP Paribas
SVB
Provincie Utrecht
CB Logistics
Universiteit Tilburg
Gemeente Apeldoorn
Nederlandse Spoorwegen
Fokker
Altran
RAVU
Bank Mendes Gans
Rendo
UBR Uitvoeringsorganisatie Bedrijfsvoering Rijk
Feenstra inSystems
Darling
VION Food Group
inSystems Unive
Holland Casino
AgroEnergy
Allianz
Gemeente Gouda
Alphabet
Thales
Multi Tank Card
Rijk Zwaan inSystems
TenneT
Ministerie van Economische Zaken, Landbouw & Innovatie
Syntrus Achmea Real Estate & Finance
DICTU
BMW
Van Iperen Groeispecialisten
JUVA
Greenchoice
Alliance Healthcare
Ziggo
Oracle University
ING Bank
Rechtspraak
ASR Nederland
NVWA inSystems
Telegraaf Media Groep
Gemeente Den Haag
RIGD LOXIA
CBR
VAA ICT Consultancy
PC Uitvaart
inSystems KLM
IBM
Leaseplan
MN Services
Stratech Social
GVB
WVDB Adviseurs Accountants
Twinq
Eneco
Cannock
Ahold