403Webshell
Server IP : 103.119.228.120  /  Your IP : 3.145.109.244
Web Server : Apache
System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64
User : nobody ( 99)
PHP Version : 5.6.40
Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime
MySQL : ON |  cURL : ON |  WGET : ON |  Perl : ON |  Python : ON |  Sudo : ON |  Pkexec : ON
Directory :  /usr/local/ssl/local/ssl/share/doc/postgresql-9.2.24/html/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /usr/local/ssl/local/ssl/share/doc/postgresql-9.2.24/html/pgupgrade.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>pg_upgrade</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REV="MADE"
HREF="mailto:pgsql-docs@postgresql.org"><LINK
REL="HOME"
TITLE="PostgreSQL 9.2.24 Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="Server Applications"
HREF="contrib-prog-server.html"><LINK
REL="PREVIOUS"
TITLE="pg_test_timing"
HREF="pgtesttiming.html"><LINK
REL="NEXT"
TITLE="External Projects"
HREF="external-projects.html"><LINK
REL="STYLESHEET"
TYPE="text/css"
HREF="stylesheet.css"><META
HTTP-EQUIV="Content-Type"
CONTENT="text/html; charset=ISO-8859-1"><META
NAME="creation"
CONTENT="2017-11-06T22:43:11"></HEAD
><BODY
CLASS="REFENTRY"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="5"
ALIGN="center"
VALIGN="bottom"
><A
HREF="index.html"
>PostgreSQL 9.2.24 Documentation</A
></TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="top"
><A
TITLE="pg_test_timing"
HREF="pgtesttiming.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="top"
><A
HREF="contrib-prog-server.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="60%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="20%"
ALIGN="right"
VALIGN="top"
><A
TITLE="External Projects"
HREF="external-projects.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="PGUPGRADE"
></A
><SPAN
CLASS="APPLICATION"
>pg_upgrade</SPAN
></H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN154320"
></A
><H2
>Name</H2
>pg_upgrade&nbsp;--&nbsp;upgrade a <SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
> server instance</DIV
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN154326"
></A
><H2
>Synopsis</H2
><P
><TT
CLASS="COMMAND"
>pg_upgrade</TT
>  <TT
CLASS="OPTION"
>-b</TT
>   <TT
CLASS="REPLACEABLE"
><I
>oldbindir</I
></TT
>   <TT
CLASS="OPTION"
>-B</TT
>   <TT
CLASS="REPLACEABLE"
><I
>newbindir</I
></TT
>   <TT
CLASS="OPTION"
>-d</TT
>   <TT
CLASS="REPLACEABLE"
><I
>olddatadir</I
></TT
>   <TT
CLASS="OPTION"
>-D</TT
>   <TT
CLASS="REPLACEABLE"
><I
>newdatadir</I
></TT
>  [<TT
CLASS="REPLACEABLE"
><I
>option</I
></TT
>...]</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN154347"
></A
><H2
>Description</H2
><P
>  <SPAN
CLASS="APPLICATION"
>pg_upgrade</SPAN
> (formerly called <SPAN
CLASS="APPLICATION"
>pg_migrator</SPAN
>) allows data
  stored in <SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
> data files to be upgraded to a later <SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
>
  major version without the data dump/reload typically required for
  major version upgrades, e.g. from 8.4.7 to the current major release
  of <SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
>.  It is not required for minor version upgrades, e.g. from
  9.0.1 to 9.0.4.
 </P
><P
>  Major PostgreSQL releases regularly add new features that often
  change the layout of the system tables, but the internal data storage
  format rarely changes.  <SPAN
CLASS="APPLICATION"
>pg_upgrade</SPAN
> uses this fact
  to perform rapid upgrades by creating new system tables and simply
  reusing the old user data files.  If a future major release ever
  changes the data storage format in a way that makes the old data
  format unreadable, <SPAN
CLASS="APPLICATION"
>pg_upgrade</SPAN
> will not be usable
  for such upgrades.  (The community will attempt to avoid such
  situations.)
 </P
