If you’ve ran into a road block and need to reset the database and everything makes the profile manager work the scripts below will help.
I have had to do this personally after removing a device from profile manager and tried to add it again.
NOTE: You will need to reinput all the server information.
sudo /Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend/wipeDB.sh sudo serveradmin stop devicemgr sudo serverctl disable service=com.apple.DeviceManagement.devicemgrd sudo serverctl disable service=com.apple.DeviceManagement.postgres sudo killall -9 -u _devicemgr dmrunnerd devicemgrd migration_tool sd_relocator dmpgHelper sudo mv /Library/Server/ProfileManager/Config/ServiceData/Data/PostgreSQL ~/.Trash/PostgreSQL_$RANDOM sudo mv /Library/Server/ProfileManager/Config/ServiceData/Data/backup ~/.Trash/backup_$RANDOM sudo /Applications/Server.app/Contents/ServerRoot/usr/libexec/deviceManagerCommon.sh
In some case you may need to remove macOS Server and start completely over
sudo rm -rf /Applications/Server.app sudo rm -rf /Library/Server