In this video I'll show you how to move archive files
from one location to another. Some of my archive files are
only sharing a hard drive with my operating system and because these
files are read and written to a lot, moving them to a separate
hard drive will increase my machine's performance and stability.
I'll also be showing how we could decommission and move archive
files to a network location. This can be a useful
procedure for disk space management.
Here in the archive tab of System Management
Tools, I can see my ten registered archives.
All of them are located on my C drive
except for the current primary archive which is on the D drive.
My operating system is also installed on the C drive
and because these archive files are written to and read from often,
when they share a hard drive with the operating system,
it can reduce the read and write performance of your PI Data Archive.
If I explore to this C
drive, piarc directory, we can view these archive files in
Windows Explorer.
But if I try to copy and
paste any of these files onto my D drive, I
won't be able to.
Instead I'll get this
error message saying that these files are already open
in the PI Archive Subsystem.
The easiest way to remove this lock
is to select the file or files you want in
PI System Management Tools, right
click and then unregister. Before I
unregister, it's important to know that
unregistering this archive will create an archive gap.
This is important to know because any data sent to
an archive gap will be lost and unrecoverable.
So before you create an archive gap, ask
yourself if you are doing any back filling or expect any
data to get written to that time period in question.
Since I'm not back filling at the moment and all of my
interfaces are only writing current data to the primary
archive, I should be safe to unregister the historical archive.
Here System Management Tools keeps track
of all the files that have been recently registered in a
given time period as noted by this grey text.
But if I close System Management Tools and open it
again, or I simply click refresh, the user interface will
forget what used to be registered here and this will appear
as an archive gap meaning that no archive is currently
registered for this time period. Remember
this archive gap means that any data written to this time
period will be lost. So it's important to keep these to a
minimum. Let's go back to Explorer and move
our archive files the C drive to our designated archive drive
D. Now that the PI Data Archive no longer has a
lock, I can move these as I would any file. So I'll select the
two archives I unregistered earlier along with their
annotation file, cut them and then
paste them here in D: piarc
Back in System Management Tools, right clicking in my archive
window, I can choose to register archive.
Then navigate to my archive folder
and choose my two moved archives.
Once I hit
OK, we can see that they've been successfully registered
and they are now located on the D drive.
Now I left the other archives on the C drive because now I'll show you
how we can use wild cards in the command prompt to
unregister, move and register an entire folder of archives
all at once.
So opening a command
prompt as administrator,
I'll change my directory to
the environment variable
PISERVER slash ADM.
And here I'll be using the PIRTool
command. I'll start by passing a question mark to view the help
dialogue. This screen will show us how
to use the PIAR tool and we can see that the proper
usage of PIAR tool is
PIAR followed by dash and then the command. And then
any options we want to add.
The commands I'll be using in this video are
ar for archive register and au for archive
unregister. So let's start by using
the au command. I'm going to type in
PIARTOOL and
unregister archives. And now I'm going to
target my C: piarc folder by
typing in C: PIARC and then
an asterisks to imply that I want to target all the files in that folder.
Once it chews through that
command I can see that I've successfully
unregistered the rest of the seven archives on C. Back in System Management Tools,
after I refresh we can see that those
archives have indeed been successfully unregistered.
There is no archive gap listed this time because archive gaps
only appear when there is an archive gap between
two registered archives not at the chronological
start of our archive files. But still since there are no
archive files registered for this time period, any data
sent to it will be lost forever.
Now that the PI Data Archive doesn't have a lock on these files,
I can run a move command from the command prompt.
I'll type in move and
then C drive piarc * to
imply that I want to target everything in piarc.
And then D drive piarc
So I'll move everything in
C PIARC to
D PIARC. This is exactly the same as copying and pasting. And
since these archives are unregistered I could actually choose to do that
instead.
Now the last step is to run PIARTOOL
again. And this time using the ar command for
archive register. I'll run
PIARTOOL ar
and then target everything in my D PIARC
folder. This asterisks means I want to register all files.
I'll get some harmless
error messages about trying to register files that are already
registered. But the PIARTOOL will successfully
mass register any other archive in that folder.
Back in System Management Tools, after refreshing,
we can see that our archive files have all successfully moved to our D drive.
The last thing I'll do in this video is decommission
my oldest archive file and move it off the machine for safe keeping.
It's the exact same procedure as
before starting by unregistering the
file
navigating to
it and I'm
going to cut it
and paste it in my networking directory here.
Decommissioning the archive in this way will mean that the PI Data Archive
can no longer query the data in this archive, but we can
always register it again if we need that data in the future.
If you are looking for more information about external
locations, and what kind of network storage OSIsoft supports,
visit KB482 on our tech support site.
Or KB3106.
Now that we've seen
two different ways to unregister,
move and register archives, you can choose the one that makes sense for you.
And while it might take a little bit more time to
get comfortable using the command prompt on a day to day basis at first, you can
use those commands in batch files and automatically
schedule tasks to automate parts to your PI administrative duties.
In the next video in the series,
we'll be detecting, troubleshooting and running
diagnostics on problems with our archive files
and the PI Data Archive archiving process in general.