Previous Topic

Next Topic

How You Perform an Upgrade Using Unload/Reload

A database unload/reload ensures a clean start with a fresh database.

To perform an upgrade using unload/reload, use the following process.

Note: In this process, the notation [Each DB] means: "For each database, not including the iidbdb (master database), become the DBA for that database, cd to the unload directory for the database created in Step 1, and perform this step." If using Ingres Star, include the coordinator database in the list of databases. Steps that apply to a particular upgrade type only (that is, in-place upgrade or clean install upgrade) are marked accordingly.

  1. [Each DB including iidbdb] Create unload directory.
  2. [Each DB] Run unloaddb.
  3. [Each DB] Check for obsolete users.
  4. (Optional) [Each DB Including iidbdb] Checkpoint the database.
  5. Disable user access.
  6. Disable Remote Command Server.
  7. Shut down Ingres and back up system.
  8. [Each DB] Unload the database.
  9. (Optional) [Each DB] Print optimizer statistics.
  10. [Each DB] Record database information.
  11. Record database privileges.
  12. Save users, groups, and roles.
  13. [Each DB] Destroy the database.
  14. Clean iidbdb database.
  15. Shut down ingres.
  16. Disable Ingres startup.
  17. Preserve site modifications.
  18. (Optional) Delete install directory (UNIX).
  19. Install Ingres.
  20. Create imadb database.
  21. Restore site modifications.
  22. Review Ingres configuration.
  23. Set up Ingres Net.
  24. Start Ingres.
  25. Recreate users, groups, and roles.
  26. Recreate locations.
  27. [Each DB] Recreate the database.
  28. [Each DB] Extend the database.
  29. Recreate database privileges.
  30. [Each DB] Fix FE reload script.
  31. [Each DB] Reload the database.
  32. [Each DB] Upgrade front-end catalogs.
  33. [Each DB] Reapply optimizer statistics.
  34. [Each DB] Checkpoint the database.
  35. Install upgraded applications.

For details on these steps, see the following sections.

Previous Topic

Next Topic

Create Unload Directory

You should create a directory to hold scripts and data from the unloaded database.

Note: This directory requires a large amount of disk space. As an estimate, the unloaded data is about the same size as the Ingres database; however, compressed data can expand to take up much more space than the Ingres database.

To create a directory, issue the following commands for each database:

UNIX:

mkdir /someplace/dbname

chmod 777 /someplace/dbname

Windows:

mkdir d:\someplace\dbname

Previous Topic

Next Topic

Run Unloaddb

Run unloaddb against each database. The unloaddb command does not unload the database; it simply creates scripts.

For Ingres Star databases, unload the CDB in the same way as for a local database. For a DDB, use unloaddb/star.

For a regular DB or CDB, issue this command:

unloaddb dbname

For an Ingres Star DDB, issue this command:

unloaddb ddbname/star

If doing a clean-install upgrade to a different machine that has a newer architecture, binary data may not be compatible between the two machines. If this is the case, use the unloaddb c option, which causes an ASCII instead of binary unload.

Previous Topic

Next Topic

Check for Obsolete Users

Old databases may have objects created by users who no longer exist. Check for obsolete users for each database.

To check for obsolete users:

  1. Examine the scripts created by unloaddb in the step Run Unloaddb of the upgrade procedure.

    Each script contains set session authorization SQL statements for each user who owns a database object.

  2. Search for the set session authorization statements, and make sure that all users listed are valid.
  3. Delete all the lines from the unwanted set session authorization statement up to the next one, if obsolete users are found.
  4. Go into the database and clean out these unwanted objects.

Previous Topic

Next Topic

(Optional) Checkpoint the Database

Note: This step is optional. You can omit this step if you can rely on the system backup to be taken in the later step Shut Down Ingres and Back Up System.

Follow these steps:

  1. Checkpoint each database, including the iidbdb
  2. Copy the checkpoint files to a permanent medium such as tape. Use fresh tape.
  3. Verify that the tape can be read.

Previous Topic

Next Topic

Disable User Access

During the upgrade, the production system is not available for use. Make sure that users are not able to access the databases until the upgrade is complete.

Previous Topic

Next Topic

Disable Remote Command Server

The Remote Command Server component of Visual DBA must be disabled for the duration of the upgrade. The Remote Command Server uses the iidbdb database as a communications mechanism in versions of Ingres prior to 2.6, so it will interfere with upgrading.

Note: If you are upgrading from early versions of OpenIngres 1.x, and you do not see an entry in CBF for the Remote Command Server, skip this step.

To disable the Remote Command Server

  1. Run Configuration-By-Forms.
  2. Locate the row for the Remote Command Server.
  3. Note the startup count and record this value for later.
  4. Use the EditCount function to set the startup count to zero.

Previous Topic

Next Topic

Shut Down Ingres and Back Up System

You should perform a clean shutdown of Ingres, clearing all transactions from the transaction log, and then back up your system.

To perform a clean shutdown of Ingres

  1. Shut down Ingres.
  2. Restart Ingres.
  3. Shut down Ingres again.
  4. Check the recovery process log (iircp.log) for the message "RCP Shutdown completed normally."

To back up your system

  1. Use a command appropriate to the platform to perform the backup.
  2. Back up all Ingres directories, including data, checkpoint, journal, dump areas, and the $II_SYSTEM/ingres directory containing Ingres files and executables.
  3. Back up the application directories

    Note: Watch for symbolic links and cross-mounts; make sure real data is saved and not a symbolic link.

  4. Include the root file system in the backup if Ingres is typically started up at boot time. Alternatively, print a copy of any Ingres boot time startup and shutdown scripts.
  5. Perform the backup twice to ensure that you have an extra copy of your backup. This step ensures maximum safety.
  6. Check the backup media to ensure that the backup can be read. If your backup medium is tape, use new tapes, and clean the tape drive before the backup.
  7. Restart Ingres.

Previous Topic

Next Topic

Unload the Database

For each database, run the unload.ing script created by the unloaddb command. The database is unloaded into your unload directory.

Previous Topic

Next Topic

(Optional) Print Optimizer Statistics

Note: This step applies only to a clean-install upgrade.

Print optimizer statistics for each database. If your upgrade plan allows enough downtime to run a full optimizedb against your databases, you can omit this step. If your plan does not allow enough downtime, perform this step as a shortcut.

Note: Using this shortcut may result in some of the new Ingres metrics not being available; query performance may suffer until a full optimizedb can be completed.

If you are upgrading from OpenIngres 1.x, you should regenerate new statistics instead of saving the old ones, if possible.

To print the existing optimizer statistics, run statdump with the -o flag to a file for each database, as follows:

statdump -o dbname.stats dbname

Previous Topic

Next Topic

Record Database Information

For each database, you will need to know information such as whether the database was journaled, where the database resides, and in what order the data locations were configured.

To record database information

  1. Run infodb against each database. Issue the following command:

    infodb dbname >infodb.out

    Save the output for later.

  2. Record whether the database is public or private.

    To find out, use the catalogdb command. Select Databases, and then enter the database name. The screen that appears has an Access field that indicates whether the database is public or private.

Previous Topic

Next Topic

Record Database Privileges

To record database privileges

  1. As the installation owner, change directories to the unload directory for iidbdb created in Step 1 of the upgrade procedure.
  2. Run the following SQL to save user database privileges:

    sql iidbdb
    \script dbprivs.out
    select *
    from iidbprivileges
    where database_name <> ''
    order by database_name,grantee_name
    \go
    \script
    \quit

    The file dbprivs.out is created for future reference.

Previous Topic

Next Topic

Save Users, Groups, and Roles

Note: This step is required only for a clean-install upgrade.

To save users, groups,and roles

  1. As the installation owner, change directory to the iidbdb unload directory created in Step 1 of the upgrade procedure.
  2. Run the following SQL to save users, groups, and roles:

    sql iidbdb
    copy iiusergroup (
      groupid=c0comma,groupmem=c0nl
    ) into 'groups.out'
    \go

     copy iirole(
      roleid=c0nl
    ) into 'roles.out'
    \go

    create table role_tmp as
    select role_name,grantee_name
    from iirolegrant
    where admin_option <> 'Y'
    \go
    copy role_tmp(
      role_name = c0comma,
      grantee_name = c0nl
    ) into 'rolegrants.out';
    drop role_tmp;
    \go
     \quit

  3. Run accessdb, and select Users, then SqlScript.

    A file called users.sql is written that will recreate all users, as they are currently defined.

Previous Topic

Next Topic

Destroy the Database

Note: This step is required only for an in-place upgrade.

Destroy each database using the destroydb command.

