Last active
October 24, 2018 13:20
-
-
Save TimKraemer/a0bd511ff6cb01e84a8c23201899fbd1 to your computer and use it in GitHub Desktop.
KMDB restore kmdb from dump
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cp -a $1 /tmp/kmdb.dump | |
sudo su postgres <<EOF | |
cd ~ | |
dropdb db | |
createdb db --owner=kmdb --encoding=UTF8 | |
pg_restore -l /tmp/kmdb.dump | sed '/MATERIALIZED VIEW DATA/d' > restore.lst | |
pg_restore -L restore.lst -d db /tmp/kmdb.dump > /dev/null 2>&1 | |
pg_restore -l /tmp/kmdb.dump | grep 'MATERIALIZED VIEW DATA' > refresh.lst | |
psql -d db -c 'REFRESH MATERIALIZED VIEW unique_lexeme;' | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment