Upgrade the Old Database (Task 9)

Upgrade the old STA database schema to the latest one for STA.

If upgrading from several levels down, the upgrade script will automatically perform multiple transformations until the database is up to the latest schema.
  1. Stop all STA services:
    $ STA stop all
    
  2. If you determined in Verify the Environment Meets Requirements that the size of /tmp is not sufficient for the upgrade, increase the size of /tmp as necessary.

    If this is not possible, set an environment variable for MySQL to use an alternate temp location:

    1. Create an alternate temp location and assign open permissions to it. For example:
      $ mkdir /dbbackup/tmp
      $ chmod 777 /dbbackup/tmp
      
    2. Stop MySQL: $ STA stop mysql
    3. Edit the MySQL configuration file. For example:
      $  vi /etc/my.cnf
      
    4. In the mysqld section of the file, add a line defining the alternate temp location, which is identified by the tmpdir variable. Following is an example of the file after this line has been added.
      [mysqld]
      #----- mysqld MySQL Server Options -------------------------
       
      tmpdir                          = /dbbackup/tmp
      server-id                       = 1
      ...
      
    5. Restart MySQL: $ STA start mysql
  3. Change to the database updates directory.
    $ cd /<Oracle_storage_home>/StorageTek_Tape_Analytics/db/updates
    
  4. Start the upgrade script.

    For example:

    $ ./upgradedb.sh
    
  5. Wait until you see the finish banner before proceeding.
    +-------------------------------------------------------------+
    | Started.................2021-04-09 08:15:31                 |
    | Finished................2021-04-09 08:17:51                 |
    | Elapsed Time............01:52:26                            |
    | Starting Version........65.00r0                             |
    | Final Schema Version....74.00r0                             |                
    | Schema Release Date.....2021-04-07 17:06:02                 |
    | Records (approximate)...4,819,802                           |
    +-------------------------------------------------------------+
    

    The log files in /var/log/tbi/install also contain a record of the upgrade progress. If you previously upgraded the database with sudo or root access, the log files were created with root ownership. Now, if you upgrade using the oracle user, you may see the following message (where the ## can vary):

    /usr/bin/mysql: Can't create/write to file '/var/log/tbi/install/apply_updates##.log' (Errcode: 13 - Permission denied)

    This error results from the oracle user trying to update the log file which has root ownership. The error causes no problem for the actual database upgrade and the success of the upgrade can be verified in the finish banner.

  6. If you increased the size of /tmp or created an alternate temp location, restore it to its normal size and location.
  7. Start all STA services:
    $ STA start all
    
  8. This step is optional. Delete the STA_FRESH_INSTALL_BACKUP.sql file to free up disk space on the STA database backup volume.
  9. To check the level of the database, log into the STA GUI and click About... in the bottom right of the screen. Verify the Current Database Schema Version: 74.00.