Chapter 2. Basic Database Administration

Table of Contents

2.1. User Types
2.1.1. DBA
2.1.2. SYS
2.1.3. System Administrators
2.1.4. Application Developers
2.1.5. Database Users
2.2. Installation Environment
2.3. tbSQL Utility Usage
2.4. Creating Users and Tables
2.5. Startup and Shutdown
2.5.1. tbboot
2.5.2. tbdown
2.6. Using Binary TIP

This chapter explains the basic knowledge that DBAs need before administering Tibero.

2.1. User Types

Users who use Tibero are classified into the following groups according to their purpose and role:

2.1.1. DBA

Every DBMS needs at least one DBA. The DBA is a person or group who supervises or actually performs general tasks needed for the maintenance of the database environment.

The DBA takes charge of responding to changing needs by monitoring database performance. For example, the DBA decides accuracy or integrity of database contents, makes an internal storage structure and access management decisions, and establishes and checks data security policy. A DBA needs broad experience in various database solutions.

The table below introduces major checkpoints for the DBA:

CheckpointDescription
DBMS

Checks the current DBMS's features.

  • Is the disk space sufficient?

  • In a physically independent disk, is the system load balanced properly?

  • Is data arranged well?

  • What about the CPU, memory usage, and response time of clients?

If a problem still exists, it is recommended to expand the system's hardware or perform database tuning.

Database
  • What are the frequently used schema objects?

  • What are the frequently used SQL statements?

  • Are the frequently used SQL statements being executed efficiently?

Maintenance
  • Installs Tibero and executes patches.

  • Designs, analyzes, and implements a database.

  • Creates a database and sets permissions for the database and users.

Policies and ProceduresEstablishes policies and procedures about database management, security, and maintenance.
SecurityEstablishes security measures to prevent data leakage or loss.
Backup and RestorationBacks up data regularly and restores data if a problem occurs.

Tibero provides the DBA with utilities for the efficient and flexible management of the checkpoints above.

Note

For more details, refer to Tibero Utility Guide".

2.1.2. SYS

After Tibero is installed, a user named SYS is created, who manages metadata of the database itself. The SYS user is given the DBA role, which is similar to that of the root user in UNIX and Linux.

Tibero's data dictionary, base tables, and views are all stored in the schema of the SYS user. In particular, base tables and views play very important roles in the operation of Tibero. Therefore, they must never be modified or altered by any user other than the SYS user.

The account information for the SYS user is as follows:

ItemDescription
ID

The ID is 'SYS'.

The SYS user has only one schema. The schema has the same name as the user (SYS).

PasswordThe password is chosen when installing Tibero. It can be changed after installation.

2.1.3. System Administrators

Some organizations have more than one system administrator. A system administrator (or sysadmin, including the network administrator) is a person or group who operates and maintains computer systems or networks. System administrators are responsible for installing, supporting, and maintaining computer systems such as servers, and responding to service disruption and other problems.

Other roles may include scripting or some programming, management or supervision of system-related projects, and technical support for computer problems. A system administrator must have both technical skills and responsibility.

2.1.4. Application Developers

Application developers are people who usually develop wide-ranging computer software in the field of professional project management. Application developers contribute to general projects more than to individual programming tasks.

Application developers design and implement database applications in terms of the database usage.

Their roles are divided into:

  • Design and development of database applications.

  • Database structure design and specification for applications.

  • Request for storage space for applications.

  • Sharing database information with the DBA.

  • Tuning applications during development.

  • Establishment of security policies for applications during development.

2.1.5. Database Users

The database users group consists of all groups who use Tibero, such as DBAs, business analysts, application developers, and general users.

2.2. Installation Environment

If Tibero is installed normally, the system needs to specify the following environment variables:

Environment VariableDescription
$TB_HOMEHome directory where Tibero is installed. Contains the Tibero server, client libraries, and other files for additional functions.
$TB_SIDService ID used when a machine runs multiple instances of Tibero.
$PATHPaths to certain files.

If environment variables are not properly specified, Tibero cannot be used. Therefore, it is recommended to check the environment variables in advance.

Note

