Octopus Administrator's Guide
Octopus Operations

 

Previous Topic:
Importing Data Using the SAND CDBMS Data Loader (ndlm)
Chapter Index
Next Topic:
Non-Persistent Updates

 

Permanently Saving Database Changes Made via Octopus


Octopus users with appropriate privileges can permanently save changes to the database by performing a keep change operation. In this way, unlike in previous releases of Octopus, alterations can be made to persist even if the Octopus instance is shut down. If the keep change operation is not performed, changes made in Public Update mode will still be virtual only, and will be discarded when the Octopus instance is shut down.


The SET UPDATE KEEP CHANGE and SET UPDATE KEEP CHANGE SHUTDOWN Commands

Octopus must be operating in Public Update mode in order to permanently save database alterations made by means of SQL statements or the SAND CDBMS data loader (ndlm). When the SET UPDATE KEEP CHANGE command is executed from an SQL session, all changes committed since Octopus instance startup are written to a new Update File, creating a new database Snapshot. If the SET CURRENT option is included with the SET UPDATE KEEP CHANGE command or if the current view of the database is the default, the view of the database seen by Octopus users is then automatically refreshed with the new version, and the DB_VERSION value reported by the Octops program increments by 1, to n.0. Otherwise, the current view of the database does not change.

For more information about database Snapshots, consult the Persistent Mode Operations (Time Travel) section of the SAND CDBMS Administration Guide.

In order for a user to execute the SET UPDATE KEEP CHANGE command, the user DBA must first execute the following command from an SQL session (note that this command is valid only for operation with Octopus):

SET UPDATE EXCLUSIVE TO user-name [ WAIT ];

This gives user-name the authority to execute the SET UPDATE KEEP CHANGE command. User-name can be any user with DBA privileges. If the user DBA is also going to execute the keep change operation, the SET UPDATE EXCLUSIVE... command must still be executed with the appropriate user name specified. The SET UPDATE EXCLUSIVE... command also disconnects all users from the single OctoEng in the Updatable class, rolling back all uncommitted changes (including those made by user-name). The updatable OctoEng will then accept connections only from the specified user or the user DBA. Any commands subsequently issued either by the specified user or by the user DBA (including data imports via ndlm) will automatically be sent for execution on the Updatable OctoEng.

Note that an error will be returned if the updatable OctoEng is already locked when the SET UPDATE EXCLUSIVE command is executed, unless the WAIT keyword is included in the command. If the WAIT option is specified, Octopus will wait indefinitely until the Updatable OctoEng becomes available, then execute the SET UPDATE EXCLUSIVE command.

Octopus users' view of the database can be refreshed with any changes made in Update Exclusive mode before the KEEP CHANGE by means of the SET UPDATE PUBLIC command (see below). Note that the SET UPDATE EXCLUSIVE command will have to be re-executed before proceeding to perform the KEEP CHANGE.

To execute the keep change operation, use the following special command syntax from an SQL session (valid only for operation with Octopus):

SET UPDATE KEEP CHANGE [ SET CURRENT ] [ WAIT ];

-or-

SET UPDATE KEEP CHANGE [ SET CURRENT ] SHUTDOWN [ WAIT ];

This command may be executed only by the user designated in the SET UPDATE EXCLUSIVE... command, or by the user DBA. If SET CURRENT is included or if the parent of the new database version was the previous default version, once the keep change process has completed, other users will see the new state of the database when they begin their next transaction (that is, when they next issue a command after executing a COMMIT, ROLLBACK, or SET TRANSACTION... statement). If the SHUTDOWN keyword is included at the end of the command, the Octopus instance will be automatically shut down after the KEEP CHANGE operation is complete.

Note that an error will be returned if the updatable OctoEng is already locked when the SET UPDATE KEEP CHANGE command is executed, unless the WAIT keyword is included in the command. If the WAIT option is specified, Octopus will wait indefinitely until the Updatable OctoEng becomes available, then execute the SET UPDATE KEEP CHANGE command.

If the SET CURRENT clause was used, or if the parent of the new database version was the previous default version, when the keep change operation has finished executing, a new DB_VERSION (n.0) will be displayed by the Octops program.


The SET UPDATE PUBLIC Command

The SET UPDATE PUBLIC command can be used to release Octopus from Update Exclusive mode without performing a KEEP CHANGE, while refreshing all OctoEng's with the latest version of the database. Only the user DBA or the user designated in the SET UPDATE EXCLUSIVE command can execute this command:

SET UPDATE PUBLIC;

This command is useful for bringing users up-to-date with changes to the database before the updatable OctoEng is locked to perform the actual KEEP CHANGE operation. Once the SET UPDATE PUBLIC command has been executed, the SET UPDATE EXCLUSIVE command must be re-executed before performing the KEEP CHANGE.

 

Previous Topic:
Importing Data Using the SAND CDBMS Data Loader (ndlm)
Chapter Index
Next Topic:
Non-Persistent Updates