Thread: Using the /var/lib/pgsql/data directory in the absense of a backup for recovery
Using the /var/lib/pgsql/data directory in the absense of a backup for recovery
From
"Srinivas Kotapally"
Date:
Hello all I am a newbie PostgreSQL DB admin. I have the following problem: 1. I have a redhat 8 box which has postgres installed. 2. I have reinstalled postgresql 7.2.1-5 (native postgres installation on RedHat 7.3) on the redhat 8.0 3. I don't have the database backups from my 7.3 installation - I however have access to the /var/lib/pgsql/data directory. My question is... can I use this to recover the database from the 7.3 version. We got hacked and the earlier system was unusable. I tired to do an initdb but it would not let me provide the existing data directory and got the following: -bash-2.05b$ initdb The files belonging to this database system will be owned by "postgres". This use must also own the server process. initdb: The directory /var/lib/pgsql/data exists but is not empty. If you want to create a new database system, either remove or empty the directory /var/lib/pgsql/data or run initdb with an argument other than /var/lib/pgsql/data. I tried to do fire up the postmaster process and could not fire up the DB. I don't get a message the system just returns to the prompt without starting the database. Any help would be welcome!! Thanks Srinivas
On Tue, 22 Jul 2003, Srinivas Kotapally wrote: > I am a newbie PostgreSQL DB admin. I have the following problem: > 1. I have a redhat 8 box which has postgres installed. > 2. I have reinstalled postgresql 7.2.1-5 (native postgres installation on > RedHat 7.3) on the redhat 8.0 > 3. I don't have the database backups from my 7.3 installation - I however > have access to the /var/lib/pgsql/data directory. > > My question is... can I use this to recover the database from the 7.3 > version. We got hacked and the earlier system was unusable. > I tried to do fire up the postmaster process and could not fire up the DB. > I don't get a message the system just returns to the prompt without starting > the database. How are you attempting to start the postmaster? If it's failing it should be giving you output unless it's being redirected somewhere.
Whatever version of postgresql you WERE running is the same version you now need to BE running. I.e. if you were running 7.3.x, you should download 7.3.3 (or 7.3.4 if it's ready to go yet) and use THAT to get your database up and running. Postgresql won't run databases from different major versions. On Tue, 22 Jul 2003, Srinivas Kotapally wrote: > Hello all > > I am a newbie PostgreSQL DB admin. I have the following problem: > 1. I have a redhat 8 box which has postgres installed. > 2. I have reinstalled postgresql 7.2.1-5 (native postgres installation on > RedHat 7.3) on the redhat 8.0 > 3. I don't have the database backups from my 7.3 installation - I however > have access to the /var/lib/pgsql/data directory. > > My question is... can I use this to recover the database from the 7.3 > version. We got hacked and the earlier system was unusable. > > I tired to do an initdb but it would not let me provide the existing data > directory and got the following: > > -bash-2.05b$ initdb > The files belonging to this database system will be owned by "postgres". > This use must also own the server process. > > initdb: The directory /var/lib/pgsql/data exists but is not empty. > If you want to create a new database system, either remove or empty the > directory /var/lib/pgsql/data or run initdb with an argument other than > /var/lib/pgsql/data. > > I tried to do fire up the postmaster process and could not fire up the DB. > I don't get a message the system just returns to the prompt without starting > the database. > > Any help would be welcome!! > > Thanks > > Srinivas > > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly >
> Whatever version of postgresql you WERE running is the same version you > now need to BE running. I.e. if you were running 7.3.x, you should > download 7.3.3 (or 7.3.4 if it's ready to go yet) and use THAT to get your > database up and running. Postgresql won't run databases from different > major versions. If i am right, Srinivas Kotapally is mentioning about redhat version 7.3, not postgresql version. Srinivas: IMO, if the postgresql version(7.2.1-5) installed on redhat 7.3 and 8.0 are same, you must be able to access the db without any problem in either redhat versions. Don't try initdb. Try pg_ctl start as postgres user on the same data directory with -l option and get back with the error message it returns. Also ensure the data directory is owned by postgres user. regards, bhuvaneswaran > > On Tue, 22 Jul 2003, Srinivas Kotapally wrote: > > > Hello all > > > > I am a newbie PostgreSQL DB admin. I have the following problem: > > 1. I have a redhat 8 box which has postgres installed. > > 2. I have reinstalled postgresql 7.2.1-5 (native postgres installation on > > RedHat 7.3) on the redhat 8.0 > > 3. I don't have the database backups from my 7.3 installation - I however > > have access to the /var/lib/pgsql/data directory. > > > > My question is... can I use this to recover the database from the 7.3 > > version. We got hacked and the earlier system was unusable. > > > > I tired to do an initdb but it would not let me provide the existing data > > directory and got the following: > > > > -bash-2.05b$ initdb > > The files belonging to this database system will be owned by "postgres". > > This use must also own the server process. > > > > initdb: The directory /var/lib/pgsql/data exists but is not empty. > > If you want to create a new database system, either remove or empty the > > directory /var/lib/pgsql/data or run initdb with an argument other than > > /var/lib/pgsql/data. > > > > I tried to do fire up the postmaster process and could not fire up the DB. > > I don't get a message the system just returns to the prompt without starting > > the database. > > > > Any help would be welcome!! > > > > Thanks > > > > Srinivas > > > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 3: if posting/reading through Usenet, please send an appropriate > > subscribe-nomail command to majordomo@postgresql.org so that your > > message can get through to the mailing list cleanly > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 7: don't forget to increase your free space map settings > >