Good afternoon,

I noticed my cloud infrastructure is almost full ( we are using outsystems cloud for DEV and QA environments) and I'm currently cleaning both our system data and app data.

While checking what can be cleaned i noticed i have 17 inactive tenants just sitting there.

How can i delete these? Should i do it manually in the database (table by table i assume)?

What are the risks?


Thank you

Hi,

please check this article about OutSystems Multitenancy — Tenant “Is Active” and User Logins

But you can use this component from forge.


Cheers

Hi Marco,

You could try the TenantCleaner Forge component.

Regards,

Daniel

Miguel Verdasca wrote:

Hi,

please check this article about OutSystems Multitenancy — Tenant “Is Active” and User Logins

But you can use this component from forge.


Cheers

Hi Miguel, thank you for reply.

I've already read the OutSystems Multitenancy — Tenant “Is Active” and User Logins but it doesnt address what i want ( i want to remove the tenant completly).

I've also checked the TenantCleaner but doesn't have a stable version for my current version (Version 11.7.2) so I'm not sure i should risk using it.

Cheers


Daniël Kuhlmann wrote:

Hi Marco,

You could try the TenantCleaner Forge component.

Regards,

Daniel

Daniël Kuhlmann,

Thank you for ur reply.

As I've replyed to Miguel TenantCleaner doesn't have a stable version for my current version (Version 11.7.2) so I'm not sure i should risk using it.

Cheers


Hi Marco,

Normally you can install it, maybe you only have to refresh dependencies and do a 1CP.

The 'unstable version' scares away a lot of people interested in a component, but in many cases only the references modules like OutSystem UI in your environment are newer that used in the published Forge component.

However this component is 'brand new' (published 10 days ago), so maybe you want to check with the team that build it, as it is still marked as 'under development':

Then again this is your Personal environment, what could go wrong, maybe the data of the tenants is not removed.

The whole point of the exercise is to get rid of the tenant data.

Regards,

Daniel

Solution

Hi Marco,

Another option you could try is installing SQL Sandbox component from the Forge, which you can use to query the inactive tenants from the OSSYS_TENANT table directly from the Platform Database.

The following query will list the inactive tenants:

SELECT Id, Name, Espace_Id, Is_Active FROM OSSYS_TENANT WHERE Is_Active = 'False'

You have to be cautious though. If you made sure you listed the 17 inactive tenants you thought you could delete, you can execute a SQL Delete statement in order to get rid of them.

The following query will delete a single inactive tenant:

DELETE FROM OSSYS_TENANT WHERE Id = 67 and Is_Active = 'False' (where 67 is de TenantId you want to delete)

Screenshot for impression

Hope this helps.

Regards,

Nordin


EDIT: and of course better safe than sorry: be sure to create a backup of the database before trying to delete stuff! :)

Solution

Nordin Ahdi wrote:

Hi Marco,

Another option you could try is installing SQL Sandbox component from the Forge, which you can use to query the inactive tenants from the OSSYS_TENANT table directly from the Platform Database.

The following query will list the inactive tenants:

SELECT Id, Name, Espace_Id, Is_Active FROM OSSYS_TENANT WHERE Is_Active = 'False'

You have to be cautious though. If you made sure you listed the 17 inactive tenants you thought you could delete, you can execute a SQL Delete statement in order to get rid of them.

The following query will delete a single inactive tenant:

DELETE FROM OSSYS_TENANT WHERE Id = 67 and Is_Active = 'False' (where 67 is de TenantId you want to delete)

Screenshot for impression

Hope this helps.

Regards,

Nordin


EDIT: and of course better safe than sorry: be sure to create a backup of the database before trying to delete stuff! :)

Thank you Nordin Ahdi for the idea,

I actually have direct access to the database so this was one of my initial ideas.

Try to delete the tenant on the ossys_tenant, fail because of Foreign Keys, move to the respective table and delete there and so on until theres no more trace of that tenant.

=)



Daniël Kuhlmann wrote:

Hi Marco,

Normally you can install it, maybe you only have to refresh dependencies and do a 1CP.

The 'unstable version' scares away a lot of people interested in a component, but in many cases only the references modules like OutSystem UI in your environment are newer that used in the published Forge component.

However this component is 'brand new' (published 10 days ago), so maybe you want to check with the team that build it, as it is still marked as 'under development':

Then again this is your Personal environment, what could go wrong, maybe the data of the tenants is not removed.

The whole point of the exercise is to get rid of the tenant data.

Regards,

Daniel

Thank you Daniel for the feedback.

I'm not working on my personal environment, i'm working on my companys infrastructure.

Although i can test this on the development environment i rather not cause any major damage to our enviroment that might force me to spend a lot of time to fix :D

I belive ill take a manual approach to the situation since i already know pretty well most system tables in the database.

Cheers


Marco Damião wrote:

Thank you Nordin Ahdi for the idea,

I actually have direct access to the database so this was one of my initial ideas.

Try to delete the tenant on the ossys_tenant, fail because of Foreign Keys, move to the respective table and delete there and so on until theres no more trace of that tenant.

=)

Hi Marco,

You're welcome!

Exactly, that's what I would do too. I'm glad you were able to get rid of your old tenants. :)

Regards,

Nordin