SYMPTOMS
Special tool for deleting PBA system entities is provided as a part of distribution starting PBA version 4.3.1. For PBA versions earlier than 4.3.1, the tool has to be set up and configured according to KB article #5246.CAUSE
The tool is aimed to be used for removing test entities (accounts, subscriptions, orders, and the like) before the system is launched in production, or entities long not in use.RESOLUTION
Attention!- Deleting any entries involves removing dependent entities as well. Namely, if you remove service plan, all subscriptions to this service plan, orders and other provisioning information is removed as well. Execute extreme caution when removing any entries as they can not be restored unless DB backup was made.
- The script returns SQL DELETE statements, running it does not bring about deleting anything from DB. Returned statements have to be querried in mysql.
- Pay special attention when deleting reseller accounts! To delete reseller account, all its customer accounts should be deleted first.
Additional information
Example below illustrates how account can be removed with the script.To delete an account:
- Log in to PBA production server as root.
- Execute the script for deleting system entities via command:
- "IntAccount" here is the table account information is stored in,
- "AccountID=1000001" - ID of the account to be deleted.
parameters. The script returns 'DELETE' SQL statements.
3. Run mysql and execute queries returned by depsdb.pl.
Typical system entities that can be removed with the tool:
- Service plan. Example: ~bm/tools/depsdb.pl -d Plan PlanID=12
- Subscription. Example: ~bm/tools/depsdb.pl -d Subscription SubscriptionID=1000221
- Account. Example: ~bm/tools/depsdb.pl -d IntAccount AccountID=1000001
To optimize the deletion process, the following bash script can be used:
#!/bin/bash
for id in `cat 123` ; do
echo "Delete AccountID=$id"
~bm/tools/depsdb.pl -d IntAccount AccountID=$id | grep -v dbi | grep -v Lookout > /tmp/delaccount.sql
mysql bm4 -h192.168.156.9 -ubm4 -pbm4 < /tmp/delaccount.sql
done
"123" here is file with account IDs, one ID per row. For example:
1000001
1000002
1000003
1000004
1000005
1000006
The file has to be created in ~bm/tools/ directory.
"mysql bm4 -h192.168.156.9 -ubm4 -pbm4" is PBA DB.
The script utilizes /tmp/delaccount.sql file to temporary store SQL statements. These statements are then executed in mysql.