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>

 

Friday, April 24, 2026

.::: Read Json file using OPENJSON, OPENROWSET in SQL Server :::.


 

1. copy json sample to disk C:\bcp\teguhth.pembelian.json
 
 



2. only read json 

 

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

Friday, April 17, 2026

.::: Command Check top service, Top Memory in Linux (Centos 9, Rhel 9, Almalinux 9 include grouping & size memory & count proccess ) Top Process

 
1. total Service group 

ps -eo comm | sort | uniq -c | sort -nr | head

[root@teguhth ~]# ps -eo comm | sort | uniq -c | sort -nr | head
     13 sshd
     10 postgres
      8 nfsd
      5 metricbeat
      4 kworker/R-xfs-c
      4 kworker/R-xfs-b
      4 bash
      3 systemd
      3 filebeat
      2 sort
[root@teguhth ~]#

 

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 ;
 

.::: 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;

 

.::: 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);
 

Thursday, April 9, 2026

.::: Sample lab Using OPENROWSET in Microsoft SQL Server 2025 (read excel csv from sql server) :::.

 

A. prerequirement

1. prerequirement 
Access Database Engine 2016 (x64)

https://www.microsoft.com/en-us/download/details.aspx?id=54920

2. enable access service 
 


3. AKTIFKAN OPENROWSET


Di Microsoft SQL Server:

EXEC sp_configure 'show advanced options', 1;
RECONFIGURE;

EXEC sp_configure 'Ad Hoc Distributed Queries', 1;
RECONFIGURE;

 

.::: Sync Manual Table, Add Column, Alter Column Compare Database (teguhth,aisyah) in SQL Server :::.

 

correlation https://teguhth.blogspot.com/2025/03/query-to-check-table-column-compare.html

1. CREATE TABLE (yang belum ada di aisyah)