Previous Topic

Next Topic

Clean iidbdb Database

Note: This step is required only for an in-place upgrade.

To clean the iidbdb database

As the installation owner, run the following steps against the master database iidbdb:

Note: It is assumed that there are no objects created by users in the iidbdb.

sysmod iidbdb

verifydb -mrun -sdbname iidbdb -opurge

verifydb -mrun -sdbname iidbdb –odbms

ckpdb –j iidbdb

The verifydb command may issue the following messages, which you can ignore:

S_DU1611_NO_PROTECTS iirelation indicates that there are protections for table (owner), but none are defined.

S_DU0305_CLEAR_PRTUPS Recommended action is to clear protection information from iirelation, and S_DU1619_NO_VIEW iirelation indicates that there is a view defined for table (owner), but none exists.

S_DU030C_CLEAR_VBASE Recommended action is to clear view base specification from iirelation.

You can also ignore the "patch warning" message that warns of the loss of user tables in "runinteractive" mode. This mode will not be used.

Previous Topic

Next Topic

Disable Ingres Startup

If Ingres starts automatically when the machine boots up, turn auto-starting off until the upgrade is complete.

To disable Ingres startup and put operating system changes into effect

  1. Follow the procedures for your platform:

    UNIX: On most UNIX platforms, a file in a system startup directory performs Ingres startup and shutdown; place an "exit 0" at the top of this file. The system administrator may need to perform this step if it requires root privilege. (The system startup directory depends on your platform—/etc/init.d, or /sbin/init.d, or a similar name).

    Windows: If Ingres is run as a system service, set the service to start manually instead of automatically.

  2. Make sure that the operating system is correctly configured for your new version of Ingres, as described in How You Prepare Your System.
  3. Reboot, if necessary, to put the operating system parameter changes into effect.

Note: Step recommended even for clean install

Note: This step is recommended even if you are doing a clean installation upgrade. By leaving the old installation shut down, you eliminate the chance that someone will connect to it by mistake later.

Previous Topic

Next Topic

Preserve Site Modifications

Files distributed as part of Ingres that you have customized will be lost during the upgrade. Any custom files you have added to the $II_SYSTEM directory tree will remain.

You must copy your customized files to a safe place. Do not copy them to /tmp or anywhere in $II_SYSTEM/ingres directory.

If local collation sequence files have been customized, save the original collation definition files and the compiled files that reside in $II_SYSTEM/ingres/files/collation.

Previous Topic

Next Topic

Visual DBA Configurations

When upgrading, Visual DBA configuration files (.vdbacfg) are not upwardly compatible and must be recreated.

Note: Instead of using configuration files, you can use the vdba command with command line flags to start Visual DBA with, for example, certain windows open on given nodes. For details on the vdba command, see the Command Reference Guide.

Previous Topic

Next Topic

(Optional) Delete Install Directory (UNIX)

Note: This step is optional but recommended.

The Ingres installation procedure on UNIX starts by extracting the install subdirectory from the Ingres distribution.

You should delete the old contents of that directory first, as follows:

cd $II_SYSTEM/ingres

rm –rf install

Note: This step is required only for an in-place upgrade on UNIX.

Previous Topic

Next Topic

Install Ingres

To install Ingres, see the Ingres installation instructions for your platform.

In-place upgrades only: During the installation process, the DBMS Server setup asks whether all databases are to be upgraded; answer No. The install procedure automatically upgrades the iidbdb. If the upgrade of iidbdb fails, see the appendix "Troubleshooting Upgradedb."

After the iidbdb is upgraded, the DBMS Server setup attempts to upgrade imadb and install Remote Command Server objects into imadb. Some versions of upgradedb neglect to create imadb first, and you will get "Database does not exist: imadb" errors. These will be corrected in the next step.

Previous Topic

Next Topic

How You Upgrade to Older Versions That Require a Patch

Newer versions of Ingres distribute service packs. You can install service packs without having to install a base release of Ingres first.

UNIX: If you are upgrading to an older Ingres version that requires an overlay patch instead of a service pack, follow this procedure:

  1. Run ingbuild. When asked whether you want to set up all the Ingres components, respond No. Exit ingbuild.
  2. Install the Ingres patch.
  3. Run ingbuild again. Select Current, then SetupAll.
  4. Follow the prompts to complete the Ingres setup.

Setup now uses the fixed version.

Previous Topic

