10 Configuring the Reporting Database

Oracle HSM supports an optional reporting database that stores current metadata information for every file in a specified file system. This sideband database can be invaluable for managing and reporting on files and file system activity.

Implementing the Oracle HSM sideband database is straightforward. You use the samdb command to create and configure a MySQL database using the supplied database schema (or a custom alternative) and a recovery point file generated by the samfsdump command. The Oracle HSM daemon processes then update the database automatically as the corresponding file system changes. Additional samdb commands let you query and manage the database. For full details on commands and options, see the samdb and samdb.conf man pages.

To use the sideband database feature, carry out the following tasks:

Install and Configure the MySQL Server Software

To enable samdb reporting features, you must install and configure a MySQL database. Proceed as follows.

  1. Download the MySQL Reference Manual from http://dev.mysql.com/doc/.

    Use the procedure below to identify the MySQL tasks that are required when enabling samdb reporting. But note that the steps below are not meant to be complete or authoritative. Use them as a guide when consulting the MySQL Reference Manual.

  2. Log in to the system that will host the MySQL server as root.

    You can install the MySQL server on the Oracle HSM metadata server host or on an independent Solaris or Linux host.

    In the example, we install MySQL on the Solaris host samsql:

    root@samsql:~# 
    
  3. Download and install the MySQL server software, as directed in the MySQL Reference Manual. Enable automatic startup.

  4. Connect to the MySQL server with the mysql client and the root user account. Use the command mysql --user=root -p. When prompted, enter the password that you assigned to the root user during installation.

    The mysql command shell starts:

    root@samsql:~# mysql --user=root -p
    Enter Password:
    mysql>
    
  5. Create the Oracle HSM MySQL user. Use the command CREATE USER 'user_name'@'host_name' IDENTIFIED BY 'user-password', where:

    • user_name is the name of the Oracle HSM MySQL user

    • host_name is localhost when MySQL is installed on the Oracle HSM metadata server host. otherwise, it is the hostname or IP address of the metadata server.

    • user-password is the password that you assign to the Oracle HSM MySQL user.

    In the example, we create the user samsql on the Oracle HSM metadata server samqfs1mds. We set the user password samsqluserpassw0rd for demonstration purposes (it would not be a secure choice for production database use):

    root@samsql:~# mysql --user=root
    Enter Password:
    mysql> CREATE USER 'samsql'@'samqfs1mds' IDENTIFIED BY 'samsqluserpassw0rd'
    mysql> 
    
  6. Grant the Oracle HSM user the necessary privileges. Use the command GRANT CREATE,DROP,INDEX,SELECT,INSERT,UPDATE,DELETE ON host_name TO 'user_name'@'host_name'.

    In the example, we grant privileges to the user samsql on metadata server samqfs1mds:

    root@samsql:~# mysql --user=root -p
    Enter Password:
    mysql> CREATE USER 'samsql'@'host_name' IDENTIFIED BY 'samsqluserpassw0rd'
    mysql> CREATE,DROP,INDEX,SELECT,INSERT,UPDATE,DELETE ON samqfs1mds TO 'samsql'@'samqfs1mds'
    mysql> 
    
  7. Close the MySQL command interface, and return to the operating system command shell. Use the MySQL command QUIT.

    root@samsql:~# mysql --user=root -p
    Enter Password:
    mysql> CREATE USER 'samsql'@'host_name' IDENTIFIED BY 'samsqluserpassw0rd'
    mysql> GRANT CREATE,DROP,INDEX,SELECT,INSERT,UPDATE,DELETE ON samqfs1mds TO 'samsql'@'samqfs1mds'
    mysql> QUIT
    Bye
    root@solaris:~# 
    
  8. Next, create a database load file.

Create a Database Load File

  1. Log in to the Oracle HSM metadata server host as root.

    In the example, we login to the host samqfs1mds:

    root@samqfs1mds:~# 
    
  2. If you already have a current recovery point file, generate the database load file from the contents of the recovery point file. Use the command samfsrestore -SZ output-path-name -f recoverypoint-file, where:

    • -f specifies recoverypoint-file as the path and file name of the input file.

    • -SZ causes the command to scan a recovery point file and output a database load file with the path and file name specified by output-path-name.

    See the samfsdump man page for additional details.

    In the example, we use the daily recovery-point file, /zfs1/hsmqfs1_recovery/140129, that we scheduled when we configured the samqfs1 file system (see "Configure File System Protection"). We send the output to the database load file /root/hsmqfs1dataload:

    root@samqfs1mds:~# samfsrestore -SZ /root/hsmqfs1dataload -f /zfs1/hsmqfs1_recovery/140129
    ...
    root@samqfs1mds:~# 
    
  3. If you do not have a current recovery point file, create a database load file now. Change to the Oracle HSM file system's root directory. Then use the command samfsdump -SZ output-path-name.

    See the samfsdump man page for additional details. In the example, we change to the /hsmqfs1 directory. We send the output to the database load file /root/hsmqfs1dataload:

    root@samqfs1mds:~# cd /hsmqfs1
    root@samqfs1mds:~# samfsdump -SZ /root/hsmqfs1dataload 
    
  4. Next, create the sideband database.

