Product:
Search Type:

How to remove test accounts from PBA

Article ID: 5247 
Last Review: Jul,28 2008
APPLIES TO:
  • Parallels Business Automation - Enterprise
  • Parallels Business Automation - Enterprise, 4.1
  • Parallels Business Automation - Enterprise, 4.2

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:

  1. Log in to PBA production server as root.
  2. Execute the script for deleting system entities via command:
    "~bm/tools/depsdb.pl -d IntAccount AccountID=1000001"
  • "IntAccount" here is the table account information is stored in,
  • "AccountID=1000001" - ID of the account to be deleted.
   To remove account by another parameter, check IntAccount table structure for other
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
Note: this way can be used when it is required to delete insufficient number of account. To delete a number of accounts, use the way described below.

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.

Please provide feedback on this article

Did this article help you solve your issue?
Yes
No
Partially
I do not know yet
 
Strongly Agree   Strongly Disagree
  9 8 7 6 5 4 3 2 1
The article is easy to understand
The article is accurate
Additional Comments:
*Please provide us with your email address in case we need to contact you.
*Please type the code you can see.
* - required fields