Nuke+Pave iCal Server in Lion Server

It is possible to remove all of the content from a Lion Calendar server using Postgres. To aid you in doing so, Apple has built out a couple of commands to make the process easier. This will nuke everything from the server and so is not something that should be lightly done. To do so, first stop the Calendar service in the Server application. Then let’s back up the database:

pg_dump -U _postgres caldav -c -f /db_backups/caldav.sql

Then run dropdb to remove the database itself:

dropdb -U _postgres caldav

Once the database is gone, run the calendar_bootstrap_database script (I prefer doing so verbosely):

calendarserver_bootstrap_database -v

Now you should be able to start a fresh, clean calendar database by starting up the Calendar service in the Server application again. Note, this is dangerous if you have production data. Also note that you cannot run the bootstrap until you delete the database.

2 Comments

  • March 5, 2012 - 11:48 am | Permalink

    Thank you, thank you, thank you! You have no idea how appreciated this information is.

    If you needed to restore from a sql backup, would you first run calendarserver_bootstrap_database and then pg_restore?

  • Aamir Jadoon
    October 4, 2012 - 12:03 pm | Permalink

    Hi, find the solution.
    Just restarted the Postgres

    sudo serveradmin stop postgres
    sudo serveradmin sart postgres

  • Comments are closed.