Mimer SQL System Management Handbook TOC PREV NEXT INDEX

Mimer Developer Site

www.mimer.com/developer


Shadowing Management


All shadowing management operations can be handled from the shadowing utilities in the UTIL program. See The Shadowing Utilities or by using SQL commands described in the Mimer SQL Reference Manual.

The Shadowing Utilities

This section describes the options of the shadowing utilities in the UTIL program, which contains functions for the maintenance of a shadowing system.

Shadowing utilities are used to create or drop a shadow, transform a shadow to a master, list information about shadows and databanks, and enter or leave a program ident.

The shadowing utilities main menu looks like this:

                          --  SHADOW utilities  --       
 
                         1. Create shadow                
                         2. Drop shadow                  
                         3. Transform shadow to master   
                         4. List shadowing information   
                         5. Enter program ident          
                         6. Leave program ident          
 
                                   0. Exit      

Authorization

Any user can start the UTIL program. The separate functions are restricted by special privileges.

The following table shows the privilege that a user needs to have to do specific tasks:

Tasks
Privilege
Backup
Shadow
Create a shadow *)
X
Drop a shadow *)
X
Transform a shadow *)
X
List shadow info **)
X
X
Backup and restore **)
X
Set shadow offline **)
X

*) The user must have exclusive use of the databank. This means that no other user can access the databank until the operation is finished.

**) A user who has SHADOW or BACKUP privilege can list shadowing information for any or all databanks. Users can always backup and restore, set shadows offline and online, and list shadowing information for any databank that they have created.

SYSADM is initially granted SHADOW and BACKUP privilege with the WITH GRANT OPTION.

Wildcards

Where noted in the following descriptions, wildcard characters following the SQL standard can be used in databank names.

The percent character (%) represents one or more characters, and underscore (_) represents one and only one character. Thus DB% means every databank name beginning with DB, and DB_ specifies all databank names that consist of the letters DB followed by one (and only one) alphanumeric character or blank space. A percent character alone is shorthand for all databanks (excluding TRANSDB).

Create Shadow

When the "Create shadow" option is chosen, you are prompted for the name of the databank to be shadowed, the name for the new shadow, and the filename for the new shadow. Databanks can have more than one shadow.

Databanks with NULL option cannot be shadowed, because shadowing requires transaction handling. The databank to be shadowed cannot be used by any other users while a shadow is being created.

The shadow name cannot be the same as the name of the master databank, of any other shadow, or of any shadow that has been transformed to a master.

Creating a shadow for a large databank may take some time, and thus should be carefully planned.

Example:

                          --  SHADOW utilities  --       
 
                         1. Create shadow                
                         2. Drop shadow                  
                         3. Transform shadow to master   
                         4. List shadowing information   
                         5. Enter program ident          
                         6. Leave program ident          
 
                                   0. Exit      
 
 Select: 1
 
                                -- Create shadow -- 
 
 Databank name                 : hoteldb
 
 Create shadow for databank HOTELDB 
 
 Shadow name                   : hoteldb_s
 
 Filename for shadow           : /mnt/hoteldb_s.sdw
 
 Shadow HOTELDB_S created and copied from databank HOTELDB

A shadow databank is created and all tables and indexes in the databank are copied to the shadow.

Shadows can also be created in SQL with the CREATE SHADOW described in the Mimer SQL Reference Manual.

Drop Shadow

When "Drop shadow" is chosen, you are prompted for the databank name for which a shadow should be dropped. Wildcard characters are allowed in the databank name. A listing of all shadows for the specified databank is displayed. Enter the name of the shadow you want to drop.

When a shadow is dropped, the file where the databank is stored is usually deleted in the operating system. Otherwise, removing the file requires that it is deleted in the host operating system.

The databank cannot be used by any other users when a shadow is being dropped.

