The working computer, I have older Server app. the last versoin before this 2.2. I think it is a 2.2 bug.
I search around for days and this is what I have so far:
/usr/bin/createdb -U collab collab
/Applications/Server.app/Contents/ServerRoot/usr/bin/pg_dump --format=c --compress=9 --blobs --username=collab --file=/tmp/collab.pgdump collab
I use that instead of the Apple doc suggestion cause it will cause version number mismatch and will stall the dump.
I got this far, please provide better suggestion.
I would LOVE to provide a better suggestion, but I can't. Like you, I am
searching for days for a solution, tried many things including adding
the path to .profile etc. !!!
Nothing worked !
A colleague suggested to try to use a Time Machine backup from an old server
and on the new use the Migration Assistant to import the WIKI !
This is NOT what I wanted to do, but right now I am trying this, just to see
if it works !
My goal would be to export a WIKI and then setup a new fresh clean OS X Server and
import the old WIKI Data. This, to have a clean start !
The old Server was updated/migrated from 10.6.8 and I don't trust it,
also I need a worst case senario.
If I find out something I will post it asap !
For Server 2.2 you need to add another flag to pg_dump and pg_restore:
-h "/Library/Server/PostgreSQL For Server Services/Socket"
So, for dump on a 2.2 Server:
sudo pg_dump -h "/Library/Server/PostgreSQL For Server Services/Socket" --format=c --compress=9 --blobs --username=collab --file=/tmp/collab.pgdump collab
And for restore:
sudo -u _postgres pg_restore -h "/Library/Server/PostgreSQL For Server Services/Socket" -d collab -U collab --single-transaction /tmp/collab.pgdump
I got some mor infos from an Apple System Engineer, with it, I could successfully export the WIKI .
1. Frist install Workgroup Manager and add your Admin account to the postgress group !
2. Paste this into Terminal:
sudo /Applications/Server.app/Contents/ServerRoot/usr/bin/pg_dump -h /Library/Server/PostgreSQL\ For\ Server\ Services/Socket --format=c --compress=9 --blobs --username=collab --file=/tmp/collab.pgdump collab
You will notice that the script is similar to Dougs but it uses the pg_dump inside the Server app.
This worked for me ----- finally
I then copied the exorted /tmp/collab.pgdump to the new Server and I am now trying to import this
with help of http://support.apple.com/kb/HT5585 but I strugle - give me some more time to try.
Apple has change the information (Terminal commands) on its KB Article
http://support.apple.com/kb/HT5585 on december 21 !
I have just tried the new commands, and can report that moving WIKI data from
10.8.2 to a new 10.8.2 does now work !
I have a solution to recover the Wiki after OSX 10.8 was restored from a TimeMachine Backup.
- get the Backup file in /Library/Server/PostgreSQL For Server Services/Backup/dumpall.psql.gz
- extract the file to /tmp/dumpall.psql or to an other directory
- Follow the instructions in http://support.apple.com/kb/HT5585 like this:
- sudo chown -R _teamsserver:_teamsserver /Library/Server/Wiki/FileData
sudo chmod -R +a "www allow search" /Library/Server/Wiki/FileData
sudo serveradmin stop wiki
sudo serveradmin start postgres_server
sudo ./dropdb -h "/Library/Server/PostgreSQL For Server Services/Socket" -U collab collab
sudo ./createdb -h "/Library/Server/PostgreSQL For Server Services/Socket" -U collab collab
- Then use "psql" instead of "pg_restore":
- sudo psql -U _postgres -d collab -h "/Library/Server/PostgreSQL For Server Services/socket" -f /tmp/dumpall.psql
- Start the Wiki Server
- sudo serveradmin start wiki
try it and RATE correct answers
You're looking in the wrong spot
First things first - make yourself default sudo with sudo -s then you can forget prefixing it all the time.
- If you just use pg_dump then it'll take the command from the /var-Directory - that's the wrong version
- You have to specify the path for the Socket where the PSQL-Database for the wiki really is located by using the -h-option - it's not the default
that's why you get the error that role collab does not exist since you're connecting to a database in place where the role collab truy isn't part of it.
So - if you'd like to export the wiki-DB us the following and adapt the filename to what you like it to be.
bash-3.2# /Applications/Server.app/Contents/ServerRoot/usr/bin/pg_dump -h "/Library/Server/PostgreSQL For Server Services/Socket/" -p 5432 -f /Volumes/USBSTICK/wikidatabase.pgdump -U collab collab
- The first block specifies the "not default" pg_dump you'd like to use
- The second block (-h "/Library/.....) tells pg_dump where to find the DB
- The third block tells pg_dump to use port 5432
- The fourth block (-f /Volumes/......) tells pg_dump to place its output into this file
- The fifth block (-U collab) tells pg_dump to do this is role collab
- The sixth block tells pg_dump from with DB to dump from
In your case extend my provided command with your options --format=c --compress=9 --blobs like this:
bash-3.2# /Applications/Server.app/Contents/ServerRoot/usr/bin/pg_dump -h "/Library/Server/PostgreSQL For Server Services/Socket/" -p 5432 -F c --compress=9 -b -f /Volumes/USBSTICK/wikidatabase.pgdump -U collab collab
BTW- you can connect to the database, of course:
bash-3.2# psql -h "/Library/Server/PostgreSQL For Server Services/Socket/" -p 5432 collab collab
try it and RATE correct answers
Here is my thread https://discussions.apple.com/thread/5751873