><P
>  <SPAN
CLASS="APPLICATION"
>pg_upgrade</SPAN
> does its best to
  make sure the old and new clusters are binary-compatible, e.g.  by
  checking for compatible compile-time settings, including 32/64-bit
  binaries.  It is important that
  any external modules are also binary compatible, though this cannot
  be checked by <SPAN
CLASS="APPLICATION"
>pg_upgrade</SPAN
>.
 </P
><P
>   pg_upgrade supports upgrades from 8.3.X and later to the current
   major release of <SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
>, including snapshot and alpha releases.
  </P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN154363"
></A
><H2
>Options</H2
><P
>    <SPAN
CLASS="APPLICATION"
>pg_upgrade</SPAN
> accepts the following command-line arguments:

    <P
></P
></P><DIV
CLASS="VARIABLELIST"
><DL
><DT
><TT
CLASS="OPTION"
>-b</TT
> <TT
CLASS="REPLACEABLE"
><I
>old_bindir</I
></TT
><BR><TT
CLASS="OPTION"
>--old-bindir=</TT
><TT
CLASS="REPLACEABLE"
><I
>old_bindir</I
></TT
></DT
><DD
><P
>the old cluster executable directory;
      environment variable <TT
CLASS="ENVAR"
>PGBINOLD</TT
></P
></DD
><DT
><TT
CLASS="OPTION"
>-B</TT
> <TT
CLASS="REPLACEABLE"
><I
>new_bindir</I
></TT
><BR><TT
CLASS="OPTION"
>--new-bindir=</TT
><TT
CLASS="REPLACEABLE"
><I
>new_bindir</I
></TT
></DT
><DD
><P
>the new cluster executable directory;
      environment variable <TT
CLASS="ENVAR"
>PGBINNEW</TT
></P
></DD
><DT
><TT
CLASS="OPTION"
>-c</TT
><BR><TT
CLASS="OPTION"
>--check</TT
></DT
><DD
><P
>check clusters only, don't change any data</P
></DD
><DT
><TT
CLASS="OPTION"
>-d</TT
> <TT
CLASS="REPLACEABLE"
><I
>old_datadir</I
></TT
><BR><TT
CLASS="OPTION"
>--old-datadir=</TT
><TT
CLASS="REPLACEABLE"
><I
>old_datadir</I
></TT
></DT
><DD
><P
>the old cluster data directory; environment
      variable <TT
CLASS="ENVAR"
>PGDATAOLD</TT
></P
></DD
><DT
><TT
CLASS="OPTION"
>-D</TT
> <TT
CLASS="REPLACEABLE"
><I
>new_datadir</I
></TT
><BR><TT
CLASS="OPTION"
>--new-datadir=</TT
><TT
CLASS="REPLACEABLE"
><I
>new_datadir</I
></TT
></DT
><DD
><P
>the new cluster data directory; environment
      variable <TT
CLASS="ENVAR"
>PGDATANEW</TT
></P
></DD
><DT
><TT
CLASS="OPTION"
>-k</TT
><BR><TT
CLASS="OPTION"
>--link</TT
></DT
><DD
><P
>use hard links instead of copying files to the new cluster</P
></DD
><DT
><TT
CLASS="OPTION"
>-o</TT
> <TT
CLASS="REPLACEABLE"
><I
>options</I
></TT
><BR><TT
CLASS="OPTION"
>--old-options</TT
> <TT
CLASS="REPLACEABLE"
><I
>options</I
></TT
></DT
><DD
><P
>options to be passed directly to the
      old <TT
CLASS="COMMAND"
>postgres</TT
> command</P
></DD
><DT
><TT
CLASS="OPTION"
>-O</TT
> <TT
CLASS="REPLACEABLE"
><I
>options</I
></TT
><BR><TT
CLASS="OPTION"
>--new-options</TT
> <TT
CLASS="REPLACEABLE"
><I
>options</I
></TT
></DT
><DD
><P
>options to be passed directly to the
      new <TT
CLASS="COMMAND"
>postgres</TT
> command</P
></DD
><DT
><TT
CLASS="OPTION"
>-p</TT
> <TT
CLASS="REPLACEABLE"
><I
>old_port_number</I
></TT
><BR><TT
CLASS="OPTION"
>--old-port=</TT
><TT
CLASS="REPLACEABLE"
><I
>old_portnum</I
></TT
></DT
><DD
><P
>the old cluster port number; environment
      variable <TT
