2 Installing and Configuring the Oracle Database

This chapter describes installation and configuration of the DIVArchive databases and Backup Service and includes the following information:

Exporting the Database Dump Files

There are two methods for exporting the dump files:

Export the Database Dump Files Using DIVADBinstaller

For 7.6.2+, using DIVADBInstaller you can backup the database using data-pump export. The backup dump file has the naming convention USERNAME_Month_Date_Year_Hour-Minute-Second.DMP (for example: DIVAUSER_07_11_2018_12-32-11.DMP).

To create a backup execute DIVADBInstaller with the following:

  • Set --jobtype as backup

  • Set the --dbdumpdirectory location for the backup. If --dbdumpdirectory is omitted, it will default to H:/ for Windows and /u04 for Linux.

Example

DIVADBInstaller --dbuser=DIVA --dbpass=divapass --syspass=syspass --dbhost=localhost --dbport=1521 --jobtype=backupjob --dbdumpdirectory=H:\Backup

Export the Database Dump Files Using sqlplus

For 7.6.1 or below, you must perform the following procedure on the source computer:

  1. Open sqlplus and log in as the sys user.

  2. Execute the following commands to create the directory object:

    CREATE OR REPLACE DIRECTORY {directory_object_name} AS {'TargetPath'};
    
    GRANT READ,WRITE ON DIRECTORY {directory_object_name} TO {source_username};
    

    Windows Example:

    CREATE OR REPLACE DIRECTORY diva_dpump_dir AS 'H:\Support\DUMPS';
    GRANT READ,WRITE ON DIRECTORY diva_dpump_dir TO DIVA;
    exit;
    

    Linux Example:

    CREATE OR REPLACE DIRECTORY diva_dpump_dir AS '/u05/support/DUMPS';
    GRANT READ,WRITE ON DIRECTORY diva_dpump_dir TO DIVA;
    exit;
    
  3. Open a command prompt and execute the following command to export to the dump file:

    expdp {source_username}/{source_user_password} schemas={source_username} flashback_time=systimestamp DIRECTORY={directory_object_name} dumpfile={dump_file_name} logfile={log_file_name}
    

    Windows and Linux Example:

    expdp DIVA/password schemas=DIVA flashback_time=systimestamp directory=diva_dpump_dir dumpfile=diva_db.dmp logfile=diva_exp.log
    

Importing the Database Dump Files

There are two methods for importing the database dump files:

Import the Database Dump File Using DIVADBInstaller

For 7.6.2+, using DIVADBInstaller you can restore or import the DIVA database from a previous state if required. using the --jobtype=restorejob , and the dump file name using --dbdumpfilename.

To restore or import the database, execute DIVADBInstaller with the following:

  • Set the --jobtype to restorejob

  • Specify the location of the dump file using --dbdumpdirectory

  • Specify the name of the dump file using --dbdumpfilename

    If the source user name of the dump file is different from the --dbuser, you must also specify the source user name using --dbimportfromuser.

Example - Same Source User Name

DIVADBInstaller --dbuser=DIVA --dbpass=divapass --syspass=syspass --dbhost=localhost --dbport=1521 --jobtype=backupjob --dbdumpdirectory=/u04/backup --dbdumpfilename=DIVA_07_11_2018_12-32-11.DMP

Example - Different Source User Name

DIVADBInstaller --dbuser=DIVA --dbpass=divapass --syspass=syspass --dbhost=localhost --dbport=1521 --jobtype=backupjob --dbdumpdirectory=/u04/backup --dbdumpfilename=DIVA_07_11_2018_12-32-11.DMP --dbimportfromuser=DIVA_75

Import the Database Dump File Using sqlplus

