How to backup profile manager?
Is there a way to backup the database in the profile manger?
iPhone 4, iOS 4.3.3
Newsroom Update
Beginning in May, a special Today at Apple series titled “Made for Business” will offer small business owners and entrepreneurs free opportunities to learn how Apple products and services can support their growth and success. Learn more >
Beginning in May, a special Today at Apple series titled “Made for Business” will offer small business owners and entrepreneurs free opportunities to learn how Apple products and services can support their growth and success. Learn more >
Is there a way to backup the database in the profile manger?
iPhone 4, iOS 4.3.3
I've found this post to be helpfull: https://discussions.apple.com/thread/3227951?start=0&tstart=0
Hello !
To backup the DB in Terminal :
sudo pg_dump -U _postgres -c device_management > $HOME/device_management.sql
To restore the DB in Terminal :
sudo serveradmin stop devicemgr
sudo serveradmin start postgres
sudo psql -U _postgres -d device_management -f $HOME/device_management.sql
sudo serveradmin start devicemgr
The wholte tutorial can be found here :
Mac OS X 10.7 Lion Server # 10 : Daten des Wiki Servers übersiedeln.
Mac OS X 10.7 Lion Server # 9 : PostgreSQL.
Sorry, I wrote it in german but translate.google.com is your friend - or send a message if you have some questions.
C. M.
Thank you! I gave this a test myself and worked 😎
I also reposted this topic here http://www.edugeek.net/forums/mac/104624-how-backup-profile-manager.html#post896 895
http://www.twistedmac.com/index.php/how-to-backup-a-restore-an-apple-profile-man ager-serverdatabase
This solution works in Mac OS X 10.7 but not in OS X 10.8. Apple has changed the database some how.
Yes Apple moved everything inside the Server.app into the ServerRoot folder. I beleive you shoudl be runnin the commands from there. There are actually a couple of instances of Postgresql running you your Mac. The socket for the the services run by server are now in the following directory.
/Library/Server/PostgreSQL\ For\ Server\ Services/Socket/
You can run the following command to get the dump to work. All on one line.
sudo /Applications/Server.app/Contents/ServerRoot/usr/bin/pg_dump -U _postgres -h /Library/Server/PostgreSQL\ For\ Server\ Services/Socket/ -c device_management > $HOME/device_management.sql
Better yet use this guys scripts.
http://www.practiceofcode.com/post/44574319896/updated-postgresql-backup-scripts -for-10-8-2-os-x
Hi Marc Kerr.
It worked perfectly to create the Backup on the OS X Server 10.8.
But I couldn't restore..
Does anyone knows the commands to restore the Profile Manager on the OS X Server 10.8?
For all those that had the same problem as me trying to restore the Profile Manager on Mountain Lion here are the commands I figured out how to use.
-- Backup Profile Manager --
sudo ./pg_dump -h "/Library/Server/PostgreSQL For Server Services/Socket" --format=c --compress=9 --blobs --username=_devicemgr --file=/tmp/device_management.pgdump device_management
-- Restore Profile Manager --
sudo serveradmin stop devicemgr
sudo serveradmin start postgres_server
sudo ./dropdb -h "/Library/Server/PostgreSQL For Server Services/Socket" -U _devicemgr device_management
sudo ./createdb -h "/Library/Server/PostgreSQL For Server Services/Socket" -U _devicemgr device_management
sudo -u _postgres ./pg_restore -h "/Library/Server/PostgreSQL For Server Services/Socket" -d device_management -U _devicemgr -n public --single-transaction /tmp/device_management.pgdump
sudo serveradmin start devicemgr
Regards.
Thought I should update this info for Mavericks (10.9) and Server 3 because Apple changed things again, just slightly.
Apple removed /user/bin/psql and associated apps so now you only have one psql to deal with and it’s in your environment path. Running ‘which psql’ will show you /Applications/Server.app/Contents/ServerRoot/usr/bin/psql
That has simplified things a little.
The socket has moved also and is now in:
/Library/Server/ProfileManager/Config/var/PostgreSQL/
So to get into the database run this command.
sudo psql -U _devicemgr -d device_management -h /Library/Server/ProfileManager/Config/var/PostgreSQL/
Use \d to see the tables \h to get help \q to exit. See the man page or the postgresql documentation online for more if you are new to this, like me.
The basic backup/dump command is:
pg_dump -U _devicemgr -h /Library/Server/ProfileManager/Config/var/PostgreSQL/ -c device_management > $HOME/device_management.sql
If you use the above psql command to create the backup it will be in a text format. Apparently that means you need to also use psql to restore. I’m sure there are better ways to do the backup and restore. Having a full TimeMachine backup of your server works well.
For the restore I modified the previously posted commands just a bit.
---
sudo serveradmin stop devicemgr
sudo serveradmin start postgres
sudo dropdb -h /Library/Server/ProfileManager/Config/var/PostgreSQL/ -U _devicemgr device_management
sudo createdb -h /Library/Server/ProfileManager/Config/var/PostgreSQL/ -U _devicemgr device_management
sudo psql -U _devicemgr -d device_management -h /Library/Server/ProfileManager/Config/var/PostgreSQL/
sudo serveradmin start devicemgr
---
I rand all this on a test server and it appears to work.
Correction, sorry. Use the following to do the restore.
sudo psql -U _devicemgr -d device_management -h /Library/Server/ProfileManager/Config/var/PostgreSQL/ -f $HOME/device_management.sql
Thanks Marc for your updated post re backing up Mavericks Server.
I realise that this is an old post but unfortunately I am currently in a position where I am having to rebuild our server (long and unnecessary story!) and the one thing I want to avoid is having to re-enroll all of the devices again so this should help enormously!
One question though however, does anyone know if this backup would include the deployable Settings for device groups? I'm hoping this would be but just wanted to double check!
Many thanks in advance, Justin
Hi again,
Just tried to dump out the device_mangement DB and apparent;y it doesn't exist in that location oddly.
Only files in that location are a couple of aliases and this ".s.PGSQL.5432.lock"
Anyone have any ideas?
I'm running 10.9.5 and Server 3.2.2
Not to worry... found it in another post!
For anyone else following this breadcrumb trail, I found a working backup command for Mavericks & Yosemite here How do I backup profile manager database on OS X Yosemite?
How to backup profile manager?