Database Maintenance Exits with U00031148 Archive folder already exists

Document ID : KB000097608
Last Modified Date : 27/08/2018
Show Technical Document Details
Issue:
Database maintenance can be set up to run automatically via workflows, and Professional Services has already-built solutions for this requirement. In some of the first iterations of the custom solution, the maintenance utilities (especially when ran multiple times per day) may exit with the following error:

U00031148 Archive folder 'c:\automic\data\archives\0360\UC_ARCHIV_20180517_0\ <file:///c:\automic\data\archives\0360\UC_ARCHIV_20180517_0\> ' already exists. 
If last archive was not finished successfully, please increment the value of the 'ARCHIVSET' section in the variable. 

Updating the ARCHIVSET section of the variable UC_UTILITY_ARCHIVE

https://docs.automic.com/documentation/webhelp/english/AWA/12.1/DOCU/12.1/AWA%20Guides/help.htm#AE_AWA_Source/Administration/admin_UC_UTILITY_ARCHIVE.htm?

resolves the issue temporarily, but the custom solution clears this value and will present again if the utilities are re-ran. 
Environment:
Any ONE Automation Engine where this solution has been implemented may be affected. 
Cause:
In the first iterations of the solution, "Replace if exists" (via the PRPT.ARCHIVE_SETTINGS.MAINT PromptSet of the custom solution) is set to TRUE.
Resolution:
The workflow has the ability to update the maintenance settings in the UC_UTILITY_ARCHIVE and UC_UTILITY_REORG. However, it has an issue if someone runs maintenance multiple times on the same day with the following parameter set to TRUE. 

"Replace if exists" - via PRPT.ARCHIVE_SETTINGS.MAINT PromptSet. 

It clears out the ARCHIVSET setting and causes the following error: 

U00031148 Archive folder 'c:\automic\data\archives\0360\UC_ARCHIV_20180517_0\ <file:///c:\automic\data\archives\0360\UC_ARCHIV_20180517_0\> ' already exists. 
If last archive was not finished successfully, 
please increment the value of the 'ARCHIVSET' section in the variable. 

This setting should be kept as FALSE, going forward. If setting to FALSE doesn't work, you could rename the current directory from UC_ARCHIV_xxxx_0 to UC_ARCHIV_xxxx_0.BAK, then rerun the aborted job.