Teguh Triharto Learning Center
Best of Sharing Knowledge Number 1 In The World & In The Universe
Friday, June 19, 2026
.::: Check dbsize MariaDB using ls -h OS, with & exclude table :::.
correlation https://teguhth.blogspot.com/2025/12/script-check-size-database-base-on-size.html
1. check dbsize full
sh cek_teguhth.sh
[root@teguhth-all ceksizemaria]# cat cek_teguhth.sh
#!/bin/bash
BASE_DIR="/var/lib/mysql/teguhth"
echo "Database Directory Size Report"
echo "=============================="
printf "%-25s %10s\n" "FOLDER" "SIZE"
echo "------------------------------"
du -sh ${BASE_DIR}/* 2>/dev/null | sort -h | while read size folder; do
printf "%-25s %10s\n" "$(basename "$folder")" "$size"
done
echo "------------------------------"
echo "TOTAL:"
du -sh "$BASE_DIR" | awk '{print $1}'
[root@teguhth-all ceksizemaria]#
Friday, June 12, 2026
.::: Script check IP NAS Mounting in fstab for trouble shooting :::.
1. check df -h
2. cek simple
[root@teguhth8 cekfstab]# more cek_mounting_simple.sh
for ip in $(grep -v '^#' /etc/fstab | awk '$3=="nfs"{print $1}' | cut -d: -f1 | sort -u)
do
ping -c 1 -W 1 $ip >/dev/null
if [ $? -ne 0 ]; then
echo "DOWN: $ip"
fi
done
[root@teguhth8 cekfstab]#
3. check all ip
[root@teguhth8 cekfstab]# cat cek_mounting_allip.sh
#!/bin/bash
for ip in $(grep -v '^#' /etc/fstab | awk '$3=="nfs"{print $1}' | cut -d: -f1 | sort -u)
do
if ping -c 1 -W 1 $ip >/dev/null 2>&1
then
echo "UP : $ip"
else
echo "DOWN : $ip"
fi
done
[root@teguhth8 cekfstab]#
Tuesday, May 5, 2026
.::: bat script to simulate pararel query thread or Injector CPU in MSSQL SQL Server :::.
1. create script cpu_injector_mssql.bat
@echo off
setlocal enabledelayedexpansion
REM ===== CONFIG DATABASE =====
set DB_HOST=10.10.10.7
set DB_PORT=1433
set DB_USER=sa
set DB_PASS=P@ssw0rd
set DB_NAME=teguhth
REM ===== QUERY =====
set QUERY=SELECT 'CPU Injector by Teguh Triharto',WAITFOR DELAY '00:00:00.001';
Thursday, April 30, 2026
.::: Install Maxscale 25 Trial with license license_key (maxscale: The mandatory parameter 'license_key' is not provided) :::.
1. Downlaod Maxscale & license
https://mariadb.com/downloads/community/maxscale-trial/
https://customers.mariadb.com/license/maxscale-trial/
2. Install
tar -xvf maxscale-25.10.2-trial-release.rocky.9.x86_64.tar
yum install maxscale-common-25.10.2-1.rhel.9.x86_64.rpm -y
yum install maxscale-maxctrl-25.10.2-1.rhel.9.x86_64.rpm -y
yum install maxscale-trial-25.10.2-1.rhel.9.x86_64.rpm -y
3. Try start & enable automatic
[root@teguhth-ha03 data]# systemctl status maxscale.service
× maxscale.service - MariaDB MaxScale Database Proxy
Loaded: loaded (/usr/lib/systemd/system/maxscale.service; enabled; preset: disabled)
Active: failed (Result: exit-code) since Wed 2026-04-22 15:28:47 WIB; 2min 23s ago
Process: 13163 ExecStart=/usr/bin/maxscale (code=exited, status=1/FAILURE)
CPU: 72ms
Tuesday, April 28, 2026
.::: Command remote access mongodb using mongosh, authenticationMechanism SCRAM-SHA-256, authenticationMechanism SCRAM-SHA-1 :::
https://teguhth.blogspot.com/2024/04/backup-restore-database-mongodb-using.html
1. console admin
mongosh -u admin -p admin --authenticationDatabase admin
[root@teguhth-all ~]# mongosh -u admin -p admin --authenticationDatabase admin
Current Mongosh Log ID: 69f05c29e551710562d805da
Connecting to: mongodb://<credentials>@127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&authSource=admin&appName=mongosh+2.8.1
Using MongoDB: 8.0.20
Using Mongosh: 2.8.1
mongosh 2.8.2 is available for download: https://www.mongodb.com/try/download/shell
For mongosh info see: https://www.mongodb.com/docs/mongodb-shell/
------
The server generated these startup warnings when booting
2026-04-28T14:01:22.306+07:00: For customers running the current memory allocator, we suggest changing the contents of the following sysfsFile
2026-04-28T14:01:22.306+07:00: We suggest setting the contents of sysfsFile to 0.
2026-04-28T14:01:22.306+07:00: We suggest setting swappiness to 0 or 1, as swapping can cause performance problems.
------
test>
1. console admin
mongosh -u admin -p admin --authenticationDatabase admin
[root@teguhth-all ~]# mongosh -u admin -p admin --authenticationDatabase admin
Current Mongosh Log ID: 69f05c29e551710562d805da
Connecting to: mongodb://<credentials>@127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&authSource=admin&appName=mongosh+2.8.1
Using MongoDB: 8.0.20
Using Mongosh: 2.8.1
mongosh 2.8.2 is available for download: https://www.mongodb.com/try/download/shell
For mongosh info see: https://www.mongodb.com/docs/mongodb-shell/
------
The server generated these startup warnings when booting
2026-04-28T14:01:22.306+07:00: For customers running the current memory allocator, we suggest changing the contents of the following sysfsFile
2026-04-28T14:01:22.306+07:00: We suggest setting the contents of sysfsFile to 0.
2026-04-28T14:01:22.306+07:00: We suggest setting swappiness to 0 or 1, as swapping can cause performance problems.
------
test>
Friday, April 24, 2026
Thursday, April 23, 2026
.::: Export MSSQL SQL Server to csv using OPENROWSET :::.
https://teguhth.blogspot.com/2025/12/backup-restore-table-sql-server-using.html
https://teguhth.blogspot.com/2026/04/sample-lab-using-openrowset-in.html
1. create excel dummy with header save as "openrowsori.xlsx"
2. replace openrows.xlsx (
copy openrowsori.xlsx openrows.xlsx
Karena Excel (via Microsoft ACE OLEDB):
tidak support DELETE
tidak support TRUNCATE
tidak support OVERWRITE
https://teguhth.blogspot.com/2026/04/sample-lab-using-openrowset-in.html
1. create excel dummy with header save as "openrowsori.xlsx"
2. replace openrows.xlsx (
copy openrowsori.xlsx openrows.xlsx
Karena Excel (via Microsoft ACE OLEDB):
tidak support DELETE
tidak support TRUNCATE
tidak support OVERWRITE
Friday, April 17, 2026
Tuesday, April 14, 2026
.::: Shell Script Sync Manual Table, Add Column, Alter Column Compare Database (teguhth,aisyah) in MariaDB, MySQL, MarinaDB :::.
corelation https://teguhth.blogspot.com/2026/04/create-store-procedure-sync-manual_10.html
https://teguhth.blogspot.com/2026/04/sync-manual-table-add-column-alter_10.html
1. script
run_sp_compare_table.sh
run_sp_compare_add_column_table.sh
run_sp_compare_alter_column_table.sh
run_sp_compare_table_csv.sh
run_sp_compare_add_column_table_csv.sh
run_sp_compare_alter_column_table_csv.sh
2. run
sh run_sp_compare_table.sh teguhth aisyah
sh run_sp_compare_add_column_table.sh teguhth aisyah
sh run_sp_compare_alter_column_table.sh teguhth aisyah
sh run_sp_compare_table_csv.sh teguhth aisyah
sh run_sp_compare_add_column_table_csv.sh teguhth aisyah
sh run_sp_compare_alter_column_table_csv.sh teguhth aisyah
Friday, April 10, 2026
.::: Create Store Procedure Sync Manual Table, Add Column, Alter Column Compare Database (teguhth,aisyah) in MariaDB MarinaDB MySQL :::.
correlation https://teguhth.blogspot.com/2026/04/sync-manual-table-add-column-alter_10.html
1. CREATE TABLE (yang belum ada di aisyah)
DELIMITER $$
CREATE PROCEDURE sp_compare_table(
IN p_source_db VARCHAR(100),
IN p_target_db VARCHAR(100)
)
BEGIN
SET SESSION group_concat_max_len = 1000000;
SET @sql = CONCAT(
'SELECT
CONCAT(
''CREATE TABLE ', p_target_db, '.'' , t.table_name, '' ( \n'',
GROUP_CONCAT(
CONCAT(
'' '', c.column_name, '' '',
c.column_type,
IF(c.is_nullable = ''YES'', '' NULL'', '' NOT NULL'')
)
ORDER BY c.ordinal_position
SEPARATOR '',\n''
),
''\n);''
) AS create_table_script
FROM information_schema.tables t
JOIN information_schema.columns c
ON t.table_schema = c.table_schema
AND t.table_name = c.table_name
WHERE t.table_schema = ''', p_source_db, '''
AND t.table_name NOT IN (
SELECT table_name
FROM information_schema.tables
WHERE table_schema = ''', p_target_db, '''
)
GROUP BY t.table_name'
);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END$$
DELIMITER ;
1. CREATE TABLE (yang belum ada di aisyah)
DELIMITER $$
CREATE PROCEDURE sp_compare_table(
IN p_source_db VARCHAR(100),
IN p_target_db VARCHAR(100)
)
BEGIN
SET SESSION group_concat_max_len = 1000000;
SET @sql = CONCAT(
'SELECT
CONCAT(
''CREATE TABLE ', p_target_db, '.'' , t.table_name, '' ( \n'',
GROUP_CONCAT(
CONCAT(
'' '', c.column_name, '' '',
c.column_type,
IF(c.is_nullable = ''YES'', '' NULL'', '' NOT NULL'')
)
ORDER BY c.ordinal_position
SEPARATOR '',\n''
),
''\n);''
) AS create_table_script
FROM information_schema.tables t
JOIN information_schema.columns c
ON t.table_schema = c.table_schema
AND t.table_name = c.table_name
WHERE t.table_schema = ''', p_source_db, '''
AND t.table_name NOT IN (
SELECT table_name
FROM information_schema.tables
WHERE table_schema = ''', p_target_db, '''
)
GROUP BY t.table_name'
);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END$$
DELIMITER ;
.::: Sync Manual Table, Add Column, Alter Column Compare Database (teguhth,aisyah) in MariaDB, MySQL, MarinaDB :::.
correlation https://teguhth.blogspot.com/2025/03/query-to-check-table-column-compare_28.html
1. CREATE TABLE (yang belum ada di aisyah)
SELECT
CONCAT(
'CREATE TABLE aisyah.', t.table_name, ' ( \n',
GROUP_CONCAT(
CONCAT(
' ', c.column_name, ' ',
c.column_type,
IF(c.is_nullable = 'YES', ' NULL', ' NOT NULL')
)
ORDER BY c.ordinal_position
SEPARATOR ',\n'
),
'\n);'
) AS create_table_script
FROM information_schema.tables t
JOIN information_schema.columns c
ON t.table_schema = c.table_schema
AND t.table_name = c.table_name
WHERE t.table_schema = 'teguhth'
AND t.table_name NOT IN (
SELECT table_name
FROM information_schema.tables
WHERE table_schema = 'aisyah'
)
GROUP BY t.table_name;
1. CREATE TABLE (yang belum ada di aisyah)
SELECT
CONCAT(
'CREATE TABLE aisyah.', t.table_name, ' ( \n',
GROUP_CONCAT(
CONCAT(
' ', c.column_name, ' ',
c.column_type,
IF(c.is_nullable = 'YES', ' NULL', ' NOT NULL')
)
ORDER BY c.ordinal_position
SEPARATOR ',\n'
),
'\n);'
) AS create_table_script
FROM information_schema.tables t
JOIN information_schema.columns c
ON t.table_schema = c.table_schema
AND t.table_name = c.table_name
WHERE t.table_schema = 'teguhth'
AND t.table_name NOT IN (
SELECT table_name
FROM information_schema.tables
WHERE table_schema = 'aisyah'
)
GROUP BY t.table_name;
.::: Create Store Procedure Sync Manual Table, Add Column, Alter Column Compare Database (teguhth,aisyah) in SQL Server :::.
correlation https://teguhth.blogspot.com/2026/04/sync-manual-table-add-column-alter.html
1. CREATE TABLE (yang belum ada di aisyah)
CREATE PROCEDURE sp_compare_table
@source_db SYSNAME,
@target_db SYSNAME
AS
BEGIN
SET NOCOUNT ON;
DECLARE @sql NVARCHAR(MAX);
1. CREATE TABLE (yang belum ada di aisyah)
CREATE PROCEDURE sp_compare_table
@source_db SYSNAME,
@target_db SYSNAME
AS
BEGIN
SET NOCOUNT ON;
DECLARE @sql NVARCHAR(MAX);
Subscribe to:
Posts (Atom)
Popular Posts
-
Sertifikasi profesional, kadang hanya disebut dengan sertifikasi atau kualifikasi saja, adalah suatu penetapan yang diberikan oleh ...
-
SQL atau Structured Query Language) adalah sebuah bahasa yang digunakan untuk mengakses data dalam basis data relasional. Bahasa ini sec...
-
bagaimana cara mengubah hostid di Solaris The Hostid is a globally unique ID for a Sun Solaris Machine. Sometimes, you need to change t...
-
DNSPerf and ResPerf are free tools developed by Nominum that make it simple to gather accurate latency and throughput metrics for Domain ...
-
1. Check Host ID Solaris The Hostid is a globally unique ID for a Sun Solaris Machine. Sometimes, you need to change this hostid for ...



