Next Topic

Create imadb Database

Note: Perform this step only if you received "Database does not exist: imadb" messages during the DBMS setup phase of your Ingres install. This should only occur if you are upgrading from OpenIngres 1.x to Ingres 2.6 or older.

To create the imadb database, as the installation owner, execute these commands:

UNIX:

ingstart
cd $II_SYSTEM/ingres/vdba
createdb '-u$ingres' imadb –f nofeclients
sql '-u$ingres' imadb <makimau.sql
rmcmdgen
ingstop

Windows:

ingstart
cd %II_SYSTEM%\ingres\vdba
createdb -u$ingres imadb –f nofeclients
sql -u$ingres imadb <makiman.sql
rmcmdgen
ingstop

As the makimau or makiman SQL scripts run, you see a series of messages such as "E_US0AC1 'some-name' does not exist or is not owned by you." These are normal and can be ignored.

Previous Topic

Next Topic

Restore Site Modifications

Restore any site-specific files that you copied in the step Preserve Site Modifications.

If the checkpoint template file cktmpl.def has been modified, the modifications may need to be carried forward into Ingres. The cktmpl.def from Ingres 6.4 cannot be used with Ingres, as the file format has changed. This means that you must recreate the changes using the Ingres 6.4 cktmpl.def as a guide. See the Ingres 6.4 Database Administrator's Guide.

If the archiver exit script acpexit was changed in Ingres 6.4, you must make the changes to the Ingres template (acpexit.def), and then move that file to $II_SYSTEM/ingres/files/acpexit.

Previous Topic

Next Topic

Review Ingres Configuration

If you are doing a clean install, you need to change the default Ingres configuration to match your site requirements.

If you are doing an in-place upgrade, the upgrade process preserves your original Ingres installation parameters. You should review the configuration because some parameters may change from version to version. For information on parameters that changed, check the Readme for your new version of Ingres.

Review your parameter settings by running Configuration-By-Forms or Configuration Manager. Especially pay attention to major items such as startup counts and DBMS cache settings. If you are doing a clean install, you can use your original Ingres installation configuration as a guide.

Note: If you disabled the Remote Command Server in the step Disable Remote Command Server, use EditCount to restore its startup count to the original value.

Previous Topic

Next Topic

Set Up Ingres Net

Create the vnode definitions for the remote installations by using netutil. If using shadow passwords on UNIX, you must run mkvalidpw. For details, see the Connectivity Guide.

If there are NFS client-only installations that have not been set up, run ingmknfs to set them up.

Previous Topic

Next Topic

Start Ingres

Run ingstart to start Ingres.

Previous Topic

Next Topic

Recreate Users, Groups, and Roles

Note: This step is required only for a clean-installation upgrade.

To recreate users, groups, and roles:

  1. As the installation owner, change directory to your iidbdb unloaddb directory where you stored the files from the step Save Users, Groups, and Roles of this upgrade procedure
  2. Run this SQL to recreate users and groups:

    sql '-u$ingres' iidbdb
    copy iiusergroup(groupid=c0comma,groupmem=c0nl)
    from 'groups.out'
    \go
    commit
    \go
    \read users.sql
    commit
    \go
    \quit

    Windows: Omit the quotes from the sql command line.

    The file users.sql may try to recreate some users that already exist in the installation, such as the installation owner and root user. This will cause "E_US18B6 The user 'name' already exists" errors. You can ignore these errors.

  3. If your original installation had roles defined, recreate them with the ADD ROLE SQL statement. Use the file roles.out as a guide.

    Roles cannot be reliably bulk-loaded from the original installation, so you must recreate them by hand. After you recreate each role, issue the following SQL statement:

    grant rolename to user; commit

    The most common user here is public. You can use the file rolegrants.out to determine what role grants are needed.

Previous Topic

Next Topic

Recreate Locations

Note: This step is required only for a clean-install upgrade.

To recreate locations:

  1. Refer to each infodb output saved in the step Record Database Information of this upgrade procedure.
  2. Create any location that is not a default installation location (ii_database, ii_checkpoint, ii_journal, or ii_dump). For more information about creating locations, see the Database Administrator Guide.

Previous Topic

Next Topic

Recreate the Database

Before creating each database, refer to the infodb output saved in the step Record Database Information of this upgrade procedure. Look at the location names for ROOT, JOURNAL, CHECKPOINT, and DUMP. If these are not ii_database, ii_journal, ii_checkpoint, or ii_dump, you must specify the location to createdb with the –d, -j, -c, or –b flags, respectively.

