2 Replies Latest reply on Apr 18, 2018 12:15 PM by ariveron

    Archive Duration

    Mike315

      Hi All,

       

      I recently took over responsibility of our company's PI historian. I've been tasked with finding if we keep archived data indefinitely or if we only keep it for a limited time (say 5 years or so) and then the data is removed to free up space. Could someone tell me the easiest way to go about finding this out? I currently have PI System Explorer and PI System Mangement Tools installed on my machine. Thanks!

       

      Mike

        • Re: Archive Duration
          ariveron

          Hi Michael,

           

          To my knowledge, the PI Data Archive does not have a built in feature to automatically delete archives older than a certain date. The closest thing to this feature would be disable automatic archive creation, and enable overwrite data on auto shift failure, the combination of which would stop the archive from creating new archives and would cause it to overwrite existing archives, starting from the oldest archive. If the automatic archive creation is left enabled then and the overwrite data is enabled, then the PI Data Archive will only overwrite older archives, if it fails to create a new archive to shift to. The following linked article goes into more detail about these tuning parameters, which can be found in PI System Management Tools (SMT) > Operation > Tuning Parameters > Archive: KB3122OSI8.

           

          Regards,

          Alex

            • Re: Archive Duration
              ariveron

              I would also like to add, that you could create a simple script to delete archives older than a certain date:

               

              This would be possible with scripts (VBA scripts for example) or custom-written program, or perhaps 3rd party file-cleanup software.

              - We do not have a such a script available, but the general logic of such a script would look something like this:

              1) Query the archive folder for all file names      (FileList = AllFiles("C:\PI\Archives")

              2) Loop through each file for the “date modified”

              (Something like this:   ModifiedDate = IO.File.GetLastWriteTime(“FileList”))

              3.) Unregister the files that are over 3 years old    (piartool –au “file path”)

              4.) Delete the file   (My.Computer.FileSystem.DeleteFile("C:\test.txt"))