Create the Sideband Database

  1. Log in to the MySQL server host as root.

    In the example, the MySQL server is hosted on Solaris host samqfs1mds:

    root@samqfs1mds:~# 
    
  2. In a text editor, open the file /etc/opt/SUNWsamfs/samdb.conf.

    In the example, we use the vi editor. We start by adding a heading row as a comment:

    root@samqfs1mds:~# vi /etc/opt/SUNWsamfs/samdb.conf
            #FS_NAME:HOST:USER:PASSWORD:NAME:PORT:CLIENT_FLAG:MOUNT_POINT
    
  3. In the first column of the samdb.conf file, enter the family-set name for the file system, followed by a colon (:) as a column separator.

    In the example, we enter the family-set name samqfs1:

    root@samqfs1mds:~# vi /etc/opt/SUNWsamfs/samdb.conf
    # /etc/opt/SUNWsamfs/samdb.conf
            #FS_NAME:HOST:USER:PASSWORD:NAME:PORT:CLIENT_FLAG:MOUNT_POINT
    samqfs1:
    
  4. In the second column, enter the hostname for the MySQL database server, followed by a colon (:) as a column separator.

    In the example, we are co-hosting the database server on the Oracle HSM metadata server host, samqfs1mds. So we enter the hostname localhost:

    root@samqfs1mds:~# vi /etc/opt/SUNWsamfs/samdb.conf
    # /etc/opt/SUNWsamfs/samdb.conf
            #FS_NAME:HOST:USER:PASSWORD:NAME:PORT:CLIENT_FLAG:MOUNT_POINT
    samqfs1:localhost:
    
  5. In the third column, enter the user name that the Oracle HSM software uses when accessing the MySQL database, followed by a colon (:) as a column separator.

    In the example, we have created the user samqfs for the purpose of logging in to the database:

    root@samqfs1mds:~# vi /etc/opt/SUNWsamfs/samdb.conf
    # /etc/opt/SUNWsamfs/samdb.conf
            #FS_NAME:HOST:USER:PASSWORD:NAME:PORT:CLIENT_FLAG:MOUNT_POINT
    samqfs1:localhost:samqfs:
    
  6. In the fourth column, enter the password that the Oracle HSM software uses when accessing the MySQL database, followed by a colon (:) as a column separator.

    In the example, we use a dummy password, P^ssw0rd:

    root@samqfs1mds:~# vi /etc/opt/SUNWsamfs/samdb.conf
    # /etc/opt/SUNWsamfs/samdb.conf
            #FS_NAME:HOST:USER:PASSWORD:NAME:PORT:CLIENT_FLAG:MOUNT_POINT
    samqfs1:localhost:samqfs:P^ssw0rd:
    
  7. In the fifth column, enter the name of the MySQL database, followed by a colon (:) as a column separator.

    In the example, we name the database samqfs1db:

    root@samqfs1mds:~# vi /etc/opt/SUNWsamfs/samdb.conf
    # /etc/opt/SUNWsamfs/samdb.conf
            #FS_NAME:HOST:USER:PASSWORD:NAME:PORT:CLIENT_FLAG:MOUNT_POINT
    samqfs1:localhost:samqfs:P^ssw0rd:samqfs1db:
    
  8. In the sixth column, enter the TCP/IP port of the database server, followed by a colon (:) as a column separator.

    In the example, we enter 0 (zero). If we were using a remote server, a zero (or blank) value would specify the default port, 3306. But, since we are using localhost, the zero serves merely as a place holder:

    root@samqfs1mds:~# vi /etc/opt/SUNWsamfs/samdb.conf
    # /etc/opt/SUNWsamfs/samdb.conf
            #FS_NAME:HOST:USER:PASSWORD:NAME:PORT:CLIENT_FLAG:MOUNT_POINT
    samqfs1:localhost:samqfs:P^ssw0rd:samqfs1db:0:
    
  9. In the seventh column, enter a MySQL client flag, followed by a colon (:) as a column separator.

    The MySQL client flag is usually set to 0 (zero). But various combinations of values can be set to enable particular MySQL features. For details, see the MySQL documentation for the mysql_real_connect() function.

    In the example, we enter 0 (zero):

    root@samqfs1mds:~# vi /etc/opt/SUNWsamfs/samdb.conf
    # /etc/opt/SUNWsamfs/samdb.conf
            #FS_NAME:HOST:USER:PASSWORD:NAME:PORT:CLIENT_FLAG:MOUNT_POINT
    samqfs1:localhost:samqfs:P^ssw0rd:samqfs1db:0:0:
    
  10. In the eighth and last column, enter the mount point of the Oracle HSM file system. Save the file and close the editor.

    In the example, the file system is mounted at /hsmqfs/hsmqfs1:

    root@samqfs1mds:~# vi /etc/opt/SUNWsamfs/samdb.conf
    # /etc/opt/SUNWsamfs/samdb.conf
            #FS_NAME:HOST:USER:PASSWORD:NAME:PORT:CLIENT_FLAG:MOUNT_POINT
    samqfs1:localhost:samqfs:P^ssw0rd:samqfs1db:0:0:/hsmqfs/hsmqfs1
    :wq
    root@samqfs1mds:~# 
    
  11. Create a new database and associated tables. Use the command samdb create family_set, where family_set is the family-set name specified for the Oracle HSM file system in the /etc/opt/SUNWsamfs/mcf file.

    The default database schema is /opt/SUNWsamfs/etc/samdb.schema. You may specify an alternative by entering the command as samdb create family_set -s schema, where schema is the path and name of a schema file.

    In the example, we use the default schema to create a database for file-system family set samqfs1.

    root@samqfs1mds:~# samdb create samqfs1 
    
  12. Populate the database with the data contained in the database load file that you created in the preceding procedure. Use the command samdb load family_set input_file, where family_set is the family-set name specified for the file system in the /etc/opt/SUNWsamfs/mcf file and input_file is the path and name of the database load file.

    In the example, we load the database for file-system family set samqfs1 using the database load file /root/hsmqfs1dataload.

    root@samqfs1mds:~# samdb load samqfs1 /root/hsmqfs1dataload
    
  13. Check the database for consistency. Use the command samdb check family_set, where family_set is the family-set name specified for the file system in the /etc/opt/SUNWsamfs/mcf file.

    The samdb check command compares the database entries with the current file system metadata. It notes and, where possible, corrects inconsistencies that may have arisen during the load process.

    In the example, we load the database for file-system family set samqfs1 using the database load file /root/hsmqfs1dataload.

    root@samqfs1mds:~# samdb check samqfs1
    
  14. Next, mount the Oracle HSM file system with database support enabled.

