Document Type | Technical Information
Category | Utility
Applicable Product Version | Tibero 7 (DB 7.2.5) Build 313465
Document Number | TUTTI022
Overview
During support tasks, it is common to restart Tibero frequently. However, this document is prepared to address cases where the .proc.list file is deleted or corrupted, making normal shutdown impossible.
Test Environment
|
Method
How tbdown Works
When the tbdown command is executed, it refers to the $TB_HOME/instance/$TB_SID/.proc.list file created at startup to perform the command.
However, if the .proc.list file is deleted or its contents differ from the original startup information, normal shutdown will not be possible.
1. If Deleted
node1@tibero:/home/tibero/tibero7/instance/tibero # tbdown
tbdown failed. proc info file is deleted.
Hint: Please check if the tbsvr instance was already stopped.2. If Modified (e.g., shm key content arbitrarily changed)
node1@tibero:/home/tibero/tibero7/instance/tibero # tbdown
shared memory attach failed.
please retry...In such cases, Tibero can only be shut down by forcefully terminating the processes using kill -9.
To minimize the risk of data file corruption, it is recommended to perform a forced checkpoint and redo switch before doing so.
Contents of the .proc.list File
Tibero 7 start at (2026-07-28 15:14:36) by 1000
shared memory: 139623464435712 size: 1073741824
shm_key: 1497711233 1 sem_key: -5704128 197 listener_pid: 3400 listener_port: 8629 listener_special_port: 8630 epa_pid: -1
3399 MONP
3401 MGWP
3402 FGWP0000
3403 FGWP0001
3404 PEWP0000
3405 PEWP0001
3406 PEWP0002
3407 PEWP0003
3408 PEWP0004
3409 AGNT
3410 DBWR
3411 RCWPThe top line shows which User ID forked the Tibero process.
Below that are the shared memory address and size information.
The lower section lists the process IDs (pids) for each process, which can also be checked using the tbdown pid command, sorted by pid.
Note that the tbdown pid command may also fail if the .proc.list file is deleted or corrupted.
.proc.list Creation Script
Please note that due to environmental constraints, this script has only been tested in a single Linux environment.
#!/bin/bash
#==============================================================================
# tbdown_make_pid.sh (v2)
# Reconstructs the Tibero instance boot header block from a running OS state.
#
# Usage: ./tbdown_make_pid.sh [SID]
# If SID is not specified, uses $TB_SID. Port is referenced from $TB_HOME/config/<SID>.tip.
# Debug: TB_DEBUG=1 ./tbdown_make_pid.sh <SID>
# Execution permission: tibero OS account (or root). /proc/<pid>/{exe,maps} and
# socket-PID mapping (ss -p / lsof) are visible only to the same uid or root.
#
# Changes from v1:
# [FIX-1] Replaced process search from relying on comm("tbsvr") to /proc/<pid>/exe.
# This fixes the issue where Tibero changes process titles to worker names (e.g., FGWP0000),
# causing `pgrep -x tbsvr` to return zero results.
# [FIX-2] Changed worker name extraction from assuming 'tbsvr_' suffix to matching comm/cmdline tokens.
# Fixed bug where MGWP/AGNT/DBWR/RCWP without suffixes were all marked as MONP.
# [FIX-3] Removed detection of epa_pid as special port occupier. EPA (external procedure
# agent) is unrelated to listener special port โ detected as actual EPA process,
# or -1 if not found (matches original behavior).
#==============================================================================
set -u
SID="${1:-${TB_SID:-}}"
TB_HOME="${TB_HOME:-}"
DEBUG="${TB_DEBUG:-0}"
dbg(){ [ "$DEBUG" = "1" ] && printf '[debug] %s\n' "$*" &2; }
[ -z "$SID" ] && { echo "ERROR: Please provide SID as an argument or set \$TB_SID." &2; exit 1; }
# Tibero outputs IPC keys as signed int32. Convert unsigned to signed.
to_int32(){ local v=$1; [ "$v" -ge 2147483648 ] && v=$((v-4294967296)); echo "$v"; }
# Known Tibero worker name tokens (add if necessary). The last [A-Z]{3,4}[0-9]* is for unknown workers.
TB_WK_RE='MONP|MGWP|FGWP[0-9]+|PEWP[0-9]+|AGNT|DBWR|RCWP|LGWR|CKPT|SNNP|GWHP[0-9]*'
#--- 0) tbsvr process set (based on exe symbolic link, safe from comm modification) -----------
find_tbsvr_pids(){
local pid exe cmd hits="" all=""
for d in /proc/[0-9]*; do
pid=${d#/proc/}
exe=$(readlink "/proc/$pid/exe" 2/dev/null)
cmd=$(tr '\0' ' ' /dev/null)
case "${exe##*/}|$cmd" in *tbsvr*) ;; *) continue ;; esac
all="$all $pid"
case "$cmd $exe" in *"$SID"*) hits="$hits $pid" ;; esac
done
# If SID is embedded in cmdline/exe, filter by it; otherwise (single instance) use all.
[ -n "$hits" ] && echo $hits | tr ' ' '\n' | sort -n \
|| echo $all | tr ' ' '\n' | sort -n
}
mapfile -t PIDS &2; exit 1; }
MASTER_PID="${PIDS[0]}" # Lowest PID = MONP (master)
dbg "tbsvr pids: ${PIDS[*]} master=$MASTER_PID"
#--- 1) start at = master start time, by = UID --------------------------------
OWNER_UID=$(awk '/^Uid:/{print $2; exit}' "/proc/$MASTER_PID/status")
OWNER_NAME=$(id -nu "$OWNER_UID" 2/dev/null || echo "$OWNER_UID")
START_RAW=$(ps -o lstart= -p "$MASTER_PID")
START_AT=$(date -d "$START_RAW" "+%Y-%m-%d %H:%M:%S" 2/dev/null)
[ -z "$START_AT" ] && START_AT="$START_RAW"
#--- 2) /proc/<pid>/maps SysV shared memory (largest segment) ------------------
# maps line: - rw-s /SYSV (deleted)
# Note: attach address changes every boot (ASLR). Cannot restore original log values, only current.
SHM_ADDR_DEC=0; SHM_KEY_HEX=""; MAXSZ=0
while read -r start end key; do
s=$((16#$start)); e=$((16#$end)); sz=$((e-s))
[ "$sz" -gt "$MAXSZ" ] && { MAXSZ=$sz; SHM_ADDR_DEC=$s; SHM_KEY_HEX=$key; }
done /dev/null)
[ -z "$SHM_KEY_HEX" ] && { echo "ERROR: Could not find SysV shared memory mapping (check permissions/version)." &2; exit 1; }
SHM_KEY_U=$((16#$SHM_KEY_HEX))
SHM_KEY=$(to_int32 "$SHM_KEY_U")
SHM_KEY_NORM=$(printf '0x%x' "$SHM_KEY_U")
dbg "shm addr=$SHM_ADDR_DEC keyhex=$SHM_KEY_HEX key=$SHM_KEY size=$MAXSZ"
#--- 3) ipcs -m : size (= bytes for matching key), second field = segment count ---
# In banner 'shm_key: ', N = number of shared memory segments owned by instance (tibero)
# Tibero usually has 1 SGA segment โ 1. This is not shmid (shmid and N differ even for same instance).
SHM_SIZE="-1"; SHM_NSEG=0
while read -r key id owner perms bytes rest; do
case "$key" in 0x*) ;; *) continue ;; esac
[ "$owner" = "$OWNER_NAME" ] && SHM_NSEG=$((SHM_NSEG+1))
[ "$(printf '0x%x' "$((key))")" = "$SHM_KEY_NORM" ] && SHM_SIZE=$bytes
done ', M = number of semaphore sets created by owner.
# (Not sum of nsems: actual was 197 sets ร 2 nsems each = 394 total, banner shows 197)
# Symmetric with shm 'segment count', both are counts of IPC objects.
SEM_KEY="0"; SEM_NSET=0; first_sem=1
while read -r key id owner perms nsems rest; do
case "$key" in 0x*) ;; *) continue ;; esac
[ "$owner" = "$OWNER_NAME" ] || continue
SEM_NSET=$((SEM_NSET + 1))
if [ "$first_sem" = "1" ]; then SEM_KEY=$(to_int32 "$((key))"); first_sem=0; fi
done /dev/null 2&1 && \
pid=$(ss -ltnp "sport = :$port" 2/dev/null | grep -oE 'pid=[0-9]+' | head -1 | cut -d= -f2)
[ -z "$pid" ] && command -v lsof /dev/null 2&1 && \
pid=$(lsof -nP -iTCP:"$port" -sTCP:LISTEN -t 2/dev/null | head -1)
[ -z "$pid" ] && command -v fuser /dev/null 2&1 && \
pid=$(fuser "$port/tcp" 2/dev/null | tr -s ' ' '\n' | grep -E '^[0-9]+$' | head -1)
echo "${pid:--1}"
}
LPID=$(listen_pid_of "$LPORT")
#--- 7) epa_pid: actual EPA process detection. -1 if none -------------------------
# EPA (External Procedure Agent) is a separate process (tbepa/EPA worker), unrelated to special port.
EPA_PID=-1
for p in "${PIDS[@]}"; do
blob="$(cat /proc/$p/comm 2/dev/null) $(tr '\0' ' ' /dev/null)"
case "$blob" in *EPA*|*tbepa*) EPA_PID=$p; break ;; esac
done
#--- 8) Version ----------------------------------------------------------------
VER=$( { tbboot -h 2&1; tbsql -v 2&1; } | grep -oiE 'Tibero[[:space:]]*[0-9]+' | head -1)
[ -z "$VER" ] && VER="Tibero 7"
#--- 9) Extract worker names ---------------------------------------------------
# - Master (lowest PID) appears with '-t NORMAL' so shows as NORMAL, but banner name is MONP.
# - OS title index is 3 digits (FGWP000) but banner uses 4 digits (FGWP0000) โ re-padding.
worker_name(){
local pid=$1 comm cmd tok cls num
if [ "$pid" = "$MASTER_PID" ]; then echo "MONP"; return; fi
comm=$(cat "/proc/$pid/comm" 2/dev/null)
cmd=$(tr '\0' ' ' /dev/null)
dbg "pid=$pid comm='$comm' cmdline='$cmd'"
tok=""
for s in "$comm" "$cmd"; do
tok=$(grep -oE "$TB_WK_RE"
Manual .proc.list Creation and tbdown Test
1. If Deleted
node1@tibero:/home/tibero/tibero7/instance/tibero # ll -a
total 16
drwxr-xr-x. 3 tibero dba 20 Jul 22 16:45 ..
drwxr-xr-x. 4 tibero dba 29 Jul 22 16:45 out
drwxr-xr-x. 9 tibero dba 113 Jul 22 16:47 log
drwxr-xr-x. 5 tibero dba 54 Jul 22 16:49 dump
drwxr-xr-x. 2 tibero dba 177 Jul 28 15:14 path
-rw-r--r--. 1 tibero dba 366 Jul 28 15:19 .proc.list
-rw-r--r--. 1 tibero dba 8764 Jul 28 15:28 make.sh
drwxr-xr-x. 6 tibero dba 85 Jul 28 15:28 .
node1@tibero:/home/tibero/tibero7/instance/tibero #
node1@tibero:/home/tibero/tibero7/instance/tibero # ps -ef | grep tbsvr
tibero 3399 1 0 15:14 pts/0 00:00:00 tbsvr -t NORMAL -SVR_SID tibero
tibero 3401 3399 0 15:14 pts/0 00:00:00 tbsvr_MGWP -t NORMAL -SVR_SID tibero
tibero 3402 3399 0 15:14 pts/0 00:00:00 tbsvr_FGWP000 -t NORMAL -SVR_SID tibero
tibero 3403 3399 0 15:14 pts/0 00:00:01 tbsvr_FGWP001 -t NORMAL -SVR_SID tibero
tibero 3404 3399 0 15:14 pts/0 00:00:00 tbsvr_PEWP000 -t NORMAL -SVR_SID tibero
tibero 3405 3399 0 15:14 pts/0 00:00:00 tbsvr_PEWP001 -t NORMAL -SVR_SID tibero
tibero 3406 3399 0 15:14 pts/0 00:00:00 tbsvr_PEWP002 -t NORMAL -SVR_SID tibero
tibero 3407 3399 0 15:14 pts/0 00:00:00 tbsvr_PEWP003 -t NORMAL -SVR_SID tibero
tibero 3408 3399 0 15:14 pts/0 00:00:00 tbsvr_PEWP004 -t NORMAL -SVR_SID tibero
tibero 3409 3399 0 15:14 pts/0 00:00:01 tbsvr_AGNT -t NORMAL -SVR_SID tibero
tibero 3410 3399 0 15:14 pts/0 00:00:00 tbsvr_DBWR -t NORMAL -SVR_SID tibero
tibero 3411 3399 0 15:14 pts/0 00:00:00 tbsvr_RCWP -t NORMAL -SVR_SID tibero
tibero 3575 1207 0 15:28 pts/0 00:00:00 grep --color=auto tbsvr
node1@tibero:/home/tibero/tibero7/instance/tibero #
node1@tibero:/home/tibero/tibero7/instance/tibero # rm .proc.list
node1@tibero:/home/tibero/tibero7/instance/tibero #
node1@tibero:/home/tibero/tibero7/instance/tibero # tbdown
tbdown failed. proc info file is deleted.
Hint: Please check if the tbsvr instance was already stopped.
node1@tibero:/home/tibero/tibero7/instance/tibero #
node1@tibero:/home/tibero/tibero7/instance/tibero # sh make.sh .proc.list
node1@tibero:/home/tibero/tibero7/instance/tibero #
node1@tibero:/home/tibero/tibero7/instance/tibero # ll -a
total 16
drwxr-xr-x. 3 tibero dba 20 Jul 22 16:45 ..
drwxr-xr-x. 4 tibero dba 29 Jul 22 16:45 out
drwxr-xr-x. 9 tibero dba 113 Jul 22 16:47 log
drwxr-xr-x. 5 tibero dba 54 Jul 22 16:49 dump
drwxr-xr-x. 2 tibero dba 177 Jul 28 15:14 path
-rw-r--r--. 1 tibero dba 8764 Jul 28 15:28 make.sh
drwxr-xr-x. 6 tibero dba 85 Jul 28 15:29 .
-rw-r--r--. 1 tibero dba 369 Jul 28 15:29 .proc.list
node1@tibero:/home/tibero/tibero7/instance/tibero #
node1@tibero:/home/tibero/tibero7/instance/tibero # tbdown
Tibero instance terminated (NORMAL mode).
2. If Modified (e.g., shm key content arbitrarily changed)
".proc.list" 15L, 365B written
node1@tibero:/home/tibero/tibero7/instance/tibero # tbdown
shared memory attach failed.
please retry...
node1@tibero:/home/tibero/tibero7/instance/tibero # sh make.sh .proc.list
node1@tibero:/home/tibero/tibero7/instance/tibero #
node1@tibero:/home/tibero/tibero7/instance/tibero # tbdown
Tibero instance terminated (NORMAL mode).Caution
This script may not work in TAC or TSC environments, or on non-Linux operating systems.