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
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.
- We strongly recommend you to back the database up before you make changes in it.
- 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_zones.id - DNS zone resource identifier;
dns_zones.name - 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.
parent_child.account_id=accounts.id - account identifier;
parent_child.parent_id - parent resource identifier;
parent_child.child_id - child resource identifier. DNS zone is a child resource to
- accounts - the list of accounts.
accounts.id - 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.
users.id - user id;
users.reseller_id=resellers.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_account.user_id=users.id - user id;
user_account.account_id=accounts.id - account id for this user;
- resellers - the list of resellers.
resellers.id - reseller id;
- e_zones - the list of service DNS zones.
e_zones.id=dns_zones.id - service DNS zone id;
e_zones.reseller_id=resellers.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 = 'domain.com';
Here, domain.com 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
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:
- Log into your control panel server as cpanel user running the following command:
su -l cpanel
- 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:
- Make sure you are logged as cpanel user.
- Execute the following command:
java psoft.hsphere.tools.DeleteAccounts < 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.