Question:
How to find all subscriptions that exist in the Operations Automation Database and does not in the Business Automation Database for further deletion of such subscriptions.
Answer:
There is no such functionality in OA but the following selects from the Databases can be compared in order to find the aforementioned subscriptions:
From Operations Automation Database:
plesk=> \o /tmp/dbpoamn.txt plesk=> select sub_id from subscriptions where is_active=1 order by sub_id asc; plesk=> \o
From Business Automation Database:
pba=> \o /tmp/dbbilling.txt pba=> select "subscriptionID" from "Subscription" where "Status"=30 order by "subscriptionID" asc; pba=> \o
To delete these subscriptions, use OpenAPI method pem.removeSubscription:
Create a pem.removeSubscription.xml file on the OA Management Node with the following content:
<?xml version='1.0'?> <methodCall> <methodName>pem.removeSubscription</methodName> <params> <param> <value> <struct> <member> <name>subscription_id</name> <value><int>SUB_ID</int></value> </member> </struct> </value> </param> </params> </methodCall>
Replace
SUB_ID
in the content above with the ID of the existing subscription you are about to remove.Send an XML API request to OA using the curl utility:
curl -d@pem.removeSubscription.xml http://localhost:8440