YottaDB Recreate GLD - Transfer Database
YottaDB Recreate GLD
The cleanest, easiest, repeatable way to clone your YottaDB Global Directory structure from one machine (WSL2 Ubuntu) to another — but with empty database files — is to copy only the directory metadata and regenerate fresh DB files using mdbfile or ydbinstall tooling.
The key is: you never copy the .dat files, only the .gld
Locate and copy your Global Directory to the target
ydb <<< 'WRITE $ZGBLDIR'
scp /path/to/yottadb.gld target:/path/to/new/
The .gld file is the entire schema of your YottaDB instance:
- global → region mappings
- region → segment mappings
- segment → file paths
- block sizes
- record sizes
- journaling settings
If you want the target machine to have the same structure, you must use the same .gld.
Inspect GLD
from bash shell
gde
from inside ydb shell
YDB> do ^GDE
GDE> show -segment
GDE> show -region
GDE> show -name
Recreate empty database file
YottaDB uses MUPIP CREATE to generate empty .dat files based on the regions defined in the .gld.
mupip create
This command:
- reads the
.gld - creates all
.datfiles defined in the regions - initializes them empty
- applies correct block size, record size, etc.
But there is one important nuance: You must ensure the file paths inside the .gld match the target machine’s filesystem before running mupip create.
If your .gld contains file paths that do not exist on the target machine, you must adjust them using GDE for example:
GDE> CHANGE -SEGMENT DEFAULT -FILE_NAME=/home/user/.yottadb/r2.04_x86_64/g/default.dat
GDE> SHOW -SEGMENT DEFAULT
GDE> SHOW -SEGMENT
GDE> SHOW -NAME
GDE> EXIT
GDE> CHANGE -SEGMENT ABOX -FILE_NAME=/home/user/.yottadb/r2.06_x86_64/g/abox.dat
GDE> CHANGE -SEGMENT DEFAULT -FILE_NAME=/home/user/.yottadb/r2.06_x86_64/g/default.dat
GDE> CHANGE -SEGMENT NORTHWIND -FILE_NAME=/home/user/.yottadb/r2.06_x86_64/g/northwind.dat
GDE> CHANGE -SEGMENT TBOX -FILE_NAME=/home/user/.yottadb/r2.06_x86_64/g/tbox.dat
GDE> CHANGE -SEGMENT TRANSACTIONS -FILE_NAME=/home/user/.yottadb/r2.06_x86_64/g/transactions.dat
GDE> CHANGE -REGION ABOX -JOURNAL=FILE_NAME=/home/user/.yottadb/r2.06_x86_64/g/abox.mjl
GDE> CHANGE -REGION NORTHWIND -JOURNAL=FILE_NAME=/home/user/.yottadb/r2.06_x86_64/g/northwind.mjl
GDE> CHANGE -REGION TBOX -JOURNAL=FILE_NAME=/home/user/.yottadb/r2.06_x86_64/g/tbox.mjl
mupip set -journal="ENABLE,ON,BEFORE" -region "NORTHWIND"
mupip set -journal="ENABLE,ON,BEFORE" -region "TBOX"
mupip set -journal="ENABLE,ON,BEFORE" -region "ABOX"
mupip set -journal="ENABLE,ON,BEFORE" -region "DEFAULT"
mupip set -journal="ENABLE,ON,BEFORE" -region "TRANSACTION"
Generate empty database files
mupip create
This reads the .gld and creates all .dat files fresh.
Installation
wget https://download.yottadb.com/ydbinstall.sh
sudo ./ydbinstall.sh --installdir YottaDB --utf8 --allplugins --user user --group user
YottaDB version r2.06 installed successfully at /home/user/YottaDB
YottaDB pkg-config file installed successfully at /usr/share/pkgconfig/yottadb.pc
Now installing YDBAIM
Now installing YDBCurl
Now installing YDBPosix
Now installing YDBSodium
Now installing YDBSupport
Now installing YDBSyslog
Now installing YDBEncrypt
Now installing YDBZlib
Now installing YDBGUI
Now installing YDBOcto
source ~/YottaDB/ydb_env_set
Inspect the environment variables
echo "ydb_dist=$ydb_dist"
ydb_dist=/home/user/YottaDB
echo "ydb_gbldir=$ydb_gbldir"
ydb_gbldir=/home/user/.yottadb/r2.06_x86_64/g/yottadb.gld
echo "ydb_routines=$ydb_routines"
which mupip
/home/user/YottaDB/mupip
ydb <<< 'WRITE $ZGBLDIR'
YDB>
/home/user/.yottadb/r2.06_x86_64/g/yottadb.gld
YDB>
Install TaxisDB
rmdir /home/user/.yottadb/r
mv r /home/user/.yottadb/
cd /home/user/.yottadb/r
cp yottadb.gld ../r2.06_x86_64/g/
cp fix_gld.sh ../r2.06_x86_64/g/
cd ../r2.06_x86_64/g/
rm yottadb.dat
rm yottadb.mjl
chmod u+x fix_gld.sh
./fix_gld.sh
%GDE-I-LOADGD, Loading Global Directory file
/home/user/.yottadb/r2.06_x86_64/g/yottadb.gld
%GDE-I-VERIFY, Verification OK
%GDE-I-GDUPDATE, Updating Global Directory file
/home/user/.yottadb/r2.06_x86_64/g/yottadb.gld
%YDB-I-DBFILECREATED, Database file /home/user/.yottadb/r2.06_x86_64/g/default.dat created
%YDB-I-DBFILECREATED, Database file /home/user/.yottadb/r2.06_x86_64/g/transactions.dat created
%YDB-I-DBFILECREATED, Database file /home/user/.yottadb/r2.06_x86_64/g/tbox.dat created
%YDB-I-DBFILECREATED, Database file /home/user/.yottadb/r2.06_x86_64/g/abox.dat created
%YDB-I-DBFILECREATED, Database file /home/user/.yottadb/r2.06_x86_64/g/northwind.dat created
%YDB-I-JNLCREATE, Journal file /home/user/.yottadb/r2.06_x86_64/g/yottadb.mjl created for region DEFAULT with BE
FORE_IMAGES
%YDB-I-JNLSTATE, Journaling state for region DEFAULT is now ON
%YDB-I-JNLCREATE, Journal file /home/user/.yottadb/r2.06_x86_64/g/transactions.mjl created for region TRANSACTIO
NS with BEFORE_IMAGES
%YDB-I-JNLSTATE, Journaling state for region TRANSACTIONS is now ON
%YDB-I-JNLCREATE, Journal file /home/user/.yottadb/r2.06_x86_64/g/tbox.mjl created for region TBOX with BEFORE_I
MAGES
%YDB-I-JNLSTATE, Journaling state for region TBOX is now ON
%YDB-I-JNLCREATE, Journal file /home/user/.yottadb/r2.06_x86_64/g/abox.mjl created for region ABOX with BEFORE_I
MAGES
%YDB-I-JNLSTATE, Journaling state for region ABOX is now ON
%YDB-I-JNLCREATE, Journal file /home/user/.yottadb/r2.06_x86_64/g/northwind.mjl created for region NORTHWIND wit
h BEFORE_IMAGES
%YDB-I-JNLSTATE, Journaling state for region NORTHWIND is now ON
Global directory recreated and journaling enabled.
ydb
DO ^start
YottaDB GUI Server
yottadb -run %ydbgui --readwrite
Starting Server at port 9080 in directory /home/user/YottaDB/plugin/etc/ydbgui at logging level 0 in readwrite mode
Scripts
Inspect first and modify them according to your needs
fix_gld.sh
#!/bin/bash
set -e
GLD_DIR=/home/user/.yottadb/r2.06_x86_64/g
# Step 1: Fix segment and journal paths via GDE
$ydb_dist/mumps -run GDE <<EOF
CHANGE -SEGMENT ABOX -FILE_NAME=$GLD_DIR/abox.dat
CHANGE -SEGMENT DEFAULT -FILE_NAME=$GLD_DIR/default.dat
CHANGE -SEGMENT NORTHWIND -FILE_NAME=$GLD_DIR/northwind.dat
CHANGE -SEGMENT TBOX -FILE_NAME=$GLD_DIR/tbox.dat
CHANGE -SEGMENT TRANSACTIONS -FILE_NAME=$GLD_DIR/transactions.dat
CHANGE -REGION ABOX -JOURNAL=FILE_NAME=$GLD_DIR/abox.mjl
CHANGE -REGION NORTHWIND -JOURNAL=FILE_NAME=$GLD_DIR/northwind.mjl
CHANGE -REGION TBOX -JOURNAL=FILE_NAME=$GLD_DIR/tbox.mjl
EXIT
EOF
# Step 2: Create empty databases for the application regions only
for region in DEFAULT TRANSACTIONS TBOX ABOX NORTHWIND; do
mupip create -region "$region"
done
# Step 3: Enable journaling on the four regions that need it
mupip set -journal="ENABLE,ON,BEFORE" -region "ABOX,DEFAULT,NORTHWIND,TBOX,TRANSACTIONS"
echo "Global directory recreated and journaling enabled."
taxisdb_transfer.sh
#!/bin/bash
set -e
GLD_DIR=/home/user/.yottadb/r2.06_x86_64/g
# Source location of the already-populated .dat files to transfer.
# Adjust to wherever they're staged (local path, or use scp/rsync
# below if they're still on the source machine).
SRC_DIR=/path/to/transferred/dat/files
# Step 1: Copy the populated database files into place
mkdir -p "$GLD_DIR"
for db in abox.dat default.dat northwind.dat tbox.dat transactions.dat; do
cp "$SRC_DIR/$db" "$GLD_DIR/$db"
done
# If instead copying over the network from the source host, use e.g.:
# rsync -av user@sourcehost:/path/to/dat/*.dat "$GLD_DIR/"
# Step 2: Fix segment and journal paths via GDE to point at the
# transferred files' new location
$ydb_dist/mumps -run GDE <<EOF
CHANGE -SEGMENT ABOX -FILE_NAME=$GLD_DIR/abox.dat
CHANGE -SEGMENT DEFAULT -FILE_NAME=$GLD_DIR/default.dat
CHANGE -SEGMENT NORTHWIND -FILE_NAME=$GLD_DIR/northwind.dat
CHANGE -SEGMENT TBOX -FILE_NAME=$GLD_DIR/tbox.dat
CHANGE -SEGMENT TRANSACTIONS -FILE_NAME=$GLD_DIR/transactions.dat
CHANGE -REGION ABOX -JOURNAL=FILE_NAME=$GLD_DIR/abox.mjl
CHANGE -REGION NORTHWIND -JOURNAL=FILE_NAME=$GLD_DIR/northwind.mjl
CHANGE -REGION TBOX -JOURNAL=FILE_NAME=$GLD_DIR/tbox.mjl
EXIT
EOF
# Step 3 (was: mupip create empty databases) — SKIPPED.
# The .dat files already contain live data (and Octo's catalog
# globals), so no mupip create is needed or wanted here; creating
# fresh databases would overwrite what was just transferred.
# Step 4: Verify database integrity after the file transfer
mupip integ -region "ABOX,DEFAULT,NORTHWIND,TBOX,TRANSACTIONS" -fast
# Step 5: (Re)enable journaling on the transferred regions, pointing
# at the new journal file paths
mupip set -journal="ENABLE,ON,BEFORE" -region "ABOX,DEFAULT,NORTHWIND,TBOX,TRANSACTIONS"
echo "Global directory recreated, database files transferred, and journaling enabled."