For 7.6.1 or below, perform the following procedures on the destination computer:

  1. Open sqlplus and log in as the sys user.

  2. Execute the following commands to create the directory object:

    CREATE OR REPLACE DIRECTORY {directory_object_name} AS {'TargetPath'};
    
    GRANT READ,WRITE ON DIRECTORY {directory_object_name} TO { destination_username};
    

    Windows Example:

    CREATE OR REPLACE DIRECTORY diva_dpump_dir AS 'H:\Support\DUMPS';
    GRANT READ,WRITE ON DIRECTORY diva_dpump_dir TO DIVA;
    exit;
    

    Linux Example:

    CREATE OR REPLACE DIRECTORY diva_dpump_dir AS '/u05/support/DUMPS';
    GRANT READ,WRITE ON DIRECTORY diva_dpump_dir TO DIVA;
    exit;
    
  3. Open a command window and copy the exported dump file to the {'TargetPath'}.

    For example: H:\Support\DUMPS (Windows) or /u05/support/DUMPS (Linux)

  4. Navigate to the %DIVA_HOME%\program\database\core\install folder in your DIVArchive installation.

  5. Create a DIVArchive database user with the following command:

    Windows: create_diva_user.bat syspass DIVA2 divapass -useronly

    Linux: create_diva_user.sh syspass DIVA2 divapass -useronly

  6. Execute the import command as follows:

    impdp {destination_username}/{user_password} transform=OID:n:type DIRECTORY={directory_object_name} dumpfile={dump_file_name} table_exists_action=replace REMAP_SCHEMA={source_username}:{destination_username} logfile={log_file_name}
    

    Example:

    impdp DIVA2/pass transform=OID:n:type DIRECTORY= diva_dpump_dir dumpfile= diva_db.dmp table_exists_action=replace REMAP_SCHEMA=DIVA:DIVA2 logfile=diva_imp.log
    

Uninstalling the Oracle Database Server (if required)

Before installing the new DIVArchive Oracle Database, you may be required to uninstall the existing database and database engine. If Oracle Database is already installed on the computer, then you must remove the existing database and database engine.

Uninstalling the Oracle Database Server in Windows

Use the following procedure to uninstall the existing database in Windows environments:

Caution:

Use the same Oracle Database package to uninstall the database that was used to install it.
  1. Stop all running DIVArchive services.

  2. Export the existing database contents using the procedures previously described.

    Caution:

    Confirm the export completed successfully before continuing.
  3. Extract the original database .zip file used to perform the installation.

  4. For DIVArchive database package releases 2.3.4 and earlier, use the following commands in the exact sequence shown:

    uninstall_database.cmd
    
    uninstall_engine.cmd
    
  5. For DIVArchive database packages release 3.0.0 and later, execute C:\app\Oracle\product\12.1.0\db_home1\deinstall\deinstall.bat and follow the displayed instructions.

Uninstalling the Oracle Database Server in Linux

Use the following procedure to uninstall the existing database (package release 3.0.0 and later) in a Linux environment:

  1. Log in as the Oracle operating system user.

  2. Open a terminal window.

  3. Export the existing Oracle database.

  4. Execute $ORACLE_HOME/deinstall/deinstall and follow the displayed instructions.

Installing the Oracle Database Server in Windows

You must log in to the computer as an Administrator. After you have backed up and uninstalled the existing database (see the previous sections in this chapter), use the following procedure to install the new database:

  1. Locate the latest release of the DIVAOracle database package for Windows and unzip it.

  2. Execute install.bat to start the installation.

  3. Follow the prompts through the wizard to complete the installation.

  4. Import the previously exported data into the new database using the procedure previously described.

Assuming no errors occurred, you have successfully installed the database and imported the existing data from the original database.

Installing the Oracle Database Server in Linux

Before running the installer verify the following is complete:

  • Yum is configured to connect to the latest release of Oracle Linux.

  • The recommended partitions for the Oracle Database exist. Oracle recommends partitions that dedicate the space to the Oracle Database.

    • /u01 partition for the Oracle Binaries

    • /u02 partition for the Oracle Database files (8 KB cluster size recommended)

    • /u03 partition for the Oracle Archive Logs (4 KB cluster size recommended)

    • /u04 partition for the Oracle database backups (64 KB cluster size recommended)

To begin installation, locate the latest release of the DIVAOracle database package for Linux, execute it as root, and follow the displayed instructions.

Pre-requisites for Installing the Oracle Database: Configure Shared Memory