CLASS="ENVAR"
>PGPORTOLD</TT
></P
></DD
><DT
><TT
CLASS="OPTION"
>-P</TT
> <TT
CLASS="REPLACEABLE"
><I
>new_port_number</I
></TT
><BR><TT
CLASS="OPTION"
>--new-port=</TT
><TT
CLASS="REPLACEABLE"
><I
>new_portnum</I
></TT
></DT
><DD
><P
>the new cluster port number; environment
      variable <TT
CLASS="ENVAR"
>PGPORTNEW</TT
></P
></DD
><DT
><TT
CLASS="OPTION"
>-r</TT
><BR><TT
CLASS="OPTION"
>--retain</TT
></DT
><DD
><P
>retain SQL and log files even after successful completion
      </P
></DD
><DT
><TT
CLASS="OPTION"
>-u</TT
> <TT
CLASS="REPLACEABLE"
><I
>user_name</I
></TT
><BR><TT
CLASS="OPTION"
>--user=</TT
><TT
CLASS="REPLACEABLE"
><I
>user_name</I
></TT
></DT
><DD
><P
>cluster's super user name; environment
      variable <TT
CLASS="ENVAR"
>PGUSER</TT
></P
></DD
><DT
><TT
CLASS="OPTION"
>-v</TT
><BR><TT
CLASS="OPTION"
>--verbose</TT
></DT
><DD
><P
>enable verbose internal logging</P
></DD
><DT
><TT
CLASS="OPTION"
>-V</TT
><BR><TT
CLASS="OPTION"
>--version</TT
></DT
><DD
><P
>display version information, then exit</P
></DD
><DT
><TT
CLASS="OPTION"
>-?</TT
><BR><TT
CLASS="OPTION"
>-h</TT
><BR><TT
CLASS="OPTION"
>--help</TT
></DT
><DD
><P
>show help, then exit</P
></DD
></DL
></DIV
><P>
   </P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN154502"
></A
><H2
>Usage</H2
><P
>   These are the steps to perform an upgrade
   with <SPAN
CLASS="APPLICATION"
>pg_upgrade</SPAN
>:
  </P
><DIV
CLASS="PROCEDURE"
><OL
TYPE="1"
><LI
CLASS="STEP"
><P
><B
>Optionally move the old cluster</B
></P
><P
>     If you are using a version-specific installation directory, e.g.
     <TT
CLASS="FILENAME"
>/opt/PostgreSQL/9.1</TT
>, you do not need to move the old cluster. The
     graphical installers all use version-specific installation directories.
    </P
><P
>     If your installation directory is not version-specific, e.g.
     <TT
CLASS="FILENAME"
>/usr/local/pgsql</TT
>, it is necessary to move the current PostgreSQL install
     directory so it does not interfere with the new <SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
> installation.
     Once the current <SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
> server is shut down, it is safe to rename the
     PostgreSQL installation directory; assuming the old directory is
     <TT
CLASS="FILENAME"
>/usr/local/pgsql</TT
>, you can do:

</P><PRE
CLASS="PROGRAMLISTING"
>mv /usr/local/pgsql /usr/local/pgsql.old</PRE
><P>
     to rename the directory.
    </P
></LI
><LI
CLASS="STEP"
><P
><B
>For source installs, build the new version</B
></P
><P
>     Build the new PostgreSQL source with <TT
CLASS="COMMAND"
>configure</TT
> flags that are compatible
     with the old cluster. <SPAN
CLASS="APPLICATION"
>pg_upgrade</SPAN
> will check <TT
CLASS="COMMAND"
>pg_controldata</TT
> to make
     sure all settings are compatible before starting the upgrade.
    </P
></LI
><LI
CLASS="STEP"
><P
><B
>Install the new PostgreSQL binaries</B
></P
><P
>     Install the new server's binaries and support files.
    </P
><P
>     For source installs, if you wish to install the new server in a custom
     location, use the <TT
CLASS="LITERAL"
>prefix</TT
> variable:

