Article ID: 3426, created on Nov 30, 2007, last review on Dec 7, 2015

  • Applies to:
  • H-Sphere


This document contains step-by-step instruction on how to remove the DNS zone if, while adding DNS zone for a domain, the following error message shows up:

Zone ... has been taken

See also the troubleshooter

Note: Here, we deal with such issues where, by some reason, DNS zone was not correctly created or not completely removed from the system. We don't consider cases where this DNS zone exists on a live account.

First of all, you need to check from the CP interface if this domain zone is indeed removed. For this, choose the Search/In resellers menu and search for the domain name.

If no account is found, you need to remove the DNS zone from the H-Sphere database.

  1. We strongly recommend you to back the database up before you make changes in it.
  2. Use transactions when you modify tables. Transactions have the following format:

    begin; - start the transaction.
    [statements for modifying data: delete, insert, update, and the like]
    rollback; - rollback the transaction; also perform rollback when you make a syntax error in the previous statement.
    commit; - commit the transaction.
    Use either rollback; or commit; to finish the transaction.

The following tables and fields are considered in this guide:

  • dns_zones - the list of DNS zones. - DNS zone resource identifier; - DNS zone domain name.
  • parent_child - the tree of resources related to accounts. Account is a root resource. Certain account resources (parent resources) may have child resources. - account identifier;
       parent_child.parent_id - parent resource identifier;
       parent_child.child_id - child resource identifier. DNS zone is a child resource to the account.
  • accounts - the list of accounts. - account identifier;
       account.deleted - contains the date when the account has been deleted, or NULL if the account is alive;
  • users - the list of end users. - user id; - id of the reseller under whom this user is created; 1 if the user has no reseller.
  • user_account - the table which maintains the user-account correspondence. It links the users and accounts tables. - user id; - account id for this user;
  • resellers - the list of resellers. - reseller id;
  • e_zones - the list of service DNS zones. - service DNS zone id; - id of the reseller who hosts this zone;

1. Check if the DNS zone is present in the database:
select * from dns_zones where name = '';
Here, is the DNS zone name.

2. Find out the type of the DNS zone (user DNS zone or service DNS zone).
select account_id from parent_child where child_id = <dns_zone_id>;

If the query returns nothing, the DNS zone is the service DNS zone.

Otherwise, it is the user DNS zone. parent_child.account_id is the account under which this DNS zone is created.


Removing User Domain Zone

1. Check if the account for the DNS zone is deleted:
select deleted from accounts where id = <account_id>;

2. If accounts.deleted is not NULL, it means that the account has been deleted.

In this case, it is required to remove all records with this account id from the parent_child table:

delete from parent_child where account_id = <account_id> and account_id <> child_id;

3. If account.deleted is NULL, check if there is a user for this account:
select * from user_account where account_id = <account_id>;

If this query returns nothing, we have got an error: account exists, but no user corresponds to this account. In this case, you should run the DeletedAccounts Java utility:

  1. Log into your control panel server as cpanel user running the following command:
    su -l cpanel
  2. Execute the following command:

Then, enter the ids of the accounts you wish to delete, or create the file with these account ids in separate lines and redirect it to the standard input of the above command:

  1. Make sure you are logged as cpanel user.
  2. Execute the following command:
    java < file_with_account_ids

Note: DeleteAccounts should not be used against reseller accounts!


Removing Service Domain Zone

1. Find the reseller id for this DNS zone:
select reseller_id from e_zones where id = <dns_zone_id>;

2. Find the reseller in the resellers and users table:
select * from resellers where id = <reseller_id>;
select* from users where id = <reseller_id>;

3. If the reseller is not found in any of these tables:
1) change the reseller id to 1 in the e_zones table:
update e_zones set reseller_id = 1 where id = <dns_zones_id>;
2) restart CP;
3) Remove the DNS zone from the CP admin interface in the E.Manager/DNS Settings menu.

f213b9fa8759d57bee5d547445806fe7 6311ae17c1ee52b36e68aaf4ad066387

Email subscription for changes to this article
Save as PDF