DB2 Data Links Manager Quick Beginnings

2. Creating a test environment on the DB2 Data Links server

After creating a test environment on the DB2 UDB server, we must create a test environment on the DB2 Data Links server.

There are four sub-tasks involved in creating the test environment on the Data Links server:

Preparing a File System

You can choose to create a Journaled File System (JFS) or a DCE-DFS file system to test your Data Links Manager installation.

Creating a Journaled File System (JFS) on the DB2 Data Links server:

To create a JFS on the DB2 Data Links server:

  1. Log in as a user with root authority.
  2. Prepare a JFS to use a Data Links Filesystem Filter as follows:
    1. Create a Journaled File System (JFS) file system using the smit manfs command and set the Mount AUTOMATICALLY at system restart? option to no. You can also use an existing JFS file system. For more information, refer to your AIX Administration Guide.
    2. Open the /etc/filesystems file, record the current setting for the vfs entry, and edit its stanza such that:
         mount    = false
         vfs      = dlfs
      
    3. Add the following attribute to the stanza of the /etc/filesystems file:
         nodename = -
      
      Note:You must ensure that there are no blank spaces after the null character (-) for this entry.
    4. Edit the stanza for the /etc/filesystems file for your file system and set the Basefs parameter, in the options attribute, to the value that you recorded for the vfs entry above. For example, the entry would be similar to the following:
         options = rw,Basefs=jfs
       
      
  3. Modify the properties of a file system, so that it comes under the control of the Data Links Filesystem Filter, and mount it by entering the following command:
       /usr/lpp/db2_07_01/instance/dlfmfsmd dlfm_mountpoint
    

    where dlfm_mountpoint is the mount point of the JFS file system you are using.

    For our example, enter the following command:

       /usr/lpp/db2_07_01/instance/dlfmfsmd /test
    
  4. Log out.

Creating a DCE-DFS file system on the DB2 Data Links Server

To create a DCE-DFS file system on the DB2 Data Links server:

  1. Log in as root and dce_login as a DFS administrator.
  2. Create a logical volume by entering the following command:
       mklv -y aggregate_name -t aggregate_type lfs rootvg 1
    

    where aggregate_name represents the name of the logical volume, aggregate_type represents the aggregate type, rootvg represents the logical volume type, and 1 represents the number of logical partitions.

  3. Create an aggregate in the logical volume by entering the following command:
       newaggr -aggregate /dev/dmtest -block 8192 -frag 1024 -overwrite
    

    where /dev/dmtest represents the aggregate name, given as a device file. Note that if this aggregate name already exists, the -overwrite option will delete all data in the aggregate.

  4. Initialize and export the aggregate by entering the following command:
       mkdfslfs -d /dev/dmtest -n dmtest
    

    where /dev/dmtest is the device name for the aggregate.

  5. Create the filesets in the aggregate by entering the following command:
       mkdfslfs -f dmtest1.ft -m /:/dmtest/dmtest1 -n dmtest
    

    where /:/dmtest/dmtest1 represents the mountpoint in the DFS namespace and dmtest represents the name of the aggregate.
    Note:You must have a valid dce_login and the authority to create directories in the DFS namespace.

  6. Edit the /opt/dcelocal/var/dfs/dfstab file and change the entry for the aggregate you just created from lfs to dmlfs. For example, this file will have entries for each aggregate similar to the following:
       # blkdev aggname aggtype aggid [UFS fsid]
       /dev/aggrdev1 aggrname1 lfs 1 
       /dev/aggrdev2 aggrname2 lfs 2 
     
    

    Change aggtype to dmlfs for all aggregates that are to be brought under Data Links control. Save and close the file.

    Notes:

    1. When you create an aggregate using SMIT, you can also specify an aggregate id. However, the default id is the next available higher integer value.

    2. If the aggregate already has been exported, you must unexport it before performing this and the following step.
  7. Enable DFS SMT on the aggregate by running the following command:
       dmaggr -aggregate name [{-on | -off}] [{-needapp | -noneedapp}] [-help]
     
    

    We recommend you always use the -needapp option when running this command.

  8. Export the aggregate so that it can be controlled by the Data Links Filesystem Filter.
  9. Register a file system that is under the control of a Data Links Filesystem Filter by entering the following command:
       dlfm add_prefix prefix_path
    

    where prefix_path is the location of the file system that is under the control of a DLFF.

  10. To register a DCE-DFS fileset, you can either use the dlfm add_prefix /test command or you can use one of the following variations:
       dlfm add_prefix for dfs rwpath prefix_path
    

    This command specifies a read-only path for DCE-DFS.

       dlfm add_prefix for dfs rwpath prefix_path localpath local_mount_point
    

    where local_mount_point represents the native file system mount point of the prefix. The native file system mount point can be used to improve the performance of the archival and retrieval of files. For more information, see Performance Enhancements for Disk Backup in the DFS Environment.
    Note:You must issue all dlfm add_prefix commands from the node on which the DFS fileset resides. After issuing this command, you must issue a dlfm start command on the same node.

