5 Replies Latest reply on Jan 9, 2019 8:35 AM by Lal_Babu_Shaik

    How to list PI tags in AF Database


      I need to periodically copy an AF database and change the data archive server the PI Point Data References refer to.


      I usually export the AF database as XML, do a find and replace on the server name.  This won't however create PI tags with the correct configuration on the other data archive server.  I can pull the tag name using PI Builder but that process is quite manual.


      Is there an easy way to extract all the PI tags in use by an AF model?  I'd be interested in querying the PIFD SQL database directly or using some other method to list out the PI tags.  I would then import their configuration from the original data archive server and create/update the other data archive server.


      Or is there a better way to accomplish this?  The important part is that the second data archive server is manually updated.  It doesn't have the same automation to create/update tags as the first data archive server.




        • Re: How to list PI tags in AF Database
          David Hearn

          Have you looked at using the AFUpdatePlugInConfigurations command line utility? It has an option to 'ReplacePIServer' by specifying the old and new names of the PI Data Archive.

          • Re: How to list PI tags in AF Database

            This looks useful.  The one issue is that my AF model does not contain all the PI tag attributes required to create the PI tags.  This would help me replace the server name but not create the PI tags.


            AFUpdate PlugIn Configuration Utility 2017 SP2 (

            Copyright c 2007-2017 OSIsoft, LLC



            /Root:<string>    Specifies the PI AF Server (PISystem) or database on which to

                              operate on. (e.g. /Root:\\<PISystem>\<database>) Use '.' to

                              specify either the default PI AF Server or default database.

                              (short form /Root)



                              Replaces PI Data Archive with the new name specified if the

                              old name matches the name in the ConfigString of the

                              attribute (e.g. //replacepiserver:<old PI Data Archive

                              name>;<new PI Data Archive name>) (short form /Replace)


            /Repair[-]        Repairs any PI Point Data Reference attributes where the

                              point ID is not stored or is incorrect due to renaming,

                              deleting, etc. (default if CreateConfig or ReplacePIServer is

                              not specified) (short form /Repair)


            /CreateConfig[-]  Performs CreateConfig on all attributes of a database or PI

                              AF Server (PISystem) (short form /CreateConfig)


            /List[-]          Lists all the attributes which will be operated on without

                              actually operating on them (short form /List)



                              Performs specified operation of CreateConfig, Repair, or

                              Replace PI Data Archive on each attribute of all event frame

                              templates and event frames which occurred between the start

                              and end time specified (e.g. /EF:<start time>;<end time>)

                              (short form /EF)


            /?, /help         Print this help message.

            @<file>           Use the specified file to provide additional input arguments.

                              The file should contain one argument per line. Comment lines

                              start with the '#' character.

            • Re: How to list PI tags in AF Database
              Eugene Lee

              One way to simplify all these is to change the way that you build your AF Structure by having the PI Data Archive name as an AFAttribute in an Element at the root level. All Attribute Templates with PI Point DR configurations will point to this AFAttribute via substitution parameters. E.g.


              Element name: PIDA

              Attribute name: Name


              Subsitution parameter: %@\PIDA|Name%

              1 of 1 people found this helpful