Tuesday, August 4, 2026

.::: Check xml_deadlock_report offline & online :::.

 

correlation deadlock 

https://teguhth.blogspot.com/2026/03/simalation-locking-blocking-deadlock-in.html
https://teguhth.blogspot.com/2021/09/sql-server-how-to-simulate-and-catch.html

1. check targent data  event_file


SELECT create_time,target_name,name,session_source,
    CAST(xt.target_data AS XML) AS TargetData
FROM sys.dm_xe_session_targets xt
JOIN sys.dm_xe_sessions xs
ON xs.address = xt.event_session_address
WHERE xs.name='system_health'
AND xt.target_name='event_file';

output 

<EventFileTarget truncated="0">
  <Buffers logged="4" dropped="0" />
  <File name="C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\Log\system_health_0_134303098936130000.xel" />
</EventFileTarget>
 


2. check xml deadlock

SELECT
    object_name,
    file_name,
    timestamp_utc,
    CAST(event_data AS XML) AS EventData
FROM sys.fn_xe_file_target_read_file
(
    N'C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\Log\system_health*.xel',
    NULL,
    NULL,
    NULL
)
WHERE object_name = 'xml_deadlock_report'
ORDER BY timestamp_utc DESC;

gmt +7 

SELECT
    object_name,
    file_name,

    CONVERT(datetime2(3), DATEADD(HOUR, 7, timestamp_utc)) AS Date_Jakarta,

    CAST(event_data AS XML) AS EventData

FROM sys.fn_xe_file_target_read_file
(
    N'C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\Log\system_health*.xel',
    NULL,
    NULL,
    NULL
)
WHERE object_name = 'xml_deadlock_report'
ORDER BY Date_Jakarta DESC;
 

3. read even_data.xml xml_deadlock_report

DECLARE @FileName NVARCHAR(260) = 'C:\backup\EventData_teguhth.xml';
DECLARE @OnlyFileName NVARCHAR(260);
DECLARE @SQL NVARCHAR(MAX);

