Trying to restore a Mountain Lion caldav.sql into a fresh/clean Mavericks installation

Call me cynical, but upgrades and Migration Assistant were never my thing. I'm starting to experiment with migrating some of my Mountain Lion OS X Servers to Mavericks.
Under OS X Server 2.2.x (Mountain Lion), I had a script that would individually backup the postgres_server databases, caldav, collab, device_management, etc.
I'm now working with a clean Mavericks installation and trying to restore the caldav db. Through the help of ~morgen, I've worked out that caldav seems to have its own postgres instance and I can see and view the fresh caldav database there:
/Applications/Server.app/Contents/ServerRoot/usr/bin/psql -U caldav -h /var/run/caldavd/ccs_postgres_3d403b3009fe0c830944d87bd751fbe9/ caldav
So, I backed that up before proceeding with:
/Applications/Server.app/Contents/ServerRoot/usr/bin/pg_dump -U caldav -h /var/run/caldavd/ccs_postgres_3d403b3009fe0c830944d87bd751fbe9/ -c caldav | gzip -c > /Library/Server/Backups/PostgreSQL/caldav.sql.gz
And then tried to use dropdb to drop it, so I could use createdb to re-create it and then use psql to suck in my Mountain Lion backup. The three intended commands in order would have been:
/Applications/Server.app/Contents/ServerRoot/usr/bin/dropdb -U caldav -h /var/run/caldavd/ccs_postgres_3d403b3009fe0c830944d87bd751fbe9/ caldav
/Applications/Server.app/Contents/ServerRoot/usr/bin/createdb -U caldav -h /var/run/caldavd/ccs_postgres_3d403b3009fe0c830944d87bd751fbe9/ caldav
/Applications/Server.app/Contents/ServerRoot/usr/bin/psql -U caldav -h /var/run/caldavd/ccs_postgres_3d403b3009fe0c830944d87bd751fbe9/ -d caldav < /Library/Server/Backups/PostgreSQL/caldav.sql
HOWEVER.... the first command failed:
dropdb: database removal failed: ERROR:  database "caldav" is being accessed by other users
DETAIL:  There is 1 other session using the database.
Interestingly, even though neither Calendar nor Contacts server are running, there's quite a bit running under _calendar:
_calendar         656   0.0  0.1  2471756   4412   ??  Ss    6:53pm   0:00.03 postgres: caldav caldav [local] idle                         
_calendar         651   0.0  0.0  2471120   2228   ??  Ss    6:53pm   0:00.11 postgres: wal sender process caldav [local] streaming 0/422E020                         
_calendar         650   0.0  0.0  2460732   2216   ??  S     6:53pm   0:00.07 /Applications/Server.app/Contents/ServerRoot/usr/bin/pg_receivexlog -h /var/run/caldavd/ccs_postgres_3d403b3009fe0c830944d87bd751fbe9 --no-password --directory /Library/Server/Calendar and Contacts/Data/Database.xpg/backup --verbose
_calendar         649   0.0  0.0  2491744   1496   ??  S     6:53pm   0:00.02 /usr/sbin/distnoted agent
_calendar         646   0.0  0.0  2465500    652   ??  Ss    6:53pm   0:00.19 postgres: stats collector process                            
_calendar         645   0.0  0.0  2465500    416   ??  Ss    6:53pm   0:00.02 postgres: archiver process                            
_calendar         644   0.0  0.0  2470988   2460   ??  Ss    6:53pm   0:00.12 postgres: autovacuum launcher process                            
_calendar         643   0.0  0.0  2470856    560   ??  Ss    6:53pm   0:00.06 postgres: wal writer process                            
_calendar         642   0.0  0.0  2470856   1240   ??  Ss    6:53pm   0:00.09 postgres: writer process                            
_calendar         641   0.0  0.0  2470856   1056   ??  Ss    6:53pm   0:00.01 postgres: checkpointer process                            
_calendar         639   0.0  0.0  2455256    400   ??  Ss    6:53pm   0:00.01 postgres: logger process                            
_calendar         638   0.0  0.1  2470856   5272   ??  S     6:53pm   0:00.08 /Applications/Server.app/Contents/ServerRoot/usr/bin/postgres_real -c listen_addresses= -k /var/run/caldavd/ccs_postgres_3d403b3009fe0c830944d87bd751fbe9 -c shared_buffers=105 -c max_connections=70 -c standard_conforming_strings=on -c log_lock_waits=TRUE -c deadlock_timeout=10 -c log_line_prefix=%m [%p]  -c logging_collector=on -c log_truncate_on_rotation=on -c log_directory=/var/log/caldavd/postgresql -c log_filename=postgresql_%w.log -c log_rotation_age=1440
_calendar         636   0.0  0.0  2492336   2832   ??  S     6:53pm   0:00.04 /System/Library/PrivateFrameworks/TCC.framework/Resources/tccd
_calendar         634   0.0  0.2  2472760  16104   ??  S     6:53pm   0:02.17 /usr/bin/python /Applications/Server.app/Contents/ServerRoot/usr/bin/xpostgres -c listen_addresses= -k /var/run/caldavd/ccs_postgres_3d403b3009fe0c830944d87bd751fbe9 -c shared_buffers=105 -c max_connections=70 -c standard_conforming_strings=on -c log_lock_waits=TRUE -c deadlock_timeout=10 -c log_line_prefix=%m [%p]  -c logging_collector=on -c log_truncate_on_rotation=on -c log_directory=/var/log/caldavd/postgresql -c log_filename=postgresql_%w.log -c log_rotation_age=1440
_calendar         630   0.0  0.0  2471388    900   ??  Ss    6:53pm   0:00.20 /sbin/launchd
So, how can I gently get this mystical one user off of the DB in order to do this? OR, how can I start up calendar in such a way that this mythical user is not connected?
If I unload this job:
launchctl load /Applications/Server.app/Contents/ServerRoot/System/Library/LaunchDaemons/org.calendarserver.agent.plist
I can no longer access the postgres instance in order to drop and create the db.
Any other ideas / suggestions / solutions?