If the shared memory on the server where the Oracle Database is installed is less than 16 GB, you must set it to at least 70 percent of your RAM.

  1. Use the following command to confirm the computer's RAM size:

    # free -m
    

    The output will look similar to the following:

          total        used        free      shared  buff/cache   available
    Mem:  15791         186       15456           8         148       15516
    Swap: 16380           0       16380
    
  2. Use the following command to check your shared memory setting in MB:

    # df -m /dev/shm
    

    The output will look similar to the following:

    Filesystem     1M-blocks  Used Available Use% Mounted on
    tmpfs            7896       0    7896     0%   /dev/shm
    
  3. To change the size of shared memory you must add the following line into /etc/fstab. The setting must not exceed the size of your installed memory. You must restart the computer after making this change for it to take affect.

    For example, the following command will increase the size of /dev/shm to 11GB:

    tmpfs /dev/shm tmpfs defaults,size=11g 0 0
    

Pre-requisite for Installing the Oracle Database: Creating Drive Partitions

First you must configure the drive partitions for the Oracle Database as follows:

  1. Navigate to Applications, and then Utilities.

  2. Click Disks from the menu.

  3. Locate your disk in the Disks dialog box. Selecting the disk will display the Device Name.

  4. In Linux you must add the disk (that you want to add partitions to) to the partition table using the fdisk utility. For example, fdisk /dev/xvdb1. You can use the g and w options to add it to the partitions table.

  5. Click the Plus button on the right side of the Disks dialog box to add a partition.

  6. When the Create Partition dialog box appears create the following four partitions. For each partition leave the Erase option and Type option at their default settings, and then click Create. Repeat this step for each partition.

    /u01

    This partition must be 10 GB in Linux. Use the operating system default block size.

    /u02

    This partition must be 30 GB in Linux. Oracle recommends using an 8 KB cluster size.

    /u03

    This partition must be 5 GB in Linux. Oracle recommends using a 4 KB cluster size.

    /u04

    This partition must be either 100 GB or all of the remaining disk space. Oracle recommends using a 64 KB cluster size.

  7. When you are done creating the partitions and returned to the Disks dialog box, click the Gears icon on the right side of the screen.

  8. Click Edit Mount Options.

  9. Change Automatic Mount Options to OFF.

  10. Select the Mount at startup check box.Enter the appropriate mount point in the Mount Point field for that specific partition (/u01, /u02, /u03, /u04).

  11. Click OK.

  12. When this is completed successfully, all four partitions are identified and displaying their appropriate mount points in the Disks dialog box.

Use the following procedure for the Managed Disk partition (this must be 54 GB):

  1. Locate the Managed Disk in the Disks dialog box.

  2. Click the Gears icon on the right side of the screen.

  3. Click Format.

  4. Leave all settings at their defaults, but enter /managed in the Mount Point field.

  5. Click Format.

  6. When asked, click Format to confirm that you want to format the disk.

  7. Click the Gears icon.

  8. Click Edit Mount Options.

  9. Change Automatic Mount Options to OFF.

  10. Select the Mount at startup check box.

  11. Enter /managed in the Mount Point field.

  12. Confirm that the Filesystem Type is set to ext4.

  13. Click OK.

Installing the Oracle Database Server

Verify you have completed the following:

After completing the pre-requisites, use the following procedure to install the Oracle Database Server:

  1. Open a terminal console.

  2. If you run in a Virtual Machine (VM), confirm that your host name is in the /etc/hosts file using the following command:

    gedit /etc/hosts
    

    If the hosts file looks similar to this:

    127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
    ::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
    

    You must replace localhost with your host name. For example, if the host name is clefvm015L, it will look like this:

    127.0.0.1   celfvm015L localhost.localdomain localhost4 localhost4.localdomain4
    ::1         celfvm015L localhost.localdomain localhost6 localhost6.localdomain6
    
  3. If you made changes to the host file save the changes and exit gedit.

  4. Change to the directory of the shell script for the Oracle Database Package.

  5. Change the permissions on the shell script using the following command to make it an executable file:

    chmod +x OracleDivaDB_3-0-0_12_1_0_2_0_SE2_OEL7_x86_64.sh
    
  6. Execute the script as follows:

    ./OracleDivaDB_3-0-0_12_1_0_2_0_SE2_OEL7_x86_64.sh
    

    If an Oracle operating system account has already been created, you may be asked whether you want to change the password. Follow the prompts if you require a password change for this account.

  7. When prompted for a SYS account password, ensure you use a secure password.

