Tape Drive Management System

The Tape Drive Management System (TDMS) is comprised of four main pages, which allow the listing and bulk operations on Libraries, Device Groups, Tape Drives and Tape Services. All TDMS PL/SQL stored procedures are located in the tdms package from the cdbsql schema.

The tables library, devicegroup, tapedrive and tapeservice, which are all found in the cdbw schema, are used by TDMS procedures and contain data about Libraries, Device Groups, Tape Drives and Tape Services, respectively. The relationship between this four tables is the following:

  • Each library can have multiple device groups, and each device group belongs to one library.
  • Each device group can have multiple tape drives, and each tape drive belongs to one device group.
  • Each tape service is associated with one tape server and one tape drive. A tape drive can be associated with either one or zero tape services. The same happens for tape servers, they can be associated with either one or zero tape services. It is not possible to have multiple tape services with the same tape server.

A cascade delete is defined between the libraries, device groups and tape drives tables. Notice that the cascade delete does not propagate into the tape services table. This means:

  • When a library which does not have any tape services associated with it indirectly, that is, it does not have any associated device groups which do not have any tape drives with associated tape services, when deleted, all its device groups and tape drives will also be deleted.
  • When a device group does not have any tape drives associated with tape services, when deleted, all its tape drives are also deleted.

For the device groups table, the cascade delete is defined with the following DDL statements:

ALTER TABLE devicegroup ADD (
   CONSTRAINT devicegroup_pk PRIMARY KEY (groupid),
   CONSTRAINT devicegroup_groupname_un UNIQUE (groupname),
   CONSTRAINT is_located_in FOREIGN KEY (libraryid) REFERENCES library (libraryid) ON DELETE CASCADE);

ALTER TABLE tapedrive ADD (
   CONSTRAINT tapedrive_pk PRIMARY KEY (driveid),
   CONSTRAINT tapedrives_hwaddr_un UNIQUE (hwaddr),
   CONSTRAINT tapedrives_ipaddress_un UNIQUE (ipaddress),
   CONSTRAINT tapedrives_name_un UNIQUE (tapedrivename),
   CONSTRAINT tapedrives_serialnr_un UNIQUE (currentserialnr),
   CONSTRAINT belong_to FOREIGN KEY (groupid) REFERENCES devicegroup (groupid) ON DELETE CASCADE);

For each one of this tables, except for the tape services one, there is a trigger which inserts a ID value into the ID field of the respective table whenever a new record is inserted. Each ID value comes from a sequence defined exclusively for the associated table. These triggers and schemas are also found in the cdbw schema. The DDL code for the trigger and sequence dedicated to the library table follows:

CREATE SEQUENCE library_id_sq START WITH 1;

CREATE TRIGGER library_id_tr
BEFORE INSERT ON library
FOR EACH ROW
BEGIN
         SELECT library_id_seq.NEXTVAL INTO :NEW.libraryid FROM DUAL;
END;

These four tables have a modifdate field, whose purpose is to store the system date when a record was last modified (or created, if it was never modified). To prevent a database user inserting a data value other than the current system date, four triggers were created, in the cdbw schema, and whose purposes are to insert the current system date in the modifdate field each time one of this table's record is modified (or inserted). The DDL for the trigger dedicated to the Tape Drives table follows:

CREATE TRIGGER tapedrive_modifdate_tr
BEFORE INSERT OR UPDATE ON tapedrive
FOR EACH ROW
BEGIN
         SELECT SYSDATE INTO :NEW.modifdate FROM DUAL;
END;

The device groups table has a field named color which stores the hexadecimal color associated with device groups. CDBWEB uses this color values to highlight device group's tape services, making it more easy to the user to distinguish to which device group each tape service belongs to. To ensure that a consistent case is used for all color values, a trigger named devicegroup_color_trigger, exists in cdbw, and whose purpose is to convert color values to uppercase when they are inserted or updated. The DDL for this trigger follows:

CREATE TRIGGER devicegroup_color_trigger
BEFORE INSERT OR UPDATE ON devicegroup
FOR EACH ROW
BEGIN
         :NEW.color := UPPER(:NEW.color);
END devicegroup_color_trigger;

Libraries pages

The main libraries page...

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r4 - 2007-08-06 - FilipeManana
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Sandbox All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback