added blurb about htdig as a good search engine, pointed to
[mir.git] / doc / MAINTENANCE
1 To dump mir database <dbname>:
2         pg_dumplo -a -d <dbname> -s /dumpdir/dir
3         pg_dump -c -D -f /dumpdir/<dbname>.sql <dbname>
4 this generates a dir with all blobs and a sql-file with all data.
5
6 To restore the database:
7         psql <dbname> < <dbname>.sql
8         pgdump_lo -i -d <dbname> -s /dumpdir/dir
9
10 Every once in a while (or make a script) postgresql database should
11 be "cleaned". See postgresql docs for commands VACUUM and VACUUM ANALYZE
12
13 Every once in a while (or make a script) postgresql database should
14 be "cleaned". See postgresql docs for commands VACUUM and VACUUM ANALYZE
15
16 We also have misc. perl scripts to merge Large Objects from other DB's.
17 these can be used as a basis to write your own custom scripts.
18
19
20 USER MANAGMENT IN POSTGRESQL
21
22 -- set owner of datbase
23 select * from pg_database;
24 select * from pg_user;
25 update pg_database set datdba=ID_FROM_PG_USER where datname=DATABASENAME
26
27 -- find all tables to grant privs / select is just building sql
28 -- to be exectued
29
30 select 'grant all on '||relname||' to "de_indy";'
31 from pg_class
32 where relname not like 'pg%'
33 order by relname;
34
35 -- alter table owner / select is just building sql
36 -- to be exectued
37 select 'alter table '||relname||' owner to "de_indy";'
38 from pg_class
39 where relname not like 'pg%'
40 order by relname;