I need help to prepare one batch file to unregister archives and delete them from drive which is older than 1year.
Appreciate your help.
Thanks in Advance
You can use power shell script to unregister and delete.
e.g. Unregister an archive --->Unregister-PIArchive -Name "D:\Program Files\PI\arc\piarch008.arc" -Connection $con
Remove-item to remove a file.
If you familiar with this, could you please share some sample examples on this.
With Best Regards,
m +91 9951062323
Sensitivity: Internal & Restricted
On PI server --> PIHome (Folder) -->OSIsoft.PowerShell-->ExampleScripts--> MoveOldArchives.ps1
Alternate to PowerShell, you an also use the plain old batch script:
To unregister an archive, use the piartool -au command. The syntax is:
piartool -au path
where path specifies an absolute pathname.
For example, to unregister an archive called piarch.006 in the PI\dat directory on the D drive:
piartool -au D:\PI\dat\piarch.006
You can use the wildcard characters * and ? to register archives in bulk. The symbol * matches all possibilities with any number of characters. The symbol ? matches a single character and may be used any number of times.
For example, to unregister all archive files that begin with the piarch.0 prefix and are located in the PI\dat directory:
piartool -au D:\PI\dat\piarch.0*
Are you intending to delete the files from disk? This is dangerous as the data will be lost permanently. If you need to free up space in the PI Server you could unregister the archives and move them on a separate storage.
for automation world, not every engineer knows how to do it.
for my case, customer only wants to keep the production data for 3 years. they required the production data to be deleted after 3 years. the system only has 2500 tags
my questions to the PI Guru are:
1. how to calculate the archive file size and how many archive files need? temporary, I setup each archive file to 1024MB. I understood that the new archive file will be created automatically when the current archive file size hit 1024MB. and the PI system will re-use the oldest archive file when the HDD size is not enough.
but I do not know how many archive files will be created eventually when 3 years time elapsed and not sure whether the HDD size is good enough to keep these 3 years data.
2. I also setup site backup to NAS storage. I need prepare for the step by step maintenance plan for customer to clear the NAS storage.
It will be very helpful if someone can share the tips or documents.
Thank you again.
PI Data Archive collects data based on events (changes in value) and applies a compression, which is configurable. It is not possible to tell in advance how much data will be written every day into PI Archive. It depends on your data sources and how fast data is changing.
To estimate data amount written daily:
- open PI System Management Tools
- in the detailed information find for the current archive file: archive start date and percent full
- calculate (percent full * achive size in MB) / (current date - archive start date, in days)
- you get average MB per day
Of course, you must have all your interfaces running and delivering data.
I have a look into Tuning parameters again. I did not find the parameters I want to do the following action.
1. Customer wants to delete the archive older than 3 years automatically, with zero maintenance.
2. Based on the calculation, it only need 150GB for 2500 tags up to 3 years archive.
3. to play safe, I reserved 1,000 GB HDD, that is more than enough.
4. now the question is, how do I create the plan for customer has zero maintenance? if I did not do anything, and auto archive creation is turned on then the HDD will be full eventually ( (1000/150)*3= 20 years later.
Not sure whether it is correct way to do so, I believed that the easier way to me is:
Step a. Assume each archive file is 5 GB, I can manually create 150/5=30 archives in the first place
Step b. Disable to auto archive by clear the value in this tuning parameter: Archive_AutoArchiveFileRoot
as such, Auto Archive Creation feature will be turned off. and the pi will use these 30 archived files I created at step a. once primary archive file is full, next archive file will begin so on and forth up to 30th archive files. if 30 archive file is fully, it will return to first archive file.
It will work exactly the way you described. The oldest archive file will be overwritten if all archive files are full.
If your archive sizing calculations result in 20 years drive capacity, you don't need to do anything, just leave the auto creation of data archives. Every 5-7 years the system will be upgraded anyway and probably moved to a new hardware. It is impossible to keep the same hardware configuration for 20 years...
And "zero maintenance" for PI Data Archive is not the best practice. The weekly/monthly maintenance is needed like with other Windows servers.
We have the sizing guidelines in both PI System Management Guide as well as online Hardware Sizing Tool.
The size of archive file size will depend on many parameters such as (incoming data rate, compression ratio, and online data time range) It would be best to play with our online sizing tools as below:
System Manager Resources
Yes, I used this tool to do the calculation ( but I changed each archive file size to 5GB).
my question now is not the concern of HDD size, but how to help customer to do zero maintenance (un-attended). I have done one project few years ago which used SQL as data log, and due to lack of skilled personal on site, the HDD is full in 3 years due to huge chunk of SQL transaction log.
for the project I am running currently, I choose Pi as data log. in order to prevent the HDD become full again (after many years), I have created the following procedure to do so. is it the correct way to do so?
We have tried this in early project, please refer to below link where we are finding the old files and moving them to different location using batch file(s).
Hope this might find you help full with above suggestions.
Looking for a script to unregister old archives and move it to mount drive and register from the new location
Thanks for your email, i will download and check whether it suits my requirement.
Retrieving data ...