Beruflich Dokumente
Kultur Dokumente
Commands for t h e D B A
155
156 • Commands for the DBA
and possibly engage in data insertion, updating, and deletion. Support for
this kind of task is included in RM/V2 (see Chapter 18, "Authorization").
Two of the commands for the DBA were introduced in Section 3.4 at
the end of Chapter 3. These were the FIND commands (Features RE-1 and
RE-2) for locating all occurrences of all active values drawn from any
specified domain ( F A O m A V ) and locating all occurrences of just those
values that occur both in a specified list and in a specified domain ( F A O _
LIST).
Of course, the term "locating" is used here in a sense that is meaningful
to users of relational systems (see Chapter 3), and therefore has nothing to
do with disk addresses as far as the user is concerned.
For example, it is often the case that applying the comparator < to part
serial numbers is meaningless. Note that, if < is applicable, then so are all
of the other comparators. That is the reason why only the comparator < is
cited in Feature RE-1. Note also that the basic data type indicates whether
arithmetic operators are applicable.
Since large parts of the catalog may have to be locked during the latter
process, the DBA would be well advised to make this kind of request only
during periods of low activity.
References by application programs to the cited domain by its old name
are not automatically updated in RM/V2, but may be in RM/V3. There
should be little impairment of application programs because normally these
programs do not make direct reference to any domain.
Taking all of these factors into account, dropping such a table can cause
a significant impact on users of that database. This action therefore requires
special authorization (see Features RA-5 and RA-6 in Chapter 18). Nor-
mally, only the DBA and his or her staff are so authorized.
Sometimes the aim of the user is to replace the dropped R-table by
other tables, preserving the integrity constraints, views, and authorization
constraints. The sheer bulk of these items makes them worth preserving,
even if they need minor editing. For this purpose, RM/V2 provides the
catalog block (Feature RM-7 in Chapter 12) to postpone the cascading
actions. The catalog block is a sequence of commands, each of which
operates on the catalog only. Certain ones of these commands may normally
have a cascading effect. This cascading action is postponed. It is the catalog
that is allowed to leave a state of integrity during execution of the catalog
block. The postponed cascading is re-examined by the DBMS at commit
time to see whether any of it must be re-executed immediately prior to the
execution of the commit that terminates this catalog block.
For safety reasons, the DROP R-TABLE command is executed in three
steps. However, only Step 1 is applied if the R-table is not a base relation.
In the first step, the DBMS checks that the table name is recorded in
the catalog as either a base relation or a view. If the specified R-table
happens to be only a temporary R-table, it is immediately and uncondition-
ally dropped.
If the relation being dropped is a base R-table or a view, the DBMS
checks to see whether the catalog block indicator (Feature RJ-11 in Chapter
11) is on. If it is, the DBMS drops the relation and omits any cascading
action.
If RJ-11 is off, the DBMS checks to see whether there is any potential
cascading action. If not, the DBMS again drops the relation. If there is
potential cascading action, the user is warned of the type of such action,
and notified that the cascading action can be postponed by requesting a
catalog block. If the user responds "go ahead anyway," the DBMS not only
drops the relation, but also takes all of the necessary cascading action. On
the other hand, if the user requests that the command be aborted, the
DBMS cancels its attempt to drop the specified R-table. This ends Step 1.
In the second step, applicable to base R-tables only, if the DBMS has
decided to initiate the drop procedure, it archives the specified R-table for
either a specified or a default period. This period is at least seven days (the
default value). See Features RA-5 and RA-6 in Chapter 18 for the author-
ization aspects.
Upon expiration of the archiving period, the DBMS takes the third and
final step, applicable only to base R-tables by deleting all rows of the data
in the specified R-table. It then drops the description of that R-table from
the catalog. At any time during the archiving period, the DBA can restore
the R-table to its state immediately before the execution of the DROP
request.
7.1 Commands for Domains, Relations, and Columns • 161
References by application programs to the cited column by its old name are
not automatically updated in RM/V2, but may be in RM/V3.
This command makes those component values in each row that fall
in the specified column inaccessible to all users. These component
162 • Commands for the DBA
Except for the special cases discussed next, this command then drops from
the description of the pertinent R-table both (1) the column name and
(2) the column description, including any reference therein to its domain.
If it happens that the column being dropped is part of the primary key
of that R-table, the DBMS requests that a new primary key be declared.
Since that and other R-tables may include numerous foreign keys drawn
from the same domain as the primary key being dropped, the possibility of
cascading action exists. Use of the catalog block may be appropriate in
order to postpone any cascading action and to update these foreign keys.
If the column being dropped is part of a foreign key, the foreign-key
declaration is dropped. If the column is simply indexed, the corresponding
index is dropped. In the case of a domain-based index, only the contribution
from this column is dropped.
References by application programs to the dropped column are not
automatically found and reported by RM/V2, but may be by RM/V3.
This command has as its single operand a table that may have
duplicate rows in it. In other words, the operand need not be a true
relation. It generates a true relation (an R-table) that contains only
those rows of the operand that are distinct with respect to each
7.3 Commands for Other Purposes • 165
Exercises
7.1 What relational objects can you create, rename, and drop using the
DBA commands?
7.2 Why are the following two properties considered to be columnar, rather
than domain-oriented?
1. Whether values are permitted to be missing from the pertinent
column.
2. Whether all the values in the column are required to be distinct
from one another.
Give examples of a type of domain, and two types of columns based
on it, to support your argument.
7.3 Consider the task of appending new columns to two of the base
relations. Is it necessary first to bring all the traffic to a halt? If not,
explain how RM/V2 handles this problem.
7.4 Are there any commands in RM/V2 for keeping indexes consistent
with whatever columns of data are indexed? Can semantic properties,
such as uniqueness of values or keyhood, be associated with indexes?
Explain your answer.
7.5 What is a domain-based index? How can it help improve the speed of
execution of joins and of referential-integrity checks? (See also Chapter
13.)
7.6 If the occurrence of duplicate rows within a relation is banned by the
relational model, why is the CONTROL DUPLICATE ROWS com-
mand needed (1) to check the existence of duplicate rows and (2) to
remove the redundant duplicate rows?
7.7 What is an important reason for requiring that a user-defined function
comes into effect during loading or unloading data? Does RM/V2
require such a function to be invoked when using the L O A D or
EXTRACT command (Features RE-18 and RE-19), or is this optional?