If you knew your sql, I don't think it would be insurmountable to pull apart the full dump.
As to the upgrades in place, here's some of the output in caldav's error log every startup:
2013-12-02 21:29:02+1000 [-] [txdav.common.datastore.upgrade.sql.upgrade.UpgradeDatabaseSchemaStep#warn] Beginning database schema check.
2013-12-02 21:29:02+1000 [-] [txdav.common.datastore.upgrade.sql.upgrade.UpgradeDatabaseSchemaStep#warn] Required database key VERSION: 24.
2013-12-02 21:29:02+1000 [-] [txdav.common.datastore.upgrade.sql.upgrade.UpgradeDatabaseSchemaStep#warn] Actual database key VERSION: 24.
2013-12-02 21:29:02+1000 [-] [txdav.common.datastore.upgrade.sql.upgrade.UpgradeDatabaseSchemaStep#warn] Schema version check complete: no upgrade needed.
2013-12-02 21:29:02+1000 [-] [txdav.common.datastore.upgrade.sql.upgrade.UpgradeDatabaseSchemaStep#warn] Database schema check complete.
2013-12-02 21:29:02+1000 [-] [txdav.common.datastore.upgrade.sql.upgrade.UpgradeDatabaseAddressBookDataStep#warn] Beginning database addressbook data check.
2013-12-02 21:29:02+1000 [-] [txdav.common.datastore.upgrade.sql.upgrade.UpgradeDatabaseAddressBookDataStep#warn] Required database key ADDRESSBOOK-DATAVERSION: 2.
2013-12-02 21:29:02+1000 [-] [txdav.common.datastore.upgrade.sql.upgrade.UpgradeDatabaseAddressBookDataStep#warn] Actual database key ADDRESSBOOK-DATAVERSION: 2.
2013-12-02 21:29:02+1000 [-] [txdav.common.datastore.upgrade.sql.upgrade.UpgradeDatabaseAddressBookDataStep#warn] Addressbook data version check complete: no upgrade needed.
2013-12-02 21:29:02+1000 [-] [txdav.common.datastore.upgrade.sql.upgrade.UpgradeDatabaseAddressBookDataStep#warn] Database addressbook data check complete
To be clear, I don't believe its Server.app. Each of these services stores its schema version IN the database and its checked every startup, and it would appear, that each service knows how to perform that upgrade at each startup.

Similar Messages

  • Trying to upgrade to Mountain Lion, error is  message; " product distribution file could not be verified. It may be damaged or was not signed"

    trying to upgrade to Mountain Lion, error   message; " product distribution file could not be verified. It may be damaged or was not signed" ??
    what to do? This is in App store. I followed the link e-mailed to me that an upgrade was available....... Puzzled.

    Several causes for this problem have been reported. Please take each of the following steps that you haven't already tried. Stop when it's resolved.
    Step 1
    Back up all data.
    From the menu bar, select
     ▹ System Preferences... ▹ Network
    If the preference pane is locked, click the lock icon in the lower left corner and enter your password to unlock it. Then click the Advanced button and select the Proxies tab. If any proxy options are selected, make a note of them and then deselect them. You don’t need to change the bypass or FTP settings. Click OK and then Apply. Test. The result may be that you can't connect to any web server. Restore the previous settings if that happens.
    Step 2
    Rebuild the Spotlight index. If you try to search now from the magnifying-glass icon in the top right corner of the display, there will be an indication that indexing is in progress.
    Step 3
    Start up in safe mode and log in to the account with the problem. You must hold down the shift key twice: once when you turn on the computer, and again when you log in.
    Note: If FileVault is enabled, or if a firmware password is set, or if the startup volume is a Fusion Drive or a software RAID, you can’t do this. Ask for further instructions.
    Safe mode is much slower to start and run than normal, with limited graphics performance, and some things won’t work at all, including sound output and Wi-Fi on certain models. The next normal startup may also be somewhat slow.
    The login screen appears even if you usually login automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin.
    Test while in safe mode. Same problem?
    After testing, restart as usual (not in safe mode) and verify that you still have the problem. Post the results of the test.

  • Tried to reinstall OSX Mountain Lion 10.8.4 and every time i start with the installation i get a requested time out message, had to shut down my MacBook Pro retina. Now when i start up it automatically start internet recovery

    tried to reinstall OSX Mountain Lion 10.8.4 and every time i start with the installation i get a requested time out message, had to shut down my MacBook Pro retina. Now when i start up it automatically start internet recovery for two ouers. After the internet recovery the same problem with reinstalling OSX message

    Gave up on the GUI.  This script derived from http://blog.netnerds.net/2012/07/os-x-how-to-setup-nat-on-lion-and-mountain-lion / seems to work for me:
    gwdev=en0 # This is my WiFi connection (has Internet connection)
    targetdev=en1 # This is the USB to Ethernet adapter (to give Internet connection)
    /sbin/ifconfig $targetdev down
    /sbin/ifconfig bridge0 create
    /sbin/ifconfig bridge0 up
    /sbin/ifconfig bridge0 addm $gwdev
    /sbin/ifconfig bridge0 $HOST_ADDR
    /sbin/route add default -interface bridge0 -ifscope bridge0 -cloning
    /usr/sbin/sysctl -w net.inet.ip.forwarding=1
    /sbin/ipfw add 100 divert natd ip from any to any via $gwdev
    /usr/sbin/natd -interface $gwdev -use_sockets -same_ports -unregistered_only -dynamic -clamp_mss -enable_natportmap -natportmap_interface $targetdev

  • This mini is operating OSX 10.6.8 and trying to update to Mountain Lion but upgrade stops and a black overscreen displays saying to power off and power on.  The upgrade fails.  What's the problem?

    This mini is operating OSX 10.6.8 and trying to update to Mountain Lion but upgrade stops and a black overscreen displays saying to power off and power on.  The upgrade fails.  What's the problem?

    Hi Fred,
    Could be many things, we should start with this...
    "Try Disk Utility
    1. Insert the Mac OS X Install disc, then restart the computer while holding the C key.
    2. When your computer finishes starting up from the disc, choose Disk Utility from the Installer menu at the top of the screen. (In Mac OS X 10.4 or later, you must select your language first.)
    Important: Do not click Continue in the first screen of the Installer. If you do, you must restart from the disc again to access Disk Utility.
    3. Click the First Aid tab.
    4. Select your Mac OS X volume.
    5. Click Repair. Disk Utility checks and repairs the disk."
    http://docs.info.apple.com/article.html?artnum=106214
    Then try a Safe Boot, (holding Shift key down at bootup), run Disk Utility in Applications>Utilities, then highlight your drive, click on Repair Permissions, reboot when it completes.
    (Safe boot may stay on the gray radian for a long time, let it go, it's trying to repair the Hard Drive.)

  • I'm trying to reinstall my mountain lion, but it won't install on my regular disk

    so, i have a problem.
    When i tried to restart my Mac earlier today, I got the gray screen. Now i'm trying to reinstall my mountain lion, but when the install guide tells me to choose a disk to reinstall on, it says that my disk is locked.
    please help, urgent!
    thanks.

    No, you'll lose your data. Do you have a backup? If you don't use Time Machine, here are some cloning programs you can use to make a backup. Two backups are better than one.
    Clone  - Carbon Copy Cloner
    Clone – Data Backup
    Clone – Deja Vu
    Clone  - SuperDuper
    Clone Software – 6 Applications Tested

  • I am trying to download the mountain lion software which I purchased and downloaded successfully in my air book, in to my desktop and I get an error 403 message saying that an server error ocurred during downloading

    I am trying to download the mountain lion software which I purchased and downloaded successfully in my air book, in to my desktop and I get an error 403 message saying that an server error ocurred during downloading

    Implies that the DL is hosed and necessitating DLing it again.

  • Trying to download OSX Mountain Lion, but just says waiting all the time? Anyone know what this could be?

    Trying to download OSX Mountain Lion, but just says waiting all the time? Anyone know what this could be?

    You are not specific with your problem or errors but one thing that always throws people off is as follows:
    When entering you're login name you must use the entire login with carrier name such as [email protected] The field defults to just your name but not the carrier name.

  • Trying to download new mountain lion and it keeps telling me that i dont have enough memory and i deleted a bunch of stuff and it still wont work?

    trying to download new mountain lion and it keeps telling me that i dont have enough memory and i deleted a bunch of stuff and it still wont work?

    You are confusing Free Disc Space with RAM.
    mjohnson1645 wrote:
    ...it keeps telling me that i dont have enough memory ..
    You need more RAM
    You can use these Links to check which RAM is suitable for your Mac...
    http://eshop.macsales.com/shop/apple/memory/
    If in the UK... Go to http://curcial.com
    It is Important to get the Correct and Matching RAM
    Those sites also have videos on how to Install RAM should you need it....

  • Am trying to download Os mountain lion, been trying since last night and nothing is happening. Just says waiting. Am I missing something, doing something wrong please tell?

    Am trying to download Os mountain lion, been trying since last night and nothing is happening. Just says waiting. Am I missing something, doing something wrong please tell?

    1. Make sure that your machine is compatible with Mountain Lion
    http://www.apple.com/osx/specs/
    2. Run into safe mode and test downloading it there
    3. If the above does not work, Create a new location(go to system preferences > network > click Location)
    4. Add Google DNS
    https://developers.google.com/speed/public-dns/

  • Trying to down load mountain lion but will only get to 53.25mb

    trying to down load mountain lion but will only get to 53.25mb

    See if this applies:
    Apple has tightened its requirements for this OS upgrade, and some older Macs— even ones that qualified for Lion — won't make the cut for Mountain Lion.
    The general system requirements are straightforward:
    OS X v10.6.8 or later
    2GB of memory
    8GB of available space
    Apple also lists which models WILL support Mountain Lion:
    iMac (Mid 2007 or newer)
    MacBook (Late 2008 Aluminum, or Early 2009 or newer)
    MacBook Pro (Mid/Late 2007 or newer)
    Xserve (Early 2009)
    MacBook Air (Late 2008 or newer)
    Mac mini (Early 2009 or newer)
    Mac Pro (Early 2008 or newer)
    Hope this helps

  • I tried unsuccessfully to download Mountain Lion

    I tried unsuccessfully to download Mountain Lion (installer I suppose) on a MBP 17" running under 10,6,8.
    After clicking on the "dowload" buttion, ssurprisingly I vas not  asked to pay, the downloading began and lasted deveral hours as apparentlly usual, but when finished I didn't find the downloaded file.
    Though ML appears in my bought products list, .
    App store app doesn't work correctly any more, for example I can't disconnect.
    How to pay for and to reload again ML ?

    The ML installatin file "Installer OS X Mountain Lion.app" is inside Applications folder, it is not a ".dmg" file.
    I have been able to use it, although I didn't pay for it...??

  • Trying to upgrade to mountain lion but I get a connection fail

    connection fail only when I am trying to upgrade to mountain lion during the apple ID process

    I had a similar problem when I migrated from a Macbook (old OS) to a Mac Air (OS 10.9).  The "fix" was to ensure that my computer system date was the right one - believe it or not.  The default system date was a year prior, and since I"ve updated it the correct date, no issues. 

  • Tried to down load Mountain Lion  currently have OS 10.6.8. Said computer would not accept?  did I do something wrong?

    tried to down load Mountain Lion  currently have OS 10.6.8. Said computer would not accept?  did I do something wrong?

    Does your iMac meet the system requirements as set forth on this web page?
    http://www.apple.com/osx/how-to-upgrade/

  • Can I use a mountain lion time machine back up on new mavericks macs?

    My macbook retina was stolen at my school. I was wondering because I used time machine having mountain lion, does it affect anything when if i purchase a mavericks macbook pro? the just announced one. I have all my pictures (iphoto) in that last back up. Can i use a mountain lion time machine back up on new mavericks macs?  My macbook retina was stolen on August 16? So I don't know if there was an update on my mac that might affect it in any way...

    It's ok you can use your ML TM to transfer your account.   iPhoto library and other things will be upgraded when you open the apps. 
    At the end of the Apple article it says:
    Migrating a Time Machine backup to a new Mac
    When you get a new Mac, you can transfer all of your applications, files, settings, and other information from a Time Machine backup you've already made. When you start up your new Mac for the first time, the Setup Assistant asks you if you would like to restore from backup. If you've already set up your new Mac, you can use theMigration Assistant (located in Applications/Utilities) to do the same thing.
    After Migration Assistant completes the transfer and you select your existing Time Machine backup drive, you will be prompted with "Inherit Backup History". Once selected you will be able to continue to use your existing Time Machine backup on your new Mac.

  • How to go back to Mountain lion os x 10.8 again from mavericks.?

    How to go back to Mountain lion os x 10.8 again from mavericks.?

    You can reinstall your system from a backup (Time Machine or "clone") or erase it completely and reinstall Mountain Lion.
    OS X Mountain Lion: Erase and reinstall OS X
    If your Mac shipped with Mountain Lion already installed, you can reinstall it. Otherwise, you can only reinstall Mountain Lion if you purchased it from the App Store.
    You may be better off describing the problems you're experiencing, so that they can be fixed. The vast majority of Mavericks complaints are due to outdated or poorly written software or similarly incompatible system modifications, and some simple troubleshooting may reveal the cause.

Maybe you are looking for

  • JTrees, JDK 1.4.2 and Windows XP

    Hi, I noticed that under JDK 1.4.2 with Windows XP, JTrees are drawn without the lines connecing the children the parent node. I want to draw the lines. Can anyone tell me how? thanks

  • Unrecoverable disk space loss after failure in scanning

    I am using a Mac Mini with HP C410a for scanning.  The OSX verion is 10.7.1.  Because HP has not provided the special driver for lion, I have to rely on the Scan function of OSX.  The scanning process usually consumes huge volume of disk space.  For

  • Duplicate Artists and Titles problem ipod w video

    Hi all, I haven't seen this problem listed and I went back 6 pages. I've noticed that there are a lot of artists that are listed twice in my ipod, but songs are listed once. For example, I xfered a cd into itunes, and then highlighted and drug it to

  • Jdbc-swing

    Hi All, I would like to connect the database and retrieve and updates values from/into tables through swing components.I have tried that,but some socketexception is occured. please answer to my question. Regards, Aravind

  • Using a dummy battery in a EOS 70D

    My question is this:  I am getting a dummy battery to plug into the camera so I can use an external larger battery source.  I want to also use an ac adaptor to feed 7.5v to the camera but don't know how much current the camera draws.  I need to know