Re: psql: FATAL: the database system is starting up - Mailing list pgsql-general
From | Tom K |
---|---|
Subject | Re: psql: FATAL: the database system is starting up |
Date | |
Msg-id | CAE3EmBA8fPtRVNYDd9nt_7Yo1rSoCEw82FGCSEfbMmoJ7ZU+tQ@mail.gmail.com Whole thread Raw |
In response to | Re: psql: FATAL: the database system is starting up (Adrian Klaver <adrian.klaver@aklaver.com>) |
Responses |
Re: psql: FATAL: the database system is starting up
|
List | pgsql-general |
On Sat, Jun 1, 2019 at 6:36 PM Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 6/1/19 3:14 PM, Tom K wrote:
>
>
> ** Correction. There is postgres, template1 and template2 but none of
> the other databases we had.
In a psql session do:
select oid, datname from pg_database ;
Then go to /data/patroni an drill down to the base directory. In that
directory there should be sub-directories with numbers equal to the oid
values from the query. If not then something is wrong. That could be:
1) Wrong data directory.
2) Copied over incorrect data directory.
Basically if the only sub-directories are for the system databases then
the user databases do not exist. You might want to look at some of the
other clusters to see what is there.
-bash-4.2$ pwd
/var/lib/pgsql
-bash-4.2$ psql -h psql03 -U postgres
Password for user postgres:
psql (10.8)
Type "help" for help.
postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
(3 rows)
postgres=# select oid, datname from pg_database ;
oid | datname
-------+-----------
13806 | postgres
1 | template1
13805 | template0
(3 rows)
postgres=#
postgres=# cd /data/patroni
postgres-# ls -altri
postgres-# pwd
postgres-# pwd
postgres-# ls -altrid
postgres-# ;
ERROR: syntax error at or near "cd"
LINE 1: cd /data/patroni
^
postgres=# \q
-bash-4.2$ ls -altri
total 652
134299846 drwxr-xr-x. 39 root root 4096 Oct 24 2018 ..
67178653 -rw-r--r--. 1 postgres postgres 30 Oct 24 2018 .pgsql_profile
134734937 drwx------. 4 postgres postgres 31 May 8 06:25 10
67178637 drwx------. 3 postgres postgres 4096 May 8 06:25 .
68994450 -rw-r--r--. 1 postgres postgres 204336 May 26 22:37 s1.log
67677594 -rwx------. 1 postgres postgres 266 May 26 23:06 .bash_profile
68994451 -rw-r--r--. 1 postgres postgres 433920 May 26 23:44 s2.log
68391913 -rw-------. 1 postgres postgres 4716 Jun 1 17:34 .bash_history
67178638 -rw-------. 1 postgres postgres 325 Jun 1 18:54 .psql_history
-bash-4.2$ cd /data/patroni/
-bash-4.2$ ls -altri
total 144
69085037 drwxr-xr-x. 3 root root 20 Oct 23 2018 ..
135316997 -rw-------. 1 postgres postgres 206 Oct 29 2018 backup_label.old
201708781 drwx------. 2 postgres postgres 6 Oct 29 2018 pg_commit_ts
1502746 drwx------. 2 postgres postgres 6 Oct 29 2018 pg_dynshmem
68994449 drwx------. 2 postgres postgres 6 Oct 29 2018 pg_twophase
1502749 drwx------. 2 postgres postgres 6 Oct 29 2018 pg_snapshots
201708785 drwx------. 2 postgres postgres 6 Oct 29 2018 pg_serial
1502747 drwx------. 4 postgres postgres 34 Oct 29 2018 pg_multixact
67677559 drwx------. 5 postgres postgres 38 Oct 29 2018 base
1502751 drwx------. 2 postgres postgres 17 Oct 29 2018 pg_xact
1502750 drwx------. 2 postgres postgres 6 Oct 29 2018 pg_tblspc
134668882 -rw-------. 1 postgres postgres 88 Oct 29 2018 postgresql.auto.conf
134500181 -rw-------. 1 postgres postgres 3 Oct 29 2018 PG_VERSION
134500173 -rw-------. 1 postgres postgres 1636 Oct 29 2018 pg_ident.conf
134500171 -rw-------. 1 postgres postgres 4730 Oct 29 2018 pg_hba.conf
134668883 -rw-------. 1 postgres postgres 22783 Oct 29 2018 postgresql.base.conf
134500170 -rw-------. 1 postgres postgres 124 Oct 29 2018 patroni.dynamic.json
134668889 -rw-r--r--. 1 postgres postgres 90 Oct 29 2018 recovery.done
201708786 drwx------. 2 postgres postgres 17 Oct 29 2018 pg_subtrans
134500162 drwx------. 2 postgres postgres 4096 Nov 4 2018 log
134500182 drwx------. 3 postgres postgres 8192 Apr 28 06:06 pg_wal
1502748 drwx------. 4 postgres postgres 42 May 22 01:55 pg_replslot
134668893 -rw-r--r--. 1 postgres postgres 90 May 26 22:34 t.txt
134668885 -rw-r--r--. 1 postgres postgres 575 May 26 22:34 postgresql.conf
134668886 -rw-r--r--. 1 postgres postgres 575 May 26 22:34 postgresql.conf.backup
134668884 -rw-------. 1 postgres postgres 22783 May 26 22:34 postgresql.base.conf.backup
134500172 -rw-------. 1 postgres postgres 4730 May 26 22:34 pg_hba.conf.backup
134500174 -rw-------. 1 postgres postgres 1636 May 26 22:34 pg_ident.conf.backup
68994437 drwx------. 4 postgres postgres 65 Jun 1 17:34 pg_logical
134734900 -rw-------. 1 postgres postgres 38 Jun 1 18:53 .s.PGSQL.5432.lock
134734941 srwxrwxrwx. 1 postgres postgres 0 Jun 1 18:53 .s.PGSQL.5432
201708783 drwx------. 2 postgres postgres 17 Jun 1 18:53 pg_notify
134668887 -rw-------. 1 postgres postgres 439 Jun 1 18:53 postmaster.opts
134734940 -rw-------. 1 postgres postgres 30 Jun 1 18:53 current_logfiles
134812989 drwx------. 20 postgres postgres 4096 Jun 1 18:53 .
134734899 -rw-------. 1 postgres postgres 81 Jun 1 18:53 postmaster.pid
68994444 drwx------. 2 postgres postgres 6 Jun 1 18:53 pg_stat
67677567 drwx------. 2 postgres postgres 4096 Jun 1 18:53 global
134500180 drwx------. 2 postgres postgres 60 Jun 1 18:54 pg_stat_tmp
-bash-4.2$ cd
-bash-4.2$ cd 10
-bash-4.2$ ls
backups data
-bash-4.2$ pwd
/var/lib/pgsql/10
-bash-4.2$ cd data/
-bash-4.2$ ls -altri
total 0
134734937 drwx------. 4 postgres postgres 31 May 8 06:25 ..
245519 drwx------. 2 postgres postgres 6 May 8 06:25 .
-bash-4.2$ cd ..
-bash-4.2$ pwd
/var/lib/pgsql/10
-bash-4.2$ cd ..
-bash-4.2$
/var/lib/pgsql
-bash-4.2$ psql -h psql03 -U postgres
Password for user postgres:
psql (10.8)
Type "help" for help.
postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
(3 rows)
postgres=# select oid, datname from pg_database ;
oid | datname
-------+-----------
13806 | postgres
1 | template1
13805 | template0
(3 rows)
postgres=#
postgres=# cd /data/patroni
postgres-# ls -altri
postgres-# pwd
postgres-# pwd
postgres-# ls -altrid
postgres-# ;
ERROR: syntax error at or near "cd"
LINE 1: cd /data/patroni
^
postgres=# \q
-bash-4.2$ ls -altri
total 652
134299846 drwxr-xr-x. 39 root root 4096 Oct 24 2018 ..
67178653 -rw-r--r--. 1 postgres postgres 30 Oct 24 2018 .pgsql_profile
134734937 drwx------. 4 postgres postgres 31 May 8 06:25 10
67178637 drwx------. 3 postgres postgres 4096 May 8 06:25 .
68994450 -rw-r--r--. 1 postgres postgres 204336 May 26 22:37 s1.log
67677594 -rwx------. 1 postgres postgres 266 May 26 23:06 .bash_profile
68994451 -rw-r--r--. 1 postgres postgres 433920 May 26 23:44 s2.log
68391913 -rw-------. 1 postgres postgres 4716 Jun 1 17:34 .bash_history
67178638 -rw-------. 1 postgres postgres 325 Jun 1 18:54 .psql_history
-bash-4.2$ cd /data/patroni/
-bash-4.2$ ls -altri
total 144
69085037 drwxr-xr-x. 3 root root 20 Oct 23 2018 ..
135316997 -rw-------. 1 postgres postgres 206 Oct 29 2018 backup_label.old
201708781 drwx------. 2 postgres postgres 6 Oct 29 2018 pg_commit_ts
1502746 drwx------. 2 postgres postgres 6 Oct 29 2018 pg_dynshmem
68994449 drwx------. 2 postgres postgres 6 Oct 29 2018 pg_twophase
1502749 drwx------. 2 postgres postgres 6 Oct 29 2018 pg_snapshots
201708785 drwx------. 2 postgres postgres 6 Oct 29 2018 pg_serial
1502747 drwx------. 4 postgres postgres 34 Oct 29 2018 pg_multixact
67677559 drwx------. 5 postgres postgres 38 Oct 29 2018 base
1502751 drwx------. 2 postgres postgres 17 Oct 29 2018 pg_xact
1502750 drwx------. 2 postgres postgres 6 Oct 29 2018 pg_tblspc
134668882 -rw-------. 1 postgres postgres 88 Oct 29 2018 postgresql.auto.conf
134500181 -rw-------. 1 postgres postgres 3 Oct 29 2018 PG_VERSION
134500173 -rw-------. 1 postgres postgres 1636 Oct 29 2018 pg_ident.conf
134500171 -rw-------. 1 postgres postgres 4730 Oct 29 2018 pg_hba.conf
134668883 -rw-------. 1 postgres postgres 22783 Oct 29 2018 postgresql.base.conf
134500170 -rw-------. 1 postgres postgres 124 Oct 29 2018 patroni.dynamic.json
134668889 -rw-r--r--. 1 postgres postgres 90 Oct 29 2018 recovery.done
201708786 drwx------. 2 postgres postgres 17 Oct 29 2018 pg_subtrans
134500162 drwx------. 2 postgres postgres 4096 Nov 4 2018 log
134500182 drwx------. 3 postgres postgres 8192 Apr 28 06:06 pg_wal
1502748 drwx------. 4 postgres postgres 42 May 22 01:55 pg_replslot
134668893 -rw-r--r--. 1 postgres postgres 90 May 26 22:34 t.txt
134668885 -rw-r--r--. 1 postgres postgres 575 May 26 22:34 postgresql.conf
134668886 -rw-r--r--. 1 postgres postgres 575 May 26 22:34 postgresql.conf.backup
134668884 -rw-------. 1 postgres postgres 22783 May 26 22:34 postgresql.base.conf.backup
134500172 -rw-------. 1 postgres postgres 4730 May 26 22:34 pg_hba.conf.backup
134500174 -rw-------. 1 postgres postgres 1636 May 26 22:34 pg_ident.conf.backup
68994437 drwx------. 4 postgres postgres 65 Jun 1 17:34 pg_logical
134734900 -rw-------. 1 postgres postgres 38 Jun 1 18:53 .s.PGSQL.5432.lock
134734941 srwxrwxrwx. 1 postgres postgres 0 Jun 1 18:53 .s.PGSQL.5432
201708783 drwx------. 2 postgres postgres 17 Jun 1 18:53 pg_notify
134668887 -rw-------. 1 postgres postgres 439 Jun 1 18:53 postmaster.opts
134734940 -rw-------. 1 postgres postgres 30 Jun 1 18:53 current_logfiles
134812989 drwx------. 20 postgres postgres 4096 Jun 1 18:53 .
134734899 -rw-------. 1 postgres postgres 81 Jun 1 18:53 postmaster.pid
68994444 drwx------. 2 postgres postgres 6 Jun 1 18:53 pg_stat
67677567 drwx------. 2 postgres postgres 4096 Jun 1 18:53 global
134500180 drwx------. 2 postgres postgres 60 Jun 1 18:54 pg_stat_tmp
-bash-4.2$ cd
-bash-4.2$ cd 10
-bash-4.2$ ls
backups data
-bash-4.2$ pwd
/var/lib/pgsql/10
-bash-4.2$ cd data/
-bash-4.2$ ls -altri
total 0
134734937 drwx------. 4 postgres postgres 31 May 8 06:25 ..
245519 drwx------. 2 postgres postgres 6 May 8 06:25 .
-bash-4.2$ cd ..
-bash-4.2$ pwd
/var/lib/pgsql/10
-bash-4.2$ cd ..
-bash-4.2$
--
Adrian Klaver
adrian.klaver@aklaver.com
pgsql-general by date: