What Is a DBEnvironment? [ Up and Running with ALLBASE/SQL ] MPE/iX 5.0 Documentation
Up and Running with ALLBASE/SQL
What Is a DBEnvironment?
In ALLBASE/SQL, you create one or more databases in a structure called a
DBEnvironment. The structure of a DBEnvironment is shown in Figure 1-2.
Figure 1-2. ALLBASE/SQL DBEnvironment
The following objects are the most important parts of the DBEnvironment:
* The DBECon file.
* DBEFiles.
* DBEFileSets.
* Databases.
* Tables and indexes.
* Authorities.
* System catalog.
* Log files.
Objects are structures created and stored in an ALLBASE/SQL
DBEnvironment. SQLCore and DBCore connect the user interface, such as
ISQL or an application program, with the objects of the DBEnvironment.
To better understand the DBEnvironment and its objects, imagine that it
is like a library, which is used to store books, periodicals, or other
information. Like a library, the DBEnvironment is a physical location
for information, so you need to set aside physical space for it. Also
like a library, the DBEnvironment uses a logical method for storing and
retrieving information.
The DBECon File
When you create a DBEnvironment, ALLBASE/SQL creates a physical file
known as the DBEnvironment Configuration File or DBECon file. This file
contains basic information that is used every time the DBEnvironment is
opened. The DBECon file has the same name as the DBEnvironment itself.
If the DBEnvironment is like a library, the DBECon file is like a
building directory that points to the other DBEnvironment components.
DBEFiles
You must allocate physical storage space by creating DBEFiles--operating
system files that hold table data, index data, or both. Like the
individual bookcases in the library, they have a specific capacity.
DBEFiles have both physical names--operating system names--and logical
names, by which the files are known internally to the ALLBASE/SQL system
catalog, to be explained shortly.
DBEFileSets
DBEFiles are grouped together in logical groupings known as DBEFileSets.
These are something like the different subject categories in a library.
You create a DBEFileSet with a logical name (this corresponds to the
subject category name). Then you add DBEFiles to the DBEFileSet as
needed, as you would add bookcases to the category to add more space.
For example, a section may be labeled "Computer Periodicals" and hold
many bookcases with different magazines in them. DBEFileSets do not have
a specific capacity; you can always add more DBEFiles to create more
space in them.
Databases
The data in a DBEnvironment is stored in databases, which are groups of
tables having the same owner. The database in a DBEnvironment is a bit
like division ownership of certain books or periodicals in a library. In
a university, some of the periodicals may belong to a computer science
library, others may belong to a medical library, though these may be
housed inside the same building and use the same card catalog. In such a
subdivision of the library, certain books and periodicals could only be
checked out by people belonging to the appropriate division or having
special permission.
When you create an object in the DBEnvironment, you are its owner by
default, and therefore it belongs to your database.
Tables and Indexes
The most important objects you create are tables. The table is like a
periodical stored in the library, and the rows in the table are like
individual articles in the periodical. The index on a table is like the
index to the content of a group of periodicals in the bookcase. The
index may appear on the same shelf as the periodical or it may be located
along with other indexes in a different bookcase.
Tables and indexes have only logical names; a table name is like the
title of the periodical. When you create a table, you only need to
define its name and characteristics and associate it with a DBEFileSet.
This is like adding a new periodical to a subject category in the
library.
More detailed information about the organization of data in tables is
presented in chapter 2, "Looking at Data."
System Catalog
To enable readers to find issues of ComputerWorld, the librarian puts an
entry in a card catalog that shows where the issues are stored. In the
DBEnvironment, SQLCore inserts an entry in the system catalog for each
database object you create. The system catalog is created at the time
you create a DBEnvironment.
The system catalog is physically located in a DBEFile known as DBEFILE0.
This file contains extra space for the additional entries that are made
by SQLCore each time you create a new object. Like a good librarian,
ALLBASE/SQL keeps the system catalog up-to-date for you, without your
being aware of it.
The system catalog is a set of tables for internal use by SQLCore. These
tables are associated with a DBEFileSet known as SYSTEM. SQLCore uses the
system catalog to look up database objects much as you would use the card
catalog in a library to look up the bookcase and shelf number for a book
or periodical.
Log Files
ALLBASE/SQL provides logging of all transactions that take place in the
DBEnvironment. Like the library's record of items checked out and
returned, the log file is a record of the rows in database tables that
are added, deleted, or changed. The log makes it possible to keep data
consistent when multiple users are accessing the system, and it makes
recovery possible in the event of a system failure. Information about
the system log is stored in the DBECon file.
Because logging is essentially automatic, it will not be discussed any
further in this book. For more information, you can refer to the chapter
entitled "Backup and Recovery" in the ALLBASE/SQL Database Administration
Guide.
MPE/iX 5.0 Documentation