Example:

                          --  SHADOW utilities  --       
 
                         1. Create shadow                
                         2. Drop shadow                  
                         3. Transform shadow to master   
                         4. List shadowing information   
                         5. Enter program ident          
                         6. Leave program ident          
 
                                   0. Exit      
 
 Select: 2
 
                                 -- Drop shadow -- 
 
 Databank name                 : hoteldb
 
 DATABANK
 SHADOW
 OFFLINE
 FILE
 ========================================
 HOTELDB
 HOTELDB_S
 N
 /mnt/hoteldb_s.sdw
 ---
 One shadow found
 
 Name of shadow to drop (<CR> = skip): hoteldb_s
 
 Shadow HOTELDB_S dropped

Shadows can also be dropped in SQL with the DROP SHADOW command described in the Mimer SQL Reference Manual.

Transform Shadow to Master

If a master is lost, it is possible to continue operations by transforming a shadow to the master. This operation must be done from the Shadowing utilities menu or with the ALTER SHADOW statement - it cannot be done in the operating system.

When the "Transform shadow to master" option is chosen from the Shadowing utilities you are prompted for the master databank name (wildcard characters are allowed). After the name is entered, a listing of all shadows for the selected databanks are displayed. Select which shadow to transform by giving the shadow name.

The transform operation only affects the data dictionary. The databank filenames are not changed. The old master databank file is usually deleted in the operating system. Otherwise, removing the file requires that it is deleted in the host operating system.

The databank cannot be used by any other user when a shadow is being transformed into the master (this is not very likely to happen since this function is normally used when the master has been lost or damaged).

Example:

                          --  SHADOW utilities  --       
 
                         1. Create shadow                
                         2. Drop shadow                  
                         3. Transform shadow to master   
                         4. List shadowing information   
                         5. Enter program ident          
                         6. Leave program ident          
 
                                   0. Exit      
 
 Select: 3
 
                              -- Transform shadow -- 
 
 Databank name                 : hoteldb
 
 DATABANK
 SHADOW
 OFFLINE
 FILE
 ========================================
 HOTELDB
 HOTELDB_S
 Y
 /mnt/hoteldb_s.sdw
 ---
 One shadow found
 
 Name of shadow to transform (<CR> = skip): hoteldb_s
 
 Shadow HOTELDB_S is set online before it is transformed to master
 
 Shadow HOTELDB_S transformed to master

The SQL commands ALTER SHADOW and DROP SHADOW can be used together to transform a shadow to a master.

List Shadowing Information

The "List shadowing information" option lists the following information for both master and shadow databanks: databank name, shadow name (if the databank is a shadow), offline status for the shadows (Y = Offline, N = Online) and the filename.

Enter the master databank's name that you want to list the shadowing information for. Wildcard characters are allowed. If a databank is specified, shadowing information for that databank is displayed. If a carriage return (<CR>) is entered without specifying a databank, shadow information for all databanks in the system are displayed. The listing is halted when the screen is full and you can decide whether to continue the listing or not.

Example of list all shadows:

                          --  SHADOW utilities  --       
 
                         1. Create shadow                
                         2. Drop shadow                  
                         3. Transform shadow to master   
                         4. List shadowing information   
                         5. Enter program ident          
                         6. Leave program ident          
 
                                   0. Exit      
 
 Select: 4
 
                         -- List shadowing information -- 
 
 Databank name (<CR> => all databanks): 
 
 DATABANK
 SHADOW
 OFFLINE
 FILE
 ========================================
 SYSDB
 SYSDB
 N
 sysdb82.dbf
 ---
 TRANSDB
 TRANSDB
 N
 transdb.dbf
 ---
 LOGDB
 LOGDB
 N
 logdb.dbf
 ---
 SQLDB
 SQLDB
 N
 sqldb.dbf
 ---
 BOOKDB
 BOOKDB_S
 N
 bookdb.dbf
 ---
 ROOMSDB
 ROOMSDB
 N
 roomsdb.dbf
 ---
 HOTELDB
 HOTELDB_S
 N
 /mnt/hoteldb_s.sdw
 ---
 CUSTOMERS
 CUSTOMERS_S
 Y
 /mnt/customers_s.sdw
 ---
 6 databanks found
 2 shadows found



Upright Database Technology AB
Voice: +46 18 780 92 00
Fax: +46 18 780 92 40
dbtechnology@upright.se
Mimer SQL System Management Handbook TOC PREV NEXT INDEX