If at some point during the installation you receive the following error:

[FATAL] [INS-35172] Target database memory (5181MB) exceeds available shared memory (3866MB) on the system

You must run the commands below to extend your tmpfs partition (if it is still not large enough):

  1. Check the current size of the tmpfs partition:

    df -h /dev/shm
    
  2. Extend the amount of the target database memory size as follows:

    1. Execute gedit /etc/fstab.

    2. Add the following line to the bottom of the file:

      tmpfs /dev/shm tmpfs defaults,size=6G 0 0
      
    3. Save the file and exit gedit.

  3. Execute the following commands:

    umount tmpfs
    mount -a
    
  4. If the commands in Step 3 do not work, restart the computer and run the df -h /dev/shm command again to check that the size of tmpfs has actually increased.

  5. Run the Oracle Database shell script again.

Installing the DIVA Database User and Schema

DIVArchive 7.6.2 has DIVADBinstaller which can install a new DIVA database or upgrade an existing DIVA database on the Oracle Database Server. For 7.6.1, you must manually create the user.

Using DIVADBinstaller for 7.6.2+

Verify Oracle Database Version

Verify the existing Oracle Database Server release before upgrading a system to DIVArchive 7.6.2. Oracle Database Server must be at a minimum of 11.2.0.4. You can verify the release level by navigating to C:\app\oracle and opening the VERSION.TXT file. The release number is displayed in the file.

Installer Location

The database installer DIVADBInstaller.bat (Windows) or DIVADBInstaller.sh (Linux) can be found under <DIVA_HOME>/Database/DBInstaller/bin.

DIVADBInstaller Parameters

Table 2-1 DIVADBInstaller Parameters

Parameter Description

--dbuser=<username>

DIVA Database username. Required.

--dbpass=<password>

DIVA Database username password. Required.

--syspass=<syspassword>

SYS Database username password. Required.

--jobtype=<jobtype>

Job type to executed can be one of the following:

  • installjob — does a fresh install

  • upgradejob — upgrades the DIVA database

  • backupjob — performs a datapump export of the DIVA database

  • restorejob — performs a datapump import to the DIVA database user form the file mentioned in --dbdumpfilename

If Jobtype is omitted, its defaults to installjob if the user does not exist or upgradejob if the user already exists.

--jobname=<jobname>

Given a custom name for the job execution. Optional and defaults to the system timestamp.

--dbhost=<databaseHost>

Database hostname or ipaddress. Optional and defaults to localhost.

--dbport=<databasePort>

Database port. Optional and defaults to 1521.

--dbservicename=<dbServiceName>

Database service name. Optional and defaults to lib5.world.

--dbsecureconnect=<"TRUE|FALSE">

Enables secure connection to Database. Optional and defaults to FALSE.

--dbdumpdirectory=<dbdumpdirectory>

Database dump directory. Optional and defaults to H:/ for Windows and /u04 for Linux

--dbdumpfilename=<dbdumpfilename>

Database dump filename.

--dbimportfromuser=<dbimportfromuser>

Dump filename source username if differnet than --dbuser,Mandatory only for --jobtype=importjob. Defaults to NULL.


Example Fresh Installation of DIVA Database

DIVADBInstaller --dbuser=DIVA --dbpass=divapass --syspass=syspass --dbhost=localhost --dbport=1521 --dbservicename=lib5.world --jobtype=installjob

Example Upgrade Installation of DIVA Database

DIVADBInstaller --dbuser=DIVA --dbpass=divapass --syspass=syspass --dbhost=localhost --dbport=1522 --dbservicename=lib5.world --dbsecureconnect=TRUE --jobtype=upgardejob

The database installer always backs up the existing user using data-pump export before upgrading. The backup dump file is under the --dbdumpdirectory location on the Database server. If you omit --dbdumpdirectory, it will default to H:/ in Windows and /u04 in Linux.

Manually Create the Database User and Schema for 7.6.1 and below

Note:

If upgrading 7.2.2 and lower using 7.6.2 installer, you must manually update the actor configuration and actor partial restore configuration in the database using the config utility. See "Actor Configuration in the Database" in the Installation Guide.

