---
title: "Database management: databases.txt, volumes and logs"
description: "How CoraDB finds databases through databases.txt, the files of a database (data, log, archive, double write buffer) and the DBA and PUBLIC users."
url: "https://www.coradb.ai/manual/admin/db_manage.html"
markdown_url: "https://www.coradb.ai/manual/markdown/admin/db_manage.md"
product: "CoraDB"
version: "1.0"
keywords: "coradb databases.txt, CORADB_DATABASES, coradb volumes, data volume, temporary volume, active log, archive log, double write buffer, coradb dba public"
---

# Database management: databases.txt, volumes and logs

## Database users

A CoraDB database user can have members with the same authorization. If authorization **A** is granted to a user, the same authorization is also granted to all members belonging to the user. A database user and its members are called a "group."; a user who has no members is called a "user."

CoraDB provides **DBA** and **PUBLIC** users by default.

- **DBA** can access every object in the database, that is, it has authorization at the highest level. Only **DBA** has sufficient authorization to add, alter and delete the database users.
- All users including **DBA** are members of **PUBLIC**. Therefore, all database users have the authorization granted to **PUBLIC** . For example, if authorization **B** is added to **PUBLIC** group, all database members will automatically have the **B** authorization.

## databases.txt file

CoraDB stores information on the locations of all existing databases in the **databases.txt** file. This file is called the "database location file". A database location file is used when CoraDB executes utilities for creating, renaming, deleting or copying databases; it is also used when CoraDB runs each database. By default, this file is located in the **databases** directory under the installation directory. The directory is located through the environment variable **CORADB_DATABASES**.

``` text
db_name db_directory server_host logfile_directory
```

The format of each line of a database location file is the same as defined by the above syntax; it contains information on the database name, database path, server host and the path to the log files. The following example shows how to check the contents of a database location file.

``` bash
% more databases.txt

testdb /home/coradb/CoraDB/databases/testdb dbhost /home/coradb/CoraDB/databases/testdb
e-commerce /home/coradb/CoraDB/databases/e-commerce dbhost /home/coradb/CoraDB/databases/e-commerce
```

By default, the database location file is stored in the **databases** directory under the installation directory. You can change the default directory by modifying the value of the **CORADB_DATABASES** environment variable. The path to the database location file must be valid so that the **coradb** utility for database management can access the file properly. You must enter the directory path correctly and check if you have write permission on the file. The following example shows how to check the value configured in the **CORADB_DATABASES** environment variable.

``` bash
% set | grep CORADB_DATABASES
CORADB_DATABASES=/home/coradb/CoraDB/databases
```

An error occurs if an invalid directory path is set in the **CORADB_DATABASES** environment variable. If the directory path is valid but the database location file does not exist, a new location information file is created. If the **CORADB_DATABASES** environment variable has not been configured at all, CoraDB retrieves the location information file in the current working directory.


## Database volume

The volumes of CoraDB database are classified as permanent volume, temporary volume and backup volume.

- In the permanent volumes,
  - There are data volumes, that usually store permanent data, but can also store temporary data.
  - There are log volumes, that can be further classified as: one active log, archive logs and one background archiving log.
- In the temporary volumes, only temporary data is stored.

For more details on volumes, see [Database volume structure](https://www.coradb.ai/manual/intro.html#database-volume-structure).

The following is an example of files related to the database when *testdb* database operates.

| File | Size | Purpose | Kind | Description |
|---|---|---|---|---|
| `testdb` | 512 MB | Permanent data | Database volume | The first volume, created with the database. Stores permanent data (system, heap and index files) and the database meta information. **coradb createdb** sizes it by **db_volume_size** in `coradb.conf` unless **--db-volume-size** is given. |
| `testdb_perm` | 512 MB | Permanent data | Database volume | Added with **coradb addvoldb**; stores permanent data. |
| `testdb_temp` | 512 MB | Temporary data | Database volume | Added with **coradb addvoldb -p temp**; stores temporary data (query results, list files, sort files, join hashes). |
| `testdb_x003` … `testdb_x006` | 512 MB (the last one may be smaller) | Permanent data | Database volume | Created automatically when the database needs more space; stores permanent data. |
| `testdb_t32766` | 512 MB | Temporary data | Temporary volume | Created automatically for temporary data and removed when the server stops. |
| `testdb_lgar_t` | 512 MB | Background archiving | Log volume | Used by background archiving while an archive log is written. |
| `testdb_lgar224` | 512 MB | Archive | Log volume | Archive logs, numbered with three or more digits. Older ones (here 001–223) were removed by **coradb backupdb -r** or by **log_max_archives**; removed numbers are listed in the REMOVE section of the `lginf` file. See [Managing archive logs](https://www.coradb.ai/manual/admin/admin_backup.html#managing-archive-logs). |
| `testdb_lgat` | 512 MB | Active | Log volume | The active log. |
| `testdb_dwb` | 1 MB | — | Double write buffer | Pages are written here first when they are flushed; see below. |

- Database volume file
  - In the table above, *testdb*, *testdb_perm*, *testdb_temp*, *testdb_x003* ~ *testdb_x006* are classified as the database volume files.
  - File size is determined by **db_volume_size** in **coradb.conf** or the **--db-volume-size** option of **coradb createdb** and **coradb addvoldb**.
  - When database remains out of space, it automatically expands existing volumes and creates new volumes.
- Temporary volume
  - Temporary volumes are usually used to store temporary data. They are automatically created and destroyed by database.
  - File size is determined by **db_volume_size** in **coradb.conf**.
- Log volume file
  - In the above, *testdb_lgar_t*, *testdb_lgar224* and *testdb_lgat* are classified as the log volume files.
  - File size is determined by **log_volume_size** in **coradb.conf** or the **--log-volume-size** option of **coradb createdb**.
- Double write buffer file
  - Double write buffer file is a storage area used to protect against I/O errors (partial writes).
  - Every data page write is first written into the buffer and then flushed to its location in the permanent data volumes.
  - During database reboot, partially written page is detected and replaced with the counterpart page in double write buffer.
  - The file size is determined by **double_write_buffer_size** in **coradb.conf**. If set to zero, no file is created and double write buffer is disabled.

> **Note:**
> Any data that has to be persistent over database restart and crash is stored in the database volumes created for permanent data purpose. The volumes store table rows (heap files), indexes (b-tree files) and several system files.
>
> Intermediate and final results of query processing and sorting need only temporary storage. Based on the size of required temporary data, it will be first stored in memory (the space size is determined by the system parameter **temp_file_memory_size_in_pages** specified in **coradb.conf**). Exceeding data has to be stored on disk.
>
> Database will usually create and use temporary volumes to allocate disk space for temporary data. Administrator may however assign permanent database volumes with the purpose of storing temporary data using by running **coradb addvoldb -p temp** command. If such volumes exist, they will have priority over temporary volumes when disk space is allocated for temporary data.
>
> The examples of queries that can use temporary data are as follows:
>
> - Queries creating the resultset like **SELECT**
> - Queries including **GROUP BY** or **ORDER BY**
> - Queries including a subquery
> - Queries executing sort-merge join
> - Queries including the **CREATE INDEX** statement
>
> To have complete control on the disk space used for temporary data and to prevent it from consuming all system disk space, our recommendation is to:
>
> - Create permanent database volumes in advance to secure the required space for temporary data
> - Limit the size of the space used in the temporary volumes when a queries are executed by setting **temp_file_max_size_in_pages** parameter in **coradb.conf** (there is no limit by default).
