---
title: "Database server: start, stop, access control, logs and errors"
description: "Control CoraDB database servers with coradb server start, stop and status, limit client access, and read the server error log."
url: "https://www.coradb.ai/manual/admin/control_server.html"
markdown_url: "https://www.coradb.ai/manual/markdown/admin/control_server.md"
product: "CoraDB"
version: "1.0"
keywords: "coradb server start, coradb server stop, coradb server status, cora_server, access control list, server error log, coradb error codes"
---

# Database server: start, stop, access control, logs and errors

Each database runs in its own server process, **cora_server**, controlled with `coradb server`.

## Starting database server

The following example shows how to run *e-commerce* server.

``` bash
% coradb server start e-commerce

@ coradb server start: e-commerce

This may take a long time depending on the amount of recovery works to do.

CoraDB 1.0

++ coradb server start: success
```

If you start *e-commerce* server while master process has stopped, master process automatically runs at first and then a specified database server runs.

``` bash
% coradb server start e-commerce

@ coradb master start
++ coradb master start: success
@ coradb server start: e-commerce

This may take a long time depending on the amount of recovery works to do.

CoraDB 1.0

++ coradb server start: success
```

The following message is returned while *e-commerce* server is running.

``` bash
% coradb server start e-commerce

@ coradb server start: e-commerce
++ coradb server 'e-commerce' is running.
```

## Stopping database server

The following example shows how to stop *e-commerce* server.

``` bash
% coradb server stop e-commerce

@ coradb server stop: e-commerce
Server e-commerce notified of shutdown.
This may take several minutes. Please wait.
++ coradb server stop: success
```

The following message is returned while *e-commerce* server has stopped.

``` bash
% coradb server stop e-commerce

@ coradb server stop: e-commerce
++ coradb server 'e-commerce' is not running.
```

## Restarting database server

The following example shows how to restart *e-commerce* server. *e-commerce* server that has already run stops and the server restarts.

``` bash
% coradb server restart e-commerce

@ coradb server stop: e-commerce
Server e-commerce notified of shutdown.
This may take several minutes. Please wait.
++ coradb server stop: success
@ coradb server start: e-commerce

This may take a long time depending on the amount of recovery works to do.

CoraDB 1.0

++ coradb server start: success
```

## Checking database server status

The following example shows how to check the status of a database server. Names of currently running database servers are displayed.

``` bash
% coradb server status

@ coradb server status
Server testdb (rel 1.0, pid 24465)
Server e-commerce (rel 1.0, pid 24342)
```

The following example shows the message when master process has stopped.

``` bash
% coradb server status

@ coradb server status
++ coradb master is not running.
```

## Limiting database server access

To limit brokers and the corasql interpreter connecting to the database server, configure the parameter value of **access_ip_control** in the **coradb.conf** file to yes and enter the path of a file in which the list of IP addresses allowed to access the **access_ip_control_file** parameter value is written. You should enter the absolute file path. If you enter the relative path, the system will search the file under the **\$CORADB/conf** directory on Linux and under the **%CORADB%\conf** directory on Windows.

The following example shows how to configure the **coradb.conf** file.

``` text
# coradb.conf
access_ip_control=yes
access_ip_control_file="/home1/coradb1/CoraDB/db.access"
```

The following example shows the format of the **access_ip_control_file** file.

``` text
[@<db_name>]
<ip_addr>
...
```

- \<db_name\>: The name of a database in which access is allowed
- \<ip_addr\>: The IP address allowed to access a database. Using an asterisk (\*) at the last digit means that all IP addresses are allowed. Several lines of \<ip_addr\> can be added in the next line of the name of a database.

To configure several databases, it is possible to specify additional \[@\<db_name\>\] and \<ip_addr\>.

Accessing any IP address except localhost is blocked by server if **access_ip_control** is set to yes but **ip_control_file** is not configured. A server will not run if analyzing **access_ip_control_file** fails caused by incorrect format.

The following example shows **access_ip_control_file**.

``` text
[@dbname1]
10.10.10.10
10.156.*

[@dbname2]
*

[@dbname3]
192.168.1.15
```

The example above shows that *dbname1* database allows the access of IP addresses starting with 10.156; *dbname2* database allows the access of every IP address; *dbname3* database allows the access of an IP address, 192.168.1.15, only.

For the database which has already been running, you can modify a configuration file or you can check the currently applied status by using the following commands.

To change the contents of **access_ip_control_file** and apply it to server, use the following command.

``` bash
coradb server acl reload <database_name>
```

To display the IP configuration of a server which is currently running, use the following command.

``` bash
coradb server acl status <database_name>
```

## Database server log

### Error log

The following log is created in the file of a server error log if an IP address that is not allowed to access is used.

``` text
Time: 10/29/10 17:32:42.360 - ERROR *** ERROR CODE = -1022, Tran = 0, CLIENT = (unknown):(unknown)(-1), EID = 2
Address(10.24.18.66) is not authorized.
```

An error log of the database server is saved into **\$CORADB/log/server** directory, and the format of the file name is *\<db_name\>\_\<yyyymmdd\>\_\<hhmi\>.err*. The extension is ".err".

``` text
e-commerce_20130618_1655.err
```

> **Note:**
> For details on how to limit an access to the broker server, see [Limiting broker access](https://www.coradb.ai/manual/admin/control_broker.html#limiting-broker-access).


### Event log

If an event which affects on the query performance occurs, this is saved into the event log.

The events which are saved on the event log are *SLOW_QUERY*, *MANY_IOREADS*, *LOCK_TIMEOUT*, *DEADLOCK* and *TEMP_VOLUME_EXPAND*.

This log file is saved into the **\$CORADB/log/server** directory, and the format of the file name is *\<db_name\>\_\<yyyymmdd\>\_\<hhmi\>.event*. The extension is ".event".

``` text
e-commerce_20130618_1655.event
```

**SLOW_QUERY**

If a slow query occurs, this event is written. If **sql_trace_slow** parameter value of coradb.conf is set, this event will arise. The output example is as follows.

``` text
06/12/13 16:41:05.558 - SLOW_QUERY
  client: PUBLIC@testhost|corasql(13173)
  sql: update [y] [y] set [y].[a]= ?:1  where [y].[a]= ?:0  using index [y].[pk_y_a](+)
  bind: 5
  bind: 200
  time: 1015
  buffer: fetch=48, ioread=2, iowrite=0
  wait: cs=1, lock=1010, latch=0
```

- client: \<DB user\>@\<application client host name\>\|\<program name\>(\<process ID\>)
- sql: slow query
- bind: binding value. it is printed out as the number of \<num\> in the sql item, "?:\<num\>". The value of "?:0" is 5, and the value of "?:1" is 200.
- time: execution time(ms)
- buffer: execution statistics in the buffer
  - fetch: fetching pages count
  - ioread: I/O read pages count
  - iowrite: I/O write pages count
- wait: waiting time
  - cs: waiting time on the critical section(ms)
  - lock: waiting time to acquire the lock(ms)
  - latch: waiting time to acquire the latch(ms)

On the above example, the query execution time was 1015ms, and lock waiting time was 1010ms, so we can indicate that almost all execution time was from lock waiting.

**MANY_IOREADS**

Queries which brought many I/O reads are written on the event log. If I/O reads occurs more than **sql_trace_ioread_pages** parameter value of coradb.conf, the event is written on the event log. The following is an output example.

``` text
06/12/13 17:07:29.457 - MANY_IOREADS
  client: PUBLIC@testhost|corasql(12852)
  sql: update [x] [x] set [x].[a]= ?:1  where ([x].[a]> ?:0 ) using index [x].[idx](+)
  bind: 8
  bind: 100
  time: 528
  ioreads: 15648 
```

- client: \<DB user\>@\<application client host name\>\|\<process name\>(\<process ID\>)
- sql: an SQL which brought many I/O reads
- bind: binding value. it is printed out as the number of \<num\> in the sql item, "?:\<num\>". The value of "?:0" is 8, and the value of "?:1" is 100.
- time: execution time(ms)
- ioread: I/O read pages count

**LOCK_TIMEOUT**

When lock timeout occurs, queries of a waiter and a blocker are written on the event log. The following is an output example.

``` text
02/02/16 20:56:18.650 - LOCK_TIMEOUT
waiter:
  client: public@testhost|corasql(21529)
  lock:    X_LOCK (oid=0|650|3, table=t)
  sql: update [t] [t] set [t].[a]= ?:0  where [t].[a]= ?:1
  bind: 2
  bind: 1

blocker:
  client: public@testhost|corasql(21541)
  lock:    X_LOCK (oid=0|650|3, table=t)
  sql: update [t] [t] set [t].[a]= ?:0  where [t].[a]= ?:1
  bind: 3
  bind: 1
```

- waiter: a waiting client to acquire locks.
  - lock: lock type, table and index names
  - sql: a waiting SQL to acquire locks.
  - bind: binding value.
- blocker: a client to have locks.
  - lock: lock type, table and index names
  - sql: a SQL which is acquiring locks
  - bind: binding value

On the above, you can indicate the blocker which brought lock timeout and the waiter which is waiting locks.

**DEADLOCK**

When a deadlock occurs, lock information of that transaction is written into the event log. The following is an output example.

``` text
02/02/16 20:56:17.638 - DEADLOCK
client: public@testhost|corasql(21541)
hold:
  lock:    X_LOCK (oid=0|650|5, table=t)
  sql: update [t] [t] set [t].[a]= ?:0  where [t].[a]= ?:1 
  bind: 3
  bind: 1

  lock:    X_LOCK (oid=0|650|3, table=t)
  sql: update [t] [t] set [t].[a]= ?:0  where [t].[a]= ?:1 
  bind: 3
  bind: 1

wait:
  lock:    X_LOCK (oid=0|650|4, table=t)
  sql: update [t] [t] set [t].[a]= ?:0  where [t].[a]= ?:1 
  bind: 5
  bind: 2

client: public@testhost|corasql(21529)
hold:
  lock:    X_LOCK (oid=0|650|6, table=t)
  sql: update [t] [t] set [t].[a]= ?:0  where [t].[a]= ?:1 
  bind: 4
  bind: 2

  lock:    X_LOCK (oid=0|650|4, table=t)
  sql: update [t] [t] set [t].[a]= ?:0  where [t].[a]= ?:1 
  bind: 4
  bind: 2

wait:
  lock:    X_LOCK (oid=0|650|3, table=t)
  sql: update [t] [t] set [t].[a]= ?:0  where [t].[a]= ?:1 
  bind: 6
  bind: 1
```

- client: \<DB user\>@\<application client host name\>\|\<process name\>(\<process ID\>)
  - hold: an object which is acquiring a lock
    - lock: lock type, table name
    - sql: SQL which is acquiring locks
    - bind: binding value
  - wait: an object which is waiting a lock
    - lock: lock type, table name
    - sql: SQL which is waiting a lock
    - bind: binding value

On the above output, you can check the application clients and SQLs which brought the deadlock.

For more details on locks, see [lockdb](https://www.coradb.ai/manual/admin/admin_transactions.html#lockdb) and [Lock protocol](https://www.coradb.ai/manual/sql/transaction_locking.html#lock-protocol).

**TEMP_VOLUME_EXPAND**

When a temporary volumes are expanded, this time is written to the event log. By this log, you can check what transaction brought the expansion of a temporary volumes.

``` text
06/15/13 18:55:43.458 - TEMP_VOLUME_EXPAND
  client: public@testhost|corasql(17540)
  sql: select [x].[a], [x].[b] from [x] [x] where (([x].[a]< ?:0 )) group by [x].[b] order by 1
  bind: 1000
  time: 44
  pages: 24399
```

- client: \<DB user\>@\<application client host name\>\|\<process name\>(\<process ID\>)
- sql: SQL which requires a more space for temporary data. All INSERT statement except for INSERT ... SELECT syntax, and DDL statement are not delivered to the DB server, so it is shown as EMPTY SELECT, UPDATE and DELETE statements are shown on this item
- bind: binding value
- time: the required time to create a temporary volume(ms)
- pages: the number of available pages within new temporary volume.

## Database server errors

Database server error processes use the server error code when an error has occurred. A server error can occur in any task that uses server processes. For example, server errors may occur while using the query handling program or the **coradb** utility.

**Checking the database server error codes**

- Every data definition statement starting with **\#define ER\_** in the **\$CORADB/include/error_code.h** file indicate the server error codes.
- All message groups under "\$set 5 MSGCAT_SET_ERROR" in the **CoraDB/msg/en_US (in Korean, ko_KR.eucKR** or **ko_KR.utf8)/coradb.msg** \$ file indicates the server error messages.

When you write a C code with CCI driver, we recommend you to write a code with an error code name than with an error code number. For example, the error code number for violating the unique key is -670 or -886, but users can easily recognize the error when it is written as **ER_BTREE_UNIQUE_FAILED** or **ER_UNIQUE_VIOLATION_WITHKEY**.

However, when you write a JAVA code with JDBC driver, you have to use error code numbers because "dbi.h" file cannot be included into the JAVA code. For JDBC program, you can get an error number by using getErrorCode() method of SQLException class.

``` bash
$ vi $CORADB/include/error_code.h

#define NO_ERROR                                       0
#define ER_FAILED                                     -1
#define ER_GENERIC_ERROR                              -1
#define ER_OUT_OF_VIRTUAL_MEMORY                      -2
#define ER_INVALID_ENV                                -3
#define ER_INTERRUPTED                                -4
...
#define ER_LK_OBJECT_TIMEOUT_SIMPLE_MSG              -73
#define ER_LK_OBJECT_TIMEOUT_CLASS_MSG               -74
#define ER_LK_OBJECT_TIMEOUT_CLASSOF_MSG             -75
#define ER_LK_PAGE_TIMEOUT                           -76
...
#define ER_PT_SYNTAX                                -493
...
#define ER_BTREE_UNIQUE_FAILED                      -670
...
#define ER_UNIQUE_VIOLATION_WITHKEY                 -886
...
#define ER_LK_OBJECT_DL_TIMEOUT_SIMPLE_MSG          -966
#define ER_LK_OBJECT_DL_TIMEOUT_CLASS_MSG           -967
#define ER_LK_OBJECT_DL_TIMEOUT_CLASSOF_MSG         -968
...
```

The following are some of the server error code names, error code numbers, and error messages.

| Error code name                     | Error code number | Error message                                                                                                                                       |
|-------------------------------------|-------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|
| ER_LK_OBJECT_TIMEOUT_SIMPLE_MSG     | -73               | Your transaction (index ?, ?@?\|?) timed out waiting on ? lock on object ?\|?\|?. You are waiting for user(s) ? to finish.                          |
| ER_LK_OBJECT_TIMEOUT_CLASS_MSG      | -74               | Your transaction (index ?, ?@?\|?) timed out waiting on ? lock on class ?. You are waiting for user(s) ? to finish.                                 |
| ER_LK_OBJECT_TIMEOUT_CLASSOF_MSG    | -75               | Your transaction (index ?, ?@?\|?) timed out waiting on ? lock on instance ?\|?\|? of class ?. You are waiting for user(s) ? to finish.             |
| ER_LK_PAGE_TIMEOUT                  | -76               | Your transaction (index ?, ?@?\|?) timed out waiting on ? on page ?\|?. You are waiting for user(s) ? to release the page lock.                     |
| ER_PT_SYNTAX                        | -493              | Syntax: ?                                                                                                                                           |
| ER_BTREE_UNIQUE_FAILED              | -670              | Operation would have caused one or more unique constraint violations.                                                                               |
| ER_UNIQUE_VIOLATION_WITHKEY         | -886              | "?" caused unique constraint violation.                                                                                                             |
| ER_LK_OBJECT_DL_TIMEOUT_SIMPLE_MSG  | -966              | Your transaction (index ?, ?@?\|?) timed out waiting on ? lock on object ?\|?\|? because of deadlock. You are waiting for user(s) ? to finish.      |
| ER_LK_OBJECT_DL_TIMEOUT_CLASS_MSG   | -967              | Your transaction (index ?, ?@?\|?) timed out waiting on ? lock on class ? because of deadlock. You are waiting for user(s) ? to finish.             |
| ER_LK_OBJECT_DL_TIMEOUT_CLASSOF_MSG | -968              | Your transaction (index ?, ?@?\|?) timed out waiting on ? lock on instance ?\|?\|? of class ? because of deadlock. You are waiting for user(s) ? to |