-- Ambil nama file saja
SET @OnlyFileName =
RIGHT(@FileName, CHARINDEX('\', REVERSE(@FileName)) - 1);

SET @SQL = N'
DECLARE @x XML;

SELECT @x = BulkColumn
FROM OPENROWSET
(
    BULK ''' + @FileName + ''',
    SINGLE_BLOB
) AS A;

SELECT DISTINCT

    ''' + @OnlyFileName + ''' AS FileName,

    P.value(''@spid'',''int'') AS SPID,

    P.value(''@loginname'',''nvarchar(256)'') AS LoginName,

    DB_NAME(P.value(''@currentdb'',''int'')) AS DatabaseName,

    (
        SELECT TOP (1)
            R.value(''@objectname'',''nvarchar(300)'')
        FROM @x.nodes(''/event/data/value/deadlock/resource-list/*'') X(R)
    ) AS ObjectName,

    CASE
        WHEN EXISTS
        (
            SELECT 1
            FROM @x.nodes(''/event/data/value/deadlock/victim-list/victimProcess'') V(X)
            WHERE V.X.value(''@id'',''varchar(100)'')
                  =
                  P.value(''@id'',''varchar(100)'')
        )
        THEN ''Korban''
        ELSE ''Bukan Korban''
    END AS StatusDeadlock,

    P.value(''(inputbuf/text())[1]'',''nvarchar(max)'') AS DeadlockQuery

FROM @x.nodes(''/event/data/value/deadlock/process-list/process'') T(P)

ORDER BY SPID;
';

EXEC sp_executesql @SQL;


Monday, August 3, 2026

.::: Test MariaDB MaxScale Routing Hint Routing to Master or Slave Using Lucee :::.

 
 
correlation https://teguhth.blogspot.com/2025/01/test-insert-select-data-using-maxscale.html

1. info server testing 
 


2. diagram
 

 

.::: Upgrading from MariaDB 11.8 to MariaDB 12.3 :::.

 

https://teguhth.blogspot.com/2023/06/upgrading-from-mariadb-104-to-mariadb.html

1. check Repo for prepare maria 12x
[root@teguhth-all /]# cat /etc/yum.repos.d/mariadb.repo

[mariadb-main]
name = MariaDB Server
#baseurl = https://dlm.mariadb.com/repo/mariadb-server/11/yum/rhel/9/x86_64
baseurl = https://dlm.mariadb.com/repo/mariadb-server/12.rolling/yum/rhel/9/x86_64
gpgkey = file:///etc/pki/rpm-gpg/MariaDB-Server-GPG-KEY
gpgcheck = 1
enabled = 1
module_hotfixes = 1

[mariadb-maxscale]
# To use the latest stable release of MaxScale, use "latest" as the version
# To use the latest beta (or stable if no current beta) release of MaxScale, use "beta" as the version
name = MariaDB MaxScale
baseurl = https://dlm.mariadb.com/repo/maxscale/latest/yum/rhel/9/x86_64
gpgkey = file:///etc/pki/rpm-gpg/MariaDB-MaxScale-GPG-KEY
gpgcheck = 1
enabled = 1

[root@teguhth-all /]#

 

Thursday, July 30, 2026

Tuesday, July 28, 2026

.::: Upgrade PostgreSQL from 16 to 18 on Almalinux 9 :::.

 
 
correlation https://teguhth.blogspot.com/2023/10/upgrade-postgresql-from-15-to-16-on.html

 1. check version before upgrade
SELECT version();
select pg_read_file('/etc/hostname') as hostname, version();

 


2. backup all

su - postgres -c "pg_dumpall -p 5432 > /var/lib/pgsql/backupupgrade/all_16postgresbeforeupgrade.sql"

3. remove old repository & install repository, install postgres16
detail http://teguhth.blogspot.com/2021/07/install-postgresql-linux-using.html

rpm -qa | grep -i pgdg
yum remove pgdg-redhat-repo-42.0-66.rhel9.8PGDG.noarch -y
yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86_64/pgdg-redhat-repo-latest.noarch.rpm
yum clean all
yum -y install postgresql18-server

 
 

Thursday, July 23, 2026

.::: How to Simulation Locking with 'Waiting for table metadata lock' MariaDB MySQL :::.

 

correlation https://teguhth.blogspot.com/2026/07/how-to-simulation-blockinglock-locking.html

1. terminal 1 (user admin)

USE teguhth;

START TRANSACTION;
select connection_id() as session_id, user() as user;
SELECT * FROM pembelian WHERE KODE_PEMBELIAN='BEL-E001';

atau 
 

Wednesday, July 22, 2026

.::: Check ETA (Estimated Time of Arrival) restore status MariaDB MarinaDB on Persent (%) :::.

 

correlation https://teguhth.blogspot.com/2026/06/check-progress-restore-status-mariadb.html


1. check sourcedata full database 

du -s /var/lib/mysql/teguhth
du -sh /var/lib/mysql/teguhth

[root@teguhth-all eta]# du -s /var/lib/mysql/teguhth
570752  /var/lib/mysql/teguhth
[root@teguhth-all eta]#

[root@teguhth-all eta]# du -sh /var/lib/mysql/teguhth
558M    /var/lib/mysql/teguhth
[root@teguhth-all eta]#
 

Tuesday, July 14, 2026

.::: Sample Access Database MariaDB via Frontend & Backend using Lucee with access login Application.cfc, users save in table users, insert, update, delete with confirm :::.

 
 
hanya berubah pembelian_all.cfm n lanjutan dari https://teguhth.blogspot.com/2026/07/sample-access-database-mariadb-via_01669209479.html

1. create user for login

CREATE TABLE users (
    id INT AUTO_INCREMENT PRIMARY KEY,
    username VARCHAR(50) NOT NULL,
    password VARCHAR(100) NOT NULL,
    nama VARCHAR(100),
    aktif CHAR(1) DEFAULT 'Y'
);

INSERT INTO users(username,password,nama,aktif)
VALUES
('admin','123456','Administrator','Y');

INSERT INTO users(username,password,nama,aktif)
VALUES
('aisyah','123456','Administrator','Y');

INSERT INTO users(username,password,nama,aktif)
VALUES
('teguh','123456','readonly','Y');
 

Monday, July 13, 2026

.::: Sample Access Database MariaDB via Frontend & Backend using Lucee with accecc login Application.cfc, users save in table users :::

 

 
correlation https://teguhth.blogspot.com/2026/07/sample-access-database-mariadb-via.html

1. create user for login

CREATE TABLE users (
    id INT AUTO_INCREMENT PRIMARY KEY,
    username VARCHAR(50) NOT NULL,
    password VARCHAR(100) NOT NULL,
    nama VARCHAR(100),
    aktif CHAR(1) DEFAULT 'Y'
);

INSERT INTO users(username,password,nama,aktif)
VALUES
('admin','123456','Administrator','Y');

INSERT INTO users(username,password,nama,aktif)
VALUES
('aisyah','123456','Administrator','Y');

INSERT INTO users(username,password,nama,aktif)
VALUES
('teguh','123456','readonly','Y');

 

.::: How to Simulation Blocking,Lock, Locking Identifying and Avoiding Deadlocks MariaDB MySQL & Advanced PROCESSLIST Update Juli 2026 :::.

 
correlation 

https://teguhth.blogspot.com/2023/09/how-to-sample-simulation-blocking.html

1. SIMULASI LOCKING

Session 1 - root - session_id 3

select connection_id() as session_id, user() as user;
START TRANSACTION;
UPDATE pembelian 
SET JUMLAH_PEMBELIAN = 10 
WHERE KODE_PEMBELIAN = 'BEL-E001';

select connection_id() as session_id, user() as user; START TRANSACTION; UPDATE pembelian SET JUMLAH_PEMBELIAN = 10 WHERE KODE_PEMBELIAN = 'BEL-E001';

 
 

Friday, July 10, 2026

.::: Sample Access Database MariaDB via Frontend & Backend using Lucee with accecc login Application.cfc :::.

  
https://teguhth.blogspot.com/2026/02/sample-access-database-mariadb-via.html

Kalau tujuan Anda adalah setiap kali membuka:

http://10.10.10.90:8888/pembelian_front.cfm

maka pengguna harus login terlebih dahulu, saya sarankan menggunakan Session Login. Cara ini lebih sederhana dibanding CFLOGIN dan umum dipakai di Lu

1. Struktur file

root@teguhth-all ROOT]# pwd
/opt/lucee/tomcat/webapps/ROOT
[root@teguhth-all ROOT]#
[root@teguhth-all ROOT]# ls -lh Application.cfc login.cfm logout.cfm pembelian_front.cfm pembelian_api.cfm
-rw-r--r-- 1 root root  744 Jul 10 15:06 Application.cfc
-rw-r--r-- 1 root root 1.1K Jul 10 14:57 login.cfm
-rw-r--r-- 1 root root   76 Jul 10 14:57 logout.cfm
-rw-r--r-- 1 root root  296 Jul 10 15:07 pembelian_api.cfm
-rw-r--r-- 1 root root  912 Jul 10 15:09 pembelian_front.cfm
[root@teguhth-all ROOT]#

 

Thursday, July 9, 2026

.::: SOP Restore table production without lost data in MariaDB :::.

 

1. server

source 
ip         : 10.10.10.90 
db         : teguhthdb
table    : pembelian 

destination
ip         : 10.10.10.90 
db         : teguhth
table    : pembelian 
 
 

Friday, June 19, 2026

.::: Check progress restore and backup status MariaDB MarinaDB :::.

  

1. check folder size

watch du -s /var/lib/mysql/teguhth
 

 

Popular Posts