StéphanS
Regular Pleskian
After migrating an old Plesk 8.6 to Plesk 11.5, I came across this annoying named limitation:
Which means that I have NS records that point to a host name that doesn't exist in the same zone.
You can list all of these failed zones with:
There were only 16 of these failed DNS zones for me, so I could have just fixed them by hand via Plesk.
But I'm in the process of migrating another 15 Plesk servers, so I decided to invest some time into fixing this via the DB.
I came across http://kb.parallels.com/en/113119 which doesn't solve the problem, but had far better SQL than I had.
So I merged my first piece of code with some of the code in the article.
This is my result:
Now if only
could do this for me, I would be so much happier 
Code:
zone xx.tld/IN: NS 'ns.xx.tld' has no address records (A or AAAA)
zone xx.tld/IN: not loaded due to errors.
_default/xx.tld/IN: bad zone
[FAILED]
Which means that I have NS records that point to a host name that doesn't exist in the same zone.
You can list all of these failed zones with:
Code:
service named restart | grep "bad zone"
There were only 16 of these failed DNS zones for me, so I could have just fixed them by hand via Plesk.
But I'm in the process of migrating another 15 Plesk servers, so I decided to invest some time into fixing this via the DB.
I came across http://kb.parallels.com/en/113119 which doesn't solve the problem, but had far better SQL than I had.
So I merged my first piece of code with some of the code in the article.
This is my result:
Code:
# Fix any broken DNS entries
# Inspect first
mysql -uadmin -p$(cat /etc/psa/.psa.shadow) -D psa -Nse "SELECT * FROM dns_recs AS DR, dns_zone AS DZ WHERE DZ.status=0 AND DZ.id=DR.dns_zone_id AND DR.type='NS' AND DR.val = CONCAT('ns.',DZ.name,'.') AND DR.val NOT IN (SELECT host FROM dns_recs);"
# Delete all bad records and regenerate the bad zones
mysql -uadmin -p$(cat /etc/psa/.psa.shadow) -D psa -Nse "SELECT DR.id, DZ.name FROM dns_recs AS DR, dns_zone AS DZ WHERE DZ.status=0 AND DZ.id=DR.dns_zone_id AND DR.type='NS' AND DR.val = CONCAT('ns.',DZ.name,'.') AND DR.val NOT IN (SELECT host FROM dns_recs);" | while read record domain; do mysql -uadmin -p$(cat /etc/psa/.psa.shadow) -D psa -Nse "DELETE FROM dns_recs WHERE dns_recs.id=$record"; plesk sbin dnsmng --update $domain; done
service named restart
Now if only
Code:
plesk bin repair --run