Repairing broken PostgreSQL databases / tables
DATABASE=yourdatabase
TABLES=$(echo \\d | psql $DATABASE | grep "^ public" | awk '{print $3}')
for TABLE in $TABLES; do
echo $TABLE
echo "SET zero_damaged_pages = on; VACUUM FULL $TABLE; REINDEX TABLE $TABLE" | psql $DATABASE
done
ref:
https://lxadm.com/Repairing_broken_PostgreSQL_databases_/_tables
沒有留言:
張貼留言