SELECT 
'CREATE TABLE aisyah.dbo.[' + t1.name + '] (' + CHAR(10) +
STRING_AGG(
    '    [' + c1.name + '] ' + 
    ty1.name +
    CASE 
        WHEN ty1.name IN ('varchar','char','varbinary','binary') 
            THEN '(' + 
                CASE WHEN c1.max_length = -1 THEN 'MAX' 
                     ELSE CAST(c1.max_length AS VARCHAR(10)) END + ')'
 

Tuesday, March 31, 2026

.::: Shell script to simulate pararel query thread or Injector CPU in MariaDB :::.

  

1. run run_query_parallel.sh , cpu lebih rendah 

sh run_query_parallel.sh

[root@teguhth-all pararel]# sh run_query_parallel.sh
Jumlah eksekusi (TOTAL): 10000
Jumlah paralel (THREAD): 10
Menjalankan 10000 query dengan 10 paralel...
Query yang dijalankan: 'SELECT *, SLEEP(0.001) as delay FROM pembelian;'
Progress: 10000/10000 (100%)
Selesai semua eksekusi.
[root@teguhth-all pararel]# 

Monday, March 30, 2026

::: Simalation Locking, Blocking & Deadlock in SQl Server MSSQL, LCK_M_S(locking), LCK_M_X(Blocking Deadlock) :::.

 
Mantap ini contoh tabel kamu sudah pas untuk bikin simulasi.
Saya buatkan 3 skenario nyata di SQL Server: locking ? blocking ? deadlock (step-by-step, tinggal kamu jalankan di 2 query window / session).

1. SIMULASI LOCKING

Session 1 (Window 1) (session 64 sa)

SELECT @@SPID as session_id;
BEGIN TRAN;
UPDATE pembelian 
SET JUMLAH_PEMBELIAN = 10 
WHERE KODE_PEMBELIAN = 'BEL-E001';
 

Session 2 (session 60 sa)
 

Thursday, March 5, 2026

.::: Create User Access MariaDB MySQL using login Active Directory Windows via PAM :::.

 


1. correlation from https://teguhth.blogspot.com/2019/08/join-domain-active-directory-on-centos.html

2. enable pam plugin 


INSTALL SONAME 'pam';
SELECT PLUGIN_NAME, PLUGIN_STATUS FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME LIKE '%pam%';

MariaDB [(none)]> INSTALL SONAME 'pam';
Query OK, 0 rows affected (0.007 sec)

MariaDB [(none)]>
MariaDB [(none)]> SELECT PLUGIN_NAME, PLUGIN_STATUS FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME LIKE '%pam%';
+-------------+---------------+
| PLUGIN_NAME | PLUGIN_STATUS |
+-------------+---------------+
| pam         | ACTIVE        |
+-------------+---------------+
1 row in set (0.002 sec)

MariaDB [(none)]>
 

Wednesday, February 25, 2026

.::: T-SQL Clean backup retention di SQL Server MSSQL :::.

  
correlation with http://teguhth.blogspot.com/2025/12/create-script-backup-all-database-full.html

1. create sp_backup .bat script for backup

### 10.10.10.200

sqlcmd -U user -P password -S 10.10.10.200 -d dbatools -Q "exec dbatools.[dbo].[sp_backup_full_basic]"
sqlcmd -U user -P password -S 10.10.10.200 -d dbatools -Q "exec dbatools.[dbo].[sp_backup_diff_basic]"
sqlcmd -U user -P password -S 10.10.10.200 -d dbatools -Q "exec dbatools.[dbo].[sp_backup_log_basic]"

2. create sp_cleanbackup.bat for sp_clean

sqlcmd -U user -P password -S 10.10.10.200 -d dbatools -Q "exec dbatools.[dbo].[sp_backup_cleanup_direct]"
 

Wednesday, February 18, 2026

.::: Sample Access Database MariaDB via Backend Golang & Frontend using Lucee & PHP :::.

 


1. Sample for table pembelian

mkdir -p /opt/go-pembelian
cd /opt/go-pembelian

mkdir backend
cd backend

2. run mod & driver 

cd backend
go mod init pembelian-api
go get github.com/go-sql-driver/mysql

[root@teguhth-all go-pembelian]# cd backend
[root@teguhth-all backend]# go mod init pembelian-api
go: creating new go.mod: module pembelian-api
[root@teguhth-all backend]# ls
go.mod
[root@teguhth-all backend]# go get github.com/go-sql-driver/mysql
go: downloading github.com/go-sql-driver/mysql v1.9.3
go: downloading filippo.io/edwards25519 v1.1.0
go: added filippo.io/edwards25519 v1.1.0
go: added github.com/go-sql-driver/mysql v1.9.3

[root@teguhth-all backend]# pwd
/opt/go-pembelian/backend
[root@teguhth-all backend]# ls
go.mod  go.sum
[root@teguhth-all backend]#
 

.::: Move log_bin_basename (mysqlbinlogs) MariaDB / MySQL using symlink relink symbolic link :::.

 


A. capture before 

1.check mariadb version

2. check log_bin_basename 

SHOW VARIABLES WHERE Variable_name IN ('datadir','basedir','log_bin_basename');
 

3. check before move datadir 
 
B. move log_bin_basename 
 

.::: Move Datadir MariaDB / MySQL using symlink relink symbolic link :::.

 

A. capture before 

1. check mariadb version

2. check datadir 


SHOW VARIABLES WHERE Variable_name IN ('datadir','basedir');
SHOW VARIABLES LIKE 'log_bin_basename';

 
 

Thursday, February 12, 2026

.::: Install MariaDB 10.11.x Using repo local cdrom ISO on Centos 9, Almalinux 9, Redhat 9 :::.

.::: Install Maxscale 24 Using repo local cdrom on Centos 9, Almalinux 9, Redhat 9 :::.

 

1. enable repolocal 

https://teguhth.blogspot.com/2026/02/enable-repo-local-using-cdrom-on-centos.html

2. download maxscale maxscale-24.02.7-1.rhel.9.x86_64.rpm

mariadb archive 
https://archive.mariadb.org/mariadb-10.11/yum/almalinux9-amd64/rpms/

maxscale archive
https://dlm.mariadb.com/browse/mariadbmaxscale/24.02.7/yum/rhel/9/x86_64/

[root@teguhth data]# pwd
/data
[root@teguhth data]# ls | grep -i maxscale
maxscale-24.02.7-1.rhel.9.x86_64.rpm
[root@teguhth data]#

.::: Enable Repo Local Using cdrom (ISO file) on Centos 9, Almalinux 9, Redhat 9 :::.

 
 
1. check iso/disk/rom 

lsblk

[root@teguhth ~]# lsblk
NAME               MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
sr0                 11:0    1 12.4G  0 rom
nvme0n1            259:0    0   30G  0 disk
+-nvme0n1p1        259:1    0    1G  0 part /boot
+-nvme0n1p2        259:2    0   29G  0 part
  +-almalinux-root 253:0    0   27G  0 lvm  /
  +-almalinux-swap 253:1    0    2G  0 lvm  [SWAP]
[root@teguhth ~]#

 
mount -o loop rhel-server-6.6-x86_64-dvd.iso /mnt
 

Tuesday, February 10, 2026

.::: Install Golang 25 in Centos 9 :::.

 

1. download golang 

wget https://go.dev/dl/go1.25.7.linux-amd64.tar.gz

2. check after downlaod 

[root@teguhth-all golang]# wget https://go.dev/dl/go1.25.7.linux-amd64.tar.gz
--2026-02-09 15:59:22--  https://go.dev/dl/go1.25.7.linux-amd64.tar.gz
Resolving go.dev (go.dev)... 216.239.34.21, 216.239.38.21, 216.239.32.21, ...
Connecting to go.dev (go.dev)|216.239.34.21|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://dl.google.com/go/go1.25.7.linux-amd64.tar.gz [following]
--2026-02-09 15:59:22--  https://dl.google.com/go/go1.25.7.linux-amd64.tar.gz
Resolving dl.google.com (dl.google.com)... 74.125.24.136, 74.125.24.91, 74.125.24.190, ...
Connecting to dl.google.com (dl.google.com)|74.125.24.136|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 59768749 (57M) [application/x-gzip]
Saving to: ‘go1.25.7.linux-amd64.tar.gz’

 

Monday, February 9, 2026

.::: Sample Access Database MariaDB via Frontend & Backend using Lucee :::.

 


1. enable datasource 
 


2. backend 


http://10.10.10.90:8888/pembelian_api.cfm

[root@teguhth-all ROOT]# pwd
/opt/lucee/tomcat/webapps/ROOT
[root@teguhth-all ROOT]#
[root@teguhth-all ROOT]# cat pembelian_api.cfm
<cfquery name="
qPembelian" datasource="dbteguhth">
 SELECT
        KODE_PEMBELIAN,
        KODE_BARANG,
        KODE_CUSTOMER,
        TANGGAL_PEMBELIAN,
        JUMLAH_PEMBELIAN
    FROM pembelian
</cfquery>

<cfcontent type="application/json">
<cfoutput>#serializeJSON(qPembelian)#</cfoutput>

[root@teguhth-all ROOT]#

.::: create Tools Migration from MongoDB to MariaDB using bash shell script nocsv :::.

  


1. sample data edb & mariadb

MySQL MariaDB
https://teguhth.blogspot.com/2019/04/study-kasus-praktis-belajar-query-mysql.html

MongoDB
https://teguhth.blogspot.com/2020/12/study-kasus-praktis-belajar-query.html

Install 
yum install jq -y

2. data server A & B 
server A mongodb
ip : 10.10.10.9
db : teguhth
port 27017
user : admin
password : admin

server B Mariadb
ip : 10.10.10.90
db : mariamongo
port 3306
user : admin
password : admin

buat script shell untuk migrasi dari server A mariadb to server B mongodb

 

Thursday, February 5, 2026

.::: create Tools Migration from MariaDB to MongoDB using bash shell script using insert & no csv :::.

   

correlation with https://teguhth.blogspot.com/2025/12/create-tools-migration-from-mongodb-to.html

1. data migration server A Maria to server B mongo
server A Mariadb
ip : 10.10.10.90
db : teguhth
port 3306
user : admin
password : admin

server B mongodb
ip : 10.10.10.9
db : mariadbsample
port 27017
user : admin
password : admin

buat script shell untuk migrasi dari server A maria to server B mongo 

db.barang.find();

db.barang.drop();

db.suplier.find();

db.suplier.drop();

db.customer.find();

db.customer.drop();

db.pasok.find();

db.pasok.drop();

db.pembelian.find();

db.pembelian.drop();

 

.::: create Tools Migration from SQL Server MSSQL to MariaDB using bash shell script using insert & NoCSV :::.


 
correlation with https://teguhth.blogspot.com/2024/01/install-configure-odbcinstini-odbc-for.html

1. sample data mssql & mariadb

MySQL MariaDB
https://teguhth.blogspot.com/2019/04/study-kasus-praktis-belajar-query-mysql.html

MSSQL
https://teguhth.blogspot.com/2019/04/study-kasus-praktis-belajar-query.html

2. data server A & B 
server A sql server
ip : 10.10.10.7
db : teguhth
schema : dbo
port 1433
user : admin 
password : admin11!!

server B Mariadb
ip : 10.10.10.90
db : teguhthsql
port 3306
user : admin
password : admin

mysql -h 10.10.10.90 -uadmin -p --skip-ssl

buat script shell untuk migrasi dari server A mssql to server B 

 

Wednesday, February 4, 2026

.::: create Tools Migration from MariaDB to PostgreSQL using bash shell script (no csv):::.

  
correlation https://teguhth.blogspot.com/2025/12/create-tools-migration-from-postgresql.html

1. sample data edb & mariadb

MySQL MariaDB
https://teguhth.blogspot.com/2019/04/study-kasus-praktis-belajar-query-mysql.html

PostgreSQL
https://teguhth.blogspot.com/2019/09/study-kasus-praktis-belajar-query.html

2. data server A & B 

server A Mariadb
ip : 10.10.10.9
db : teguhth
port 3306
user : admin
password : admin

server B Postgres
ip : 10.10.10.90
db : mariaedb
port 5432
user : admin
password : admin
 

Friday, January 30, 2026

.::: Script backup Daily MariaDB Windows :::.

  

1. check
SHOW VARIABLES LIKE 'datadir';
SHOW VARIABLES LIKE 'basedir';

C:\Windows\system32>mariadb -uroot -proot
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 11
Server version: 10.11.11-MariaDB mariadb.org binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> SHOW VARIABLES LIKE 'datadir';
+---------------+--------------------------------------+
| Variable_name | Value                                |
+---------------+--------------------------------------+
| datadir       | C:\Program Files\MariaDB 10.11\data\ |
+---------------+--------------------------------------+
1 row in set (0.001 sec)

MariaDB [(none)]> SHOW VARIABLES LIKE 'basedir';
+---------------+---------------------------------+
| Variable_name | Value                           |
+---------------+---------------------------------+
| basedir       | C:\Program Files\MariaDB 10.11\ |
+---------------+---------------------------------+
1 row in set (0.001 sec)

MariaDB [(none)]>

Wednesday, January 28, 2026

.::: Shell Script to Detect and Compare AI-Generated vs Original Images and Videos :::.

  

A. Install

1. Install for image

sudo dnf install ImageMagick -y
sudo dnf install perl-Image-ExifTool -y

[root@teguhth-all sampleimage]# identify -version
Version: ImageMagick 6.9.13-25 Q16 x86_64 18639 https://legacy.imagemagick.org
Copyright: (C) 1999 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP(4.5)
Delegates (built-in): bzlib cairo djvu fontconfig freetype gslib gvc jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png ps raqm raw rsvg tiff webp wmf x xml zlib
[root@teguhth-all sampleimage]#

[root@teguhth-all sampleimage]# convert -version
Version: ImageMagick 6.9.13-25 Q16 x86_64 18639 https://legacy.imagemagick.org
Copyright: (C) 1999 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP(4.5)
Delegates (built-in): bzlib cairo djvu fontconfig freetype gslib gvc jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png ps raqm raw rsvg tiff webp wmf x xml zlib

[root@teguhth-all sampleimage]# exiftool -ver
13.10
[root@teguhth-all sampleimage]#

Monday, January 12, 2026

.::: Script to kill Locking in Database Oracle using oracle & root User :::.

 

1. run from https://teguhth.blogspot.com/2024/11/how-to-sample-simulation-blocking.html

export ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1
export ORACLE_SID=tgh
export PATH=$ORACLE_HOME/bin:$PATH
 
or 
 
export ORACLE_HOME=/u01/app/oracle/product/12.2.0/dbhome_1 
export ORACLE_SID=tgh 
export PATH=$ORACLE_HOME/bin:$PATH 

2. original script locking
SELECT
    s1.sid AS waiting_session,
    s1.serial# AS waiting_serial,
    s1.username AS waiting_user,
    s1.status AS waiting_status,
    s2.sid AS blocking_session,
    s2.serial# AS blocking_serial,
    s2.username AS blocking_user,
    s2.status AS blocking_status,
 s1.event,
    'ALTER SYSTEM KILL SESSION ''' || s1.sid || ',' || s1.serial# || ''' IMMEDIATE;' AS query_kill
FROM
    v$session s1
JOIN
    v$session s2
ON
    s1.blocking_session = s2.sid;

Friday, January 9, 2026

.::: Find ENCRYPTION_KEY_ID & CURRENT_KEY_ID MariaDB from OS & Database MariaDB :::.

 

correlation https://teguhth.blogspot.com/2023/06/enable-encryption-table-database-for.html
https://teguhth.blogspot.com/2023/05/how-to-remove-encryptionkeyid-from-file.html


A. from OS

1. query 1 
grep -o 'ENCRYPTION_KEY_ID`=[0-9]*' teguhth_enc.sql | sort | uniq

2. query 2

grep -o 'ENCRYPTION_KEY_ID`=[0-9]*' teguhth_enc.sql | cut -d= -f2 | sort | uniq

3. query 3

grep -i  ENCRYPTION_KEY_ID teguhth_enc.sql
 
 

Tuesday, January 6, 2026

.::: Sample Create VIEW, Routine / Store Procedure, Trigger with DEFINER=`simple_admin`@`%` in MariaDB :::.

 


correlation https://teguhth.blogspot.com/2019/04/study-kasus-praktis-belajar-query-mysql.html#more

1. create user 

SELECT Host, User FROM mysql.user WHERE User='simple_admin';

create user 'simple_admin'@'%' identified by 'simple_admin';

GRANT CREATE ROUTINE, ALTER ROUTINE, TRIGGER, CREATE VIEW
ON teguhth.* TO `simple_admin`@`%`;

GRANT EXECUTE ON PROCEDURE teguhth.sp_insert_pembelian
TO 'simple_admin'@'%';

GRANT ALL PRIVILEGES ON *.* TO 'simple_admin'@'%' WITH GRANT OPTION;

flush PRIVILEGES;

Kalau DEFINER tidak ada ? ERROR 1449

 

Friday, January 2, 2026

.::: Sample Access Database MariaDB via Frontend & Backend using php :::.

 

1. instal httpd

2. config 


[root@teguhth-all html]# pwd
/var/www/html
[root@teguhth-all html]# cat config.php
<?php
$host = "10.10.10.90";
$user = "admin";
$pass = "admin";
$db   = "teguhth";
$port = 3306;

$conn = new mysqli($host, $user, $pass, $db, $port);

if ($conn->connect_error) {
    die("Koneksi gagal: " . $conn->connect_error);
}
?>

[root@teguhth-all html]#
 

Popular Posts