</P><PRE
CLASS="PROGRAMLISTING"
>gmake prefix=/usr/local/pgsql.new install</PRE
><P></P
></LI
><LI
CLASS="STEP"
><P
><B
>Install pg_upgrade and pg_upgrade_support</B
></P
><P
>     Install the <SPAN
CLASS="APPLICATION"
>pg_upgrade</SPAN
> binary and
     <SPAN
CLASS="APPLICATION"
>pg_upgrade_support</SPAN
> library in the new PostgreSQL cluster.
    </P
></LI
><LI
CLASS="STEP"
><P
><B
>Initialize the new PostgreSQL cluster</B
></P
><P
>     Initialize the new cluster using <TT
CLASS="COMMAND"
>initdb</TT
>.
     Again, use compatible <TT
CLASS="COMMAND"
>initdb</TT
>
     flags that match the old cluster. Many
     prebuilt installers do this step automatically. There is no need to
     start the new cluster.
    </P
></LI
><LI
CLASS="STEP"
><P
><B
>Install custom shared object files</B
></P
><P
>     Install any custom shared object files (or DLLs) used by the old cluster
     into the new cluster, e.g. <TT
CLASS="FILENAME"
>pgcrypto.so</TT
>,
     whether they are from <TT
CLASS="FILENAME"
>contrib</TT
>
     or some other source. Do not install the schema definitions, e.g.
     <TT
CLASS="FILENAME"
>pgcrypto.sql</TT
>, because these will be upgraded from the old cluster.
    </P
></LI
><LI
CLASS="STEP"
><P
><B
>Adjust authentication</B
></P
><P
>     <TT
CLASS="COMMAND"
>pg_upgrade</TT
> will connect to the old and new servers several
     times, so you might want to set authentication to <TT
CLASS="LITERAL"
>peer</TT
>
     in <TT
CLASS="FILENAME"
>pg_hba.conf</TT
> or use a <TT
CLASS="FILENAME"
>~/.pgpass</TT
> file
     (see <A
HREF="libpq-pgpass.html"
>Section 31.15</A
>).
    </P
></LI
><LI
CLASS="STEP"
><P
><B
>Stop both servers</B
></P
><P
>     Make sure both database servers are stopped using, on Unix, e.g.:

</P><PRE
CLASS="PROGRAMLISTING"
>pg_ctl -D /opt/PostgreSQL/8.4 stop
pg_ctl -D /opt/PostgreSQL/9.0 stop</PRE
><P>

     or on Windows, using the proper service names:

</P><PRE
CLASS="PROGRAMLISTING"
>NET STOP postgresql-8.4
NET STOP postgresql-9.0</PRE
><P>

     or

</P><PRE
CLASS="PROGRAMLISTING"
>NET STOP pgsql-8.3  (<SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
> 8.3 and older used a different service name)</PRE
><P></P
></LI
><LI
CLASS="STEP"
><P
><B
>Run <SPAN
CLASS="APPLICATION"
>pg_upgrade</SPAN
></B
></P
><P
>     Always run the <SPAN
CLASS="APPLICATION"
>pg_upgrade</SPAN
> binary of the new server, not the old one.
     <SPAN
CLASS="APPLICATION"
>pg_upgrade</SPAN
> requires the specification of the old and new cluster's
     data and executable (<TT
CLASS="FILENAME"
>bin</TT
>) directories. You can also specify
     user and port values, and whether you want the data linked instead of
     copied (the default).
    </P
><P
>     If you use link mode, the upgrade will be much faster (no file
     copying), but you will not be able to access your old cluster
     once you start the new cluster after the upgrade.  Link mode also
     requires that the old and new cluster data directories be in the
     same file system.  See <TT
CLASS="LITERAL"
>pg_upgrade --help</TT
> for a full
     list of options.
   </P
><P
>   </P
><P
>     For Windows users, you must be logged into an administrative account, and
     then start a shell as the <TT
CLASS="LITERAL"
>postgres</TT
> user and set the proper path:

</P><PRE
CLASS="PROGRAMLISTING"
>RUNAS /USER:postgres "CMD.EXE"
SET PATH=%PATH%;C:\Program Files\PostgreSQL\9.0\bin;</PRE
><P>

     and then run <SPAN
