• Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
  • Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

Database Cleanup commands

Scheduled Pinned Locked Moved
FOG Problems
3
7
702
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D
    DylanG
    last edited by Sebastian Roth Oct 26, 2020, 11:30 AM Oct 26, 2020, 1:35 PM

    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??

    1 Reply Last reply Reply Quote 0
    • G
      george1421 Moderator
      last edited by Oct 26, 2020, 2:01 PM

      MOD Note: I forked this topic since the question is unrelated to the OP’s issue in the other thread.

      Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

      1 Reply Last reply Reply Quote 0
      • S
        Sebastian Roth Moderator
        last edited by Oct 26, 2020, 5:34 PM

        @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%';
        

        Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

        Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

        D 1 Reply Last reply Oct 27, 2020, 10:59 AM Reply Quote 0
        • D
          DylanG @Sebastian Roth
          last edited by Oct 27, 2020, 10:59 AM

          @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

          1 Reply Last reply Reply Quote 0
          • S
            Sebastian Roth Moderator
            last edited by Oct 27, 2020, 12:55 PM

            @DylanG Please post a picture of the error message you get when you want to create the host!

            Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

            Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

            D 1 Reply Last reply Oct 27, 2020, 2:30 PM Reply Quote 0
            • D
              DylanG @Sebastian Roth
              last edited by Oct 27, 2020, 2:30 PM

              @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

              1 Reply Last reply Reply Quote 0
              • S
                Sebastian Roth Moderator
                last edited by Oct 27, 2020, 3:02 PM

                @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.

                Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                1 / 1
                • First post
                  3/7
                  Last post

                150

                Online

                12.1k

                Users

                17.3k

                Topics

                155.3k

                Posts
                Copyright © 2012-2024 FOG Project