Usually, users access a Mimer SQL database via a database server (multi-user mode), but in some situations it may be necessary to restrict use of a database to a single user.
Any local database can be opened in single-user mode, provided there is no database server currently running against the database.
Note:An application started in single-user mode will access the databank files directly from within its own process.
This means that the operating system user who is running the application must have access, at the operating system level, to all the existing databank files.
All new databank files created in single-user mode will typically be owned in the operating system by that user.
File Protection in Single- and Multi-user Mode
If a database which has been created in single-user mode is to be used by a database server, or vice versa, certain precautions must be observed with regard to the databank files:
•Files created in single-user mode must be accessible for read and write by a database server if the database is to be subsequently used in multi-user mode, since databank file access is performed by the database server process. The creator of the files should change the protection if necessary. Suitably the database server should have exclusive access to the databank files.
•Conversely, files created in multi-user mode are created by the database server process and will not be accessible by a specific user who needs to access the database in single-user mode. The protection on these files can only be changed by an operating system user who has privileges equivalent to those of the database server process.
Note:Individual users should not generally have direct access to databank files.
Specifying Single-user Mode Access
If the database is to be accessed in single-user mode by default, the environmental variable or logical name called MIMER_MODE should be defined as SINGLE, as shown in the examples that follow.
If MIMER_MODE is not defined or is set to MULTI, or the database is a remote one, it will be accessed in multi-user mode by default.
If MIMER_MODE is set to SINGLE and the default database, see The Default Database, is set to point to a local database, the database will be opened in single-user mode. (Remote databases will be accessible through the client/server interfaces in multi-user mode).
Note:Many of the programs which are part of the Mimer SQL distribution support the command-line flags -s and -m (or /SINGLE, /MULTI) which control whether they access a database in single-user or multi-user mode.
Mimer SQL applications that connect to a local database server when single-user access is indicated, will dynamically include a shared library when activated. This library holds all the functionality that normally is provided by the database server program.
The following example session first connects to the INVENTORY database in single-user mode and then connects to the STAFF database, administered by a running database server process.
$ export MIMER_DATABASE MIMER_MODE
$ unset MIMER_MODE
$ export MIMER_DATABASE
$ DEFINE MIMER_DATABASE INVENTORY
$ DEFINE MIMER_MODE SINGLE
$ RUN MIMER$EXE:BSQL
$ DEASSIGN MIMER_MODE
$ DEFINE MIMER_DATABASE STAFF
$ RUN MIMER$EXE:BSQL
C:\> SET MIMER_DATABASE=INVENTORY
C:\> SET MIMER_MODE=SINGLE
C:\> SET MIMER_MODE=
C:\> SET MIMER_DATABASE=STAFF
The use of a SINGLEDEFS parameter file is optional.
When a single-user mode connection is established, the SQLPOOL and bufferpool data areas are dynamically created.
The SQLPOOL area will grow dynamically if more space is needed, see SQLPOOL.
Linux + VMS:To change the size of the bufferpool in single-user mode a SINGLEDEFS file, similar to the MULTIDEFS file, should be created in the database home directory.
A template of this file, showing the default values for the relevant parameters, can be found in the examples directory which is located in the Mimer SQL installation directory.
-- Parameters for single-user system
Databanks 100 -- (40-1000) Max number of databanks
Tables 4000 -- (500-1000000) Max number of tables
ActTrans 50 -- (10-1000000) Max number of transactions
Pages4K 8000 -- (22-1000000) Size of 4k bufferpool region (pages)
Pages32K 800 -- (22-1000000) Size of 32k bufferpool region (pages)
Pages128K 96 -- (22-1000000) Size of 128k bufferpool region (pages)
Note:When changing parameters in the SINGLEDEFS file, always change the copy in the database home directory. Never change the template file in the examples directory.
Win:The use of a SINGLEDEFS is not supported on the Windows platform.