Here an asciicast for you. With less do more :)
PostgreSQL
Dienstag, 10. Oktober 2017
Donnerstag, 5. März 2015
Upgrade from PSQL9X to PSQLXY with pg_upgrade (OpenSUSE)
Upgrade from PSQL9X to PSQLXY
with pg_upgrade (OpenSUSE)
- Step 1
Proof which Extension you are use in your Database
- Step 2
Install all PSQL 9.4 Packets - all Extension like ip4r or oraclefce too
- Step 3
shutdown the old one DB (9.3)
systemctl stop postgresql
- Step 4
Move the old DATA-Folder (/var/lib/pgsql/data) and create a new one
Moving
mv /var/lib/pgsql/data/ /var/lib/pgsql/data93
Create new Folder
mkdir /var/lib/pgsql/data/
PSQL Rights
chown postgres:postgres /var/lib/pgsql/data/
- Step 5
PSQL 9.4 start and stop - only to reinit the DATA-Folder
systemctl start postgresql
systemctl stop postgresql
- Step 6
Change User to postgres
su - postgres
- Step 7
Execute pg_upgrade as user postgres
pg_upgrade -d /var/lib/pgsql/data93 -D /var/lib/pgsql/data -b /usr/lib/postgresql93/bin -B /usr/lib/postgresql94/bin
Failure Situation:
Performing Consistency Checks
-----------------------------
Checking cluster versions ok
Checking database user is a superuser ok
Checking for prepared transactions ok
Checking for reg* system OID user data types ok
Checking for contrib/isn with bigint-passing mismatch ok
Checking for invalid "line" user columns ok
Creating dump of global objects ok
Creating dump of database schemas
ok
Checking for presence of required libraries fatal
Your installation references loadable libraries that are missing from the
new installation. You can add these libraries to the new installation,
or remove the functions using them from the old installation. A list of
problem libraries is in the file:
loadable_libraries.txt
Failure, exiting
In File loadable_libraries.txt
Could not load library "$libdir/tds_fdw"
FEHLER: konnte nicht auf Datei „$libdir/tds_fdw“ zugreifen: Datei oder Verzeichnis nicht gefunde
Go back to root-user and compile or install open dependencies
In my case
make clean && make && make install TDS_FDW Libs
Then go again to user postgres
su - postgres
and reexec pg_upgrade command
pg_upgrade -d /var/lib/pgsql/data93 -D /var/lib/pgsql/data -b /usr/lib/postgresql93/bin -B /usr/lib/postgresql94/bin
This output looks good:
Performing Consistency Checks
-----------------------------
Checking cluster versions ok
Checking database user is a superuser ok
Checking for prepared transactions ok
Checking for reg* system OID user data types ok
Checking for contrib/isn with bigint-passing mismatch ok
Checking for invalid "line" user columns ok
Creating dump of global objects ok
Creating dump of database schemas
ok
Checking for presence of required libraries ok
Checking database user is a superuser ok
Checking for prepared transactions ok
If pg_upgrade fails after this point, you must re-initdb the
new cluster before continuing.
Performing Upgrade
------------------
Analyzing all rows in the new cluster ok
Freezing all rows on the new cluster ok
Deleting files from new pg_clog ok
Copying old pg_clog to new server ok
Setting next transaction ID and epoch for new cluster ok
Deleting files from new pg_multixact/offsets ok
Copying old pg_multixact/offsets to new server ok
Deleting files from new pg_multixact/members ok
Copying old pg_multixact/members to new server ok
Setting next multixact ID and offset for new cluster ok
Resetting WAL archives ok
Setting frozenxid and minmxid counters in new cluster ok
Restoring global objects in the new cluster ok
Adding support functions to new cluster ok
Restoring database schemas in the new cluster
ok
Creating newly-required TOAST tables ok
Removing support functions from new cluster ok
Copying user relation files
/var/lib/pgsql/data93/base/104033558/115121165
...Later...
Setting next OID for new cluster ok
Sync data directory to disk ok
Creating script to analyze new cluster ok
Creating script to delete old cluster ok
Upgrade Complete
----------------
Optimizer statistics are not transferred by pg_upgrade so,
once you start the new server, consider running:
analyze_new_cluster.sh
Running this script will delete the old cluster's data files:
delete_old_cluster.sh
Finishing :)
Start your PSQL with
systemctl start postgresql
and run as postgres
analyze_new_cluster.sh
it lies in /var/lib/pgsql folder
5 minutes or whatever your SATA controller can move :)
Abonnieren
Posts (Atom)