This guide follows the syntax of GNU Bash (http://www.gnu.org/software/bash/) for the execution of UNIX shell commands. Depending on the shell type, the syntax may differ. For more details on this, check the operating system's guide.

The syntax to check environment variables via a UNIX shell prompt is shown below:

  • $TB_HOME

    $ echo $TB_HOME
    /home/tibero/tibero6

    This directory contains the Tibero server, client libraries, and other files for additional functions.

  • $TB_SID

    $ echo $TB_SID
    Tb6

    It is recommended to specify the service ID as the database name.

  • $PATH

    $ echo $PATH
    ...:/home/tibero/tibero6/bin:/home/tibero/tibero6/client/bin:...

    $PATH must include the following directories:

    DirectoryDescription
    $TB_HOME/binTibero's executable files and utilities for server management.
    $TB_HOME/client/binTibero's client executable files.

2.3. tbSQL Utility Usage

tbSQL is an interactive utility for SQL command processing, which is provided by Tibero®. It can process SQL queries, data definition language (DDL), and transaction-related SQL statements.

This section describes how to connect to the database using the tbSQL utility and how to execute some simple SQL statements.

tbSQL Utility

Executing the tbSQL utility is shown below:

[Example 2.1] tbSQL Utility Execution

$ tbsql

tbSQL 6 

TmaxData Corporation Copyright (c) 2008-. All rights reserved.

SQL>

After the tbSQL utility executes normally, the SQL prompt is shown as above. Database users can execute SQL statements within this prompt. If the database connection fails and the SQL prompt does not appear, refer to “Appendix C. Troubleshooting” to solve the problem.

Database Connection

If the SQL prompt is shown on the screen after the tbSQL utility executes, the database is ready to connect to.

Connecting to the database is shown below:

[Example 2.2] Database Connection Using tbSQL

$ tbsql SYS/tibero

tbSQL 6 

TmaxData Corporation Copyright (c) 2008-. All rights reserved.

Connected to Tibero.

SQL>


In the example above, the user name (SYS) and password (tibero) are entered as part of executing the tbSQL utility in a UNIX shell prompt.

When entering user name and password, the following rules apply:

ItemDescription
User nameLike schema object names, the user name is case insensitive, except for characters entered between double quote marks (" ").
PasswordPassword is not case sensitive except when it is enclosed in single quotes (' ').

tbSQL Utility Commands

Commands provided by tbSQL are case insensitive and include those necessary for executing SQL statements and managing the database.

The following are the commands can be used in tbSQL. The commands can be executed without including the letters between square brackets ([ ]).

CommandDescription
!

Executes an OS command.

Same as the HOST command.

%Re-executes a command that is saved in the history buffer.
@

Executes a script.

Same as the START command.

/

Executes SQL statements within the SQL buffer or tbPSM program.

Same as the RUN command.

ACC[EPT]Accepts the user's input of specified attributes of substitution variables.
ARCHIVE LOGDisplays redo log file information.
C[HANGE]Changes pattern characters into set characters after searching for them on the current line of the SQL buffer.
CL[EAR]Initializes or removes set options.
COL[UMN]Specifies display attributes of columns.
CONN[ECT]Connects to the database with a certain user ID.
DEF[INE]Defines or displays a bind variable.
DELDeletes the line specified in the SQL buffer.
DESC[RIBE]Displays the column information of an object.
DISC[ONNECT]Disconnects from the database.
ED[IT]Edits a file or the contents of the SQL buffer using an external editor.
EXEC[UTE]Executes a single tbPSM statement.
EXIT

Exits the tbSQL utility.

Same as the QUIT command.

EXP[ORT]Exports SELECT statement execution results or table data to a file.
H[ELP]Shows help.
HIS[TORY]Displays the history of executed commands.
HO[ST]

Executes an OS command.

Same as the '!' command.

I[NPUT]Adds a new line after the current line of the SQL buffer.
L[IST]Lists contents within the SQL buffer.
LOAD[FILE]Stores a Tibero table in a format that can be recognized by Oracle's SQL*Loader tool.
LOOPRepeats the execution of a single command in an infinite loop.
LSLists the database objects that were created by the current user.
PASSW[ORD]Changes user password.
PAU[SE]Pauses until the user presses the <Enter> key.
PINGDisplays whether a specific database can be accessed.
PRI[NT]Prints values of user-defined bind variables.
PRO[MPT]Displays user-defined SQL statements or empty lines on the screen.
Q[UIT]

Quits the tbSQL utility.

Same as the EXIT command.

REST[ORE]Restores selected data from file.
R[UN]

Runs SQL statement in the current SQL buffer or the tbPSM program.

Same as the / command.

SAVESaves selected data in a file.
SETSpecifies system variables for tbSQL.
SHO[W]Shows system variables of tbSQL.
SPO[OL]Starts or stops spooling screen contents to an external file.
STA[RT]

Starts executing a script file.

Same as the '@' command.

TBDOWNShuts down Tibero.
UNDEF[INE]Removes one or more substitution variables.
VAR[IABLE]Declares user-defined bind variables.
WHENEVERDefines action for an error occurrence.

Note

For more details on tbSQL, refer to "Tibero Utility Guide".

The LS command can be used to view objects in the schema.

The following example shows the execution of the LS command after connecting to the database as the SYS user.

[Example 2.3] LS Command Execution

SQL> LS

NAME                           SUBNAME       OBJECT_TYPE
------------------------------ ------------- --------------------
SYS_CON100                                   INDEX
SYS_CON400                                   INDEX
SYS_CON700                                   INDEX
_DD_CCOL_IDX1                                INDEX
        [Some results omitted for brevity]......
UTL_RAW                                      PACKAGE
DBMS_STATS                                   PACKAGE BODY
TB_HIDDEN2                                   PACKAGE BODY

SQL>

The LS command is provided for user convenience and is only usable within tbSQL. In other words, when the connection is made through JDBC or CLI, not tbSQL, this command cannot be used.

In [Example 2.3], all objects in the SYS user's schema are listed. The SYS schema has many objects that are internally used for Tibero to manage itself.

The following example shows how to view the currently connected users with the LS command:

[Example 2.4] LS Command Execution - User Lookup

SQL> LS USER

USERNAME
------------------------------
SYS

The following example shows how to view the tablespaces that are currently in the database using the LS command:

[Example 2.5] LS Command Execution - Tablespace Lookup

SQL> LS TABLESPACE

TABLESPACE_NAME
------------------------------
SYSTEM
UNDO
TEMP
USER

Execution of SQL Statements

The following example shows the execution of an SQL statement that searches for data of the 'WTHR' type using the VT_SESSION view:

[Example 2.6] SQL Statement Execution (1)

SQL> SELECT SID, STATUS, TYPE, WTHR_ID FROM V$SESSION WHERE TYPE = 'WTHR';

       SID STATUS                           TYPE        WTHR_ID
---------- -------------------------------- -------- ----------
        10 ACTIVE                           WTHR              1
        13 RUNNING                          WTHR              1

2 rows selected.

V$SESSION is a view that lists session IDs.

The following is a brief explanation of the SQL standard.

There are some rules that must be obeyed when executing SQL statements. These rules follow the SQL standard, which is the relational or object-relational database language created by ANSI (American National Standard Institute) and ISO/IEC (International Standard Organization/International Electrotechnical Commission).

The SQL standard reached version 2 1992 and reached version in 1999. The SQL standard released in 1992 is called SQL2 or SQL-92 and is a relational database language.

The SQL standard released in 1999 is called SQL3 or SQL-99 and is an object-relational database language with object-oriented concepts added.

SQL statements defined in the SQL standard are divided into:

  • Data Manipulation Language (DML)

  • Data Definition Language (DDL)

  • Data Control Language (DCL)

Note

In this guide, some DCL SQL commands such as COMMIT and ROLLBACK are recomposed in transaction and session language. Therefore, for the entire contents of DCL, refer to relevant guides.

The SELECT statement included in DML can be executed as follows:

[Example 2.7] SQL Statement Execution (2)

SQL> select SID, STATUS, TYPE, WTHR_ID from v$session where type = 'WTHR';

......Same result as [Example 2.6]......

SQL> select SID, STATUS, TYPE, WTHR_ID from V$SESSION where type = 'WTHR';

......Same result as [Example 2.6]......

SQL> select SID, STATUS, TYPE, WTHR_ID From v$session Where type = 'WTHR';

......Same result as [Example 2.6]......

The SQL standard is case insensitive, so a mixture of uppercase and lowercase letters can be used, except for characters included between double quotes (" ") or single quotes (' '). All the examples above show the same result as [Example 2.6] and their meaning is identical.

However, the following SQL statement has a different meaning, showing a different result:

SQL> SELECT SID, STATUS, TYPE, WTHR_ID FROM V$SESSION WHERE TYPE = 'wthr';

0 row selected.

2.4. Creating Users and Tables

This section describes how to create a user and a table for use in the database.

Creating Users

The CREATE USER statement is used to create a user.

The following example creates a user named ADMIN and grants it permission to create sessions and tables (CREATE SESSION and CREATE TABLE).

[Example 2.8] Creating a User

SQL> CREATE USER ADMIN IDENTIFIED BY 'password123';
      ...A user named 'ADMIN' is created with the password 'password123'.
User 'ADMIN' created.

SQL> GRANT CREATE SESSION TO ADMIN;
      ...The permission to create a session is granted to the ADMIN user.
Granted.

SQL> GRANT CREATE TABLE TO ADMIN;
      ...The permission to create a table is granted to the ADMIN user.
Granted.

SQL> CONN ADMIN/PASSWORD123
      ...Connects to the database with the ADMIN user.
TBR-17001: Login failed: invalid user name or password.

No longer connected to server.
      ...Failed to connect to the database because the password is 
         case sensitive.

SQL> CONN ADMIN/password123
      ...Enter the password correctly and retry the connection.
Connected.

SQL> LS
      ...The new user has no schema to show.

SQL>

After the process of [Example 2.8] is completed, the 'ADMIN' user is added to Tibero.

Creating Tables

The CREATE TABLE statement is used to create a table.

The following example creates a table named 'PRODUCT' and inserts four rows of data via INSERT.

[Example 2.9] Creating a Table

SQL> CREATE TABLE "PRODUCT"
    (
      PROD_ID NUMBER(3) NOT NULL CONSTRAINT PROD_ID_PK PRIMARY KEY,
      PROD_NAME VARCHAR(50) NULL,
      PROD_COST NUMBER(10) NULL,
      PROD_PID NUMBER(3) NULL,
      PROD_DATE DATE NULL
    );
Table 'PRODUCT' created.

SQL> SELECT TABLE_NAME FROM USER_TABLES;
      ...USER_TABLES is a static view that lists all tables of 
         the users currently connected to the database.

TABLE_NAME
------------------------
PRODUCT

1 row selected.


SQL> DESC "PRODUCT"
      ...DESC is a command of the tbSQL utility that displays column
         types for a given table.

COLUMN_NAME              TYPE             CONSTRAINT
------------------------ ---------------- --------------------------
PROD_ID                  NUMBER(3)        PRIMARY KEY
                                          NOT NULL
PROD_NAME                VARCHAR(50)
PROD_COST                NUMBER(10)
PROD_PID                 NUMBER(3)
PROD_DATE                DATE

INDEX_NAME               TYPE    COLUMN_NAME
------------------------ ------- ------------------------------
PROD_ID_PK               NORMAL  PROD_ID


SQL> INSERT INTO "PRODUCT" VALUES(601,'TIBERO',7000,'',
to_date('2004-12-31 09:00:00', 'yyyy-mm-dd hh24:mi:ss'));
           ...If double quotes (" ") are used in PRODUCT, characters,
           other than alphabetical, can be used for a schema or user name 
           according to SQL standards.


           ... According to SQL standards, use single quotes for string 
           data that is inserted to a database directly...
1 row inserted.

SQL> INSERT INTO "PRODUCT" VALUES(602,'TIBERO2',8000,'601',
to_date('2005-06-21 09:00:00', 'yyyy-mm-dd hh24:mi:ss'));
1 row inserted.

SQL> INSERT INTO "PRODUCT" VALUES(603,'TIBERO3',9000,'601',
to_date('2007-01-01 09:00:00', 'yyyy-mm-dd hh24:mi:ss'));
1 row inserted.

SQL> INSERT INTO "PRODUCT" VALUES(604,'TIBERO4',10000,'601',
to_date('2009-04-30 09:00:00', 'yyyy-mm-dd hh24:mi:ss'));
1 row inserted.

SQL> SELECT * FROM "PRODUCT";
      ...This SQL statement displays all data in the PRODUCT table.

   PROD_ID PROD_NAME             PROD_COST    PROD_PID  PROD_DATE
---------- -------------------  ----------  ----------  ----------
       601 TIBERO                    7000               2004/12/31
       602 TIBERO2                   8000          601  2005/06/21
       603 TIBERO3                   9000          601  2007/01/01
       604 TIBERO4                  10000          601  2009/04/30

4 rows selected.

In addition to USER_TABLES, various static views are provided by Tibero. Using these views, current database users can see information about accessible schema objects.

Note

For more details on static views, refer to "Tibero Reference Guide".

After the table has been created and data has been inserted, leave this console window open and open another console window.

The following example uses the tbSQL utility to connect to Tibero with the ADMIN user created in [Example 2.8].

$ tbsql ADMIN/password123

tbSQL 6 

TmaxData Corporation Copyright (c) 2008-. All rights reserved.

Connected to Tibero.

SQL> SELECT * FROM "PRODUCT";

0 row selected.

In the example above, the four rows of data are not present as in [Example 2.9]. Because Tibero supports transactions, session data is invisible to other sessions until the data is committed. Therefore, move to the previous console window ([Example 2.9]) and execute the COMMIT command to see the four rows of data.

Executing the COMMIT command is shown below:

SQL> COMMIT;
Commit succeeded.

After the COMMIT is finished, execute a SELECT command in the second console window to see that the four rows of data are displayed.

Usage

The following describes the execution of some SQL statements in an example scenario:

  • The prices of all products less than 8,500 KRW (PROD_COST column) are increased by 10% and then returned to their previous state.

  • The TIBERO2 product is no longer for sale.

Based on this scenario, the following SQL statements are executed:

SQL> UPDATE "PRODUCT" SET PROD_COST = PROD_COST * 1.1
    WHERE PROD_COST < 8500;
2 rows updated.

SQL> SELECT PROD_NAME, PROD_COST FROM "PRODUCT";

PROD_NAME                                           PROD_COST
-------------------------------------------------- ----------
TIBERO                                                   7700
TIBERO2                                                  8800
TIBERO3                                                  9000
TIBERO4                                                 10000

4 rows selected.

      ...The UPDATE statement raised product prices which are less than 8,500 Won
         by 10%.

SQL> ROLLBACK;
      ...Rolls back to the previous state.

Rollback succeeded.


SQL> DELETE FROM "PRODUCT" WHERE PROD_NAME = 'TIBERO2';
      ...The TIBERO2 product is no longer for sale.
         Thus, this product is deleted from the PRODUCT table.

1 row deleted.

SQL> SELECT PROD_NAME, PROD_COST FROM "PRODUCT";
      ...Shows the PRODUCT table. The TIBERO2 product has been deleted, and
         the TIBERO products which had their prices raised by 10%
         have been rolled back. 

PROD_NAME                                           PROD_COST
-------------------------------------------------- ----------
TIBERO                                                   7000
TIBERO3                                                  9000
TIBERO4                                                 10000

3 rows selected.

SQL> quit
      ...The quit command commits the current transactions and ends the database
         connection. After the transaction is finished, the TIBERO2 product has
         been completely removed from the PRODUCT table.
Disconnected.

$

When executing SQL statements, permissions given to users are very important. If a user is granted a DBA role, it is easy to execute any SQL statement while managing the database. Otherwise, users need to reconnect to the database with the SYS user or a user with the DBA role, and grant those permissions necessary to execute certain commands. To solve this problem, a method exists to create a role by combining various permissions.

Note

For more details on permissions and roles, refer to “5.2. Privileges” and “5.4. Roles”.

The following example connects to the database with the SYS user and grants the DBA role to the ADMIN user created in [Example 2.8].

$ tbsql SYS/tibero

tbSQL 6 

TmaxData Corporation Copyright (c) 2008-. All rights reserved.

Connected to Tibero.

SQL> GRANT DBA TO ADMIN;
Granted.

If the ADMIN user is no longer needed, execute the DROP command below:

SQL> DROP USER ADMIN;
TBR-7139: cascade is required to remove this user from the system

SQL> DROP USER ADMIN CASCADE;
User 'ADMIN' dropped.

As shown in the example, the CASCADE option must be used to completely delete the objects created in the ADMIN user's schema. Otherwise, the TBR-7139 error will occur. After being dropped, the ADMIN user cannot connect to the database.

2.5. Startup and Shutdown

This section describes the commands used to start up and shut down Tibero and how to use them.

2.5.1. tbboot

tbboot must be executed on the machine where Tibero is installed. As explained in “2.2. Installation Environment”, environment variables must be set properly to execute tbboot. The environment variables $TB_HOME and $TB_SID are related to this command.

Also, if permission to execute tbboot is given to multiple users, any of them can start Tibero. Therefore, for security reasons, it is recommended to grant this permission only to the user who installed Tibero.

Specifying file permissions is shown below:

$ cd $TB_HOME/bin
$ chmod 700 tbsvr tblistener tbboot tbdown tbctl
$ ls -alF
total 56
drwxr-xr-x  4 tiberotibero 4096 Dec 28 18:12 ./
drwxr-xr-x 13 tiberotibero 4096 Dec 20 11:59 ../

        ...... Some results omitted for brevity......

-rwx------  1 ... tbboot*
-rwx------  1 ... tbctl*
-rwx------  1 ... tbsvr*
lrwxrwxrwx    1 ... tblistener*
lrwxrwxrwx    1 ... tbdown -> $TB_HOME/bin/tbsvr*

Using tbboot is shown below:

tbboot
tbboot -v
tbboot -h
tbboot -C
tbboot -c
tbboot [-t] [ normal | mount | nomount | resetlogs |
              NORMAL | MOUNT | NOMOUNT | RESETLOGS ]
OptionDescription
 If no option is specified, Tibero starts up in NORMAL mode.
-hDisplays help for tbboot.
-vDisplays version information of Tibero.
-CDisplays the character set and nls_date_lang information of Tibero
-cOption to disable the replication mode when Tibero is set to the replication mode.
-tSets startup options for the Tibero server.

Tibero provides four startup modes for tbboot.

NORMAL

Uses all functions of the database.

Starting up in the NORMAL mode is shown below:

$ tbboot NORMAL
listener port = 8629

Tibero 6 

TmaxData Corporation Copyright (c) 2008-. All rights reserved.

Tibero instance started suspended at NORMAL mode.

Note

If the database is terminated abnormally, crash recovery is automatically run when booting Tibero. For more details, refer to “6.3.2. Crash Recovery”.

NOMOUNT

Only starts Tibero processes.

This mode is rarely used. A database is created using CREATE DATABASE after Tibero boots.

Starting up in the NOMOUNT mode is shown below:

$ tbboot NOMOUNT
listener port = 8629

Tibero 6 

TmaxData Corporation Copyright (c) 2008-. All rights reserved.

Tibero instance started suspended at NOMOUNT mode.

MOUNT

Used for media recovery.

Starting up in the MOUNT mode is shown below:

$ tbboot MOUNT
listener port = 8629

Tibero 6 

TmaxData Corporation Copyright (c) 2008-. All rights reserved.

Tibero instance started suspended at MOUNT mode.

RESETLOGS

Resets log files when starting the Tibero server and uses them after media recovery.

Starting up in RESETLOGS mode is shown below:

$ tbboot RESETLOGS
listener port = 8629

Tibero 6 

TmaxData Corporation Copyright (c) 2008-. All rights reserved.

Tibero instance started suspended at NORMAL mode.

Note

The RESETLOGS boot mode cannot be used after the abnormal termination of the database. After Tibero boots, this mode is the same as the NORMAL mode. For more details, refer to “6.3.3. Media Recovery”.

2.5.2. tbdown

tbdown shuts down the currently running Tibero.

Using tbdown is shown below:

tbdown
tbdown -h
tbdown [-t] [ normal | post_tx | immediate | abort | switchover | abnormal |
              NORMAL | POST_TX | IMMEDIATE | ABORT | SWITCHOVER | ABNORMAL ]
tbdown clean
OptionDescription
 If no option is set, Tibero shuts down in NORMAL mode.
-hDisplays help for tbdown.
-tSets the shutdown option for the Tibero server. This option can be omitted.
clean

Releases shared memory or semaphore resources used by an abnormally terminated Tibero server.

This option cannot be used while Tibero is running.

Note

If Tibero terminates abnormally due to a internal command such as kill, shared memory or semaphore resources may not be released. In this case, a reboot will fail, and an administrator can recognize that the server has terminated abnormally via an error message. The existing resources must be released with tbdown clean.

Even if the server terminates abnormally, if the initialization parameter BOOT_WITH_AUTO_DOWN_CLEAN is set to Y, resources used by the server are automatically released. However, an administrator will not be able recognize the abnormal termination. Because existing resources or processes may not be cleaned up due to an exceptional situation, it is not recommend to set BOOT_WITH_AUTO_DOWN_CLEAN to Y.

Tibero provides four down modes for tbboot.

Down modeDescription
NORMALNormal shutdown mode.
POST_TXTerminates Tibero after all transactions are complete.
IMMEDIATETerminates Tibero immediately. All ongoing tasks are stopped and rolled back.
ABORTForces Tibero's processes to close.
SWITCHOVERSynchronizes the Standby DB and Primary DB and then terminates the Primary DB in the same way as NORMAL mode.
ABNORMALDoes not connect to the Tibero server and forcibly terminates the server process.

For the detailed information about each mode, refer to the relevant section.

When using the tbdown command to terminate the Tibero DB server, the tbdown process directly connects to the server, creates a session, and executes the command to terminate the server in all down modes except the ABNORMAL mode. command to terminate the Tibero DB server, the tbdown process directly connects to the server, creates a session, and executes the command to terminate the server in all down modes except the ABNORMAL mode.

The host name used for the tbdown process to connect to the server is fixed to localhost and the port number is the same as the initialization parameter '_LSNR_SPECIAL_PORT'. The default value of _LSNR_SPECIAL_PORT is LISTENER_PORT + 1.

Listener receives the connection request from the tbdown process and allocates the connection request to a working thread of a dedicated working process instead of a regular working process.

When the tbdown process terminates the Tibero server in ABNORMAL mode, the process uses an OS forced termination signal without connecting to the server to terminate the server processes.

Note

1. If the tbdown command is used when a session that is currently connected to Tibero server exists, it is necessary to decide whether to terminate the server using NORMAL mode or IMMEDIATE mode, or to cancel the termination.

2. The tbdown command and down modes can be used at an SQL prompt of tbSQL with the SYS user. The server can be remotely terminated using tbSQL. However, the tbdown command cannot be used with ABNORMAL mode in tbSQL.

3. If a Tibero service is closed through the service manager in Windows, Tibero server is terminated with IMMEDIATE mode by default. To use another mode, set the down mode using the initialization parameter SERVICE_CONTROL_STOP_DOWN.

Descriptions and examples of each mode are as follows:

NORMAL

Normal shutdown mode.

After connecting as the SYS user, the Tibero server is terminated after waiting for all sessions to end their connections. After tbdown has been executed, users cannot connect to the database. However, users who were already connected to the database prior to executing tbdown can continue using the database normally until they disconnect.

The usage of NORMAL shutdown mode is shown below:

$ tbdown

Tibero instance terminated (NORMAL mode).

POST_TX

Terminates Tibero after all transactions are complete.

This mode connects to Tibero as the SYS user and waits until all transactions have finished, and then shuts down Tibero. After tbdown is executed, no user can connect to the database. Even in existing sessions, new transactions cannot be started. However, ongoing transactions continue until they are committed or rolled back. When all transactions have been committed or rolled back, the database is automatically disconnected.

In addition, when tbdown is executed, a "server shut down" message will not be sent to clients connected to the database. Clients using the tbSQL utility will not know that Tibero is shutting down until they enter another command.

The usage of POST_TX shutdown mode is shown below:

$ tbsql admin/password123

tbSQL 6 

TmaxData Corporation Copyright (c) 2008-. All rights reserved.

Connected to Tibero.

SQL> CREATE TABLE T1 (COL1 NUMBER);
Table 'T1' created.

SQL> INSERT INTO T1 VALUES(10);
1 row inserted.

SQL> SELECT * FROM T1;
      COL1
----------
        10

1 row selected.

        ...At this point, tbdown POST_TX is executed.
        ...the tbdown command waits for transactions to end.

SQL> COMMIT;
Commit succeeded.
        ...At this point, the server is actually terminated, 
           completing the execution of tbdown.

SQL> SELECT * FROM T1;
TBR-2131: Generic I/O error.
        ...The TBR-2313 error occurred at the prompt of the tbSQL utility.

IMMEDIATE

Terminates Tibero immediately. All ongoing jobs are stopped and rolled back.

This mode connects to Tibero as the SYS user and forces all ongoing jobs to stop and all current transactions to be rolled back, and then shuts down Tibero. As with POST_TX mode, clients are not notified of the termination of Tibero.

If a transaction has been processing for a long time, its rollback time can also be long.

The usage of IMMEDIATE mode is shown below:

$ tbdown immediate

Tibero instance terminated (IMMEDIATE mode).

ABORT

Forces all Tibero processes to close.

After connecting as the SYS user, the Tibero server is forcibly terminated after Tibero's MTHR process sends a forcible termination signal to all processes via the OS. Therefore, this mode is used in an emergency. At the next startup of Tibero, recovery is needed.

The usage of ABORT mode is shown below:

$ tbdown abort

Tibero instance terminated (ABORT mode).

Because ABORT mode forces Tibero to close in ABORT mode, there is no chance to release system resources that are in use, so even after the server is shut down, some system resources may remain, such as shared memory, semaphores, and log or data files.

Crash Recovery can also take a long time at the next startup of Tibero.

It is recommended to make limited use of ABORT, in the following cases:

  • When normal shutdown is not possible due to an internal error of Tibero.

  • When Tibero needs to be shut down immediately due to a hardware problem.

  • When Tibero needs to be shut down immediately due to emergency situations such as unauthorized use.

SWITCHOVER

Synchronizes the Standby DB and Primary DB, and then terminates the Primary DB in NORMAL mode.

For more detailed information, refer to “8.6.1. Switchover” in “Chapter 8. Tibero Standby Cluster”.

ABNORMAL

Does not connect to Tibero and forcibly terminates the server process.

Without connecting, the Tibero server is forcibly terminated regardless of its current status using the OS's forcible termination signal. Therefore, this mode is used in an emergency. At the next startup of Tibero, recovery is needed.

The usage of ABNORMAL mode is shown below:

$ tbdown abnormal

Tibero instance terminated (ABNORMAL mode).

Because Tibero is forced to close in ABNORMAL mode, there is no chance to release system resources that are in use, so even after the server is shut down, some system resources may remain, such as shared memory, semaphores, and log or data files.

Crash Recovery can also take a long time at the next startup of Tibero.

It is recommended to make limited use of ABNORMAL, in the following cases:

  • When normal shutdown is not possible due to an internal error of Tibero

  • When Tibero needs to be shut down immediately because terminating with another mode takes too much time.

  • When other modes have failed due to a hardware or OS problem.

  • When Tibero needs to be shut down immediately due to a hardware problem.

  • When Tibero needs to be shut down immediately due to emergency situations such as unauthorized use.

2.6. Using Binary TIP

Binary TIP (hereafter BTIP) is a function that saves Tibero initialization parameter values to a binary file. Unlike a TIP file, parameters that are modified and saved during operation in a BTIP are applied at the next startup.

BTIP is created using the following DDL statements.

SQL> CREATE BTIP FROM TIP;
      ...Creates BTIP,$TB_HOME/config/$TB_SID.btip, 
      ...using the TIP file located in $TB_HOME/config. 


SQL> CREATE BTIP='PATH' FROM TIP; 
      ...To save the BTIP in a directory other than $TB_HOME/config,
      ...set the name of the BTIP file with an absolute path. 
      ...The file extension name must be .btip.

If $TB_SID.btip is located in $TB_HOME/config by default at startup, parameter information is read from the BTIP file. The user can also set a desired btip file path. If BTIP does not exist, parameter information is read from the $TB_SID.tip file.

The information of the TIP file in use is retrieved as follows.

SQL> SELECT TIP_FILE FROM V$INSTANCE;
TIP_FILE
--------------------------------------------------------------------------------
/home/tibero/work/6/config/t6.btip

...BTIP file under $TB_HOME/config is currently in use.

To make and apply dynamic changes to a parameter in BTIP, specify the scope for applying the changes through the following DDL statements.

SQL> ALTER SYSTEM SET PARAMETER1 = NEW_VALUE SCOPE BTIP ;
...By applying NEW_VALUE, the changed value of PARAMETER1, only to BTIP, 
...NEW_VALUE is applied to PARAMETER1 at the next startup. 
...The current PARAMETER 1 value is OLD_VALUE after executing DDL.

SQL> ALTER SYSTEM SET PARAMETER1 = NEW_VALUE SCOPE MEMORY ;
...NEW_VALUE, the changed value of PARAMETER1, is only applied during the operation.
...OLD_VALUE is applied to PARAMETER1 at the next startup. 

SQL> ALTER SYSTEM SET PARAMETER1 = NEW_VALUE SCOPE BOTH ;
...NEW_VALUE, the changed value of PARAMETER1, is applied to BTIP during the 
   operation. 
...NEW_VALUE is applied to PARAMETER1 at the next startup.
...The PARAMETER1 value applied after the DDL statement is also NEW_VALUE.

Creating a TIP file from a BTIP is only possible when the operating server uses BTIP.

SQL> CREATE TIP FROM BTIP;