Wednesday, February 26, 2014

How to Restore your PI Server



How to Restore your PI Server
Restoring your PI Server is the process of getting your PI Server software, configuration, and operations data from your backup files.
In order to restore your PI Server, you needed to have:
  1. Had a running PI Server
  2. Created Backup files (see How to Backup your PI Server)
If you have the backup files on a remote directory or on a USB drive, you are in a good position to use this article.
Contents
[hide]
Backup Files
Your backup files ought to (should) look like the PIHOME (e.g. C:\PI) directory. There are the following folders:
  • adm (administrative scripts)
  • bin (binaries)
  • dat (server configuration)
  • log (log files)
  • arc (archive of historical data)
Restoring to Existing PI Server
Before you begin, your PI server ought to be stopped. To stop PI:
 c:\pi\adm\pisrvstop
You also need to know which archive is the primary archive.
Determine Primary Archive
To do this, execute the following statement from the command line: c:\pi\adm\pidiag -ahd <path of archive>
For example:
 c:\pi\adm\pidiag.exe -ahd c:\pi\arc\piarch.006
The response ought to be some gibberish. You are looking for the EndTime to be "Current Time".
 PIarcfilehead[$Workfile: piarfile.cxx $ $Revision: 115 $]::
   Version: 7 Path: piarch.006
   State: 3 Type: 0 (fixed) Write Flag: 1 Shift Flag: 1
   Record Size: 1024 Count: 131072  Add Rate/Hour: 6.8
   Offsets: Primary: 26753/65536 Overflow: 81813/131072
   Annotations: 16015/65535  Annotation File Size: 4666812
        Start Time: 5-Jun-11 10:30:41
          End Time: Current Time
       Backup Time: 13-Sep-11 03:16:15
     Last Modified: 14-Sep-11 03:15:11
The archive whose End Time is "Current Time" and has the most recent Start Time is the primary archive.
Copy Backup Files to PIHOME
Copy the PI Backup files to the PI folder. For my server, the backup files are located at d:\backups\pi.
To copy those files, over, I execute the xcopy /s /y command:
 xcopy /s /y d:\backups\pi c:\pi
This command will copy all files from d:\backups\pi to c:\pi. This command will copy all subdirectories (/s) and overwrite file collisions (conflict) (/y). You are essentially replacing the existing files with files from the backup.
Note: Not all PI server files are backed up (various .bat files and binaries). Which is why you need a working PI server to accomplish this restoration.
Register the Primary Archive
What you see after running pidiag -ar
Register the primary archive with the command c:\pi\adm\pidiag -ar
 c:\pi\adm\pidiag.exe -ar
You will be presented with a dialog:
Enter the full name of the primary file (including directory structure). For example:
 c:\pi\piarch.006
Once completed, your PI server can be started. However, the history has yet to be restored.
Restoring Remaining Archive Files
Archive files are registered with the piartool -ar command. To register the remaining archives, execute that command against every archive you wish to register.
 c:\pi\adm\piartool -ar c:\pi\arc\piarch.001
 c:\pi\adm\piartool -ar c:\pi\arc\piarch.002
 c:\pi\adm\piartool -ar c:\pi\arc\piarch.003
 c:\pi\adm\piartool -ar c:\pi\arc\piarch.004
 c:\pi\adm\piartool -ar c:\pi\arc\piarch.005
If your archives have a nomenclature that can be described with a wildcard, and you have a lot of archives to register, try the for command:
 for %f in (piarch.???) do c:\pi\adm\piartool.exe -ar %f
This command executes c:\pi\adm\piartool.exe -ar against every file of the form piarch.???.

No comments:

Post a Comment