Had a bit of a brain fade the other day and deleted all the rows in one of the tables in our database and didn't realise until a couple of hours later.
I have a pg_basebackup file system copy created before that and have setup a virtual server with the same OS and same version postgresql server. I just want to have postgresql start and let me query the database to retrieve information from that one table. I do not want to use it for live data or have it try to update itself from the main server. I have tried but failed so must be missing something.
Can someone please give me a simple point by point on what I need to do or point me to some plain documentation that describes the process.
Jeff
Best Answer
Problem solved. For future reference of anyone facing the same situation I have listed the process below
Saved test servers server.crt and server.key File structure created by pg_basebackup copied across to a test server. Replaced server.crt and server.key with saved versions
sudo /etc/init.d/postgresql start
Startup failed.
Tried removing the backup_label file as suggested in the hint. sudo mv /var/lib/postgresql/9.1/main/backup_label /var/lib/postgresql/9.1/main/old_backup_label
sudo /etc/init.d/postgresql start Startup failed.
Starting PostgreSQL 9.1 database server
/usr/lib/postgresql/9.1/bin/pg_resetxlog -f /var/lib/postgresql/9.1/main
Note: This is where I went wrong in earlier attempts. I did not specifiy the full path to pg_resetxlog and received a message saying "The program 'pg_resetxlog' is currently not installed. You can install it by typing: sudo apt-get install postgres-xc". I installed that, ran it, destroyed my data and somehow lost the postgres role in the process". Specifiying the full path to the correct version solved the problem.
sudo /etc/init.d/postgresql start
Seems to have fixed it Tested with psql and I can query the databases.