Also, refer to the database access information recorded in that step. If the database access was "private," you must use the –p flag for createdb.

If all the database locations are the default, and the database is public, you can omit the flags on the createdb command line.

Recreate each user database, omitting the front-end catalogs. (The front-end catalogs will be created as part of the reload.) Use the following command:

createdb dbname flags -f nofeclients

Note: For an Ingres Star database, run createdb/star for the DDB. Do not run createdb for the CDB.

Previous Topic

Next Topic

Extend the Database

To extend each database:

  1. Refer to the infodb output saved in the step Record Database Information of this upgrade procedure.
  2. If the database was extended to data locations other than the default location, run accessdb as the installation owner and extend the newly-created databases to the same locations. The locations will already exist; it is only necessary to extend the databases to use them.

    If you prefer a non-interactive command line utility, you can use the extenddb utility instead of accessdb.

Previous Topic

Next Topic

Recreate Database Privileges

To recreate database privileges:

  1. As the installation owner, change to the iidbdb unloaddb directory.
  2. Refer to the file dbprivs.out created in the step Record Database Privileges.

    Each row in the dbprivs.out file describes one or more database privileges given to the user grantee-name. A Y or N in a privilege column indicates the specific privilege. (A U in a column means "Unchanged.")

  3. Start an iidbdb Terminal Monitor session:

    sql iidbdb

  4. For each row, issue the statement:

    grant privilege on database database-name to grantee-name;commit

    If the privilege column is N, grant noprivilege instead of privilege.

  5. When finished, use \quit to exit the iidbdb session.

The structure of the iidbpriv catalog did not change between OpenIngres 1.x and Ingres 2.6, so it is possible to copy the original contents of the catalog directly. However, we do not recommend this because the catalog may change in future releases.

If you have defined many privileges, or recreated many users, groups, or roles, you should run sysmod on the iidbdb, which will accelerate query processing. Issue the sysmod command, as follows:

sysmod iidbdb

Previous Topic

Next Topic

Fix FE Reload Script

Because the new database was not created with front-end catalogs, it is not necessary to drop them.

To fix the front-end reload script, for each database:

  1. Open the file copy.in.
  2. Delete the following lines:

    \include/ing12/ingres/files/iiud.scr
    \include/ing12/ingres/files/iiud65.scr

    Note: The directory path may differ.

  3. Check for the ii_atttype catalog definition:

    create table ii_atttype (
    .
    .
    ...about 23 lines...
    .
    .
            system_maintained char(1) not null

  4. Change the name system_maintained to sys_maintained.

    Not all databases contain the ii_atttype catalog, so it is okay if you do not find the definition.

  5. Save the modified copy.in file.

Previous Topic

Next Topic

Reload the Database

To reload the database:

  1. Run reload.ing for each database.

    UNIX: Redirect the reload to a log file so that it can be checked for errors. Using the C shell:

    reload.ing |& tee reload.log

    Note: If using Ingres Star, reload the CDB and all "real" local databases before reloading the DDBs.

  2. After the reload is complete, verify that the table ii_id has only one row.

    Type isql <database>, and select * from ii_id.

  3. If more than one row is returned, delete the row with the lowest object_id.

Previous Topic

Next Topic

Upgrade Front-End Catalogs

To upgrade the front-end catalogs to the new Ingres level, run upgradefe on each database.

Issue the following command:

upgradefe dbname INGRES

Type the word INGRES in uppercase.

Previous Topic

Next Topic

Reapply Optimizer Statistics

Reapply optimization statistics for each database. You can do this by either:

Previous Topic

Next Topic

Checkpoint the Database

Checkpoints and journals from your original Ingres version will not work with the newer version, so do not omit or delay this step.

Checkpoint each database, including the iidbdb. If the database was journaled previously, use the +j flag to turn on journaling.

To know which databases were journaled, see the infodb output from the step Record Database Information.

The iidbdb should always be journaled, regardless of whether it was journaled in the original installation.

Previous Topic

Next Topic

Install Upgraded Applications

To perform the last step of the upgrade procedure:

  1. Install the Ingres versions of the applications.
  2. Restore user logins
  3. Resume normal operation.


© 2007 Ingres Corporation. All rights reserved.