How to properly remove Elasticsearch Snapshot locations deactivated.

book

Article ID: 100052882

calendar_today

Updated On:

Description

Error Message

The shell command 

Remove-EVIndexSnapshotLocation -SnapshotLocationPath  -EVServerName evserver1.kvs.local -ForceDelete

is failing with the error message:

Remove-EVIndexSnapshotLocation: Failed to remove the index snapshot location

'\\ev1\elasticsearch' on the Enterprise
Vault index server 'evserver1.kvs.local'.
At line:1 char:1
+ Remove-EVIndexSnapshotLocation -SnapshotLocationPath \\ev1\elasticsea ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Symantec.Enterp...napshotLocation:EVIndexSnapshotLocation) [Remove-EVIndexSnapshotLocation], IndexSnapshotManagementException + FullyQualifiedErrorId : IndexSnapshotManagementRemoveSnapshotLocationsException,Symantec.EnterpriseVault.PowerShell.AdminAPI.RemoveEVIndexSnapshotLocation

Additionally, the Event ID 13405 from Directory Service is also logged in the Enterprise Vault event log: 

Log Name:      Veritas Enterprise Vault
Source:        Enterprise Vault 
Event ID:      13405
Task Category: Directory Service
Level:         Error
Keywords:      Classic
Computer:      evserver1.kvs.local
Description:
A constraint violation error was detected while accessing the Vault Database 'EnterpriseVaultDirectory' (Internal reference: {CADODataAccess::ExecuteSQLCommand} [d:\builds\13_\ev\v-prod-s\sources\source\common\adointerface\adodataaccess.cpp, lines {1326,1328,1347,1365}, built Dec  1 14:02:01 2021]): 

Description:  

The DELETE statement conflicted with the REFERENCE constraint "FK_SnapshotRepositories_SnapshotLocations". The conflict occurred in database "EnterpriseVaultDirectory", table "dbo.SnapshotRepositories", column 'LocationIdentity'.

SQL Command: 
 DeleteElasticsearchSnapshotLocation
 
Additional Microsoft supplied information:
 
Source:       Microsoft OLE DB Driver for SQL Server 
Number:       0x80040e2f 
SQL State:    23000 
Native Error: 00000547 
HRESULT        0x80040e2f

V-437-13405

Cause

In order to remove a deactivated Elasticsearch Index Snapshot location, it is required to first remove all the Index Snapshots and the repository constraint 

Resolution

In the following example, the EVServerName used is: evserver1.kvs.local and the old Elasticsearch Index Snapshot Location is \\ev1\elasticsearch

It is assumed that in the new Elasticsearch Index Snapshot Location there is at least one snapshot 

1. Get the list of the Index Snapshots bound to the deactivated Index Snapshot Repository 

Get-EVIndexSnapshotRepository -OnlyInUse:$false | Get-EVIndexSnapshot -EVServerName evserver1.kvs.local

2. Remove all the Index Snapshots returned by previous command (respond A for Yes to all)

Get-EVIndexSnapshotRepository -OnlyInUse:$false | Get-EVIndexSnapshot -EVServerName evserver1.kvs.local | Remove-EVIndexSnapshot 

3. The shell command at point 1 returns 0 entries 

4. Get the list of the Snapshot repository no longer in use 

Get-EVIndexSnapshotLocation -OnlyActive:$false | Get-EVIndexSnapshotRepository -OnlyInUse:$false -path \\ev1\elasticsearch 

5. Remove the Snapshot repository no longer in use (respond A for Yes to all)

Get-EVIndexSnapshotLocation -OnlyActive:$false | Get-EVIndexSnapshotRepository -OnlyInUse:$false -EVServerName evserver1.kvs.local -path \\ev1\elasticsearch | Remove-EVIndexSnapshotRepository

6. Get the Elasticsearch Snapshot location deactivated

Get-EVIndexSnapshotLocation -ServerName evserver1.kvs.local -OnlyActive:$false

7. Remove the Elasticsearch Snapshot location deactivated 

Remove-EVIndexSnapshotLocation -SnapshotLocationPath \\ev1\elasticsearch -EVServerName evserver1.kvs.local 

Issue/Introduction

In a scenario where a new Elasticsearch Index Snapshot location has been created, then the previous snapshot location, its repository and its index snapshots are no longer usable.