CLASS="APPLICATION"
>pg_upgrade</SPAN
> with quoted directories, e.g.:

</P><PRE
CLASS="PROGRAMLISTING"
>pg_upgrade.exe
        --old-datadir "C:/Program Files/PostgreSQL/8.4/data"
        --new-datadir "C:/Program Files/PostgreSQL/9.0/data"
        --old-bindir "C:/Program Files/PostgreSQL/8.4/bin"
        --new-bindir "C:/Program Files/PostgreSQL/9.0/bin"</PRE
><P>

     Once started, <TT
CLASS="COMMAND"
>pg_upgrade</TT
> will verify the two clusters are compatible
     and then do the upgrade. You can use <TT
CLASS="COMMAND"
>pg_upgrade --check</TT
>
     to perform only the checks, even if the old server is still
     running. <TT
CLASS="COMMAND"
>pg_upgrade --check</TT
> will also outline any
     manual adjustments you will need to make after the upgrade.  If you
     are going to be using link mode, you should use the <TT
CLASS="OPTION"
>--link</TT
>
     option with <TT
CLASS="OPTION"
>--check</TT
> to enable link-mode-specific checks.
     <TT
CLASS="COMMAND"
>pg_upgrade</TT
> requires write permission in the current directory.
    </P
><P
>     Obviously, no one should be accessing the clusters during the
     upgrade.  <SPAN
CLASS="APPLICATION"
>pg_upgrade</SPAN
> defaults to running servers
     on port 50432 to avoid unintended client connections.
     You can use the same port number for both clusters when doing an
     upgrade because the old and new clusters will not be running at the
     same time.  However, when checking an old running server, the old
     and new port numbers must be different.
    </P
><P
>     If an error occurs while restoring the database schema, <TT
CLASS="COMMAND"
>pg_upgrade</TT
> will
     exit and you will have to revert to the old cluster as outlined in <A
HREF="pgupgrade.html#PGUPGRADE-STEP-REVERT"
>step 14</A
>
     below. To try <TT
CLASS="COMMAND"
>pg_upgrade</TT
> again, you will need to modify the old
     cluster so the pg_upgrade schema restore succeeds. If the problem is a
     contrib module, you might need to uninstall the contrib module from
     the old cluster and install it in the new cluster after the upgrade,
     assuming the module is not being used to store user data.
    </P
></LI
><LI
CLASS="STEP"
><P
><B
>Restore <TT
CLASS="FILENAME"
>pg_hba.conf</TT
></B
></P
><P
>     If you modified <TT
CLASS="FILENAME"
>pg_hba.conf</TT
>, restore its original settings.
     It might also be necessary to adjust other configuration files in the new
     cluster to match the old cluster, e.g. <TT
CLASS="FILENAME"
>postgresql.conf</TT
>.
    </P
></LI
><LI
CLASS="STEP"
><P
><B
>Post-Upgrade processing</B
></P
><P
>     If any post-upgrade processing is required, pg_upgrade will issue
     warnings as it completes. It will also generate script files that must
     be run by the administrator. The script files will connect to each
     database that needs post-upgrade processing. Each script should be
     run using:

</P><PRE
CLASS="PROGRAMLISTING"
>psql --username postgres --file script.sql postgres</PRE
><P>

     The scripts can be run in any order and can be deleted once they have
     been run.
    </P
><DIV
CLASS="CAUTION"
><P
></P
><TABLE
CLASS="CAUTION"
BORDER="1"
WIDTH="100%"
><TR
><TD
ALIGN="CENTER"
><B
>Caution</B
></TD
></TR
><TR
><TD
ALIGN="LEFT"
><P
>     In general it is unsafe to access tables referenced in rebuild scripts
     until the rebuild scripts have run to completion; doing so could yield
     incorrect results or poor performance. Tables not referenced in rebuild
     scripts can be accessed immediately.
    </P
></TD
></TR
></TABLE
></DIV
></LI
><LI
CLASS="STEP"
><P
><B
>Statistics</B
></P
><P
>     Because optimizer statistics are not transferred by <TT
CLASS="COMMAND"
>pg_upgrade</TT
>, you will
     be instructed to run a command to regenerate that information at the end
     of the upgrade.
    </P