Mount the Oracle HSM File System with Database Support Enabled

  1. Log in to the Oracle HSM metadata server host as root.

    root@samqfs1mds:~#  
    
  2. Back up the /etc/vfstab file.

    root@samqfs1mds:~# cp /etc/vfstab /etc/vfstab.backup
    
  3. Open the /etc/vfstab file in a text editor, and scroll down to the entry for the file system for which you created the database.

    In the example, we use the vi editor. We scroll down to the entry for the samqfs1 file system:

    root@samqfs1mds:~# vi /etc/vfstab 
    #File
    #Device    Device   Mount     System  fsck  Mount    Mount
    #to Mount  to fsck  Point     Type    Pass  at Boot  Options
    #--------  -------  --------  ------  ----  -------  -------------------------
    /devices   -        /devices  devfs   -     no       -
    ...
    samqfs1    -        /hsmqfs1  samfs   -     yes      ... ,partial=64
    
  4. In the last column of the /etc/vfstab file, add sam_db to the mount options list for the file-system. Then save the file and close the editor.

    In the example, enable the sideband database on the samqfs1 file system:

    root@samqfs1mds:~# vi /etc/vfstab 
    #File
    #Device    Device   Mount     System  fsck  Mount    Mount
    #to Mount  to fsck  Point     Type    Pass  at Boot  Options
    #--------  -------  --------  ------  ----  -------  -------------------------
    /devices   -        /devices  devfs   -     no       -
    ...
    samqfs1    -        /hsmqfs1  samfs   -     yes      ... ,partial=64,sam_db
    :wq
    root@solaris:~# 
    
  5. Mount the Oracle HSM archiving file system.

    When a file system is mounted with the sam_db option, the Oracle HSM software starts the processes that update the sideband database.

    In the example, we mount the file system /hsmqfs1:

    root@samqfs1mds:~# mount /hsmqfs1
    
  6. Next, go to "Configuring Notifications and Logging"