星期二, 5月 22, 2018

FWD: Repairing broken PostgreSQL databases / tables

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

 

沒有留言:

LinkWithin-相關文件

Related Posts Plugin for WordPress, Blogger...