Stopping PI channels using SQL queries

During a migration of one PO system we had to stop all PO channels, our problem was that we had to ensure the channels were stopped before starting the system to avoid any risks that could make things going wrong.

Well, there are two ways of doing this, the first is the official way where you follow note 1884085 and you do what has to be done through the config tool, in our case that was not available because this was a migration and at the stage we wanted to stop the channels just the ASCS and DB instances were installed. We decided then to get a little bit out of the best practice and do this through the database.

This are the queries we used:

  • First let's check channels actual STATE:
    • select p.CHANNEL_ID, z.CHANNEL, p.ACTIVATION_STATE from SAPSR3DB.XI_AF_ADM_STATE p, SAPSR3DB.XI_AF_CPA_CHANNEL z where p.CHANNEL_ID=z.OBJECT_ID
  • We could also check channels STATE history:
    • select p.CHANNEL_ID, z.CHANNEL, p.ACTIVATION_STATE from SAPSR3DB.XI_AF_ADM_STATEHIS p, SAPSR3DB.XI_AF_CPA_CHANNEL z where p.CHANNEL_ID=z.OBJECT_ID
  • And this is to check if channels are configured to start automatically:
    • select p.CHANNEL_ID, z.CHANNEL, p.AUTOMATION from SAPSR3DB.XI_AF_ADM_AUTO p, SAPSR3DB.XI_AF_CPA_CHANNEL z where p.CHANNEL_ID=z.OBJECT_ID
  • Now we know, lets set all channels to STOPPED:
    • update POP.SAPSR3DB.XI_AF_ADM_STATE set ACTIVATION_STATE = 'STOPPED'
  • If we want to change the whole history to STOPPED (This was a migration, we wanted to kinda reset this too):
    • update POP.SAPSR3DB.XI_AF_ADM_STATEHIS set ACTIVATION_STATE = 'STOPPED'
  • And then to avoid channels getting started automatically every was set to MANUAL:
    • update POP.SAPSR3DB.XI_AF_ADM_SCHEDULE set ENABLED = 0
Category