一、To establish the variable-data directories
1、Install SharePlex in the normal manner according to the instructions in the SharePlex
Installation and Demonstration Guide. SharePlex uses the default port of 2100.
These instructions assume, as an example, that the SharePlex product directory (containing
the binaries) is installed in a directory named /splex/proddir, and that the
SharePlex variable-data directory is installed in a directory named /splex/vardir.

Note:Do not start SharePlex until directed to do so. The following steps create a variable-
data directory for each sp_cop. In this example, two directories are created, one
using port 2101 and one using port 2200. The default port of 2100 is used for the
original SharePlex installation.

2、Tar the original /splex/vardir and its subdirectories. The following commands put
the resulting tar file in /splex (one directory up). Pay close attention to the dots in the
tar command.
$ cd /splex/vardir
$ tar cvf ../splex.tar .

3、Make new variable-data directories, each named for the port number (or another
unique identifier) to be used by the associated sp_cop instance.
$ mkdir /splex/vardir/splex2101 (for the first instance of sp_cop)
$ mkdir /splex/vardir/splex2200 (for the second instance of sp_cop)

4、Change directories to the variable-data directory made for port number 2101.
$ cd /splex/vardir/splex2101

5、Enter the original variable-data directory structure into this directory.
$ tar xvf /splex/splex.tar

6、Repeat steps 4 and 5 for each additional variable-data directory. (In the example,
there is only one additional directory.)
$ cd /splex/vardir/splex2200
$ tar xvf /splex/splex.tar

7、Set the port number for each variable-data directory that you created by setting the
TCP and UDP port parameters in the SharePlex paramdb. There is a paramdb file in
each of the variable-data directories you created. See page 241 for instructions on
setting the port numbers.

Administrator and run the clean_vardir.sh script for each variable-data directory
that you created. The script removes duplicated replication queues and restores each
one to a fresh state. Instructions for running clean_vardir.sh are on page 413.

9、In the rim sub-directory of each variable-data directory, delete the shstinfo.ipc and
shmaddr.loc files.==============>此步比较重要,如果不清理,可能无法复制数据
Note: The shstinfo.ipc and shmaddr.loc files may not exist if sp_cop has never been
started against this variable-data directory.

二、To establish the Oracle users
Create an Oracle user account for each variable-data directory for which there will be an
instance of sp_cop. The account enables the Post process to log into Oracle and post
data. To create the accounts, run the SharePlex ora_setup program for each sp_cop
instance. To identify an account, use its port number, for example splex2101. See
page 387 for instructions on running ora_setup.

三、To start and control the sp_cop instances
To run multiple sp_cop sessions, start a session of sp_cop and sp_ctrl for each variable-
data directory. Follow these steps.

1 Export the SP_SYS_VARDIR environment variable to point to the first variable-data
$ export SP_SYS_VARDIR=/splex/vardir/splex2101 (ksh shell)
$ setenv SP_SYS_VARDIR /splex/vardir/splex2101 (csh shell)

2 Start sp_cop by typing the absolute path name and the –uportnumber argument,
where portnumber is the port number assigned to the first variable-data directory’s
sp_cop instance. This points SharePlex to the correct port and allows you to see that
sp_cop instance when you use the ps -ef | grep sp_ command. Use the & argument
to run sp_cop in the background.
$ /splex/proddir/bin/sp_cop -u2101 &

3 To run sp_ctrl for that instance of sp_cop, start sp_ctrl, then issue the port command.
$ ./sp_ctrl
sp_ctrl(sysA)> port 2101

4 Repeat the preceding steps for each variable-data directory.
Example syntax for a second variable-data directory
$ export SP_SYS_VARDIR=/splex/vardir/splex2200 (ksh shell)
$ setenv SP_SYS_VARDIR /splex/vardir/splex2200 (csh shell)
$ /splex/proddir/bin/sp_cop -u2200 &
$ ./sp_ctrl
sp_ctrl(sysA)> port 2200
Note: If you receive an error message similar to this:
Error cleaning up previous shared memory segment ###.
Cannot delete because there are users attached.
Check if SharePlex processes are running and kill them if necessary.
Find out if someone else started a session of sp_cop using the same port number and
variable-data directory. Kill the processes associated with that session, then start
sp_cop again.

3. 修改source&&target端paramdb
$ cd /data/shareplex /vardir/2500/data
$ vi paramdb 编辑使其内容如下:
SP_COP_TPORT 2200 #端口号更改
SP_COP_UPORT 2200 #端口号更改

至关重要:设置环境export SP_SYS_VARDIR=/quest/splex/vardir/2200 ,否则会清空现有链路信息,到时候就死定了