Domino on Linux/Unix, Troubleshooting, Best Practices, Tips and more ...

 
alt

Daniel Nashed

 

    Restoring deleted folders in a Notes database

    Daniel Nashed  25 January 2020 10:46:46

    Feature Request: Trash for Folders


    In many customer environments, restoring deleted folders is number one reason for restoring databases.

    For documents you already have soft-deletions and the trash (default 48 hours which can be increased).

    And you can restore the document to the original folder.


    There is an AHA idea to have a trash for folder deletes, which is really popular (  
    https://domino-ideas.hcltechsw.com/ideas/NTS-I-31 ).
    Actually I could come up with an extension manager which hooks into the folder delete and rename it to DeletedFolders\MyFolderName.
    But this should be there out of the box and fully integrated into Notes and into the mail-file!



    Restoring deleted folders


    Last week I had to recover folders for a customer and there is actually a straight forward way, if you know how replication works in detail.


    Idea


    Thanks to Friedhelm Klein from Timetoact, who came up with a great idea in one of his Admin Camp presentations!

    When you restore a database you just have to update the folder design notes in the restored database to make the sequence time/date newer than the deletion stub in the original database.

    An update beats a deletion and you don't have to remove any deletion stubs in the original database on your own. The replication will also take care for putting back all still existing documents into the folder!


    Out of the box without any extra tools you just need the following steps:


    1. Restore the database with replication disabled

    2. Run convert -u twice on the database -> this will update the folder design of all custom folders from the inbox and modify the folder design element

    3. Enable replication and replicate (push) the changes from the restore database to the original database. You might want to use the -NOPIRC flag depending on when the folder was deleted

    4. Disable replication or delete the restore database


    Those steps are quite straightforward.

    But if you could also add this to your restore routine. I added it to my "nshrestore" helper application, which is also the restore part of my backup solution. So with the restore, you will be able to request automatically folder restores.
    I am still testing and have to integrate it to the UI. But it works like charm!


    C-API based solution


    load nshrestore.exe mailrestore.nsf -k mailtest.nsf

    ..
     Restoring deleted folder [Test1] Deleted: 25.01.2020 13:03:32

      Restoring deleted folder [Test1\Test A] Deleted: 25.01.2020 13:03:32
      Restoring deleted folder [Test1\Test A\Test AA] Deleted: 25.01.2020 13:03:32
      Restored 3 folder(s) from [mailrestore.nsf] to [mailtest.nsf]

    How does it work?
    • I am searching for deleted NOTE_CLASS_VIEW
    • If the Note returns a deletion stub, I am looking for the original document by UNID on the restored database.
    • In case this is really a folder (DESIGN_FLAG_FOLDER_VIEW, etc), I am updating the folder note twice
    • Afterwards I push replicate the restore database, with the local server

    This restores the original folders :-)


    Conclusion


    So even with no add-on tools you can do this today. And there are options for further automation.
    It's a bit tricky to get information from a deletion stub. But beside that, it was quite straightforward.


    And I would really wish we don't have to do those kind of restores less often, once the trash for folders will make it into Domino!


    -- Daniel


    Links

      Archives


      • [HCL Domino]
      • [Domino on Linux]
      • [Nash!Com]
      • [Daniel Nashed]