How to Backup & Restore an Apple Profile Manager Server/Database

 

 

UPDATED!!

After OS X Server App 2 & 3 the below method was broken. Please see this updated article for the new method:

How To Backup Profile Manager Database (Working Solution for OS X 10.10)

 

 

 

 

The below method only worked for Server App 2.

Today I needed to look at rebuilding or at least testing out a new Profile Manager Server setup but wanted to move all the clients and groups from the old PM server to the new test server but Apple has nothing in place to just export and import this. I found a topic on the Apple Discussions that has quick terminal commands to backup and restore PM Server. As a quick test I did this with our MacMini PM Server and moved restored it on a MacBook Pro running the latest version of PM Server. (OS X Server 1.5.0 –> OS X Server 2.1.1)

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

Found the article here https://discussions.apple.com/message/17804347#17804347 with the credit going to “Christoph Murauer” ​for the info!

Cool