How to perform an Alternate Client Restore for an Informix database

Article: 100010407
Last Published: 2013-10-24
Ratings: 0 0
Product(s): NetBackup & Alta Data Protection

Problem

How to perform an Alternate Client Restore for an Informix database

Solution

Note: Thisdocument is designed to help database administrators duplicate an Informixdatabase to a new host and not as a disaster recovery document. Some of theinformation gathering in steps 1-2 would not be possible during a disasterrecovery, so it is recommended that this type of information be recorded andkept in an appropriate place, in case it is required in a disaster recoverysituation.


Prior to restoring anInformix database to a new host server, the database administrator should havealready created the Informix user, the Informix group and installed the Informixsoftware (install the same version of Informix software as the originaldatabase) on the new host, so that the database will run. This document assumesthat these tasks have been completed and will begin at collecting informationabout the original database layout and configuration.

Throughout thisdocument there will be an example showing an import. This will help explain thesteps required. In the example, the hostname of the servers and the Informixdatabase server name are as follows:

Original Host: labhp01
NewHost: labhp02
Informix Database Server Name:  NBtest

Thedatabase files being used by the Informix instance will be File System files forthis example.



1.  Obtain DBSPACE and CHUNK informationfrom the original database

Find out the location and size of thechunks (logical files that make up an Informix instance) for the originalInformix database.

To obtain this information, login as user informix on the host where the original database exists.

Then runthe following commands and note down the outputs forthem:

onstat -d

Thiscommand displays the list of chunks assigned to the database, including theirfile names (pathname) and the sizes of the chunks in database pages (a page is alogical unit of disk, normally 2 or 4 Kilobytes in size), as seen in thefollowingexample:


Dbspaces
address  number    flags    fchunk    nchunks    flags    owner    name
c330a7e0  1        0x1        1        1          N        informix  rootdbs
c2531018  2        0x1        2        1          N        informix  tempdbs
c2531160  3        0x1        3        1          N        informix  datadbs
4active, 2047maximum

Chunks
address  chk/dbs  offset   size    free    bpages    flags    pathname
a2ce6a0  1  1    0        10000    860              PO-      /data/rootdb_dev
a30c568  2  2    0        50000    42793            PO-      /data/tempdb_dev
a30c6c8  3   3    0        5000    1261              PO-      /data/datadb_dev



Tofind the size of a database page in Informix, run the followingcommand:

onstat-b

The last line from the command will look something likethis:

88 modified, 0 resident, 200 total, 256hash buckets, 2048 buffer size

The last section of this lineis BUFFER SIZE, which is 2048 bytes in this case. The buffer size in Informix isthe same size as a database page, so if this says 2048, then the Informix pagesize is 2KB. If it is 4096 then the page size is 4KB.

From the outputabove, there are three database files for the Informix Instance on the originalhost:

FileName                                               Size              
/data/rootdb_dev      (10000x 2 Kb) = 20000   KB
/data/tempdb_dev    (50000 x 2 Kb)= 100000 KB
/data/datadb_dev     (5000 x 2 Kb)   =1000    KB

These files need to be recreated on the new hostwith the same name, size, file owner/group, and file permissions as theoriginals.  

From the original host, login as the Informix user andrun the command below against the database files to obtain their ownership andpermissions details:

ls -l

In the example, an ls -l on the /data directory on the original host showed the fileshaving thesepermissions:

-rw-rw----  informixinformix.......    rootdb_dev
-rw-rw----  informixinformix.......    tempdb_dev
-rw-rw----  informixinformix .......    db_dev


2.  Collectconfiguration and onbar files from original host

Login as user informix on the original host, run the following two commands and notedown the outputs:

onstat -c | grepSERVERNUM

onstat-c | grep DBSERVERNAME


The first one is the server_number for the database, and the second command is the database_name for the Informix database (this should match the $INFORMIXSERVER environment variable).

Change to the directory $INFORMIXDIR/etc and note down the following four files:

- Theconfiguration file for the Informix database. Use the command below to retrievethe configuration file name:

echo$ONCONFIG - a file name should be echoed to the screen, this fileneeds to be copied to the new host.

Note:$ONCONFIG is an Informix environment parameter which lists the name of theconfiguration file for the Informix database.

- sqlhosts

- ixbar.<server_number> - known as the emergency boot file

