Skip to content

Commit 1041f06

Browse files
Update Lab-pg_upgrade.md
1 parent d18f9e0 commit 1041f06

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

Lab-pg_upgrade.md

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,58 +2,63 @@
22

33
## Install pg 9.6 as major
44

5+
```
6+
57
yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
68
yum install -y postgresql96 postgresql96-server postgresql96-contrib wget
79
/usr/pgsql-9.6/bin/postgresql96-setup initdb
810
systemctl start postgresql-9.6
911
systemctl status postgresql-9.6
10-
12+
```
1113

1214
## Create sampledatabase
15+
```
1316
su - postgres
1417
psql
1518
\password
1619
CREATE DATABASE sampledatabase;
1720
\q
18-
21+
```
1922
## instering sample dataset
20-
23+
```
2124
wget https://raw.githubusercontent.com/morenoh149/postgresDBSamples/master/worldDB-1.0/world.sql
2225
psql -d sampledatabase -f world.sql
23-
26+
```
2427
# varify that database was imported
25-
28+
```
2629
psql
2730
\l
2831
\c sampledatabase
2932
\dt
3033
\q
31-
34+
```
3235
## Stop postgresql servers
36+
```
3337
systemctl stop postgresql-9.6
34-
38+
```
3539
## installing version 12
36-
40+
```
3741
yum install -y postgresql12 postgresql12-contrib postgresql12-server
3842
/usr/pgsql-12/bin/postgresql-12-setup initdb
39-
43+
```
4044
## executing pg_upgrade from new version binary
41-
45+
```
4246
/usr/pgsql-12/bin/pg_upgrade --check \
4347
--old-datadir=/var/lib/pgsql/9.6/data \
4448
--new-datadir=/var/lib/pgsql/12/data \
4549
--old-bindir=/usr/pgsql-9.6/bin \
4650
--new-bindir /usr/pgsql-12/bin
47-
51+
```
4852
# run same upgrade without --check option
49-
53+
```
5054
/usr/pgsql-12/bin/pg_upgrade \
5155
--old-datadir=/var/lib/pgsql/9.6/data \
5256
--new-datadir=/var/lib/pgsql/12/data \
5357
--old-bindir=/usr/pgsql-9.6/bin \
5458
--new-bindir /usr/pgsql-12/bin
55-
59+
```
5660
## varify data was inserted into new databse after starting postgresql server
57-
61+
```
5862
systemctl start postgresql-12
59-
systemctl status postgresql-12
63+
systemctl status postgresql-12
64+
```

0 commit comments

Comments
 (0)