forked from nec-postgres/tdeforpg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
UPGRADE-GUIDE.TXT
63 lines (49 loc) · 2.42 KB
/
UPGRADE-GUIDE.TXT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
Upgrade guides
==============
Upgrade insturctions for Transparent Data Encryption for PostgreSQL Free Edition
Overview
=========
To upgrade from incompatible old version it is needed to migrate data using pg_dump/pg_restore.
* To prevent data loss we highly recommend that you make a backup of $PGDATA directory
before starting following upgrade procedure.
How to Upgrade from old version
===============================
1. Setting environment variables
$ export PGHOME = #path of PostgreSQL installed
$ export TDEHOME = #path of tdeforpg downloaded
2. Dump existing database using pg_dump
$ PGOPTIONS="-c encrypt.enable=off" pg_dump -f <dump_file> -Fc <database>
3. Make a restore list from dumpfile
$ pg_restore -l <dump_file> > <dumplist_file>
$ psql -F ' ' -d <database> << EOF | grep -E [0-9]+ > <tdeoperator_list_file>
\t
\a
SELECT a.oid, 'OPERATOR', nspname , oprname, rolname
FROM pg_operator a JOIN pg_authid b ON a.oprowner=b.oid
JOIN pg_namespace c ON c.oid=a.oprnamespace
WHERE a.oprcode in (select oid from pg_proc where probin like '%data_encryption.so');
EOF
$ grep -v -f $TDEHOME/SOURCES/lib/upgrade/installed_list_fe_<old_version>.txt -f <tdeoperator_list_file> <dumplist_file> > <restorelist_file>
4. Uninstall old version of tdeforpg
$ sh $TDEHOME/SOURCES/bin/cipher_setup.sh $PGHOME
Transparent data encryption feature setup script
Please select from the setup menu below
Transparent data encryption feature setup menu
1: activate the transparent data encryption feature
2: inactivate the transparent data encryption feature
select menu [1 - 2] > 2
Please enter database server port to connect : <port_number>
Please enter database user name to connect : <user_name>
Please enter password for authentication : <password>
Please enter database name to connect : <database>
INFO: The transparent data encryption feature has been inactivated
5. Drop the database
$ dropdb <database>
6. Recreate a database which you are dropped just before
$ createdb <database>
7. Delete old shared object file
$ sudo rm /usr/lib64/data_encryption.so
8. Building and install new tdeforpg to database
Please refer to the INSTALL-NOTE for more details.
9. Restore database using pg_restore
$ PGOPTIONS="-c encrypt.enable=off" pg_restore -d <database> -L <restorelist_file> -e <dump_file>