~ubuntu-branches/ubuntu/precise/postgresql-9.1/precise-security

« back to all changes in this revision

Viewing changes to doc/src/sgml/html/pgupgrade.html

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2011-05-11 10:41:53 UTC
  • Revision ID: james.westby@ubuntu.com-20110511104153-psbh2o58553fv1m0
Tags: upstream-9.1~beta1
ImportĀ upstreamĀ versionĀ 9.1~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 
2
<HTML
 
3
><HEAD
 
4
><TITLE
 
5
>pg_upgrade</TITLE
 
6
><META
 
7
NAME="GENERATOR"
 
8
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
 
9
REV="MADE"
 
10
HREF="mailto:pgsql-docs@postgresql.org"><LINK
 
11
REL="HOME"
 
12
TITLE="PostgreSQL 9.1beta1 Documentation"
 
13
HREF="index.html"><LINK
 
14
REL="UP"
 
15
TITLE="Additional Supplied Modules"
 
16
HREF="contrib.html"><LINK
 
17
REL="PREVIOUS"
 
18
TITLE="pg_trgm"
 
19
HREF="pgtrgm.html"><LINK
 
20
REL="NEXT"
 
21
TITLE="seg"
 
22
HREF="seg.html"><LINK
 
23
REL="STYLESHEET"
 
24
TYPE="text/css"
 
25
HREF="stylesheet.css"><META
 
26
HTTP-EQUIV="Content-Type"
 
27
CONTENT="text/html; charset=ISO-8859-1"><META
 
28
NAME="creation"
 
29
CONTENT="2011-04-27T21:20:33"></HEAD
 
30
><BODY
 
31
CLASS="SECT1"
 
32
><DIV
 
33
CLASS="NAVHEADER"
 
34
><TABLE
 
35
SUMMARY="Header navigation table"
 
36
WIDTH="100%"
 
37
BORDER="0"
 
38
CELLPADDING="0"
 
39
CELLSPACING="0"
 
40
><TR
 
41
><TH
 
42
COLSPAN="5"
 
43
ALIGN="center"
 
44
VALIGN="bottom"
 
45
><A
 
46
HREF="index.html"
 
47
>PostgreSQL 9.1beta1 Documentation</A
 
48
></TH
 
49
></TR
 
50
><TR
 
51
><TD
 
52
WIDTH="10%"
 
53
ALIGN="left"
 
54
VALIGN="top"
 
55
><A
 
56
TITLE="pg_trgm"
 
57
HREF="pgtrgm.html"
 
58
ACCESSKEY="P"
 
59
>Prev</A
 
60
></TD
 
61
><TD
 
62
WIDTH="10%"
 
63
ALIGN="left"
 
64
VALIGN="top"
 
65
><A
 
66
TITLE="Additional Supplied Modules"
 
67
HREF="contrib.html"
 
68
>Fast Backward</A
 
69
></TD
 
70
><TD
 
71
WIDTH="60%"
 
72
ALIGN="center"
 
73
VALIGN="bottom"
 
74
>Appendix F. Additional Supplied Modules</TD
 
75
><TD
 
76
WIDTH="10%"
 
77
ALIGN="right"
 
78
VALIGN="top"
 
79
><A
 
80
TITLE="Additional Supplied Modules"
 
81
HREF="contrib.html"
 
82
>Fast Forward</A
 
83
></TD
 
84
><TD
 
85
WIDTH="10%"
 
86
ALIGN="right"
 
87
VALIGN="top"
 
88
><A
 
89
TITLE="seg"
 
90
HREF="seg.html"
 
91
ACCESSKEY="N"
 
92
>Next</A
 
93
></TD
 
94
></TR
 
95
></TABLE
 
96
><HR
 
97
ALIGN="LEFT"
 
98
WIDTH="100%"></DIV
 
99
><DIV
 
100
CLASS="SECT1"
 
101
><H1
 
102
CLASS="SECT1"
 
103
><A
 
104
NAME="PGUPGRADE"
 
105
>F.36. pg_upgrade</A
 
106
></H1
 
107
><P
 
108
>  <SPAN
 
109
CLASS="APPLICATION"
 
110
>pg_upgrade</SPAN
 
111
> (formerly called <SPAN
 
112
CLASS="APPLICATION"
 
113
>pg_migrator</SPAN
 
114
>) allows data
 
115
  stored in <SPAN
 
116
CLASS="PRODUCTNAME"
 
117
>PostgreSQL</SPAN
 
118
> data files to be upgraded to a later <SPAN
 
119
CLASS="PRODUCTNAME"
 
120
>PostgreSQL</SPAN
 
121
>
 
122
  major version without the data dump/reload typically required for
 
123
  major version upgrades, e.g. from 8.4.7 to the current major release
 
124
  of <SPAN
 
125
CLASS="PRODUCTNAME"
 
126
>PostgreSQL</SPAN
 
127
>.  It is not required for minor version upgrades, e.g. from
 
128
  9.0.1 to 9.0.4.
 
129
 </P
 
130
><P
 
131
>  Major PostgreSQL releases regularly add new features that often
 
132
  change the layout of the system tables, but the internal data storage
 
133
  format rarely changes.  <SPAN
 
134
CLASS="APPLICATION"
 
135
>pg_upgrade</SPAN
 
136
> uses this fact
 
137
  to perform rapid upgrades by creating new system tables and simply
 
138
  reusing the old user data files.  If a future major release ever
 
139
  changes the data storage format in a way that makes the old data
 
140
  format unreadable, <SPAN
 
141
CLASS="APPLICATION"
 
142
>pg_upgrade</SPAN
 
143
> will not be usable
 
144
  for such upgrades.  (The community will attempt to avoid such
 
145
  situations.)
 
146
 </P
 
147
><P
 
148
>  <SPAN
 
149
CLASS="APPLICATION"
 
150
>pg_upgrade</SPAN
 
151
> does its best to
 
152
  make sure the old and new clusters are binary-compatible, e.g.  by
 
153
  checking for compatible compile-time settings, including 32/64-bit
 
154
  binaries.  It is important that
 
155
  any external modules are also binary compatible, though this cannot
 
156
  be checked by <SPAN
 
157
CLASS="APPLICATION"
 
158
>pg_upgrade</SPAN
 
159
>.
 
160
 </P
 
161
><DIV
 
162
CLASS="SECT2"
 
163
><H2
 
164
CLASS="SECT2"
 
165
><A
 
166
NAME="AEN134198"
 
167
>F.36.1. Supported Versions</A
 
168
></H2
 
169
><P
 
170
>   pg_upgrade supports upgrades from 8.3.X and later to the current
 
171
   major release of <SPAN
 
172
CLASS="PRODUCTNAME"
 
173
>PostgreSQL</SPAN
 
174
>, including snapshot and alpha releases.
 
175
 
 
176
  </P
 
177
></DIV
 
178
><DIV
 
179
CLASS="SECT2"
 
180
><H2
 
181
CLASS="SECT2"
 
182
><A
 
183
NAME="AEN134202"
 
184
>F.36.2. <SPAN
 
185
CLASS="APPLICATION"
 
186
>pg_upgrade</SPAN
 
187
> Options</A
 
188
></H2
 
189
><P
 
190
>    <SPAN
 
191
CLASS="APPLICATION"
 
192
>pg_upgrade</SPAN
 
193
> accepts the following command-line arguments:
 
194
 
 
195
    <P
 
196
></P
 
197
></P><DIV
 
198
CLASS="VARIABLELIST"
 
199
><DL
 
200
><DT
 
201
><TT
 
202
CLASS="OPTION"
 
203
>-b</TT
 
204
> <TT
 
205
CLASS="REPLACEABLE"
 
206
><I
 
207
>old_bindir</I
 
208
></TT
 
209
><BR><TT
 
210
CLASS="OPTION"
 
211
>--old-bindir=</TT
 
212
><TT
 
213
CLASS="REPLACEABLE"
 
214
><I
 
215
>OLDBINDIR</I
 
216
></TT
 
217
></DT
 
218
><DD
 
219
><P
 
220
>specify the old cluster executable directory</P
 
221
></DD
 
222
><DT
 
223
><TT
 
224
CLASS="OPTION"
 
225
>-B</TT
 
226
> <TT
 
227
CLASS="REPLACEABLE"
 
228
><I
 
229
>new_bindir</I
 
230
></TT
 
231
><BR><TT
 
232
CLASS="OPTION"
 
233
>--new-bindir=</TT
 
234
><TT
 
235
CLASS="REPLACEABLE"
 
236
><I
 
237
>NEWBINDIR</I
 
238
></TT
 
239
></DT
 
240
><DD
 
241
><P
 
242
>specify the new cluster executable directory</P
 
243
></DD
 
244
><DT
 
245
><TT
 
246
CLASS="OPTION"
 
247
>-c</TT
 
248
><BR><TT
 
249
CLASS="OPTION"
 
250
>--check</TT
 
251
></DT
 
252
><DD
 
253
><P
 
254
>check clusters only, don't change any data</P
 
255
></DD
 
256
><DT
 
257
><TT
 
258
CLASS="OPTION"
 
259
>-d</TT
 
260
> <TT
 
261
CLASS="REPLACEABLE"
 
262
><I
 
263
>old_datadir</I
 
264
></TT
 
265
><BR><TT
 
266
CLASS="OPTION"
 
267
>--old-datadir=</TT
 
268
><TT
 
269
CLASS="REPLACEABLE"
 
270
><I
 
271
>OLDDATADIR</I
 
272
></TT
 
273
></DT
 
274
><DD
 
275
><P
 
276
>specify the old cluster data directory</P
 
277
></DD
 
278
><DT
 
279
><TT
 
280
CLASS="OPTION"
 
281
>-D</TT
 
282
> <TT
 
283
CLASS="REPLACEABLE"
 
284
><I
 
285
>new_datadir</I
 
286
></TT
 
287
><BR><TT
 
288
CLASS="OPTION"
 
289
>--new-datadir=</TT
 
290
><TT
 
291
CLASS="REPLACEABLE"
 
292
><I
 
293
>NEWDATADIR</I
 
294
></TT
 
295
></DT
 
296
><DD
 
297
><P
 
298
>specify the new cluster data directory</P
 
299
></DD
 
300
><DT
 
301
><TT
 
302
CLASS="OPTION"
 
303
>-g</TT
 
304
><BR><TT
 
305
CLASS="OPTION"
 
306
>--debug</TT
 
307
></DT
 
308
><DD
 
309
><P
 
310
>enable debugging</P
 
311
></DD
 
312
><DT
 
313
><TT
 
314
CLASS="OPTION"
 
315
>-G</TT
 
316
> <TT
 
317
CLASS="REPLACEABLE"
 
318
><I
 
319
>debug_filename</I
 
320
></TT
 
321
><BR><TT
 
322
CLASS="OPTION"
 
323
>--debugfile=</TT
 
324
><TT
 
325
CLASS="REPLACEABLE"
 
326
><I
 
327
>DEBUGFILENAME</I
 
328
></TT
 
329
></DT
 
330
><DD
 
331
><P
 
332
>output debugging activity to file</P
 
333
></DD
 
334
><DT
 
335
><TT
 
336
CLASS="OPTION"
 
337
>-k</TT
 
338
><BR><TT
 
339
CLASS="OPTION"
 
340
>--link</TT
 
341
></DT
 
342
><DD
 
343
><P
 
344
>link instead of copying files to new cluster</P
 
345
></DD
 
346
><DT
 
347
><TT
 
348
CLASS="OPTION"
 
349
>-l</TT
 
350
> <TT
 
351
CLASS="REPLACEABLE"
 
352
><I
 
353
>log_filename</I
 
354
></TT
 
355
><BR><TT
 
356
CLASS="OPTION"
 
357
>--logfile=</TT
 
358
><TT
 
359
CLASS="REPLACEABLE"
 
360
><I
 
361
>LOGFILENAME</I
 
362
></TT
 
363
></DT
 
364
><DD
 
365
><P
 
366
>log session activity to file</P
 
367
></DD
 
368
><DT
 
369
><TT
 
370
CLASS="OPTION"
 
371
>-p</TT
 
372
> <TT
 
373
CLASS="REPLACEABLE"
 
374
><I
 
375
>old_portnum</I
 
376
></TT
 
377
><BR><TT
 
378
CLASS="OPTION"
 
379
>--old-port=</TT
 
380
><TT
 
381
CLASS="REPLACEABLE"
 
382
><I
 
383
>portnum</I
 
384
></TT
 
385
></DT
 
386
><DD
 
387
><P
 
388
>specify the old cluster port number</P
 
389
></DD
 
390
><DT
 
391
><TT
 
392
CLASS="OPTION"
 
393
>-P</TT
 
394
> <TT
 
395
CLASS="REPLACEABLE"
 
396
><I
 
397
>new_portnum</I
 
398
></TT
 
399
><BR><TT
 
400
CLASS="OPTION"
 
401
>--new-port=</TT
 
402
><TT
 
403
CLASS="REPLACEABLE"
 
404
><I
 
405
>portnum</I
 
406
></TT
 
407
></DT
 
408
><DD
 
409
><P
 
410
>specify the new cluster port number</P
 
411
></DD
 
412
><DT
 
413
><TT
 
414
CLASS="OPTION"
 
415
>-u</TT
 
416
> <TT
 
417
CLASS="REPLACEABLE"
 
418
><I
 
419
>username</I
 
420
></TT
 
421
><BR><TT
 
422
CLASS="OPTION"
 
423
>--user=</TT
 
424
><TT
 
425
CLASS="REPLACEABLE"
 
426
><I
 
427
>username</I
 
428
></TT
 
429
></DT
 
430
><DD
 
431
><P
 
432
>clusters superuser</P
 
433
></DD
 
434
><DT
 
435
><TT
 
436
CLASS="OPTION"
 
437
>-v</TT
 
438
><BR><TT
 
439
CLASS="OPTION"
 
440
>--verbose</TT
 
441
></DT
 
442
><DD
 
443
><P
 
444
>enable verbose output</P
 
445
></DD
 
446
><DT
 
447
><TT
 
448
CLASS="OPTION"
 
449
>-V</TT
 
450
><BR><TT
 
451
CLASS="OPTION"
 
452
>--version</TT
 
453
></DT
 
454
><DD
 
455
><P
 
456
>display version information, then exit</P
 
457
></DD
 
458
><DT
 
459
><TT
 
460
CLASS="OPTION"
 
461
>-?</TT
 
462
><BR><TT
 
463
CLASS="OPTION"
 
464
>-h</TT
 
465
><BR><TT
 
466
CLASS="OPTION"
 
467
>--help</TT
 
468
></DT
 
469
><DD
 
470
><P
 
471
>show help, then exit</P
 
472
></DD
 
473
></DL
 
474
></DIV
 
475
><P>
 
476
   </P
 
477
></DIV
 
478
><DIV
 
479
CLASS="SECT2"
 
480
><H2
 
481
CLASS="SECT2"
 
482
><A
 
483
NAME="AEN134333"
 
484
>F.36.3. Upgrade Steps</A
 
485
></H2
 
486
><DIV
 
487
CLASS="PROCEDURE"
 
488
><OL
 
489
TYPE="1"
 
490
><LI
 
491
CLASS="STEP"
 
492
><P
 
493
><B
 
494
>Optionally move the old cluster</B
 
495
></P
 
496
><P
 
497
>     If you are using a version-specific installation directory, e.g.
 
498
     <TT
 
499
CLASS="FILENAME"
 
500
>/opt/PostgreSQL/8.4</TT
 
501
>, you do not need to move the old cluster. The
 
502
     one-click installers all use version-specific installation directories.
 
503
    </P
 
504
><P
 
505
>     If your installation directory is not version-specific, e.g.
 
506
     <TT
 
507
CLASS="FILENAME"
 
508
>/usr/local/pgsql</TT
 
509
>, it is necessary to move the current PostgreSQL install
 
510
     directory so it does not interfere with the new <SPAN
 
511
CLASS="PRODUCTNAME"
 
512
>PostgreSQL</SPAN
 
513
> installation.
 
514
     Once the current <SPAN
 
515
CLASS="PRODUCTNAME"
 
516
>PostgreSQL</SPAN
 
517
> server is shut down, it is safe to rename the
 
518
     PostgreSQL installation directory; assuming the old directory is
 
519
     <TT
 
520
CLASS="FILENAME"
 
521
>/usr/local/pgsql</TT
 
522
>, you can do:
 
523
 
 
524
</P><PRE
 
525
CLASS="PROGRAMLISTING"
 
526
>mv /usr/local/pgsql /usr/local/pgsql.old</PRE
 
527
><P>
 
528
     to rename the directory.
 
529
    </P
 
530
></LI
 
531
><LI
 
532
CLASS="STEP"
 
533
><P
 
534
><B
 
535
>For source installs, build the new version</B
 
536
></P
 
537
><P
 
538
>     Build the new PostgreSQL source with <TT
 
539
CLASS="COMMAND"
 
540
>configure</TT
 
541
> flags that are compatible
 
542
     with the old cluster. <SPAN
 
543
CLASS="APPLICATION"
 
544
>pg_upgrade</SPAN
 
545
> will check <TT
 
546
CLASS="COMMAND"
 
547
>pg_controldata</TT
 
548
> to make
 
549
     sure all settings are compatible before starting the upgrade.
 
550
    </P
 
551
></LI
 
552
><LI
 
553
CLASS="STEP"
 
554
><P
 
555
><B
 
556
>Install the new PostgreSQL binaries</B
 
557
></P
 
558
><P
 
559
>     Install the new server's binaries and support files. You can use the
 
560
     same port numbers for both clusters, typically 5432, because the old and
 
561
     new clusters will not be running at the same time.
 
562
    </P
 
563
><P
 
564
>     For source installs, if you wish to install the new server in a custom
 
565
     location, use the <TT
 
566
CLASS="LITERAL"
 
567
>prefix</TT
 
568
> variable:
 
569
 
 
570
</P><PRE
 
571
CLASS="PROGRAMLISTING"
 
572
>gmake prefix=/usr/local/pgsql.new install</PRE
 
573
><P>
 
574
    </P
 
575
></LI
 
576
><LI
 
577
CLASS="STEP"
 
578
><P
 
579
><B
 
580
>Install pg_upgrade and pg_upgrade_support</B
 
581
></P
 
582
><P
 
583
>     Install the <SPAN
 
584
CLASS="APPLICATION"
 
585
>pg_upgrade</SPAN
 
586
> binary and
 
587
     <SPAN
 
588
CLASS="APPLICATION"
 
589
>pg_upgrade_support</SPAN
 
590
> library in the new PostgreSQL cluster.
 
591
    </P
 
592
></LI
 
593
><LI
 
594
CLASS="STEP"
 
595
><P
 
596
><B
 
597
>Initialize the new PostgreSQL cluster</B
 
598
></P
 
599
><P
 
600
>     Initialize the new cluster using <TT
 
601
CLASS="COMMAND"
 
602
>initdb</TT
 
603
>.
 
604
     Again, use compatible <TT
 
605
CLASS="COMMAND"
 
606
>initdb</TT
 
607
>
 
608
     flags that match the old cluster. Many
 
609
     prebuilt installers do this step automatically. There is no need to
 
610
     start the new cluster.
 
611
    </P
 
612
></LI
 
613
><LI
 
614
CLASS="STEP"
 
615
><P
 
616
><B
 
617
>Install custom shared object files</B
 
618
></P
 
619
><P
 
620
>     Install any custom shared object files (or DLLs) used by the old cluster
 
621
     into the new cluster, e.g. <TT
 
622
CLASS="FILENAME"
 
623
>pgcrypto.so</TT
 
624
>, whether they are from <TT
 
625
CLASS="FILENAME"
 
626
>contrib</TT
 
627
>
 
628
     or some other source. Do not install the schema definitions, e.g.
 
629
     <TT
 
630
CLASS="FILENAME"
 
631
>pgcrypto.sql</TT
 
632
>, because these will be upgraded from the old cluster.
 
633
    </P
 
634
></LI
 
635
><LI
 
636
CLASS="STEP"
 
637
><P
 
638
><B
 
639
>Adjust authentication</B
 
640
></P
 
641
><P
 
642
>     <TT
 
643
CLASS="COMMAND"
 
644
>pg_upgrade</TT
 
645
> will connect to the old and new servers several times,
 
646
     so you might want to set authentication to <TT
 
647
CLASS="LITERAL"
 
648
>trust</TT
 
649
> in
 
650
     <TT
 
651
CLASS="FILENAME"
 
652
>pg_hba.conf</TT
 
653
>, or if using <TT
 
654
CLASS="LITERAL"
 
655
>md5</TT
 
656
> authentication,
 
657
     use a <TT
 
658
CLASS="FILENAME"
 
659
>~/.pgpass</TT
 
660
> file (see <A
 
661
HREF="libpq-pgpass.html"
 
662
>Section 31.14</A
 
663
>)
 
664
     to avoid being prompted repeatedly for a password.
 
665
    </P
 
666
></LI
 
667
><LI
 
668
CLASS="STEP"
 
669
><P
 
670
><B
 
671
>Stop both servers</B
 
672
></P
 
673
><P
 
674
>     Make sure both database servers are stopped using, on Unix, e.g.:
 
675
 
 
676
</P><PRE
 
677
CLASS="PROGRAMLISTING"
 
678
>pg_ctl -D /opt/PostgreSQL/8.4 stop
 
679
pg_ctl -D /opt/PostgreSQL/9.0 stop</PRE
 
680
><P>
 
681
 
 
682
     or on Windows, using the proper service names:
 
683
 
 
684
</P><PRE
 
685
CLASS="PROGRAMLISTING"
 
686
>NET STOP postgresql-8.4
 
687
NET STOP postgresql-9.0</PRE
 
688
><P>
 
689
 
 
690
     or
 
691
 
 
692
</P><PRE
 
693
CLASS="PROGRAMLISTING"
 
694
>NET STOP pgsql-8.3  (<SPAN
 
695
CLASS="PRODUCTNAME"
 
696
>PostgreSQL</SPAN
 
697
> 8.3 and older used a different service name)</PRE
 
698
><P>
 
699
    </P
 
700
></LI
 
701
><LI
 
702
CLASS="STEP"
 
703
><P
 
704
><B
 
705
>Run <SPAN
 
706
CLASS="APPLICATION"
 
707
>pg_upgrade</SPAN
 
708
></B
 
709
></P
 
710
><P
 
711
>     Always run the <SPAN
 
712
CLASS="APPLICATION"
 
713
>pg_upgrade</SPAN
 
714
> binary of the new server, not the old one.
 
715
     <SPAN
 
716
CLASS="APPLICATION"
 
717
>pg_upgrade</SPAN
 
718
> requires the specification of the old and new cluster's
 
719
     data and executable (<TT
 
720
CLASS="FILENAME"
 
721
>bin</TT
 
722
>) directories. You can also specify separate
 
723
     user and port values, and whether you want the data linked instead of
 
724
     copied (the default). If you use linking, the upgrade will be much
 
725
     faster (no data copying), but you will no longer be able to access your
 
726
     old cluster once you start the new cluster after the upgrade. See
 
727
     <TT
 
728
CLASS="LITERAL"
 
729
>pg_upgrade --help</TT
 
730
> for a full list of options.
 
731
    </P
 
732
><P
 
733
>     For Windows users, you must be logged into an administrative account, and
 
734
     then start a shell as the <TT
 
735
CLASS="LITERAL"
 
736
>postgres</TT
 
737
> user and set the proper path:
 
738
 
 
739
</P><PRE
 
740
CLASS="PROGRAMLISTING"
 
741
>RUNAS /USER:postgres "CMD.EXE"
 
742
SET PATH=%PATH%;C:\Program Files\PostgreSQL\9.0\bin;</PRE
 
743
><P>
 
744
 
 
745
     and then run <SPAN
 
746
CLASS="APPLICATION"
 
747
>pg_upgrade</SPAN
 
748
> with quoted directories, e.g.:
 
749
 
 
750
</P><PRE
 
751
CLASS="PROGRAMLISTING"
 
752
>pg_upgrade.exe
 
753
        --old-datadir "C:/Program Files/PostgreSQL/8.4/data"
 
754
        --new-datadir "C:/Program Files/PostgreSQL/9.0/data"
 
755
        --old-bindir "C:/Program Files/PostgreSQL/8.4/bin"
 
756
        --new-bindir "C:/Program Files/PostgreSQL/9.0/bin"</PRE
 
757
><P>
 
758
 
 
759
     Once started, <TT
 
760
CLASS="COMMAND"
 
761
>pg_upgrade</TT
 
762
> will verify the two clusters are compatible
 
763
     and then do the upgrade. You can use <TT
 
764
CLASS="COMMAND"
 
765
>pg_upgrade --check</TT
 
766
>
 
767
     to perform only the checks, even if the old server is still
 
768
     running. <TT
 
769
CLASS="COMMAND"
 
770
>pg_upgrade --check</TT
 
771
> will also outline any
 
772
     manual adjustments you will need to make after the upgrade.
 
773
     <TT
 
774
CLASS="COMMAND"
 
775
>pg_upgrade</TT
 
776
> requires write permission in the current directory.
 
777
    </P
 
778
><P
 
779
>     Obviously, no one should be accessing the clusters during the upgrade.
 
780
    </P
 
781
><P
 
782
>     If an error occurs while restoring the database schema, <TT
 
783
CLASS="COMMAND"
 
784
>pg_upgrade</TT
 
785
> will
 
786
     exit and you will have to revert to the old cluster as outlined in <A
 
787
HREF="pgupgrade.html#PGUPGRADE-STEP-REVERT"
 
788
>step 14</A
 
789
>
 
790
     below. To try <TT
 
791
CLASS="COMMAND"
 
792
>pg_upgrade</TT
 
793
> again, you will need to modify the old
 
794
     cluster so the pg_upgrade schema restore succeeds. If the problem is a
 
795
     contrib module, you might need to uninstall the contrib module from
 
796
     the old cluster and install it in the new cluster after the upgrade,
 
797
     assuming the module is not being used to store user data.
 
798
    </P
 
799
></LI
 
800
><LI
 
801
CLASS="STEP"
 
802
><P
 
803
><B
 
804
>Restore <TT
 
805
CLASS="FILENAME"
 
806
>pg_hba.conf</TT
 
807
></B
 
808
></P
 
809
><P
 
810
>     If you modified <TT
 
811
CLASS="FILENAME"
 
812
>pg_hba.conf</TT
 
813
> to use <TT
 
814
CLASS="LITERAL"
 
815
>trust</TT
 
816
>,
 
817
     restore its original authentication settings.
 
818
    </P
 
819
></LI
 
820
><LI
 
821
CLASS="STEP"
 
822
><P
 
823
><B
 
824
>Post-Upgrade processing</B
 
825
></P
 
826
><P
 
827
>     If any post-upgrade processing is required, pg_upgrade will issue
 
828
     warnings as it completes. It will also generate script files that must
 
829
     be run by the administrator. The script files will connect to each
 
830
     database that needs post-upgrade processing. Each script should be
 
831
     run using:
 
832
 
 
833
</P><PRE
 
834
CLASS="PROGRAMLISTING"
 
835
>psql --username postgres --file script.sql postgres</PRE
 
836
><P>
 
837
 
 
838
     The scripts can be run in any order and can be deleted once they have
 
839
     been run.
 
840
    </P
 
841
><DIV
 
842
CLASS="CAUTION"
 
843
><P
 
844
></P
 
845
><TABLE
 
846
CLASS="CAUTION"
 
847
BORDER="1"
 
848
WIDTH="100%"
 
849
><TR
 
850
><TD
 
851
ALIGN="CENTER"
 
852
><B
 
853
>Caution</B
 
854
></TD
 
855
></TR
 
856
><TR
 
857
><TD
 
858
ALIGN="LEFT"
 
859
><P
 
860
>     In general it is unsafe to access tables referenced in rebuild scripts
 
861
     until the rebuild scripts have run to completion; doing so could yield
 
862
     incorrect results or poor performance. Tables not referenced in rebuild
 
863
     scripts can be accessed immediately.
 
864
    </P
 
865
></TD
 
866
></TR
 
867
></TABLE
 
868
></DIV
 
869
></LI
 
870
><LI
 
871
CLASS="STEP"
 
872
><P
 
873
><B
 
874
>Statistics</B
 
875
></P
 
876
><P
 
877
>     Because optimizer statistics are not transferred by <TT
 
878
CLASS="COMMAND"
 
879
>pg_upgrade</TT
 
880
>, you will
 
881
     be instructed to run a command to regenerate that information at the end
 
882
     of the upgrade.
 
883
    </P
 
884
></LI
 
885
><LI
 
886
CLASS="STEP"
 
887
><P
 
888
><B
 
889
>Delete old cluster</B
 
890
></P
 
891
><P
 
892
>     Once you are satisfied with the upgrade, you can delete the old
 
893
     cluster's data directories by running the script mentioned when
 
894
     <TT
 
895
CLASS="COMMAND"
 
896
>pg_upgrade</TT
 
897
> completes. You can also delete the
 
898
     old installation directories
 
899
     (e.g. <TT
 
900
CLASS="FILENAME"
 
901
>bin</TT
 
902
>, <TT
 
903
CLASS="FILENAME"
 
904
>share</TT
 
905
>).
 
906
    </P
 
907
></LI
 
908
><LI
 
909
CLASS="STEP"
 
910
><A
 
911
NAME="PGUPGRADE-STEP-REVERT"
 
912
></A
 
913
><P
 
914
><B
 
915
>Reverting to old cluster</B
 
916
></P
 
917
><P
 
918
>     If, after running <TT
 
919
CLASS="COMMAND"
 
920
>pg_upgrade</TT
 
921
>, you wish to revert to the old cluster,
 
922
     there are several options:
 
923
 
 
924
     <P
 
925
></P
 
926
></P><UL
 
927
><LI
 
928
><P
 
929
>        If you ran <TT
 
930
CLASS="COMMAND"
 
931
>pg_upgrade</TT
 
932
>
 
933
        with <TT
 
934
CLASS="OPTION"
 
935
>--check</TT
 
936
>, no modifications were made to the old
 
937
        cluster and you can re-use it anytime.
 
938
       </P
 
939
></LI
 
940
><LI
 
941
><P
 
942
>        If you ran <TT
 
943
CLASS="COMMAND"
 
944
>pg_upgrade</TT
 
945
>
 
946
        with <TT
 
947
CLASS="OPTION"
 
948
>--link</TT
 
949
>, the data files are shared between the
 
950
        old and new cluster. If you started the new cluster, the new
 
951
        server has written to those shared files and it is unsafe to
 
952
        use the old cluster.
 
953
       </P
 
954
></LI
 
955
><LI
 
956
><P
 
957
>        If you
 
958
        ran <TT
 
959
CLASS="COMMAND"
 
960
>pg_upgrade</TT
 
961
> <SPAN
 
962
CLASS="emphasis"
 
963
><I
 
964
CLASS="EMPHASIS"
 
965
>without</I
 
966
></SPAN
 
967
> <TT
 
968
CLASS="OPTION"
 
969
>--link</TT
 
970
>
 
971
        or did not start the new server, the old cluster was not
 
972
        modified except that an <TT
 
973
CLASS="LITERAL"
 
974
>.old</TT
 
975
> suffix was appended
 
976
        to <TT
 
977
CLASS="FILENAME"
 
978
>$PGDATA/global/pg_control</TT
 
979
> and perhaps
 
980
        tablespace directories. To reuse the old cluster, remove
 
981
        the <TT
 
982
CLASS="FILENAME"
 
983
>.old</TT
 
984
> suffix
 
985
        from <TT
 
986
CLASS="FILENAME"
 
987
>$PGDATA/global/pg_control</TT
 
988
>. and, if upgrading
 
989
        to 8.4 or earlier, remove the tablespace directories created
 
990
        by the upgrade and remove the <TT
 
991
CLASS="FILENAME"
 
992
>.old</TT
 
993
> suffix from
 
994
        the tablespace directory names; then you can restart the old
 
995
        cluster.
 
996
       </P
 
997
></LI
 
998
></UL
 
999
><P>
 
1000
    </P
 
1001
></LI
 
1002
></OL
 
1003
></DIV
 
1004
></DIV
 
1005
><DIV
 
1006
CLASS="SECT2"
 
1007
><H2
 
1008
CLASS="SECT2"
 
1009
><A
 
1010
NAME="AEN134457"
 
1011
>F.36.4. Limitations in Upgrading <SPAN
 
1012
CLASS="emphasis"
 
1013
><I
 
1014
CLASS="EMPHASIS"
 
1015
>from</I
 
1016
></SPAN
 
1017
> PostgreSQL 8.3</A
 
1018
></H2
 
1019
><P
 
1020
>   Upgrading from PostgreSQL 8.3 has additional restrictions not present
 
1021
   when upgrading from later PostgreSQL releases.  For example,
 
1022
   pg_upgrade will not work for upgrading from 8.3 if a user column
 
1023
   is defined as:
 
1024
   <P
 
1025
></P
 
1026
></P><UL
 
1027
><LI
 
1028
><P
 
1029
>      a <TT
 
1030
CLASS="TYPE"
 
1031
>tsquery</TT
 
1032
> data type
 
1033
     </P
 
1034
></LI
 
1035
><LI
 
1036
><P
 
1037
>      data type <TT
 
1038
CLASS="TYPE"
 
1039
>name</TT
 
1040
> and is not the first column
 
1041
     </P
 
1042
></LI
 
1043
></UL
 
1044
><P>
 
1045
  </P
 
1046
><P
 
1047
>   You must drop any such columns and upgrade them manually.
 
1048
  </P
 
1049
><P
 
1050
>   pg_upgrade will require a table rebuild if:
 
1051
   <P
 
1052
></P
 
1053
></P><UL
 
1054
><LI
 
1055
><P
 
1056
>      a user column is of data type <TT
 
1057
CLASS="TYPE"
 
1058
>tsvector</TT
 
1059
>
 
1060
     </P
 
1061
></LI
 
1062
></UL
 
1063
><P>
 
1064
  </P
 
1065
><P
 
1066
>   pg_upgrade will require a reindex if:
 
1067
   <P
 
1068
></P
 
1069
></P><UL
 
1070
><LI
 
1071
><P
 
1072
>      an index is of type hash or GIN
 
1073
     </P
 
1074
></LI
 
1075
><LI
 
1076
><P
 
1077
>      an index uses <CODE
 
1078
CLASS="FUNCTION"
 
1079
>bpchar_pattern_ops</CODE
 
1080
>
 
1081
     </P
 
1082
></LI
 
1083
></UL
 
1084
><P>
 
1085
  </P
 
1086
><P
 
1087
>   Also, the default datetime storage format changed to integer after
 
1088
   <SPAN
 
1089
CLASS="PRODUCTNAME"
 
1090
>PostgreSQL</SPAN
 
1091
> 8.3. pg_upgrade will check that the datetime storage format
 
1092
   used by the old and new clusters match. Make sure your new cluster is
 
1093
   built with the configure flag <TT
 
1094
CLASS="OPTION"
 
1095
>--disable-integer-datetimes</TT
 
1096
>.
 
1097
  </P
 
1098
><P
 
1099
>   For Windows users, note that due to different integer datetimes settings
 