></LI
><LI
CLASS="STEP"
><P
><B
>Delete old cluster</B
></P
><P
>     Once you are satisfied with the upgrade, you can delete the old
     cluster's data directories by running the script mentioned when
     <TT
CLASS="COMMAND"
>pg_upgrade</TT
> completes. You can also delete the
     old installation directories
     (e.g. <TT
CLASS="FILENAME"
>bin</TT
>, <TT
CLASS="FILENAME"
>share</TT
>).
    </P
></LI
><LI
CLASS="STEP"
><A
NAME="PGUPGRADE-STEP-REVERT"
></A
><P
><B
>Reverting to old cluster</B
></P
><P
>     If, after running <TT
CLASS="COMMAND"
>pg_upgrade</TT
>, you wish to revert to the old cluster,
     there are several options:

     <P
></P
></P><UL
><LI
><P
>        If you ran <TT
CLASS="COMMAND"
>pg_upgrade</TT
>
        with <TT
CLASS="OPTION"
>--check</TT
>, no modifications were made to the old
        cluster and you can re-use it anytime.
       </P
></LI
><LI
><P
>        If you ran <TT
CLASS="COMMAND"
>pg_upgrade</TT
>
        with <TT
CLASS="OPTION"
>--link</TT
>, the data files are shared between the
        old and new cluster. If you started the new cluster, the new
        server has written to those shared files and it is unsafe to
        use the old cluster.
       </P
></LI
><LI
><P
>        If you ran <TT
CLASS="COMMAND"
>pg_upgrade</TT
> <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>without</I
></SPAN
>
        <TT
CLASS="OPTION"
>--link</TT
> or did not start the new server, the
        old cluster was not modified except that, if linking
        started, a <TT
CLASS="LITERAL"
>.old</TT
> suffix was appended to
        <TT
CLASS="FILENAME"
>$PGDATA/global/pg_control</TT
>.  To reuse the old
        cluster, possibly remove the <TT
CLASS="FILENAME"
>.old</TT
> suffix from
        <TT
CLASS="FILENAME"
>$PGDATA/global/pg_control</TT
>; you can then restart the
        old cluster.
       </P
></LI
></UL
><P>
    </P
></LI
></OL
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN154631"
></A
><H2
>Notes</H2
><P
>   <SPAN
CLASS="APPLICATION"
>pg_upgrade</SPAN
> does not support upgrading of databases
   containing these <TT
CLASS="TYPE"
>reg*</TT
> OID-referencing system data types:
   <TT
CLASS="TYPE"
>regproc</TT
>, <TT
CLASS="TYPE"
>regprocedure</TT
>, <TT
CLASS="TYPE"
>regoper</TT
>,
   <TT
CLASS="TYPE"
>regoperator</TT
>, <TT
CLASS="TYPE"
>regconfig</TT
>, and
   <TT
CLASS="TYPE"
>regdictionary</TT
>.  (<TT
CLASS="TYPE"
>regtype</TT
> can be upgraded.)
  </P
><P
>   All failure, rebuild, and reindex cases will be reported by
   <SPAN
CLASS="APPLICATION"
>pg_upgrade</SPAN
> if they affect your installation;
   post-upgrade scripts to rebuild tables and indexes will be
   generated automatically.
  </P
><P
>   For deployment testing, create a schema-only copy of the old cluster,
   insert dummy data, and upgrade that.
  </P
><P
>   If you are upgrading a pre-<SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
> 9.2 cluster
   that uses a configuration-file-only directory, you must pass the
   real data directory location to <SPAN
CLASS="APPLICATION"
>pg_upgrade</SPAN
>, and
   pass the configuration directory location to the server, e.g.
   <TT
CLASS="LITERAL"
>-d /real-data-directory -o '-D /configuration-directory'</TT
>.
  </P
><P
>   If using a pre-9.1 old server that is using a non-default Unix-domain
   socket directory or a default that differs from the default of the
   new cluster, set <TT
CLASS="ENVAR"
>PGHOST</TT
> to point to the old server's socket
   location.  (This is not relevant on Windows.)
  </P
