$ sudo pg_dropcluster --stop 10 main
$ sudo pg_createcluster --locale ru_RU.UTF-8 10 main -- --data-checksums
$ sudo /bin/su postgres -c "rm -rf /var/lib/postgresql/10/main/*"
$ time sudo -u postgres pg_probackup-10 restore -B /backup --instance main -D /var/lib/postgresql/10/main -i PZRLHZ -j4
$ sudo pg_ctlcluster 10 main start
$ sudo apt install postgresql-10-amcheck
Для каждой базы:
postgres=# CREATE EXTENSION amcheck;
или
postgres=# CREATE EXTENSION amcheck_next;
Grigory Smolkin: для PG =<10 рекомендую ( Grigory Smolkin) использовать amcheck_next
Для каждой базы, например demo:
$ sudo -u postgres psql -c "\l"
user@u1804:~$ sudo -u postgres psql -d Cis_Bgu -c "CREATE EXTENSION amcheck_next"
CREATE EXTENSION
user@u1804:~$ sudo -u postgres psql -d Cis_Zik -c "CREATE EXTENSION amcheck_next"
CREATE EXTENSION
user@u1804:~$ sudo -u postgres psql -d Cis_Zik_Old -c "CREATE EXTENSION amcheck_next"
CREATE EXTENSION
user@u1804:~$ sudo -u postgres psql -d Sobr_Bgu -c "CREATE EXTENSION amcheck_next"
CREATE EXTENSION
user@u1804:~$ sudo -u postgres psql -d Sobr_Bgu_1941 -c "CREATE EXTENSION amcheck_next"
CREATE EXTENSION
user@u1804:~$ sudo -u postgres psql -d Sobr_Zik -c "CREATE EXTENSION amcheck_next"
CREATE EXTENSION
user@u1804:~$ sudo -u postgres psql -d Sobr_Zik_1941 -c "CREATE EXTENSION amcheck_next"
CREATE EXTENSION
user@u1804:~$ sudo -u postgres psql -d demo -c "CREATE EXTENSION amcheck_next"
CREATE EXTENSION
user@u1804:~$ sudo -u postgres psql -d obraz_bgu1 -c "CREATE EXTENSION amcheck_next"
CREATE EXTENSION
$ sudo -u postgres psql -d template1 -c "DROP EXTENSION amcheck_next"
DROP EXTENSION
$ sudo nano /root/amcheck_next.sh
#!/bin/sh -e
DB_BASE=`sudo /bin/su postgres -c "/usr/bin/psql -qAt -c 'SELECT * FROM pg_database;'| \
cut -d'|' -f1 | /bin/grep -v template"`
echo $DB_BASE
for DB_NAME in $DB_BASE
do
#echo $DB_NAME
sudo /bin/su postgres -c "/usr/bin/psql -c 'CREATE EXTENSION IF NOT EXISTS amcheck_next'\
-d $DB_NAME"
done
$ time sudo -u postgres pg_probackup-10 checkdb -B /backup --instance main --amcheck
ERROR: Some databases were not amchecked.
user@u1804:~$ sudo -u postgres psql -d postgres -c "CREATE EXTENSION amcheck_next"
CREATE EXTENSION
$ time sudo -u postgres pg_probackup-10 checkdb -B /backup --instance main --amcheck
INFO: All databases were amchecked.
$ sudo pg_createcluster --locale ru_RU.UTF-8 10 main -- --data-checksums
$ sudo /bin/su postgres -c "rm -rf /var/lib/postgresql/10/main/*"
$ time sudo -u postgres pg_probackup-10 restore -B /backup --instance main -D /var/lib/postgresql/10/main -i PZRLHZ -j4
$ sudo pg_ctlcluster 10 main start
$ sudo apt install postgresql-10-amcheck
Для каждой базы:
postgres=# CREATE EXTENSION amcheck;
или
postgres=# CREATE EXTENSION amcheck_next;
Grigory Smolkin: для PG =<10 рекомендую ( Grigory Smolkin) использовать amcheck_next
Для каждой базы, например demo:
$ sudo -u postgres psql -c "\l"
user@u1804:~$ sudo -u postgres psql -d Cis_Bgu -c "CREATE EXTENSION amcheck_next"
CREATE EXTENSION
user@u1804:~$ sudo -u postgres psql -d Cis_Zik -c "CREATE EXTENSION amcheck_next"
CREATE EXTENSION
user@u1804:~$ sudo -u postgres psql -d Cis_Zik_Old -c "CREATE EXTENSION amcheck_next"
CREATE EXTENSION
user@u1804:~$ sudo -u postgres psql -d Sobr_Bgu -c "CREATE EXTENSION amcheck_next"
CREATE EXTENSION
user@u1804:~$ sudo -u postgres psql -d Sobr_Bgu_1941 -c "CREATE EXTENSION amcheck_next"
CREATE EXTENSION
user@u1804:~$ sudo -u postgres psql -d Sobr_Zik -c "CREATE EXTENSION amcheck_next"
CREATE EXTENSION
user@u1804:~$ sudo -u postgres psql -d Sobr_Zik_1941 -c "CREATE EXTENSION amcheck_next"
CREATE EXTENSION
user@u1804:~$ sudo -u postgres psql -d demo -c "CREATE EXTENSION amcheck_next"
CREATE EXTENSION
user@u1804:~$ sudo -u postgres psql -d obraz_bgu1 -c "CREATE EXTENSION amcheck_next"
CREATE EXTENSION
$ sudo -u postgres psql -d template1 -c "DROP EXTENSION amcheck_next"
DROP EXTENSION
$ sudo nano /root/amcheck_next.sh
#!/bin/sh -e
DB_BASE=`sudo /bin/su postgres -c "/usr/bin/psql -qAt -c 'SELECT * FROM pg_database;'| \
cut -d'|' -f1 | /bin/grep -v template"`
echo $DB_BASE
for DB_NAME in $DB_BASE
do
#echo $DB_NAME
sudo /bin/su postgres -c "/usr/bin/psql -c 'CREATE EXTENSION IF NOT EXISTS amcheck_next'\
-d $DB_NAME"
done
$ time sudo -u postgres pg_probackup-10 checkdb -B /backup --instance main --amcheck
ERROR: Some databases were not amchecked.
user@u1804:~$ sudo -u postgres psql -d postgres -c "CREATE EXTENSION amcheck_next"
CREATE EXTENSION
$ time sudo -u postgres pg_probackup-10 checkdb -B /backup --instance main --amcheck
INFO: All databases were amchecked.
Комментариев нет:
Отправить комментарий