1100
   used by the one-click installer and the MSI installer, it is only
 
1101
   possible to upgrade from version 8.3 of the one-click distribution to
 
1102
   version 8.4 or later of the one-click distribution. It is not
 
1103
   possible to upgrade from the MSI installer to the one-click installer.
 
1104
  </P
 
1105
></DIV
 
1106
><DIV
 
1107
CLASS="SECT2"
 
1108
><H2
 
1109
CLASS="SECT2"
 
1110
><A
 
1111
NAME="AEN134485"
 
1112
>F.36.5. Notes</A
 
1113
></H2
 
1114
><P
 
1115
>   <SPAN
 
1116
CLASS="APPLICATION"
 
1117
>pg_upgrade</SPAN
 
1118
> does not support upgrading of databases
 
1119
   containing these <TT
 
1120
CLASS="TYPE"
 
1121
>reg*</TT
 
1122
> OID-referencing system data types:
 
1123
   <TT
 
1124
CLASS="TYPE"
 
1125
>regproc</TT
 
1126
>, <TT
 
1127
CLASS="TYPE"
 
1128
>regprocedure</TT
 
1129
>, <TT
 
1130
CLASS="TYPE"
 
1131
>regoper</TT
 
1132
>,
 
1133
   <TT
 
1134
CLASS="TYPE"
 
1135
>regoperator</TT
 
1136
>, <TT
 
1137
CLASS="TYPE"
 
1138
>regclass</TT
 
1139
>, <TT
 
1140
CLASS="TYPE"
 
1141
>regconfig</TT
 
1142
>, and
 
1143
   <TT
 
1144
CLASS="TYPE"
 
1145
>regdictionary</TT
 
1146
>.  (<TT
 
1147
CLASS="TYPE"
 
1148
>regtype</TT
 
1149
> can be upgraded.)
 
1150
  </P
 
1151
><P
 
1152
>   All failure, rebuild, and reindex cases will be reported by
 
1153
   <SPAN
 
1154
CLASS="APPLICATION"
 
1155
>pg_upgrade</SPAN
 
1156
> if they affect your installation;
 
1157
   post-upgrade scripts to rebuild tables and indexes will be
 
1158
   generated automatically.
 
1159
  </P
 
1160
><P
 
1161
>   For deployment testing, create a schema-only copy of the old cluster,
 
1162
   insert dummy data, and upgrade that.
 
1163
  </P
 
1164
><P
 
1165
>   If you want to use link mode and you don't want your old cluster
 
1166
   to be modified when the new cluster is started, make a copy of the
 
1167
   old cluster and upgrade that with link mode. To make a valid copy
 
1168
   of the old cluster, use <TT
 
1169
CLASS="COMMAND"
 
1170
>rsync</TT
 
1171
> to create a dirty
 
1172
   copy of the old cluster while the server is running, then shut down
 
1173
   the old server and run <TT
 
1174
CLASS="COMMAND"
 
1175
>rsync</TT
 
1176
> again to update the copy with any
 
1177
   changes to make it consistent.
 
1178
  </P
 
1179
></DIV
 
1180
></DIV
 
1181
><DIV
 
1182
CLASS="NAVFOOTER"
 
1183
><HR
 
1184
ALIGN="LEFT"
 
1185
WIDTH="100%"><TABLE
 
1186
SUMMARY="Footer navigation table"
 
1187
WIDTH="100%"
 
1188
BORDER="0"
 
1189
CELLPADDING="0"
 
1190
CELLSPACING="0"
 
1191
><TR
 
1192
><TD
 
1193
WIDTH="33%"
 
1194
ALIGN="left"
 
1195
VALIGN="top"
 
1196
><A
 
1197
HREF="pgtrgm.html"
 
1198
ACCESSKEY="P"
 
1199
>Prev</A
 
1200
></TD
 
1201
><TD
 
1202
WIDTH="34%"
 
1203
ALIGN="center"
 
1204
VALIGN="top"
 
1205
><A
 
1206
HREF="index.html"
 
1207
ACCESSKEY="H"
 
1208
>Home</A
 
1209
></TD
 
1210
><TD
 
1211
WIDTH="33%"
 
1212
ALIGN="right"
 
1213
VALIGN="top"
 
1214
><A
 
1215
HREF="seg.html"
 
1216
ACCESSKEY="N"
 
1217
>Next</A
 
1218
></TD
 
1219
></TR
 
1220
><TR
 
1221
><TD
 
1222
WIDTH="33%"
 
1223
ALIGN="left"
 
1224
VALIGN="top"
 
1225
>pg_trgm</TD
 
1226
><TD
 
1227
WIDTH="34%"
 
1228
ALIGN="center"
 
1229
VALIGN="top"
 
1230
><A
 
1231
HREF="contrib.html"
 
1232
ACCESSKEY="U"
 
1233
>Up</A
 
1234
></TD
 
1235
><TD
 
1236
WIDTH="33%"
 
1237
ALIGN="right"
 
1238
VALIGN="top"
 
1239
>seg</TD
 
1240
></TR
 
1241
></TABLE
 
1242
></DIV
 
1243
></BODY
 
1244
></HTML
 
1245
>
 
 
b'\\ No newline at end of file'