cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Summary

This document is targeted to Managed Service Providers (MSPs) of FlexNet Manager Suite and describes how to delete tenants from a multi-tenanted system without disrupting FlexNet Manager Suite online operations. This is a manual process using the attached SQL script and is supported with FlexNet Manager Suite 2019 R1 and later. This process doesn't involve Broker Tools.  

Deleting tenants from FlexNet Manager Suite while databases remain online

To manually delete tenants from a multi-tenanted environment (while databases remain online):

  1. Important! Contact Engineering to ensure that the following databases have been backed up prior to performing any of the remaining tenant deletion steps:
    • FNMP

    • FNMPDatabaseWarehouse

    • FNMPInventorydatabase  

  2. Download the TenantDeletion-Online.sql file located in the ATTACHMENTS section of this Knowledge Base article.
  3. In TenantDeletion-Offline.sql, update the Set @TenantUID line to include all the tenant UIDs that need to be removed. If specifying multiple tenant UIDs, separate with a space or comma or both:

    Example 1 (To remove a specific TenantUID, (such as 'TAD9HUVMUQ5RHBMY'):
    SET @TenantUIDs = 'TAD9HUVMUQ5RHBMY'

    Example 2 (To remove three tenants):
    SET @TenantUIDs = 'TAD9HUVXYX5RHBMY, 3MNAXYX8CTL2R85M, Z2ARXYXRKSVSGQQK'

     
  4. Note that the deletion process is irreversible. Ensure that you have recent database backups completed from Step 1. The only option to retrieve the deleted data is to restore the database to a previous point in time. If you are sure you're ready to continue, uncomment the following line in the SQL file by removing the two dashes.
    --SET @OutputOrExecute = 'Execute'
  5. Ensure that there is sufficient disk space for the transaction log (where "sufficient" varies depending on the amount of data). If there is not enough space, the SQL script stops with an error such as: 
    The transaction log for database 'FNMP' is full due to 'ACTIVE_TRANSACTION'.
  6. Execute the resulting SQL statement against each of the following databases before the next reconciliation starts so that the tenant is not automatically recreated:
    • FNMP

    • FNMPDatabaseWarehouse

    • FNMPInventorydatabase  

Was this article helpful? Yes No
100% helpful (1/1)
Comments
Steffen
By
Level 6

Thanks a lot for sharing this!

does this script work with 2019R1 and older releases?

In the past I used "KB 000027260 Delete Tenant data for 2018 R1 2019-03-04" for 2018R1 and there where quite a lot of "left overs" especially in AD-Inv.Data etc...

greetings

Steffen

GregBirk
By Technical Writer
Technical Writer

Hi Steffen, 

The script has been tested with 2019 R1 and later.

 

 

Tooling42
By
Level 7

@GregBirk 

Hi,

thanks for providing the script.

The result of the first test to remove a specific tenant looks good.
It takes 5 minutes until the script finished successfully.

Then the tenant was removed from the GUI login:
.../Suite/Tenants/Select

The URL of the tenant shows only:
.../Suite/Tenant/TenantUID/Login/Failure/TenantInvalid

Also in the databases in dbo.Tenant the tenant was removed.

I will observe the behavior in the next days after some imports and reconciliation.

Btw, tested on FNMS 2019 R1 Hotfix 1-4 and Update 5

Best regards

Tooling42
By
Level 7

Hi,

also to use the script with e.g. 3 multiple tenant UIDs was working.

Please aware about these points:

  • A tenant with a high number of devices will not finished in 5 minutes per database.
  • Be sure, that you have enough disk space otherwise the script stop with: 
    The transaction log for database 'FNMP' is full due to 'ACTIVE_TRANSACTION'.
    The result can be, that the Flexera GUI shows only an error message and 
    the GUI is not available anymore. It can be that the transaction log needs
    space about 10 or more GB. Hope you have a test system to check it out.
  • Use the script for one tenant against each of the following databases (FNMP, FNMPDatabaseWarehouse, FNMPInventorydatabase)
    before the next reconciliation will started. Otherwise e.g. when you have only
    delete the tenant in FNMP, the tenant will created again in FNMP.
     
Tooling42
By
Level 7

Hi,

btw... The URL .../Suite/Tenant/TenantUID/Login/Failure/TenantInvalid shows:
-----------------------------------------------------------------------------
Sign In Failure
Your FlexNet Manager Suite license was not found. Please ask your administrator to contact Flexera Support and have your license verified.
Return to FlexNet Manager Suite
-----------------------------------------------------------------------------
"Return to FlexNet Manager Suite" is a link to the URL: .../Suite/Tenant/TenantUID/Login/Relogon
But the tenant was deleted, so this will not work. Perhaps this URL is more helpful: .../Suite/Tenants/Select

Best regards

Tooling42
By
Level 7

Hi,
when the script delete a tenant in the database FNMPInventorydatabase,
for some tenants the script finished with: Query completed with errors.

The check shows these messages with: The statement has been terminated.

a)
Deleting data for tenant 6 [2019-10-24 08:29:09.170]
Msg 2627, Level 14, State 1, Line 1
Violation of UNIQUE KEY constraint 'UQ_Organization'. Cannot insert duplicate key in object 'dbo.Organization_MT'. The duplicate key value is (<NULL>, , 6).
The statement has been terminated.

b)
Processing dbo.Domain_MT [2019-10-24 08:33:00.000]
Msg 547, Level 16, State 0, Line 1
The DELETE statement conflicted with the REFERENCE constraint "FK_Organization_Domain". The conflict occurred in database "IM", table "dbo.Organization_MT".
The statement has been terminated.
Processing dbo.Organization_MT [2019-10-24 08:33:00.110]
Msg 547, Level 16, State 0, Line 1
The DELETE statement conflicted with the REFERENCE constraint "FK_Domain_ID". The conflict occurred in database "IM", table "dbo.Domain_MT".
The statement has been terminated.

Can you please check?

Best regards

Tooling42
By
Level 7

Hi,

the script didn't delete the entries of the deleted tenants in
[FNMP].[dbo].[BatchProcessSchedule]
.
Please check:
SELECT * FROM [FNMP].[dbo].[BatchProcessSchedule]
.
That means
SELECT * FROM [FNMP].[dbo].[BatchProcessExecution]
WHERE Submitted >= '2020-09-03 02:00' and Output = 'Message validation failed'
order by BatchProcessExecutionID
shows a lot of failed batch processes of the deleted tenants.

GregBirk
By Technical Writer
Technical Writer

A new version of the TenantDeletion-Offline.sql file is now attached to this article, fixing known issues with the previous version.

Version history
Last update:
‎Nov 05, 2020 04:36 PM
Updated by: