Expansion of storage area

You must expand the disk space or distribute the data storage when a directory server database expands and reaches its disk space limits. If you do not handle the disk space requirement, the server might generate errors and exist.

You can use one of the following ways to expand storage.

  • Use storage area network. It is beyond the scope of the document.
  • Distribute the database across multiple physical disks.
  • Use raw devices. For more information about raw devices, see IBM® Security Verify Directory database and table spaces in Administering section of the IBM Security Verify Directory documentation.
Distributing the database across multiple physical disks

Distributing the database across multiple disks improves performance. If you use multiple disk drives, you can derive better performance due concurrency.

Before you distribute the database across multiple physical disks, stop the directory server. For example:

ibmslapd -I instance_name -k

Setting up the file system permission and running the DB2® commands to distribute the database across multiple disks can be a complex task.

See the appropriate DB2 documentations to distribute the database across multiple disks.

Table spaces in IBM Security Verify Directory

When you create a directory database, it uses the db2 create database command with the database name specified on the directory configuration command.

Before you begin, switch context to the DB2 instance owner. These examples assume that the DB2 instance owner is ldapdb2.

  • On Linux™ and UNIX™ operating systems, run the following command:
    su - ldapdb2
  • On Windows™ operating systems, run the following command:
    db2cmd
    set DB2INSTANCE=ldapdb2

You can view the table spaces by using the following DB2 commands. Run the command with the DB2 instance owner, typically the ldapdb2 user.

db2 connect to ldapdb2
db2 list tablespaces

The following examples show table space output for a directory server:

Tablespaces for Current Database
Tablespace ID 	  = 0
Name 					  = SYSCATSPACE

Type 					  = System managed space
Contents 			  = Any data
State 					  = 0x0000
		Detailed explanation:
			Normal
Tablespace ID 	  = 1
Name 					  = TEMPSPACE1
Type 					  = System managed space
Contents 			  = Temporary data
State 					  = 0x0000
		Detailed explanation:
			Normal
Tablespace ID    = 2
Name 					  = USERSPACE1
Type 					  = System managed space
Contents 			  = Any data
State 					  = 0x0000
		Detailed explanation:
			Normal
Tablespace ID    = 3
Name 					  = LDAPSPACE1
Type 					  = System managed space
Contents 		    = Any data
State 					  = 0x0000
		Detailed explanation:
			Normal
IBM Security Verify Directory stores data in the user table space (USERSPACE1) and in the LDAP table space (LDAPSPACE). By default, there is only one container or directory for each of these table spaces. To view the details about the user table space, enter the following DB2 command:
db2 list tablespace containers for 2
The output of the command is:
Tablespace Containers for Tablespace 2
Container ID     = 0
Name 					  = /ldapdb2/NODE0000/SQL00001/SQLT0002.0
Type 					  = Path
The container or directory that DB2 uses for table space 2 is /ldapdb2/NODE0000/SQL00001/SQLT0002.0. It contains LDAP attribute database tables.

Table space 3 contains the ldap_entry table. For more information about table spaces, see Table spaces.

Creating file systems and directories on the target disks

To distribute the DB2 database across multiple disk drives, you must create and format the file systems and directories on the physical disks.

Guidelines for distributing the DB2 database across multiple disk drives include:

  • DB2 distributes the database equally across all directories. Therefore, you must make all the file systems, directories, or both, of the same size.
  • Directories to use for the DB2 database must be empty. AIX® systems create a lost+found directory at the root of any file system. Instead of deleting the lost+found directory, create a subdirectory at the root of each file system for distributing the database. For example, create a subdirectory, ldapdb2_containers, on each file system where the DB2 database is to be stored.
  • You must create two more directories under the ldapdb2_containers directory. One directory to hold table space 2 and the other for table space 3. For example, these directories can be named tblspc2 and tblspc3. Then, specify these directories on the set table space commands that are provided in Running a redirected restore of the database.
  • The DB2 instance user must have write permission on the created directories. For AIX systems, the following command sets the appropriate permissions:
    chown ldapdb2 directory_name

Platform-specific guidelines include:

  • For the AIX operating system, create an Enhanced Journaled Files System (JFS2) or create the file system with the Large File Enabled option. This option is one of the options on the Add a Journaled File System smit menu.
  • For AIX systems, set the file size limit to unlimited. You can also set file size limit to the size of the largest file system under which the DB2 database files are stored. On AIX systems, the /etc/security/limits file controls system limits and -1 means unlimited.
Backing up the existing database

To back up the existing database, follow these steps:

  1. Stop the directory server instance.
  2. To close all DB2 connections, run the following commands:
    db2 force applications all
    db2 list applications
    The following message is shown when the commands are run. For example:
    SQL1611W No data was returned by Database System Monitor.
  3. To initiate the backup process, run the following command:
    db2 backup db ldapdb2 to [file system | tape device]
    If the database is backed up successfully, the following message is shown. For example:
    Backup successful. The timestamp for this backup image is : 20100420204056
Note: You must ensure that the backup process was successful before you remove the existing database. If the backup was not successful, the existing database is lost. You can verify whether the backup was successful by restoring to a separate system.
Running a redirected restore of the database

A DB2 redirected restore operation restores the specified database table space to multiple containers or directories. In the following example, assume that the following directories to hold table space 2 are created and are empty. The directories are set with the correct permissions for write access by the DB2 instance owner, typically the ldapdb2 user.

/disk1/ldapdb2_containers/tblspc2
/disk2/ldapdb2_containers/tblspc2
/disk3/ldapdb2_containers/tblspc2
/disk4/ldapdb2_containers/tblspc2
/disk5/ldapdb2_containers/tblspc2

In the following example, assume the following directories for table space 3 is created:

/disk1/ldapdb2_containers/tblspc3
/disk2/ldapdb2_containers/tblspc3
/disk3/ldapdb2_containers/tblspc3
/disk4/ldapdb2_containers/tblspc3
/disk5/ldapdb2_containers/tblspc3

Follow these steps for a redirected restore:

  1. To start the DB2 restore process, run the command of the following format:
    db2 restore db ldapdb2 from [location of backup] replace existing redirect
    The following message is shown when the command is run. For example:
    SQL2539W Warning! Restoring to an existing database that is the same as
    the backup image database. The database files will be deleted.
    
    SQL1277N Restore has detected that one or more tablespace containers are
    inAccessible, or has set their state to 'storage must be defined'.
    
    DB20000I The RESTORE DATABASE command completed successfully.
    This command prepares for the restore, but does not actually run the restore operation. These messages indicate that DB2 is prepared to receive the next commands, which define the location of the database files.
  2. To define the containers for table space 2 and for table space 3, enter:
    db2 "set tablespace containers for 2 using (path \
    '/disk1/ldapdb2_containers/tblspc2', \
    '/disk2/ldapdb2_containers/tblspc2', \
    '/disk3/ldapdb2_containers/tblspc2', \
    '/disk4/ldapdb2_containers/tblspc2', \
    '/disk5/ldapdb2_containers/tblspc2' )"
    db2 "set tablespace containers for 3 using (path \
    '/disk1/ldapdb2_containers/tblspc3', \
    '/disk2/ldapdb2_containers/tblspc3', \
    '/disk3/ldapdb2_containers/tblspc3', \
    '/disk4/ldapdb2_containers/tblspc3', \
    '/disk5/ldapdb2_containers/tblspc3' )"
    Note: If many containers are defined, these commands can become too long to fit within the limits of a shell command. In such a case, you can put the command in a file and run within the current shell by using the dot notation. For example, assume that the commands are in a file named set_containers.sh. The following command runs it in the current shell: . set_containers.sh
    After completion of the DB2 set table space command, the following message is returned:
    DB20000I The SET TABLESPACE CONTAINERS command completed successfully.
    The command might also return the following message: SQL0298N Bad container path. SQLSTATE=428B2. This message indicates that one of the containers is not empty or the write permission is not set for the DB2 instance owner.
    Note: A newly created file system on AIX contains a directory lost+found. You must create a directory at the same level as lost+found to hold the table space and then run the set table space command again. If you experience problems, see the DB2 documentation. The following files might also contain the required information to resolve the issue:
    ldapdb2_home_dir /sqllib/Readme/en_US/Release.Notes
    ldapdb2_home_dir /sqllib/db2dump/db2diag.log
    Note the db2diag.log file contains some fairly low-level details that can be difficult to interpret.
  3. Restore to new table space containers. This step takes considerable time to complete. The time varies depending on the size of the directory. To restore to the new table space containers, enter the following command:
    db2 restore db ldapdb2 continue
    If problems occur with the redirected restore and you want to stop the restore process, run the following command:
    db2 restore db ldapdb2 abort

To know more about adding disk space to table spaces, see the Administering section of the IBM Security Verify Directory documentation.