PostgreSQL9.1 upgrade to PostgreSQL9.5rc1
2016-01-05 11:27 DataBases 阅读(458) 评论(0) 编辑 收藏 举报PostgreSQL9.1.0 upgrade to PostgreSQL9.5rc1
安装PG9.1端口为5432
[pgup@minion1 pg]$ ls
postgresql-9.1.0.tar.bz2 postgresql-9.5rc1.tar.bz2
[pgup@minion1 pg]$ tar jxvf postgresql-9.1.0.tar.bz2
[pgup@minion1 pg]$ cd postgresql-9.1.0
[pgup@minion1 postgresql-9.1.0]$ ./configure --prefix=/usr/local/pg91/
[pgup@minion1 postgresql-9.1.0]$ gmake world
[pgup@minion1 postgresql-9.1.0]$ gmake install-world
初始化并启动PG9.1
[pgup@minion1 postgresql-9.1.0]$ cd /usr/local/pg91/
[pgup@minion1 pg91]$ mkdir data
[pgup@minion1 pg91]$ cd bin/
[pgup@minion1 bin]$ ./initdb -D ../data/
[pgup@minion1 bin]$ ./pg_ctl -D ../data/ start
生成测试数据
[pgup@minion1 bin]$ ./psql -U pgup -d postgres
psql (9.1.0)
Type "help" for help.
postgres=# CREATE USER benchmarksql with superuser password '123456';
CREATE ROLE
postgres=# CREATE DATABASE benchmarksql owner benchmarksql;
CREATE DATABASE
postgres=# \q
[pgup@minion1 bin]$ ./pgbench -i -F 100 -s 714 -h 127.0.0.1 -p 5432 -U benchmarksql benchmarksql
[pgup@minion1 bin]$ ./psql -U pgup -d benchmarksql
psql (9.1.0)
Type "help" for help.
benchmarksql=# \d+
List of relations
Schema | Name | Type | Owner | Size | Description
--------+------------------+-------+--------------+---------+-------------
public | pgbench_accounts | table | benchmarksql | 9147 MB |
public | pgbench_branches | table | benchmarksql | 64 kB |
public | pgbench_history | table | benchmarksql | 0 bytes |
public | pgbench_tellers | table | benchmarksql | 344 kB |
(4 rows)
benchmarksql=# \c postgres
You are now connected to database "postgres" as user "pgup".
postgres=# \d
No relations found.
postgres=# \l+
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges | Size | Tablespace |
Description
--------------+--------------+----------+-------------+-------------+-------------------+---------+------------+---------
-----------------------------------
benchmarksql | benchmarksql | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | 10 GB | pg_default |
postgres | pgup | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | 6153 kB | pg_default | default
administrative connection database
template0 | pgup | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/pgup +| 6049 kB | pg_default | unmodifi
able empty database
| | | | | pgup=CTc/pgup | | |
template1 | pgup | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/pgup +| 6049 kB | pg_default | default
template for new databases
| | | | | pgup=CTc/pgup | | |
(4 rows)
关闭PG9.1
[pgup@minion1 bin]$ cd /usr/local/pg91/bin/
[pgup@minion1 bin]$ ./pg_ctl -D ../data/ stop
waiting for server to shut down.... done
server stopped
安装PG9.5rc端口为5432
[pgup@minion1 bin]$ cd /opt/soft_bak/pg
[pgup@minion1 pg]$ tar jxvf postgresql-9.5rc1.tar.bz2
[pgup@minion1 postgresql-9.5rc1]$ ./configure --prefix=/usr/local/pg95rc/
[pgup@minion1 postgresql-9.5rc1]$ gmake world
[pgup@minion1 postgresql-9.5rc1]$ gmake install-world
初始化并启动PG9.5rc确保PG9.5rc正常运行
[pgup@minion1 postgresql-9.5rc1]$ cd /usr/local/pg95rc/
[pgup@minion1 pg95rc]$ mkdir data
[pgup@minion1 pg95rc]$ cd bin/
[pgup@minion1 bin]$ ./initdb -D ../data/
[pgup@minion1 bin]$ vim ../data/postgresql.conf
[pgup@minion1 bin]$ ./pg_ctl -D ../data/ start
server starting
[pgup@minion1 bin]$ LOG: database system was shut down at 2016-01-05 10:13:44 CST
LOG: MultiXact member wraparound protections are now enabled
LOG: database system is ready to accept connections
LOG: autovacuum launcher started
[pgup@minion1 bin]$ ./psql -U pgup -d postgres -p 6432
psql (9.5rc1)
Type "help" for help.
postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+-------+----------+-------------+-------------+-------------------
postgres | pgup | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | pgup | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/pgup +
| | | | | pgup=CTc/pgup
template1 | pgup | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/pgup +
| | | | | pgup=CTc/pgup
(3 rows)
关闭PG9.5rc
postgres=# \q
[pgup@minion1 bin]$ ./pg_ctl -D ../data/ stop
waiting for server to shut down....LOG: received fast shutdown request
LOG: aborting any active transactions
LOG: autovacuum launcher shutting down
LOG: shutting down
LOG: database system is shut down
done
server stopped
升级PG9.1到PG9.5rc
[pgup@minion1 bin]$ pwd
/usr/local/pg95rc/bin
[pgup@minion1 bin]$ ./pg_upgrade -d /usr/local/pg91/data/ -D /usr/local/pg95rc/data/ -b /usr/local/pg91/bin/ -B /usr/local/pg95rc/bin/ -v
升级过程中输出如下信息,并生成两个脚本
Running in verbose mode
Performing Consistency Checks
-----------------------------
Checking cluster versions ok
pg_control values:
First log file ID after reset: 0
First log file segment after reset: 2
pg_control version number: 903
Catalog version number: 201105231
Database system identifier: 6236111615516434429
Latest checkpoint's TimeLineID: 1
Latest checkpoint's NextXID: 0/1821
Latest checkpoint's NextOID: 16405
Latest checkpoint's NextMultiXactId: 1
Latest checkpoint's NextMultiOffset: 0
Latest checkpoint's oldestXID: 1795
Latest checkpoint's oldestXID's DB: 1
Latest checkpoint's oldestActiveXID: 0
Maximum data alignment: 8
Database block size: 8192
Blocks per segment of large relation: 131072
WAL block size: 8192
Bytes per WAL segment: 16777216
Maximum length of identifiers: 64
Maximum columns in an index: 32
Maximum size of a TOAST chunk: 1996
Date/time type storage: 64-bit integers
Float4 argument passing: by value
Float8 argument passing: by value
Current pg_control values:
pg_control version number: 942
Catalog version number: 201510051
Database system identifier: 6236120816756050287
Latest checkpoint's TimeLineID: 1
Latest checkpoint's full_page_writes: on
Latest checkpoint's NextXID: 0/1750
Latest checkpoint's NextOID: 13242
Latest checkpoint's NextMultiXactId: 1
Latest checkpoint's NextMultiOffset: 0
Latest checkpoint's oldestXID: 1741
Latest checkpoint's oldestXID's DB: 1
Latest checkpoint's oldestActiveXID: 0
Latest checkpoint's oldestMultiXid: 1
Latest checkpoint's oldestMulti's DB: 1
Latest checkpoint's oldestCommitTs: 0
Latest checkpoint's newestCommitTs: 0
Maximum data alignment: 8
Database block size: 8192
Blocks per segment of large relation: 131072
WAL block size: 8192
Bytes per WAL segment: 16777216
Maximum length of identifiers: 64
Maximum columns in an index: 32
Maximum size of a TOAST chunk: 1996
Size of a large-object chunk: 2048
Date/time type storage: 64-bit integers
Float4 argument passing: by value
Float8 argument passing: by value
Data page checksum version: 0
Values to be changed:
First log segment after reset: 000000010000000000000002
"/usr/local/pg91/bin/pg_ctl" -w -l "pg_upgrade_server.log" -D "/usr/local/pg91/data/" -o "-p 50432 -b -c listen_addresses='' -c unix_socket_permissions=0700 -c unix_socket_directory='/usr/local/pg95rc/bin'" start >> "pg_upgrade_server.log" 2>&1
executing: SELECT c.relname, c.relfilenode FROM pg_catalog.pg_class c, pg_catalog.pg_namespace n WHERE c.relnamespace = n.oid AND n.nspname = 'pg_catalog' AND c.relname = 'pg_database' ORDER BY c.relname
executing: SELECT d.oid, d.datname, d.encoding, d.datcollate, d.datctype, t.spclocation AS spclocation FROM pg_catalog.pg_database d LEFT OUTER JOIN pg_catalog.pg_tablespace t ON d.dattablespace = t.oid WHERE d.datallowconn = true ORDER BY 2
executing: WITH regular_heap (reloid) AS ( SELECT c.oid FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid LEFT OUTER JOIN pg_catalog.pg_index i ON c.oid = i.indexrelid WHERE relkind IN ('r', 'm', 'i', 'S') AND i.indisvalid IS DISTINCT FROM false AND i.indisready IS DISTINCT FROM false AND ((n.nspname !~ '^pg_temp_' AND n.nspname !~ '^pg_toast_temp_' AND n.nspname NOT IN ('pg_catalog', 'information_schema', 'binary_upgrade', 'pg_toast') AND c.oid >= 16384) OR (n.nspname = 'pg_catalog' AND relname IN ('pg_largeobject', 'pg_largeobject_loid_pn_index', 'pg_largeobject_metadata', 'pg_largeobject_metadata_oid_index') ))), toast_heap (reloid) AS ( SELECT reltoastrelid FROM regular_heap JOIN pg_catalog.pg_class c ON regular_heap.reloid = c.oid AND c.reltoastrelid != 0), all_index (reloid) AS ( SELECT indexrelid FROM pg_index WHERE indisvalid AND indrelid IN (SELECT reltoastrelid FROM (SELECT reloid FROM regular_heap UNION ALL SELECT reloid FROM toast_heap) all_heap JOIN pg_catalog.pg_class c ON all_heap.reloid = c.oid AND c.reltoastrelid != 0)) SELECT c.oid, n.nspname, c.relname, c.relfilenode, c.reltablespace, t.spclocation FROM (SELECT reloid FROM regular_heap UNION ALL SELECT reloid FROM toast_heap UNION ALL SELECT reloid FROM all_index) all_rels JOIN pg_catalog.pg_class c ON all_rels.reloid = c.oid JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid LEFT OUTER JOIN pg_catalog.pg_tablespace t ON c.reltablespace = t.oid ORDER BY 1;
executing: WITH regular_heap (reloid) AS ( SELECT c.oid FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid LEFT OUTER JOIN pg_catalog.pg_index i ON c.oid = i.indexrelid WHERE relkind IN ('r', 'm', 'i', 'S') AND i.indisvalid IS DISTINCT FROM false AND i.indisready IS DISTINCT FROM false AND ((n.nspname !~ '^pg_temp_' AND n.nspname !~ '^pg_toast_temp_' AND n.nspname NOT IN ('pg_catalog', 'information_schema', 'binary_upgrade', 'pg_toast') AND c.oid >= 16384) OR (n.nspname = 'pg_catalog' AND relname IN ('pg_largeobject', 'pg_largeobject_loid_pn_index', 'pg_largeobject_metadata', 'pg_largeobject_metadata_oid_index') ))), toast_heap (reloid) AS ( SELECT reltoastrelid FROM regular_heap JOIN pg_catalog.pg_class c ON regular_heap.reloid = c.oid AND c.reltoastrelid != 0), all_index (reloid) AS ( SELECT indexrelid FROM pg_index WHERE indisvalid AND indrelid IN (SELECT reltoastrelid FROM (SELECT reloid FROM regular_heap UNION ALL SELECT reloid FROM toast_heap) all_heap JOIN pg_catalog.pg_class c ON all_heap.reloid = c.oid AND c.reltoastrelid != 0)) SELECT c.oid, n.nspname, c.relname, c.relfilenode, c.reltablespace, t.spclocation FROM (SELECT reloid FROM regular_heap UNION ALL SELECT reloid FROM toast_heap UNION ALL SELECT reloid FROM all_index) all_rels JOIN pg_catalog.pg_class c ON all_rels.reloid = c.oid JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid LEFT OUTER JOIN pg_catalog.pg_tablespace t ON c.reltablespace = t.oid ORDER BY 1;
executing: WITH regular_heap (reloid) AS ( SELECT c.oid FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid LEFT OUTER JOIN pg_catalog.pg_index i ON c.oid = i.indexrelid WHERE relkind IN ('r', 'm', 'i', 'S') AND i.indisvalid IS DISTINCT FROM false AND i.indisready IS DISTINCT FROM false AND ((n.nspname !~ '^pg_temp_' AND n.nspname !~ '^pg_toast_temp_' AND n.nspname NOT IN ('pg_catalog', 'information_schema', 'binary_upgrade', 'pg_toast') AND c.oid >= 16384) OR (n.nspname = 'pg_catalog' AND relname IN ('pg_largeobject', 'pg_largeobject_loid_pn_index', 'pg_largeobject_metadata', 'pg_largeobject_metadata_oid_index') ))), toast_heap (reloid) AS ( SELECT reltoastrelid FROM regular_heap JOIN pg_catalog.pg_class c ON regular_heap.reloid = c.oid AND c.reltoastrelid != 0), all_index (reloid) AS ( SELECT indexrelid FROM pg_index WHERE indisvalid AND indrelid IN (SELECT reltoastrelid FROM (SELECT reloid FROM regular_heap UNION ALL SELECT reloid FROM toast_heap) all_heap JOIN pg_catalog.pg_class c ON all_heap.reloid = c.oid AND c.reltoastrelid != 0)) SELECT c.oid, n.nspname, c.relname, c.relfilenode, c.reltablespace, t.spclocation FROM (SELECT reloid FROM regular_heap UNION ALL SELECT reloid FROM toast_heap UNION ALL SELECT reloid FROM all_index) all_rels JOIN pg_catalog.pg_class c ON all_rels.reloid = c.oid JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid LEFT OUTER JOIN pg_catalog.pg_tablespace t ON c.reltablespace = t.oid ORDER BY 1;
old databases:
Database: benchmarksql
relname: pg_catalog.pg_largeobject: reloid: 2613 reltblspace:
relname: pg_catalog.pg_largeobject_loid_pn_index: reloid: 2683 reltblspace:
relname: pg_catalog.pg_largeobject_metadata: reloid: 2995 reltblspace:
relname: pg_catalog.pg_largeobject_metadata_oid_index: reloid: 2996 reltblspace:
relname: public.pgbench_branches: reloid: 16386 reltblspace:
relname: public.pgbench_tellers: reloid: 16389 reltblspace:
relname: public.pgbench_accounts: reloid: 16392 reltblspace:
relname: public.pgbench_history: reloid: 16395 reltblspace:
relname: public.pgbench_branches_pkey: reloid: 16399 reltblspace:
relname: public.pgbench_tellers_pkey: reloid: 16401 reltblspace:
relname: public.pgbench_accounts_pkey: reloid: 16403 reltblspace:
Database: postgres
relname: pg_catalog.pg_largeobject: reloid: 2613 reltblspace:
relname: pg_catalog.pg_largeobject_loid_pn_index: reloid: 2683 reltblspace:
relname: pg_catalog.pg_largeobject_metadata: reloid: 2995 reltblspace:
relname: pg_catalog.pg_largeobject_metadata_oid_index: reloid: 2996 reltblspace:
Database: template1
relname: pg_catalog.pg_largeobject: reloid: 2613 reltblspace:
relname: pg_catalog.pg_largeobject_loid_pn_index: reloid: 2683 reltblspace:
relname: pg_catalog.pg_largeobject_metadata: reloid: 2995 reltblspace:
relname: pg_catalog.pg_largeobject_metadata_oid_index: reloid: 2996 reltblspace:
executing: SELECT spclocation FROM pg_catalog.pg_tablespace WHERE spcname != 'pg_default' AND spcname != 'pg_global'
executing: SELECT DISTINCT probin FROM pg_catalog.pg_proc WHERE prolang = 13 /* C */ AND probin IS NOT NULL AND oid >= 16384;
executing: SELECT DISTINCT probin FROM pg_catalog.pg_proc WHERE prolang = 13 /* C */ AND probin IS NOT NULL AND oid >= 16384;
executing: SELECT DISTINCT probin FROM pg_catalog.pg_proc WHERE prolang = 13 /* C */ AND probin IS NOT NULL AND oid >= 16384;
Checking database user is the install user executing: SELECT rolsuper, oid FROM pg_catalog.pg_roles WHERE rolname = current_user
executing: SELECT COUNT(*) FROM pg_catalog.pg_roles
ok
Checking database connection settings executing: SELECT datname, datallowconn FROM pg_catalog.pg_database
ok
Checking for prepared transactions executing: SELECT * FROM pg_catalog.pg_prepared_xacts
ok
Checking for reg* system OID user data types executing: SELECT n.nspname, c.relname, a.attname FROM pg_catalog.pg_class c, pg_catalog.pg_namespace n, pg_catalog.pg_attribute a WHERE c.oid = a.attrelid AND NOT a.attisdropped AND a.atttypid IN ( 'pg_catalog.regproc'::pg_catalog.regtype, 'pg_catalog.regprocedure'::pg_catalog.regtype, 'pg_catalog.regoper'::pg_catalog.regtype, 'pg_catalog.regoperator'::pg_catalog.regtype, 'pg_catalog.regconfig'::pg_catalog.regtype, 'pg_catalog.regdictionary'::pg_catalog.regtype) AND c.relnamespace = n.oid AND n.nspname NOT IN ('pg_catalog', 'information_schema')
executing: SELECT n.nspname, c.relname, a.attname FROM pg_catalog.pg_class c, pg_catalog.pg_namespace n, pg_catalog.pg_attribute a WHERE c.oid = a.attrelid AND NOT a.attisdropped AND a.atttypid IN ( 'pg_catalog.regproc'::pg_catalog.regtype, 'pg_catalog.regprocedure'::pg_catalog.regtype, 'pg_catalog.regoper'::pg_catalog.regtype, 'pg_catalog.regoperator'::pg_catalog.regtype, 'pg_catalog.regconfig'::pg_catalog.regtype, 'pg_catalog.regdictionary'::pg_catalog.regtype) AND c.relnamespace = n.oid AND n.nspname NOT IN ('pg_catalog', 'information_schema')
executing: SELECT n.nspname, c.relname, a.attname FROM pg_catalog.pg_class c, pg_catalog.pg_namespace n, pg_catalog.pg_attribute a WHERE c.oid = a.attrelid AND NOT a.attisdropped AND a.atttypid IN ( 'pg_catalog.regproc'::pg_catalog.regtype, 'pg_catalog.regprocedure'::pg_catalog.regtype, 'pg_catalog.regoper'::pg_catalog.regtype, 'pg_catalog.regoperator'::pg_catalog.regtype, 'pg_catalog.regconfig'::pg_catalog.regtype, 'pg_catalog.regdictionary'::pg_catalog.regtype) AND c.relnamespace = n.oid AND n.nspname NOT IN ('pg_catalog', 'information_schema')
ok
Checking for contrib/isn with bigint-passing mismatch ok
Checking for invalid "line" user columns executing: SELECT n.nspname, c.relname, a.attname FROM pg_catalog.pg_class c, pg_catalog.pg_namespace n, pg_catalog.pg_attribute a WHERE c.oid = a.attrelid AND NOT a.attisdropped AND a.atttypid = 'pg_catalog.line'::pg_catalog.regtype AND c.relnamespace = n.oid AND n.nspname !~ '^pg_temp_' AND n.nspname !~ '^pg_toast_temp_' AND n.nspname NOT IN ('pg_catalog', 'information_schema')
executing: SELECT n.nspname, c.relname, a.attname FROM pg_catalog.pg_class c, pg_catalog.pg_namespace n, pg_catalog.pg_attribute a WHERE c.oid = a.attrelid AND NOT a.attisdropped AND a.atttypid = 'pg_catalog.line'::pg_catalog.regtype AND c.relnamespace = n.oid AND n.nspname !~ '^pg_temp_' AND n.nspname !~ '^pg_toast_temp_' AND n.nspname NOT IN ('pg_catalog', 'information_schema')
executing: SELECT n.nspname, c.relname, a.attname FROM pg_catalog.pg_class c, pg_catalog.pg_namespace n, pg_catalog.pg_attribute a WHERE c.oid = a.attrelid AND NOT a.attisdropped AND a.atttypid = 'pg_catalog.line'::pg_catalog.regtype AND c.relnamespace = n.oid AND n.nspname !~ '^pg_temp_' AND n.nspname !~ '^pg_toast_temp_' AND n.nspname NOT IN ('pg_catalog', 'information_schema')
ok
Creating dump of global objects "/usr/local/pg95rc/bin/pg_dumpall" --host "/usr/local/pg95rc/bin" --port 50432 --username "pgup" --globals-only --quote-all-identifiers --binary-upgrade --verbose -f pg_upgrade_dump_globals.sql >> "pg_upgrade_utility.log" 2>&1
ok
Creating dump of database schemas
"/usr/local/pg95rc/bin/pg_dump" --host "/usr/local/pg95rc/bin" --port 50432 --username "pgup" --schema-only --quote-all-identifiers --binary-upgrade --format=custom --verbose --file="pg_upgrade_dump_16385.custom" "benchmarksql" >> "pg_upgrade_dump_16385.log" 2>&1
"/usr/local/pg95rc/bin/pg_dump" --host "/usr/local/pg95rc/bin" --port 50432 --username "pgup" --schema-only --quote-all-identifiers --binary-upgrade --format=custom --verbose --file="pg_upgrade_dump_12780.custom" "postgres" >> "pg_upgrade_dump_12780.log" 2>&1
"/usr/local/pg95rc/bin/pg_dump" --host "/usr/local/pg95rc/bin" --port 50432 --username "pgup" --schema-only --quote-all-identifiers --binary-upgrade --format=custom --verbose --file="pg_upgrade_dump_1.custom" "template1" >> "pg_upgrade_dump_1.log" 2>&1
ok
"/usr/local/pg91/bin/pg_ctl" -w -D "/usr/local/pg91/data/" -o "" stop >> "pg_upgrade_server.log" 2>&1
"/usr/local/pg95rc/bin/pg_ctl" -w -l "pg_upgrade_server.log" -D "/usr/local/pg95rc/data/" -o "-p 50432 -b -c synchronous_commit=off -c fsync=off -c full_page_writes=off -c listen_addresses='' -c unix_socket_permissions=0700 -c unix_socket_directories='/usr/local/pg95rc/bin'" start >> "pg_upgrade_server.log" 2>&1
executing: SELECT d.oid, d.datname, d.encoding, d.datcollate, d.datctype, pg_catalog.pg_tablespace_location(t.oid) AS spclocation FROM pg_catalog.pg_database d LEFT OUTER JOIN pg_catalog.pg_tablespace t ON d.dattablespace = t.oid WHERE d.datallowconn = true ORDER BY 2
executing: WITH regular_heap (reloid) AS ( SELECT c.oid FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid LEFT OUTER JOIN pg_catalog.pg_index i ON c.oid = i.indexrelid WHERE relkind IN ('r', 'm', 'i', 'S') AND i.indisvalid IS DISTINCT FROM false AND i.indisready IS DISTINCT FROM false AND ((n.nspname !~ '^pg_temp_' AND n.nspname !~ '^pg_toast_temp_' AND n.nspname NOT IN ('pg_catalog', 'information_schema', 'binary_upgrade', 'pg_toast') AND c.oid >= 16384) OR (n.nspname = 'pg_catalog' AND relname IN ('pg_largeobject', 'pg_largeobject_loid_pn_index', 'pg_largeobject_metadata', 'pg_largeobject_metadata_oid_index') ))), toast_heap (reloid) AS ( SELECT reltoastrelid FROM regular_heap JOIN pg_catalog.pg_class c ON regular_heap.reloid = c.oid AND c.reltoastrelid != 0), all_index (reloid) AS ( SELECT indexrelid FROM pg_index WHERE indisvalid AND indrelid IN (SELECT reltoastrelid FROM (SELECT reloid FROM regular_heap UNION ALL SELECT reloid FROM toast_heap) all_heap JOIN pg_catalog.pg_class c ON all_heap.reloid = c.oid AND c.reltoastrelid != 0)) SELECT c.oid, n.nspname, c.relname, c.relfilenode, c.reltablespace, pg_catalog.pg_tablespace_location(t.oid) AS spclocation FROM (SELECT reloid FROM regular_heap UNION ALL SELECT reloid FROM toast_heap UNION ALL SELECT reloid FROM all_index) all_rels JOIN pg_catalog.pg_class c ON all_rels.reloid = c.oid JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid LEFT OUTER JOIN pg_catalog.pg_tablespace t ON c.reltablespace = t.oid ORDER BY 1;
executing: WITH regular_heap (reloid) AS ( SELECT c.oid FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid LEFT OUTER JOIN pg_catalog.pg_index i ON c.oid = i.indexrelid WHERE relkind IN ('r', 'm', 'i', 'S') AND i.indisvalid IS DISTINCT FROM false AND i.indisready IS DISTINCT FROM false AND ((n.nspname !~ '^pg_temp_' AND n.nspname !~ '^pg_toast_temp_' AND n.nspname NOT IN ('pg_catalog', 'information_schema', 'binary_upgrade', 'pg_toast') AND c.oid >= 16384) OR (n.nspname = 'pg_catalog' AND relname IN ('pg_largeobject', 'pg_largeobject_loid_pn_index', 'pg_largeobject_metadata', 'pg_largeobject_metadata_oid_index') ))), toast_heap (reloid) AS ( SELECT reltoastrelid FROM regular_heap JOIN pg_catalog.pg_class c ON regular_heap.reloid = c.oid AND c.reltoastrelid != 0), all_index (reloid) AS ( SELECT indexrelid FROM pg_index WHERE indisvalid AND indrelid IN (SELECT reltoastrelid FROM (SELECT reloid FROM regular_heap UNION ALL SELECT reloid FROM toast_heap) all_heap JOIN pg_catalog.pg_class c ON all_heap.reloid = c.oid AND c.reltoastrelid != 0)) SELECT c.oid, n.nspname, c.relname, c.relfilenode, c.reltablespace, pg_catalog.pg_tablespace_location(t.oid) AS spclocation FROM (SELECT reloid FROM regular_heap UNION ALL SELECT reloid FROM toast_heap UNION ALL SELECT reloid FROM all_index) all_rels JOIN pg_catalog.pg_class c ON all_rels.reloid = c.oid JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid LEFT OUTER JOIN pg_catalog.pg_tablespace t ON c.reltablespace = t.oid ORDER BY 1;
new databases:
Database: postgres
relname: pg_catalog.pg_largeobject: reloid: 2613 reltblspace:
relname: pg_catalog.pg_largeobject_loid_pn_index: reloid: 2683 reltblspace:
relname: pg_catalog.pg_largeobject_metadata: reloid: 2995 reltblspace:
relname: pg_catalog.pg_largeobject_metadata_oid_index: reloid: 2996 reltblspace:
Database: template1
relname: pg_catalog.pg_largeobject: reloid: 2613 reltblspace:
relname: pg_catalog.pg_largeobject_loid_pn_index: reloid: 2683 reltblspace:
relname: pg_catalog.pg_largeobject_metadata: reloid: 2995 reltblspace:
relname: pg_catalog.pg_largeobject_metadata_oid_index: reloid: 2996 reltblspace:
Checking for presence of required libraries ok
Checking database user is the install user executing: SELECT rolsuper, oid FROM pg_catalog.pg_roles WHERE rolname = current_user
executing: SELECT COUNT(*) FROM pg_catalog.pg_roles
ok
Checking for prepared transactions executing: SELECT * FROM pg_catalog.pg_prepared_xacts
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 "/usr/local/pg95rc/bin/vacuumdb" --host "/usr/local/pg95rc/bin" --port 50432 --username "pgup" --all --analyze --verbose >> "pg_upgrade_utility.log" 2>&1
ok
Freezing all rows on the new cluster "/usr/local/pg95rc/bin/vacuumdb" --host "/usr/local/pg95rc/bin" --port 50432 --username "pgup" --all --freeze --verbose >> "pg_upgrade_utility.log" 2>&1
ok
executing: SELECT c.relname, c.relfilenode FROM pg_catalog.pg_class c, pg_catalog.pg_namespace n WHERE c.relnamespace = n.oid AND n.nspname = 'pg_catalog' AND c.relname = 'pg_database' ORDER BY c.relname
"/usr/local/pg95rc/bin/pg_ctl" -w -D "/usr/local/pg95rc/data/" -o "" stop >> "pg_upgrade_server.log" 2>&1
Deleting files from new pg_clog ok
Copying old pg_clog to new server cp -Rf "/usr/local/pg91/data/pg_clog" "/usr/local/pg95rc/data/pg_clog" >> "pg_upgrade_utility.log" 2>&1
ok
Setting next transaction ID and epoch for new cluster "/usr/local/pg95rc/bin/pg_resetxlog" -f -x 1821 "/usr/local/pg95rc/data" >> "pg_upgrade_utility.log" 2>&1
"/usr/local/pg95rc/bin/pg_resetxlog" -f -e 0 "/usr/local/pg95rc/data" >> "pg_upgrade_utility.log" 2>&1
"/usr/local/pg95rc/bin/pg_resetxlog" -f -c 1821,1821 "/usr/local/pg95rc/data" >> "pg_upgrade_utility.log" 2>&1
ok
Deleting files from new pg_multixact/offsets ok
Setting oldest multixact ID on new cluster "/usr/local/pg95rc/bin/pg_resetxlog" -m 2,1 "/usr/local/pg95rc/data" >> "pg_upgrade_utility.log" 2>&1
ok
Resetting WAL archives "/usr/local/pg95rc/bin/pg_resetxlog" -l 000000010000000000000002 "/usr/local/pg95rc/data" >> "pg_upgrade_utility.log" 2>&1
ok
"/usr/local/pg95rc/bin/pg_ctl" -w -l "pg_upgrade_server.log" -D "/usr/local/pg95rc/data/" -o "-p 50432 -b -c synchronous_commit=off -c fsync=off -c full_page_writes=off -c listen_addresses='' -c unix_socket_permissions=0700 -c unix_socket_directories='/usr/local/pg95rc/bin'" start >> "pg_upgrade_server.log" 2>&1
Setting frozenxid and minmxid counters in new cluster executing: UPDATE pg_catalog.pg_database SET datfrozenxid = '1821'
executing: UPDATE pg_catalog.pg_database SET datminmxid = '1'
executing: SELECT datname, datallowconn FROM pg_catalog.pg_database
executing: UPDATE pg_catalog.pg_class SET relfrozenxid = '1821' WHERE relkind IN ('r', 'm', 't')
executing: UPDATE pg_catalog.pg_class SET relminmxid = '1' WHERE relkind IN ('r', 'm', 't')
executing: ALTER DATABASE "template0" ALLOW_CONNECTIONS = true
executing: UPDATE pg_catalog.pg_class SET relfrozenxid = '1821' WHERE relkind IN ('r', 'm', 't')
executing: UPDATE pg_catalog.pg_class SET relminmxid = '1' WHERE relkind IN ('r', 'm', 't')
executing: ALTER DATABASE "template0" ALLOW_CONNECTIONS = false
executing: UPDATE pg_catalog.pg_class SET relfrozenxid = '1821' WHERE relkind IN ('r', 'm', 't')
executing: UPDATE pg_catalog.pg_class SET relminmxid = '1' WHERE relkind IN ('r', 'm', 't')
ok
Restoring global objects in the new cluster "/usr/local/pg95rc/bin/psql" --echo-queries --set ON_ERROR_STOP=on --no-psqlrc --dbname=template1 --host "/usr/local/pg95rc/bin" --port 50432 --username "pgup" -f "pg_upgrade_dump_globals.sql" >> "pg_upgrade_utility.log" 2>&1
ok
executing: SELECT d.oid, d.datname, d.encoding, d.datcollate, d.datctype, pg_catalog.pg_tablespace_location(t.oid) AS spclocation FROM pg_catalog.pg_database d LEFT OUTER JOIN pg_catalog.pg_tablespace t ON d.dattablespace = t.oid WHERE d.datallowconn = true ORDER BY 2
executing: WITH regular_heap (reloid) AS ( SELECT c.oid FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid LEFT OUTER JOIN pg_catalog.pg_index i ON c.oid = i.indexrelid WHERE relkind IN ('r', 'm', 'i', 'S') AND i.indisvalid IS DISTINCT FROM false AND i.indisready IS DISTINCT FROM false AND ((n.nspname !~ '^pg_temp_' AND n.nspname !~ '^pg_toast_temp_' AND n.nspname NOT IN ('pg_catalog', 'information_schema', 'binary_upgrade', 'pg_toast') AND c.oid >= 16384) OR (n.nspname = 'pg_catalog' AND relname IN ('pg_largeobject', 'pg_largeobject_loid_pn_index', 'pg_largeobject_metadata', 'pg_largeobject_metadata_oid_index') ))), toast_heap (reloid) AS ( SELECT reltoastrelid FROM regular_heap JOIN pg_catalog.pg_class c ON regular_heap.reloid = c.oid AND c.reltoastrelid != 0), all_index (reloid) AS ( SELECT indexrelid FROM pg_index WHERE indisvalid AND indrelid IN (SELECT reltoastrelid FROM (SELECT reloid FROM regular_heap UNION ALL SELECT reloid FROM toast_heap) all_heap JOIN pg_catalog.pg_class c ON all_heap.reloid = c.oid AND c.reltoastrelid != 0)) SELECT c.oid, n.nspname, c.relname, c.relfilenode, c.reltablespace, pg_catalog.pg_tablespace_location(t.oid) AS spclocation FROM (SELECT reloid FROM regular_heap UNION ALL SELECT reloid FROM toast_heap UNION ALL SELECT reloid FROM all_index) all_rels JOIN pg_catalog.pg_class c ON all_rels.reloid = c.oid JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid LEFT OUTER JOIN pg_catalog.pg_tablespace t ON c.reltablespace = t.oid ORDER BY 1;
executing: WITH regular_heap (reloid) AS ( SELECT c.oid FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid LEFT OUTER JOIN pg_catalog.pg_index i ON c.oid = i.indexrelid WHERE relkind IN ('r', 'm', 'i', 'S') AND i.indisvalid IS DISTINCT FROM false AND i.indisready IS DISTINCT FROM false AND ((n.nspname !~ '^pg_temp_' AND n.nspname !~ '^pg_toast_temp_' AND n.nspname NOT IN ('pg_catalog', 'information_schema', 'binary_upgrade', 'pg_toast') AND c.oid >= 16384) OR (n.nspname = 'pg_catalog' AND relname IN ('pg_largeobject', 'pg_largeobject_loid_pn_index', 'pg_largeobject_metadata', 'pg_largeobject_metadata_oid_index') ))), toast_heap (reloid) AS ( SELECT reltoastrelid FROM regular_heap JOIN pg_catalog.pg_class c ON regular_heap.reloid = c.oid AND c.reltoastrelid != 0), all_index (reloid) AS ( SELECT indexrelid FROM pg_index WHERE indisvalid AND indrelid IN (SELECT reltoastrelid FROM (SELECT reloid FROM regular_heap UNION ALL SELECT reloid FROM toast_heap) all_heap JOIN pg_catalog.pg_class c ON all_heap.reloid = c.oid AND c.reltoastrelid != 0)) SELECT c.oid, n.nspname, c.relname, c.relfilenode, c.reltablespace, pg_catalog.pg_tablespace_location(t.oid) AS spclocation FROM (SELECT reloid FROM regular_heap UNION ALL SELECT reloid FROM toast_heap UNION ALL SELECT reloid FROM all_index) all_rels JOIN pg_catalog.pg_class c ON all_rels.reloid = c.oid JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid LEFT OUTER JOIN pg_catalog.pg_tablespace t ON c.reltablespace = t.oid ORDER BY 1;
executing: WITH regular_heap (reloid) AS ( SELECT c.oid FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid LEFT OUTER JOIN pg_catalog.pg_index i ON c.oid = i.indexrelid WHERE relkind IN ('r', 'm', 'i', 'S') AND i.indisvalid IS DISTINCT FROM false AND i.indisready IS DISTINCT FROM false AND ((n.nspname !~ '^pg_temp_' AND n.nspname !~ '^pg_toast_temp_' AND n.nspname NOT IN ('pg_catalog', 'information_schema', 'binary_upgrade', 'pg_toast') AND c.oid >= 16384) OR (n.nspname = 'pg_catalog' AND relname IN ('pg_largeobject', 'pg_largeobject_loid_pn_index', 'pg_largeobject_metadata', 'pg_largeobject_metadata_oid_index') ))), toast_heap (reloid) AS ( SELECT reltoastrelid FROM regular_heap JOIN pg_catalog.pg_class c ON regular_heap.reloid = c.oid AND c.reltoastrelid != 0), all_index (reloid) AS ( SELECT indexrelid FROM pg_index WHERE indisvalid AND indrelid IN (SELECT reltoastrelid FROM (SELECT reloid FROM regular_heap UNION ALL SELECT reloid FROM toast_heap) all_heap JOIN pg_catalog.pg_class c ON all_heap.reloid = c.oid AND c.reltoastrelid != 0)) SELECT c.oid, n.nspname, c.relname, c.relfilenode, c.reltablespace, pg_catalog.pg_tablespace_location(t.oid) AS spclocation FROM (SELECT reloid FROM regular_heap UNION ALL SELECT reloid FROM toast_heap UNION ALL SELECT reloid FROM all_index) all_rels JOIN pg_catalog.pg_class c ON all_rels.reloid = c.oid JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid LEFT OUTER JOIN pg_catalog.pg_tablespace t ON c.reltablespace = t.oid ORDER BY 1;
new databases:
Database: benchmarksql
relname: pg_catalog.pg_largeobject: reloid: 2613 reltblspace:
relname: pg_catalog.pg_largeobject_loid_pn_index: reloid: 2683 reltblspace:
relname: pg_catalog.pg_largeobject_metadata: reloid: 2995 reltblspace:
relname: pg_catalog.pg_largeobject_metadata_oid_index: reloid: 2996 reltblspace:
Database: postgres
relname: pg_catalog.pg_largeobject: reloid: 2613 reltblspace:
relname: pg_catalog.pg_largeobject_loid_pn_index: reloid: 2683 reltblspace:
relname: pg_catalog.pg_largeobject_metadata: reloid: 2995 reltblspace:
relname: pg_catalog.pg_largeobject_metadata_oid_index: reloid: 2996 reltblspace:
Database: template1
relname: pg_catalog.pg_largeobject: reloid: 2613 reltblspace:
relname: pg_catalog.pg_largeobject_loid_pn_index: reloid: 2683 reltblspace:
relname: pg_catalog.pg_largeobject_metadata: reloid: 2995 reltblspace:
relname: pg_catalog.pg_largeobject_metadata_oid_index: reloid: 2996 reltblspace:
Restoring database schemas in the new cluster
"/usr/local/pg95rc/bin/pg_restore" --host "/usr/local/pg95rc/bin" --port 50432 --username "pgup" --exit-on-error --verbose --dbname "benchmarksql" "pg_upgrade_dump_16385.custom" >> "pg_upgrade_dump_16385.log" 2>&1
"/usr/local/pg95rc/bin/pg_restore" --host "/usr/local/pg95rc/bin" --port 50432 --username "pgup" --exit-on-error --verbose --dbname "postgres" "pg_upgrade_dump_12780.custom" >> "pg_upgrade_dump_12780.log" 2>&1
"/usr/local/pg95rc/bin/pg_restore" --host "/usr/local/pg95rc/bin" --port 50432 --username "pgup" --exit-on-error --verbose --dbname "template1" "pg_upgrade_dump_1.custom" >> "pg_upgrade_dump_1.log" 2>&1
ok
Setting minmxid counter in new cluster executing: UPDATE pg_catalog.pg_database SET datminmxid = '1'
executing: SELECT datname, datallowconn FROM pg_catalog.pg_database
executing: ALTER DATABASE "template0" ALLOW_CONNECTIONS = true
executing: UPDATE pg_catalog.pg_class SET relminmxid = '1' WHERE relkind IN ('r', 'm', 't')
executing: ALTER DATABASE "template0" ALLOW_CONNECTIONS = false
executing: UPDATE pg_catalog.pg_class SET relminmxid = '1' WHERE relkind IN ('r', 'm', 't')
executing: UPDATE pg_catalog.pg_class SET relminmxid = '1' WHERE relkind IN ('r', 'm', 't')
executing: UPDATE pg_catalog.pg_class SET relminmxid = '1' WHERE relkind IN ('r', 'm', 't')
ok
Creating newly-required TOAST tables executing: SELECT n.nspname, c.relname FROM pg_catalog.pg_class c, pg_catalog.pg_namespace n WHERE c.relnamespace = n.oid AND n.nspname NOT IN ('pg_catalog', 'information_schema') AND c.relkind IN ('r', 'm') AND c.reltoastrelid = 0
executing: SELECT pg_catalog.binary_upgrade_set_next_toast_pg_class_oid('10'::pg_catalog.oid);
executing: ALTER TABLE "public"."pgbench_tellers" RESET (binary_upgrade_dummy_option);
executing: SELECT pg_catalog.binary_upgrade_set_next_toast_pg_class_oid('10'::pg_catalog.oid);
executing: ALTER TABLE "public"."pgbench_accounts" RESET (binary_upgrade_dummy_option);
executing: SELECT pg_catalog.binary_upgrade_set_next_toast_pg_class_oid('10'::pg_catalog.oid);
executing: ALTER TABLE "public"."pgbench_branches" RESET (binary_upgrade_dummy_option);
executing: SELECT pg_catalog.binary_upgrade_set_next_toast_pg_class_oid('10'::pg_catalog.oid);
executing: ALTER TABLE "public"."pgbench_history" RESET (binary_upgrade_dummy_option);
executing: SELECT n.nspname, c.relname FROM pg_catalog.pg_class c, pg_catalog.pg_namespace n WHERE c.relnamespace = n.oid AND n.nspname NOT IN ('pg_catalog', 'information_schema') AND c.relkind IN ('r', 'm') AND c.reltoastrelid = 0
executing: SELECT n.nspname, c.relname FROM pg_catalog.pg_class c, pg_catalog.pg_namespace n WHERE c.relnamespace = n.oid AND n.nspname NOT IN ('pg_catalog', 'information_schema') AND c.relkind IN ('r', 'm') AND c.reltoastrelid = 0
ok
executing: SELECT d.oid, d.datname, d.encoding, d.datcollate, d.datctype, pg_catalog.pg_tablespace_location(t.oid) AS spclocation FROM pg_catalog.pg_database d LEFT OUTER JOIN pg_catalog.pg_tablespace t ON d.dattablespace = t.oid WHERE d.datallowconn = true ORDER BY 2
executing: WITH regular_heap (reloid) AS ( SELECT c.oid FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid LEFT OUTER JOIN pg_catalog.pg_index i ON c.oid = i.indexrelid WHERE relkind IN ('r', 'm', 'i', 'S') AND i.indisvalid IS DISTINCT FROM false AND i.indisready IS DISTINCT FROM false AND ((n.nspname !~ '^pg_temp_' AND n.nspname !~ '^pg_toast_temp_' AND n.nspname NOT IN ('pg_catalog', 'information_schema', 'binary_upgrade', 'pg_toast') AND c.oid >= 16384) OR (n.nspname = 'pg_catalog' AND relname IN ('pg_largeobject', 'pg_largeobject_loid_pn_index', 'pg_largeobject_metadata', 'pg_largeobject_metadata_oid_index') ))), toast_heap (reloid) AS ( SELECT reltoastrelid FROM regular_heap JOIN pg_catalog.pg_class c ON regular_heap.reloid = c.oid AND c.reltoastrelid != 0), all_index (reloid) AS ( SELECT indexrelid FROM pg_index WHERE indisvalid AND indrelid IN (SELECT reltoastrelid FROM (SELECT reloid FROM regular_heap UNION ALL SELECT reloid FROM toast_heap) all_heap JOIN pg_catalog.pg_class c ON all_heap.reloid = c.oid AND c.reltoastrelid != 0)) SELECT c.oid, n.nspname, c.relname, c.relfilenode, c.reltablespace, pg_catalog.pg_tablespace_location(t.oid) AS spclocation FROM (SELECT reloid FROM regular_heap UNION ALL SELECT reloid FROM toast_heap UNION ALL SELECT reloid FROM all_index) all_rels JOIN pg_catalog.pg_class c ON all_rels.reloid = c.oid JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid LEFT OUTER JOIN pg_catalog.pg_tablespace t ON c.reltablespace = t.oid ORDER BY 1;
executing: WITH regular_heap (reloid) AS ( SELECT c.oid FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid LEFT OUTER JOIN pg_catalog.pg_index i ON c.oid = i.indexrelid WHERE relkind IN ('r', 'm', 'i', 'S') AND i.indisvalid IS DISTINCT FROM false AND i.indisready IS DISTINCT FROM false AND ((n.nspname !~ '^pg_temp_' AND n.nspname !~ '^pg_toast_temp_' AND n.nspname NOT IN ('pg_catalog', 'information_schema', 'binary_upgrade', 'pg_toast') AND c.oid >= 16384) OR (n.nspname = 'pg_catalog' AND relname IN ('pg_largeobject', 'pg_largeobject_loid_pn_index', 'pg_largeobject_metadata', 'pg_largeobject_metadata_oid_index') ))), toast_heap (reloid) AS ( SELECT reltoastrelid FROM regular_heap JOIN pg_catalog.pg_class c ON regular_heap.reloid = c.oid AND c.reltoastrelid != 0), all_index (reloid) AS ( SELECT indexrelid FROM pg_index WHERE indisvalid AND indrelid IN (SELECT reltoastrelid FROM (SELECT reloid FROM regular_heap UNION ALL SELECT reloid FROM toast_heap) all_heap JOIN pg_catalog.pg_class c ON all_heap.reloid = c.oid AND c.reltoastrelid != 0)) SELECT c.oid, n.nspname, c.relname, c.relfilenode, c.reltablespace, pg_catalog.pg_tablespace_location(t.oid) AS spclocation FROM (SELECT reloid FROM regular_heap UNION ALL SELECT reloid FROM toast_heap UNION ALL SELECT reloid FROM all_index) all_rels JOIN pg_catalog.pg_class c ON all_rels.reloid = c.oid JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid LEFT OUTER JOIN pg_catalog.pg_tablespace t ON c.reltablespace = t.oid ORDER BY 1;
executing: WITH regular_heap (reloid) AS ( SELECT c.oid FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid LEFT OUTER JOIN pg_catalog.pg_index i ON c.oid = i.indexrelid WHERE relkind IN ('r', 'm', 'i', 'S') AND i.indisvalid IS DISTINCT FROM false AND i.indisready IS DISTINCT FROM false AND ((n.nspname !~ '^pg_temp_' AND n.nspname !~ '^pg_toast_temp_' AND n.nspname NOT IN ('pg_catalog', 'information_schema', 'binary_upgrade', 'pg_toast') AND c.oid >= 16384) OR (n.nspname = 'pg_catalog' AND relname IN ('pg_largeobject', 'pg_largeobject_loid_pn_index', 'pg_largeobject_metadata', 'pg_largeobject_metadata_oid_index') ))), toast_heap (reloid) AS ( SELECT reltoastrelid FROM regular_heap JOIN pg_catalog.pg_class c ON regular_heap.reloid = c.oid AND c.reltoastrelid != 0), all_index (reloid) AS ( SELECT indexrelid FROM pg_index WHERE indisvalid AND indrelid IN (SELECT reltoastrelid FROM (SELECT reloid FROM regular_heap UNION ALL SELECT reloid FROM toast_heap) all_heap JOIN pg_catalog.pg_class c ON all_heap.reloid = c.oid AND c.reltoastrelid != 0)) SELECT c.oid, n.nspname, c.relname, c.relfilenode, c.reltablespace, pg_catalog.pg_tablespace_location(t.oid) AS spclocation FROM (SELECT reloid FROM regular_heap UNION ALL SELECT reloid FROM toast_heap UNION ALL SELECT reloid FROM all_index) all_rels JOIN pg_catalog.pg_class c ON all_rels.reloid = c.oid JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid LEFT OUTER JOIN pg_catalog.pg_tablespace t ON c.reltablespace = t.oid ORDER BY 1;
new databases:
Database: benchmarksql
relname: pg_catalog.pg_largeobject: reloid: 2613 reltblspace:
relname: pg_catalog.pg_largeobject_loid_pn_index: reloid: 2683 reltblspace:
relname: pg_catalog.pg_largeobject_metadata: reloid: 2995 reltblspace:
relname: pg_catalog.pg_largeobject_metadata_oid_index: reloid: 2996 reltblspace:
relname: public.pgbench_branches: reloid: 16386 reltblspace:
relname: public.pgbench_tellers: reloid: 16389 reltblspace:
relname: public.pgbench_accounts: reloid: 16392 reltblspace:
relname: public.pgbench_history: reloid: 16395 reltblspace:
relname: public.pgbench_branches_pkey: reloid: 16399 reltblspace:
relname: public.pgbench_tellers_pkey: reloid: 16401 reltblspace:
relname: public.pgbench_accounts_pkey: reloid: 16403 reltblspace:
Database: postgres
relname: pg_catalog.pg_largeobject: reloid: 2613 reltblspace:
relname: pg_catalog.pg_largeobject_loid_pn_index: reloid: 2683 reltblspace:
relname: pg_catalog.pg_largeobject_metadata: reloid: 2995 reltblspace:
relname: pg_catalog.pg_largeobject_metadata_oid_index: reloid: 2996 reltblspace:
Database: template1
relname: pg_catalog.pg_largeobject: reloid: 2613 reltblspace:
relname: pg_catalog.pg_largeobject_loid_pn_index: reloid: 2683 reltblspace:
relname: pg_catalog.pg_largeobject_metadata: reloid: 2995 reltblspace:
relname: pg_catalog.pg_largeobject_metadata_oid_index: reloid: 2996 reltblspace:
"/usr/local/pg95rc/bin/pg_ctl" -w -D "/usr/local/pg95rc/data/" -o "" stop >> "pg_upgrade_server.log" 2>&1
Copying user relation files
mappings for database "benchmarksql":
pg_catalog.pg_largeobject: 12652 to 2613
pg_catalog.pg_largeobject_loid_pn_index: 12654 to 2683
pg_catalog.pg_largeobject_metadata: 12603 to 2995
pg_catalog.pg_largeobject_metadata_oid_index: 12605 to 2996
public.pgbench_branches: 16386 to 16386
public.pgbench_tellers: 16389 to 16389
public.pgbench_accounts: 16398 to 16392
public.pgbench_history: 16395 to 16395
public.pgbench_branches_pkey: 16399 to 16399
public.pgbench_tellers_pkey: 16401 to 16401
public.pgbench_accounts_pkey: 16403 to 16403
copying "/usr/local/pg91/data/base/16385/12652" to "/usr/local/pg95rc/data/base/16400/2613"
copying "/usr/local/pg91/data/base/16385/12654" to "/usr/local/pg95rc/data/base/16400/2683"
copying "/usr/local/pg91/data/base/16385/12603" to "/usr/local/pg95rc/data/base/16400/2995"
copying "/usr/local/pg91/data/base/16385/12605" to "/usr/local/pg95rc/data/base/16400/2996"
copying "/usr/local/pg91/data/base/16385/16386" to "/usr/local/pg95rc/data/base/16400/16386"
copying "/usr/local/pg91/data/base/16385/16386_fsm" to "/usr/local/pg95rc/data/base/16400/16386_fsm"
copying "/usr/local/pg91/data/base/16385/16389" to "/usr/local/pg95rc/data/base/16400/16389"
copying "/usr/local/pg91/data/base/16385/16389_fsm" to "/usr/local/pg95rc/data/base/16400/16389_fsm"
copying "/usr/local/pg91/data/base/16385/16398" to "/usr/local/pg95rc/data/base/16400/16392"
copying "/usr/local/pg91/data/base/16385/16398.1" to "/usr/local/pg95rc/data/base/16400/16392.1"
copying "/usr/local/pg91/data/base/16385/16398.2" to "/usr/local/pg95rc/data/base/16400/16392.2"
copying "/usr/local/pg91/data/base/16385/16398.3" to "/usr/local/pg95rc/data/base/16400/16392.3"
copying "/usr/local/pg91/data/base/16385/16398.4" to "/usr/local/pg95rc/data/base/16400/16392.4"
copying "/usr/local/pg91/data/base/16385/16398.5" to "/usr/local/pg95rc/data/base/16400/16392.5"
copying "/usr/local/pg91/data/base/16385/16398.6" to "/usr/local/pg95rc/data/base/16400/16392.6"
copying "/usr/local/pg91/data/base/16385/16398.7" to "/usr/local/pg95rc/data/base/16400/16392.7"
copying "/usr/local/pg91/data/base/16385/16398.8" to "/usr/local/pg95rc/data/base/16400/16392.8"
copying "/usr/local/pg91/data/base/16385/16398_fsm" to "/usr/local/pg95rc/data/base/16400/16392_fsm"
copying "/usr/local/pg91/data/base/16385/16395" to "/usr/local/pg95rc/data/base/16400/16395"
copying "/usr/local/pg91/data/base/16385/16399" to "/usr/local/pg95rc/data/base/16400/16399"
copying "/usr/local/pg91/data/base/16385/16401" to "/usr/local/pg95rc/data/base/16400/16401"
copying "/usr/local/pg91/data/base/16385/16403" to "/usr/local/pg95rc/data/base/16400/16403"
copying "/usr/local/pg91/data/base/16385/16403.1" to "/usr/local/pg95rc/data/base/16400/16403.1"
mappings for database "postgres":
pg_catalog.pg_largeobject: 12652 to 2613
pg_catalog.pg_largeobject_loid_pn_index: 12654 to 2683
pg_catalog.pg_largeobject_metadata: 12603 to 2995
pg_catalog.pg_largeobject_metadata_oid_index: 12605 to 2996
copying "/usr/local/pg91/data/base/12780/12652" to "/usr/local/pg95rc/data/base/13241/2613"
copying "/usr/local/pg91/data/base/12780/12654" to "/usr/local/pg95rc/data/base/13241/2683"
copying "/usr/local/pg91/data/base/12780/12603" to "/usr/local/pg95rc/data/base/13241/2995"
copying "/usr/local/pg91/data/base/12780/12605" to "/usr/local/pg95rc/data/base/13241/2996"
mappings for database "template1":
pg_catalog.pg_largeobject: 12652 to 2613
pg_catalog.pg_largeobject_loid_pn_index: 12654 to 2683
pg_catalog.pg_largeobject_metadata: 12603 to 2995
pg_catalog.pg_largeobject_metadata_oid_index: 12605 to 2996
copying "/usr/local/pg91/data/base/1/12652" to "/usr/local/pg95rc/data/base/1/2613"
copying "/usr/local/pg91/data/base/1/12654" to "/usr/local/pg95rc/data/base/1/2683"
copying "/usr/local/pg91/data/base/1/12603" to "/usr/local/pg95rc/data/base/1/2995"
copying "/usr/local/pg91/data/base/1/12605" to "/usr/local/pg95rc/data/base/1/2996"
ok
Setting next OID for new cluster "/usr/local/pg95rc/bin/pg_resetxlog" -o 16405 "/usr/local/pg95rc/data" >> "pg_upgrade_utility.log" 2>&1
ok
Sync data directory to disk "/usr/local/pg95rc/bin/initdb" --sync-only "/usr/local/pg95rc/data" >> "pg_upgrade_utility.log" 2>&1
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
在/user/local/pg95rc/bin目录下生成两个的两个脚本如下:
[pgup@minion1 bin]$ pwd
/usr/local/pg95rc/bin
[pgup@minion1 bin]$ ls
analyze_new_cluster.sh dropdb pg_archivecleanup pg_dump pg_restore pg_xlogdump vacuumlo
clusterdb droplang pg_basebackup pg_dumpall pg_rewind postgres
createdb dropuser pgbench pg_isready pg_standby postmaster
createlang ecpg pg_config pg_receivexlog pg_test_fsync psql
createuser initdb pg_controldata pg_recvlogical pg_test_timing reindexdb
delete_old_cluster.sh oid2name pg_ctl pg_resetxlog pg_upgrade vacuumdb
启动PG9.5rc 并执行analyze_new_cluster.sh
[pgup@minion1 bin]$ ./pg_ctl -D ../data/ start
server starting
[pgup@minion1 bin]$ LOG: redirecting log output to logging collector process
HINT: Future log output will appear in directory "pg_log".
[pgup@minion1 bin]$ ./analyze_new_cluster.sh
This script will generate minimal optimizer statistics rapidly
so your system is usable, and then gather statistics twice more
with increasing accuracy. When it is done, your system will
have the default level of optimizer statistics.
If you have used ALTER TABLE to modify the statistics target for
any tables, you might want to remove them and restore them after
running this script because they will delay fast statistics generation.
If you would like default statistics as quickly as possible, cancel
this script and run:
"/usr/local/pg95rc/bin/vacuumdb" --all --analyze-only
vacuumdb: processing database "benchmarksql": Generating minimal optimizer statistics (1 target)
vacuumdb: processing database "postgres": Generating minimal optimizer statistics (1 target)
vacuumdb: processing database "template1": Generating minimal optimizer statistics (1 target)
vacuumdb: processing database "benchmarksql": Generating medium optimizer statistics (10 targets)
vacuumdb: processing database "postgres": Generating medium optimizer statistics (10 targets)
vacuumdb: processing database "template1": Generating medium optimizer statistics (10 targets)
vacuumdb: processing database "benchmarksql": Generating default (full) optimizer statistics
vacuumdb: processing database "postgres": Generating default (full) optimizer statistics
vacuumdb: processing database "template1": Generating default (full) optimizer statistics
Done
连接PG95rc
[pgup@minion1 bin]$ ./psql -p 5432 -U pgup -d postgres
psql (9.5rc1)
Type "help" for help.
postgres=# \l+
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges | Size | Tablespace |
Description
--------------+--------------+----------+-------------+-------------+-------------------+---------+------------+---------
-----------------------------------
benchmarksql | benchmarksql | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | 10 GB | pg_default |
postgres | pgup | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | 7384 kB | pg_default | default
administrative connection database
template0 | pgup | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/pgup +| 7288 kB | pg_default | unmodifi
able empty database
| | | | | pgup=CTc/pgup | | |
template1 | pgup | UTF8 | en_US.UTF-8 | en_US.UTF-8 | pgup=CTc/pgup +| 7384 kB | pg_default | default
template for new databases
| | | | | =c/pgup | | |
(4 rows)
postgres=# \c benchmarksql
You are now connected to database "benchmarksql" as user "pgup".
benchmarksql=# \d+
List of relations
Schema | Name | Type | Owner | Size | Description
--------+------------------+-------+--------------+---------+-------------
public | pgbench_accounts | table | benchmarksql | 9147 MB |
public | pgbench_branches | table | benchmarksql | 56 kB |
public | pgbench_history | table | benchmarksql | 0 bytes |
public | pgbench_tellers | table | benchmarksql | 336 kB |
(4 rows)
benchmarksql=# select * from pgbench_branches limit 5;
bid | bbalance | filler
-----+----------+--------
1 | 0 |
2 | 0 |
3 | 0 |
4 | 0 |
5 | 0 |
(5 rows)
执行delete_old_cluster.sh脚本
[pgup@minion1 bin]$ pwd
/usr/local/pg95rc/bin
删除PG9.1数据目录
[pgup@minion1 bin]$ ./delete_old_cluster.sh
[pgup@minion1 bin]$ cd /usr/local/pg91/
[pgup@minion1 pg91]$ ls
bin include lib share