Creating a clone of a primary server

You use the ifxclone utility to create a clone of a primary server.

About this task

The general steps to create a clone of a server are as follows:

Procedure

  1. Set the following environment variables on the target server:
    • ONEDB_HOME
    • ONEDB_SERVER
    • ONCONFIG
    • ONEDB_ SQLHOSTS
  2. On the target server, create all of the chunks that exist on the source server. Follow these steps to create the chunks:
    1. On the source server, run the onstat -d command to display a list of chunks:
      onstat -d
    2. On the target server, log-in as user informix and use the commands touch, chown, and chmod to create the chunks. For example, to create a chunk named /usr/informix/chunks/rootdbs.chunk, follow these steps:
      $ su informix
      Password:
      $ touch /usr/informix/chunks/rootdbs.chunk
      $ chown informix:informix /usr/informix/chunks/rootdbs.chunk
      $ chmod 660 /usr/informix/chunks/rootdbs.chunk
    3. Repeat all of the commands in the previous step for each chunk reported by the onstat -d command.
  3. While still logged in as user informix, run the ifxclone utility with the appropriate parameters on the target system on which the clone server is started.
  4. Optionally, create onconfig and sqlhosts files on the target server.

Example

Use the following steps to clone a server using the ONCONFIG and ONEDB_ SQLHOSTS configuration files from the source server.

In this example, omitting the -L option causes the ifxclone utility to retrieve the necessary configuration information from the source server. The configuration files are used as a template to create the target server configuration. Having the ifxclone utility create the configuration files for you saves time and reduces the chance introducing errors in the configuration files.

For this example, assume that the source server (Amsterdam) has an sqlhosts file configured as follows:

#dbservername  nettype   hostname     servicename   options
Amsterdam      onsoctcp  192.168.0.1  123

You also must have the name, IP address, and port number of the target server. The following information is used for this example:

  • Source server name: Amsterdam
  • Source IP address: 192.168.0.1
  • Source port: 123
  • Target server name: Berlin
  • Target IP address: 192.168.0.2
  • Target port: 456
  1. On the target server, log-in as user informix and use the touch, chown, and chmod commands to create, change the owner, and change the permissions for the chunks. The chunk paths must match the paths of the chunks on the source server.
  2. Run the ifxclone utility as user informix:
    ifxclone -T -S Amsterdam -I 192.168.0.1 -P 123 -t Berlin 
             -i 192.168.0.2 -p 456

The ifxclone utility modifies the sqlhosts file on the source server and creates a copy of the file on the new target server. The sqlhosts file on the target server is the same as the source server:

#dbservername  nettype   hostname     servicename   options
 Amsterdam     onsoctcp  192.168.0.1  123
 Berlin        onsoctcp  192.168.0.2  456

Use the -L (useLocal) option to create a clone of a server on a remote host computer: The -L option is used to merge the source onconfig file configuration information with the target onconfig file. This option also copies the source sqlhosts file to the target server.

  • Source server name: Amsterdam
  • Source IP address: 192.168.0.1
  • Source port: 123
  • Target server name: Berlin
  • Target IP address: 192.168.0.2
  • Target port: 456
  1. Create the onconfig and sqlhosts files and set the environment variables on the target computer.
  2. On the target server, log-in as user informix and use the touch, chown, and chmod commands to create, change the owner, and change the permissions for the chunks. The chunk paths must match the paths of the chunks on the source server.
  3. Run the ifxclone utility as user informix:
    ifxclone -T -L -S Amsterdam -I 192.168.0.1 -P 123 -t Berlin 
             -i 192.168.0.2 -p 456

To add an RS secondary server to the existing high-availability cluster:

  • Source server name: Amsterdam
  • Source IP address: 192.168.0.1
  • Source port: 123
  • Target server name: Berlin
  • Target IP address: 192.168.0.2
  • Target port: 456
  1. Create the onconfig and sqlhosts files and set the environment variables on the target computer.
  2. On the target server, log-in as user informix and use the touch, chown, and chmod commands to create, change the owner, and change the permissions for the chunks. The chunk paths must match the paths of the chunks on the source server.
  3. On the source server (if necessary), enable the LOG_INDEX_BUILDS configuration parameter enabled by running the following command as user informix:
    onmode -wf LOG_INDEX_BUILDS=1
  4. On the source server, run the following command as user informix to add the target server as an RS secondary server:
    onmode -d add RSS Berlin
  5. Run the ifxclone utility as user informix:
    ifxclone -T -L -S Amsterdam -I 192.168.0.1 -P 123 -t Berlin 
             -i 192.168.0.2 -p 456 -s medium -d RSS

What to do next

On Windows™ systems, to clone a server instance using the useLocal (-L) option:
  1. Manually create the instance on the target Windows system without initializing the server.
  2. Use the setnet32 utility to enter the source server entry in sqlhosts file.
  3. Run the ifxclone utility.

    You must be a member of the Informix-Admin group to run the ifxclone command on Windows.

If you do not specify the UseLocal (-L) option you can run the ifxclone utility without first creating the instance on the target server. If the target server instance does not exist, you are prompted to enter the HCL OneDB™ password to create the instance.