Registering the file system with the Data Links File Filter

To register our /test filesystem with the Data Links File Filter:

  1. Log on to the system as the DB2 Data Links Manager Administrator.
  2. Run the db2profile or db2cshrc script as follows:
       . INSTHOME/sqllib/db2profile    (for bash, Bourne or Korn shell)
       source INSTHOME/sqllib/db2cshrc (for C shell)
    

    where INSTHOME is the home directory of the instance owner.

  3. Start the Data Links File Manager by entering the dlfm start command.
  4. Ensure that the Data Links File Manager started successfully by entering the dlfm see command.

    If the Data Links File Manager back-end processes started successfully and are running, you will receive output similar to the following:

        PID   PPID   PGID    RUSER    EUSER    ETIME  COMMAND
       7624  49852  55994     dlfm     dlfm    02:44   dlfmd
      49852      1  55994     dlfm     dlfm    02:44   dlfmd
    
    ·
    ·
    ·
    56510 49852 55994 dlfm root 02:44 dlfm_chownd
  5. Ensure that you successfully mounted the Journaled File System that is under the control of a Data Links Filesystem Filter (DLFF) by entering the following command:
        lsfs -v dlfs 
    

    For our example, this command should return output similar to the following:

       Name            Nodename   Mount Pt   VFS   Size  Options      
       /dev/dllv       -          /test      dlfs  --    rw,Basefs=jfs
       /dev/lv04       -          /dlinks2   dlfs  --    rw,Basefs=jfs                                                             
    

    To verify that a DFS file server is under the control of a DLFF, enter the following command:

       dfsexport | grep dmlfs 
    

    The output from this command should be similar to the following:

       /dev/dlfs_test dlfs_test dmlfs 4 
    
  6. Register a file system that is under the control of a Data Links Filesystem Filter by entering the following command:
       dlfm add_prefix prefix_path
    

    where prefix_path is the location of the file system that is under the control of a DLFF.

    For our example, register the Data Links server to use the Data Links Filesystem Filter on the test file system by entering the following command:

       dlfm add_prefix /test
    

    To update an existing prefix, enter the following command:

    dlfm update_prefix prefix_path for dfs localpath local_mount_point
    

Registering the DB2 UDB database

To register a new database with the Data Links File Manager:

  1. Log on to the system as the DB2 Data Links Manager Administrator.
  2. Register the remote DB2 UDB database where the DATALINK data type was defined by entering the following command:
        dlfm add_db database instance hostname
    

    where:

    In our example, we will register a database called STAFF, which resides in the VALIDATE instance on a DB2 UDB server with a fully qualified hostname of db2server.services.com, by entering the following command:

        dlfm add_db staff validate db2server.services.com
    

    You should not specify the DLFM_DB when you run this command. The DLFM_DB is a local database that is used to keep track of files that are under the control of the Data Links File Manager.

  3. Log out.

Creating a sample file

To create a sample file:

  1. Log on to the system as any user that is not a DB2 Data Links Manager Administrator. In DCE-DFS environments, use your dce_login.
  2. Create a directory on the file system that is under the control of a Data Links Filesystem Filter (DLFF), to store files to be controlled by a DB2 server, by entering the following command:
       mkdir filesystem_name/directory_name
    

    where:

    The DB2 Data Links Manager Administrator should never be the owner of any files or directories which are in a file system under the control of a Data Links Filesystem Filter.In our example, we will create the directory called pictures, on the file system /test, by entering the following command:

       mkdir /test/pictures
    
  3. Change the permissions for the pictures directory that you just created so that any user can create a file in it by entering the following command:
       chmod 777 /test/pictures
    
  4. Create a file called psmith.bmp in the /test/pictures directory, to be managed by the Data Links File Manager, by entering the following command:
       echo "This is a picture of Paul Smith." > /test/pictures/psmith.bmp
    
  5. Log out.

The sample file psmith.bmp is a text file, not a bitmap as the .bmp extension implies. For the purpose of verifying your installation, this file represents an employee's picture that was inserted into a table that was defined with the DATALINKS data type.


[ Top of Page | Previous Page | Next Page ]