The database user must be created using the DIVA operating system user account. Use the following procedure to create the database user:

  1. Open a terminal console.

  2. Change to the DIVA_HOME/Program/Database/Core/Install directory.

  3. Execute create_diva_user.bat (Windows) or create_diva_user.sh (Linux), which creates the given DIVA database user and its associated tables

    Usage:

    create_diva_user syspasswd username userpasswd oracle_connection [-useronly|-tablesonly] [-custom_tablespaces tables_tablespace indexes_tablespace temp_tablespace]
    
    create_diva_user {DIVA|SYS} current_password new_password [-orapwd]
    

    Parameter Definitions: 

    • syspasswd — Password of the Oracle 'sys' account

    • username — Username to create

    • userpasswd — Associated user password

    • oracle_connection — Oracle TNS service name or Oracle connection string (such as IP_ADDRESS:PORT/ORACLE_SERVICE_NAME)

    • DIVA|SYS — Mention either DIVA or SYS to reset the repective password in the password file

    • new_password — New password

    • current_password — Current password. If there is no current database password, then enter the new password for the is parameter.

    • -useronly — Only creates the database user and no database objects

    • -tablesonly — Only creates the database objects for the given user.

    • -custom_tablespaces — Use of custom tablespaces

      • tables_tablespace — tablespace for tables

      • indexes_tablespace — tablespaces for indexes

      • temp_tablespace — database temp tablespace

    • -orapwd — Option to reset/generate password file.

Secure Communication with Oracle Database

With DIVA 7.6.1, a new DIVAOracle package version 3-1-0 was created:

  • Windows: OracleDivaDB_3-1-0_12_2_0_1_0_SE2_Windows_64-bit

  • Linux: OracleDivaDB_3-1-0_12_2_0_1_0_SE2_OEL7_x86_64

This new package includes the following

  1. Secure Oracle Database listener listening on port 1522, additional on top of the regular unsecured listener listening on port 1521.

  2. Oracle Database wallet for storing the Trust Certificate and DIVADatabaseServer Certificates. During installation DIVADatabaseServer.jks holding the default DIVA_CA trust certificate and Default DIVADatabaseServer certificate is import into the Oracle Database wallet for enabling the secure communication.

  3. This new package also creates a secure TNSNames LIB5SSL which enables any DIVA services to connect to the oracle database securely over SSL connecting to the new secure Oracle database listener listening on port 1522 using the TNSNames.

New Entry in TNSNames.ora:
LIB5SSL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCPS)(HOST = HOSTNAME)(PORT = 1522))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = LIB5.WORLD)
    )
  ) 

A new Configuration Parameter "DIVAMANAGER_DB_SECURE_CONNECT" was added to the Manager,Migrate,DBBackup configuration file to enable secure communication to database using Hostname/IPAddress and port. This parameter has no effect if using DIVAMANAGER_TNSNAME parameter in the configuration file.

Valid parameter values are:

  • TRUE - When set to TRUE, the DIVAMANAGER_DBPORT in the Manager,Migrate,DBBackup configuration file must point to the secure port of the Oracle Database.

  • FALSE (default)

The Configuration Utility and Control GUI also supports connecting securely to the database. SPMService can connect securely only using TNS names.

Migrating Oracle Database Server from 11.2 to 12.1

This section describes the procedures to migrate DIVArchive releases with Oracle 11g installed. Typically this procedure is performed to upgrade installations with legacy DIVArchive installations to a current release. See Appendix A for Oracle DIVArchive options and licensing information.

Preparing the Source Computer (DIVArchive Manager with Oracle Database 11.2)

Use the following procedure to export the DIVArchive Manager and file system data from the source computer:

  1. Stop all running DIVArchive services, and then export the database to a dump file. See Exporting the Database Dump Files.

  2. Copy the dump file from the source computer to the target computer.

Updating the Destination Computer (DIVArchive Manager with Oracle Database 12.1)

Use the following procedure to import the DIVArchive Manager and file system data to the destination computer:

  1. Stop all running DIVArchive services.

  2. Install Oracle 12.1 on the destination computer. See Installing the Oracle Database Server in Windows,or Installing the Oracle Database Server in Linux for instructions depending on your operating system environment.

  3. Import the database dump file on the destination computer. See Importing the Database Dump Files.