- oncfg_<database_name>.<server_number>


Theseconfiguration files need to be copied or sent by ftp from the original to thenew host server and placed into the $INFORMIXDIR/etc directory on the newhost.

Once the files have been copied to the new host, modify sqlhosts and /etc/services on the new host to allow the databaseto start up properly.  


e.g. The sqlhosts file copiedacross to the new host will still list the original host as the location of theinstance, modify the hostname in the file to the name of the newhost:


OLD file:

#Instance_name    connect_type           host              service_name
Nbtest                    onsoctcp               labhp01         Nbtestsql


EditedFile:

#Instance_name    connect_type           host              service_name
Nbtest                    onsoctcp               labhp02         Nbtestsql


The service_name ( Nbtestsql ) seen above in the sqlhosts file needs tobe added in the /etc/services file (with a unique port number, in theexample below this is 1535) on the new host so that the instance canstart:


Add service entry for Instance in the /etc/servicefile:

Nbtestsql   1535/tcp  #Nbtest Informix instance port number


3. Create theInformix Database chunks on the new host

Once the configuration fileshave been copied across and edited to match the new host, the next step is tore-create the database files from the original database on the new host .

Note:Make sure that the location of the new Informix database files has enoughdisk space to hold them.

With the information gathered from step 1 above, loginas the root user on the new host and touch the file names that need to becreated:

touch<file_name>

Then alterthe files permission and ownership of the file to match the originals with thefollowing commands:

chmod660  <file_name>  

chown informix<file_name>

chgrp informix<file_name>


The output of commands( onstat -d, onstat -b, ls -l ) in step 1showed this:

   Filename Size          Owner      Group    Permissions
/data/rootdb_dev (10000 x2 Kb) = 20000  Kb  informix  informix  -rw-rw----
/data/tempdb_dev (50000x 2 Kb) = 100000 Kb  informix  informix  -rw-rw----      
/data/datadb_dev (5000 x 2Kb)  = 1000   Kb  informix  informix  -rw-rw----


Therefore, in this example, three files need to becreated on the new host with the above owner/group and permissions, in a mannersimilar to that shown below:

touch  /data/rootdb_dev
chmod660    /data/rootdb_dev
chowninformix  /data/rootdb_dev
chgrpinformix /data/rootdb_dev



4.  InstallNetBackup Client and Informix Database extension

Once the Informixsystem is set up, the next step is to install the NetBackup Client software andthen the Informix Database Extension for NetBackup.

To do this, followthe steps in the "NetBackup Installation Guide - UNIX" manual to install theNetBackup client and "NetBackup for Informix System Administrator Guide" toinstall the Informix-NetBackup databaseextension.



5.  Preparing the new host for an AlternateClient Restore

- In the bp.conf file under the /usr/openv/netbackup directory on thedestination host, change the current CLIENT_NAME entry to the name of thedestination host where the Informix restore will take place.

Example:
The original Informix databasebackup taken is on host labhp01, and it will be restored to the new host labhp02. Then the CLIENT_NAME entry in the bp.conf file on labhp02 should be:

CLIENT_NAME=labhp02

- On the NetBackup master server, create No.Restrictionsfile in the /usr/openv/netbackup/db/altnamesdirectory

- Login tothe new host as user informix and set the environment variable INFXBSA_CLIENT:

INFXBSA_CLIENT=<original_host_name>
exportINFXBSA_CLIENT

Example:
If the Informix database isrestored to the new host labhp02 and the backup was taken on host labhp01 then the INFXBSA_CLIENT parameter should be set as labhp01:

INFXBSA_CLIENT=labhp01
exportINFXBSA_CLIENT



6.  Performing the Informix DatabaseRestore

Now the new host is ready for restore.

Login as user informix on the new host and run the appropriate onbar restore command based on the typeof onbar backup done.


Backup command
Restore command
onbar -b -w
onbar  -r -w -p
onbar -b
onbar -r


In this exercise, the command used to back up theInformix database is onbar -b -w , whichis called "Whole System backup" in Informix terminology. Then a "Whole SystemPhysical restore" of the Informix database is needed to be performed, this canbe achieved by running the command:
onbar -r -p-w .

After the restore completes, the database will be inquiescent mode. Run the command below to bring the database online:

onmode -m

The Informixdatabase on the new host is now active and ready for use.


Was this content helpful?