Friday, October 22, 2021

.::: Latihan SSIS convert csv file to SQL / MSSQL :::.



1. Create database on SQL Server 
create database LatSSIS;
use LatSSIS;
go

.::: Configure log shipping SQL Server :::.

 to monitor log shipping

http://teguhth.blogspot.com/2023/09/monitor-transaction-log-shipping-using.html

1. Enable Log Shipping on Database 1


Wednesday, October 13, 2021

.::: How to Install Replica SQl Server (MSSQL) include distributor, publisher, subscriber :::.


1. Enable SQL replication setup



2. configure a SQL replication distributor


.::: Testing Failover Always On SQL Server (MSSQL) and collect Log after Failover :::.

 
A. Failover using GUI / SQL Management Studio
1. Capture always on before Failover


Monday, September 27, 2021

.::: SQL Server: how to simulate and catch deadlock :::.


1. Create database 
create database dead_lock_lab
go 

2. create table & row data 
USE dead_lock_lab;
 
CREATE TABLE dbo.invoices (
   id int NOT NULL,
   num nvarchar(20) NOT NULL,
   customer nvarchar(100) NOT NULL,
   created_at datetime NOT NULL,
   updated_at datetime NOT NULL,
   CONSTRAINT PK_invoices PRIMARY KEY (id)
);
 

Thursday, September 23, 2021

.::: How to Sample Simulation Blocking SQL Server & Trouble shoot :::.

 
1. Login to database and create database

create database blocking;
go 

2. Open 1 Session to New Quary Windows

Begin Tran ;

select 'query 1'

CREATE TABLE ##Employees (
    EmpId INT IDENTITY,
    EmpName VARCHAR(16),
    Phone VARCHAR(16)
)
GO

INSERT INTO ##Employees (EmpName, Phone)
VALUES ('Martha', '800-555-1212'), ('Jimmy', '619-555-8080')
GO

CREATE TABLE ##Suppliers(
    SupplierId INT IDENTITY,
    SupplierName VARCHAR(64),
    Fax VARCHAR(16)
)
GO

INSERT INTO ##Suppliers (SupplierName, Fax)
VALUES ('Acme', '877-555-6060'), ('Rockwell', '800-257-1234')
GO

 

Thursday, September 16, 2021

.::: Install PAF (PostgreSQL Automatic Failover ) on centos7 ( base on pacemaker, pcs, corosys ):::.

 
A. Install PAF 

1. Prepare Node 
Node01 
10.10.10.241

Node02
10.10.10.242

Ip Virtual 
10.10.10.243

2. Install pacemaker, corosys, pacemaker & configuration 
insttal pcsd
https://teguhth.blogspot.com/2018/08/how-to-install-and-configuration-pcs.html

Tuesday, August 31, 2021

.::: How To Install Database Redis on Centos 7 :::.



1. Enable repository

[root@teguhth data]# yum -y install epel-release yum-utils
[root@teguhth data]# yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
[root@teguhth data]# yum-config-manager --enable remi
[root@teguhth data]# 

Thursday, August 5, 2021

.:: How To Replicate Set (Redundant /Mirroring) MongoDB 5.0 on Centos 7 :::.


A. Configuring the Replica Set
1. Setting up the environment Add /etc/host to nodeA nodeB 

[root@teguhth01 ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
10.10.10.21 teguhth01 NodeA
10.10.10.22 teguhth02 NodeB
[root@teguhth01 ~]# 

[root@teguhth02 ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
10.10.10.21 teguhth01 NodeA
10.10.10.22 teguhth02 NodeB
[root@teguhth02 ~]# 

.::: Install MongoDB 5.x on Centos/Redhat 7 using repository :::.

 
1. Create repo the /etc/yum.repos.d/mongodb-org-5.0.repo file for MongoDB.

[root@teguhth02 ~]# cat /etc/yum.repos.d/mongodb-org-5.0.repo
[mongodb-org-5.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/5.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-5.0.asc
[root@teguhth02 ~]# 

Monday, August 2, 2021

.::: Change Standby Slave Database to Master/Normal on PostgreSQL ERROR: cannot execute CREATE DATABASE in a read-only transaction :::.

 
 
A. Change Database Standby/Slave to Normal /Master

1. test create database for test write
teguhth=# create database tka;
ERROR:  cannot execute CREATE DATABASE in a read-only transaction
teguhth=# 

2. Promote Standby/Slave

/usr/pgsql-13/bin/pg_ctl promote -D /var/lib/pgsql/13/data

[root@teguhth02 ~]# su - postgres
Last login: Sun Aug  1 15:14:46 WIB 2021 on pts/0
-bash-4.2$ /usr/pgsql-13/bin/pg_ctl promote -D /var/lib/pgsql/13/data
waiting for server to promote.... done
server promoted
-bash-4.2$

.::: How to Setting Streaming replication Redundant / Mirroring (Master Slave) postgreSQL 13 on Centos 7 :::.

 
A. 

B. Setting di Master Node
1. Create user replication

su - postgres

CREATE USER replicate REPLICATION LOGIN CONNECTION LIMIT 1 ENCRYPTED PASSWORD 'admin'

[root@teguhth01 13]# su - postgresq;
su: user postgresq does not exist
[root@teguhth01 13]# su - postgres
Last login: Sun Aug  1 13:38:09 WIB 2021 on pts/0
-bash-4.2$ 
-bash-4.2$ 
-bash-4.2$ psql
psql (13.3)
Type "help" for help.

Popular Posts