Database Cleanup commands
-
I have a Problem with FOG, We had computers without network cable acces, in order to fix this problem we tried to adjust the primary Mac-code to the MAC-code of the USB to Gigabit adapter but we didn’t restore the MAC-code properly after image was uploaded. Now we cannot find the hosts anymore if we try to create a new host FOG says the hostname already exist but we cannot find it in the database.
We tried to fix this problem by adjusting the following:# The following chunk of commands will clean out most problems and are safe: DELETE FROM `hosts` WHERE `hostID` = '0'; DELETE FROM `hostMAC` WHERE hmID = '0' OR `hmHostID` = '0'; DELETE FROM `groupMembers` WHERE `gmID` = '0' OR `gmHostID` = '0' OR `gmGroupID` = '0'; DELETE FROM `snapinGroupAssoc` WHERE `sgaID` = '0' OR `sgaSnapinID` = '0' OR `sgaStorageGroupID` = '0'; DELETE from `snapinAssoc` WHERE `saID` = '0' OR `saHostID` = '0' OR `saSnapinID` = '0'; DELETE FROM `hosts` WHERE `hostID` NOT IN (SELECT `hmHostID` FROM `hostMAC` WHERE `hmPrimary` = '1'); DELETE FROM `hosts` WHERE `hostID` NOT IN (SELECT `hmHostID` FROM `hostMAC`); DELETE FROM `hostMAC` WHERE `hmhostID` NOT IN (SELECT `hostID` FROM `hosts`); DELETE FROM `snapinAssoc` WHERE `saHostID` NOT IN (SELECT `hostID` FROM `hosts`); DELETE FROM `groupMembers` WHERE `gmHostID` NOT IN (SELECT `hostID` FROM `hosts`); DELETE FROM `tasks` WHERE `taskStateID` IN ("1","2","3"); DELETE FROM `snapinTasks` WHERE `stState` in ("1","2","3"); TRUNCATE TABLE multicastSessions; TRUNCATE TABLE multicastSessionsAssoc; DELETE FROM tasks WHERE taskTypeId=8;
But still the hosts cannot be founded in the database any help??
-
MOD Note: I forked this topic since the question is unrelated to the OP’s issue in the other thread.
-
@DylanG said in Database Cleanup commands:
Now we cannot find the hosts anymore if we try to create a new host FOG says the hostname already exist but we cannot find it in the database.
Does it really say the hostname already exists or the MAC address?
You can search the database for a hostname using the following command:
SELECT * FROM hosts WHERE hostName LIKE '%searchstring%';
-
@Sebastian-Roth Thank you for your help, it says the host already exists but the problem is we want to install a new image on those he cannot find.
Reagrds Dylan
-
@DylanG Please post a picture of the error message you get when you want to create the host!
-
@Sebastian-Roth thanks to your help we can rename the old hosts, but if we just give the MAC-code of the usb to gigabit adapter he cannot find the host do you know how to solve this problem?
Regards,
Dylan
-
@DylanG I provided a database query and requested you to post a picture of the error you see on screen. If you don’t provide that information I won’t be able to help you.