><P
>   A Log-Shipping Standby Server (<A
HREF="warm-standby.html"
>Section 25.2</A
>) cannot
   be upgraded because the server must allow writes.  The simplest way
   is to upgrade the primary and use <TT
CLASS="COMMAND"
>rsync</TT
> to rebuild the
   standbys.  You can run <TT
CLASS="COMMAND"
>rsync</TT
> while the primary is down,
   or as part of a base backup (<A
HREF="continuous-archiving.html#BACKUP-BASE-BACKUP"
>Section 24.3.2</A
>)
   which overwrites the old standby cluster.
  </P
><P
>   If you want to use link mode and you do not want your old cluster
   to be modified when the new cluster is started, make a copy of the
   old cluster and upgrade that in link mode. To make a valid copy
   of the old cluster, use <TT
CLASS="COMMAND"
>rsync</TT
> to create a dirty
   copy of the old cluster while the server is running, then shut down
   the old server and run <TT
CLASS="COMMAND"
>rsync</TT
> again to update the copy with any
   changes to make it consistent.  You might want to exclude some
   files, e.g. <TT
CLASS="FILENAME"
>postmaster.pid</TT
>, as documented in <A
HREF="continuous-archiving.html#BACKUP-LOWLEVEL-BASE-BACKUP"
>Section 24.3.3</A
>.
  </P
><DIV
CLASS="REFSECT2"
><A
NAME="AEN154662"
></A
><H3
>Limitations in Upgrading from PostgreSQL 8.3</H3
><P
>   Upgrading <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>from</I
></SPAN
> PostgreSQL 8.3 has additional restrictions not present
   when upgrading from later PostgreSQL releases.  For example,
   pg_upgrade will not work for upgrading from 8.3 if a user column
   is defined as:
   <P
></P
></P><UL
><LI
><P
>      a <TT
CLASS="TYPE"
>tsquery</TT
> data type
     </P
></LI
><LI
><P
>      data type <TT
CLASS="TYPE"
>name</TT
> and is not the first column
     </P
></LI
></UL
><P>
  </P
><P
>   You must drop any such columns and upgrade them manually.
  </P
><P
>   pg_upgrade will not work if the <TT
CLASS="FILENAME"
>ltree</TT
>
   contrib module is installed in a database.
  </P
><P
>   pg_upgrade will require a table rebuild if:
   <P
></P
></P><UL
><LI
><P
>      a user column is of data type <TT
CLASS="TYPE"
>tsvector</TT
>
     </P
></LI
></UL
><P>
  </P
><P
>   pg_upgrade will require a reindex if:
   <P
></P
></P><UL
><LI
><P
>      an index is of type hash or GIN
     </P
></LI
><LI
><P
>      an index uses <CODE
CLASS="FUNCTION"
>bpchar_pattern_ops</CODE
>
     </P
></LI
></UL
><P>
  </P
><P
>   Also, the default datetime storage format changed to integer after
   <SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
> 8.3. pg_upgrade will check that the datetime storage format
   used by the old and new clusters match. Make sure your new cluster is
   built with the configure flag <TT
CLASS="OPTION"
>--disable-integer-datetimes</TT
>.
  </P
><P
>   For Windows users, note that due to different integer datetimes settings
   used by the graphical installer and the MSI installer, it is only
   possible to upgrade from version 8.3 of the installer distribution to
   version 8.4 or later of the installer distribution. It is not
   possible to upgrade from the MSI installer to the new graphical installer.
  </P
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN154692"
></A
><H2
>See Also</H2
><A
HREF="app-initdb.html"
>initdb</A
>, <A
HREF="app-pg-ctl.html"
><SPAN
CLASS="APPLICATION"
>pg_ctl</SPAN
></A
>, <A
HREF="app-pgdump.html"
>pg_dump</A
>, <A
HREF="app-postgres.html"
><SPAN
CLASS="APPLICATION"
>postgres</SPAN
></A
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="pgtesttiming.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="external-projects.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><SPAN
CLASS="APPLICATION"
>pg_test_timing</SPAN
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="contrib-prog-server.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>External Projects</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

Youez - 2016 - github.com/yon3zu
LinuXploit