Skip to content

Instantly share code, notes, and snippets.

View dincosman's full-sized avatar

Osman DINC dincosman

View GitHub Profile
@dincosman
dincosman / 36av371yyctxf_statement.sql
Last active June 3, 2024 11:32
Query experiencing performance fluctuations
select plan_hash_value
inst_id,
SUM (executions) as total_exec_count,
SUM (elapsed_time) as total_elapsed,
SUM (elapsed_time) / SUM (executions) as elapsed_perexec
FROM gv$sql
WHERE sql_id = '36av371yyctxf'
GROUP BY plan_hash_value, inst_id;
PLAN_HASH_VALUE INST_ID total_exec_count total_elapsed ELAPSED_PEREXEC
@dincosman
dincosman / MariaDB_insert_1million.sh
Created June 2, 2024 20:24
Insert 1000000 rows using NoSQL Protocol Module for MariaDB
osmandinc@192 mongoapi % node 1mri_maria.js
(node:12520) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Inserted: 1000000 rows
Operation took: 42442.361542 milliseconds
[root@mongo01 ~]# mongosh --host 192.168.60.204 --port 27004
Current Mongosh Log ID: 665c9f36406e5818812202d7
Connecting to: mongodb://192.168.60.204:27004/?directConnection=true&appName=mongosh+2.2.5
@dincosman
dincosman / 1mri_maria.js
Created June 2, 2024 20:17
One million row insert using NoSQL Protocol Module for MariaDB Nodejs Script
const fs = require("fs");
const mongodb = require("mongodb").MongoClient;
const fastimp = require("fast-csv");
// Start timing
const startTime = process.hrtime();
// Mongodb connection string
let url = "mongodb://192.168.1.31:27004";
let stream = fs.createReadStream("measurements.txt");
@dincosman
dincosman / maxscale_user_configuration.sql
Created June 2, 2024 19:08
MaxScale Configuring database user with specific privileges
MariaDB [(none)]> CREATE USER 'maxscale'@'%' IDENTIFIED BY 'maxscale_pw';
MariaDB [(none)]> GRANT SELECT ON mysql.user TO 'maxscale'@'%';
MariaDB [(none)]> GRANT SELECT ON mysql.db TO 'maxscale'@'%';
MariaDB [(none)]> GRANT SELECT ON mysql.tables_priv TO 'maxscale'@'%';
MariaDB [(none)]> GRANT SELECT ON mysql.columns_priv TO 'maxscale'@'%';
MariaDB [(none)]> GRANT SELECT ON mysql.procs_priv TO 'maxscale'@'%';
MariaDB [(none)]> GRANT SELECT ON mysql.proxies_priv TO 'maxscale'@'%';
MariaDB [(none)]> GRANT SELECT ON mysql.roles_mapping TO 'maxscale'@'%';
MariaDB [(none)]> GRANT SLAVE MONITOR on *.* to 'maxscale'@'%';
MariaDB [(none)]> GRANT SHOW DATABASES ON *.* TO 'maxscale'@'%';
@dincosman
dincosman / Maxscale_installation.sh
Created June 2, 2024 18:56
Maxscale Installation on Oracle Linux
[root@maria01 ~]# yum install maxscale
Last metadata expiration check: 0:06:01 ago on Sun 02 Jun 2024 05:19:30 PM +03.
Dependencies resolved.
=========================================================================================================================================
Package Architecture Version Repository Size
=========================================================================================================================================
Installing:
maxscale x86_64 24.02.1-1.rhel.8 mariadb-maxscale 92 M
Installing dependencies:
@dincosman
dincosman / MariaDB_installation.sh
Created June 2, 2024 18:47
MariaDB Installation on Oracle Linux 8
[root@maria01 ~]# yum install --repo="mariadb-main" MariaDB-server
Waiting for process with pid 2474 to finish.
Last metadata expiration check: 0:00:04 ago on Sun 02 Jun 2024 05:19:27 PM +03.
Dependencies resolved.
=========================================================================================================================================
Package Architecture Version Repository Size
=========================================================================================================================================
Installing:
MariaDB-server x86_64 11.4.2-1.el8 mariadb-main 27 M
Installing dependencies:
@dincosman
dincosman / Oracle_MongoAPI_insert_1million.sh
Created May 17, 2024 19:26
Insert 1000000 rows using Oracle Database API for MongoDB
osmandinc@192 mongoapi % node 1mri_oracle.js
(node:28174) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Inserted: 1000000 rows
Operation took: 64296.430708 milliseconds
[root@mongo01 ~]# mongosh --tlsAllowInvalidCertificates 'mongodb://insanedba:bjk@192.168.60.203:27003/insanedba?authMechanism=PLAIN&authSource=$external&ssl=true&retryWrites=false&loadBalanced=true'
Current Mongosh Log ID: 6636b47ccd6b23e9e02202d7
Connecting to: mongodb://<credentials>@192.168.60.203:27003/insanedba?authMechanism=PLAIN&authSource=%24external&ssl=true&retryWrites=false&loadBalanced=true&tlsAllowInvalidCertificates=true&appName=mongosh+2.2.5
Using MongoDB: 4.2.14
@dincosman
dincosman / 1mri_oracle.js
Created May 17, 2024 19:20
One million row insert using Oracle Database API for MongoDB Nodejs Script
const fs = require("fs");
const mongodb = require("mongodb").MongoClient;
const fastimp = require("fast-csv");
// Start timing
const startTime = process.hrtime();
// Oracle Database API for MongoDB connection string
let url = "mongodb://insanedba:bjk@192.168.1.31:27003/insanedba?authMechanism=PLAIN&authSource=$external&tlsInsecure=true&ssl=true&retryWrites=false&loadBalanced=true";
let stream = fs.createReadStream("measurements.txt");
@dincosman
dincosman / enable_ords.sql
Created May 14, 2024 19:21
SQL commands used to enable ORDS for a user
[oracle@oradev01 ~]$ sqlplus system/oracle@FREEPDB1
SQL> create user insanedba identified by insane;
SQL> grant connect,resource to insanedba;
SQL> grant SODA_APP to insanedba;
SQL> alter user insanedba quota unlimited on users;
[oracle@oradev01 ~]$ sqlplus insanedba/insane@freepdb1
SQL*Plus: Release 23.0.0.0.0 - Production on Sat May 4 23:56:27 2024
Version 23.4.0.24.05
@dincosman
dincosman / configure_ords.sh
Last active May 14, 2024 19:25
Configure ORDS, enabling the MongoDB API and setting it to serve on a custom port (27003)
[oracle@oradev01 ~]$ export ORDS_CONFIG=/home/oracle/ordsconfig
[oracle@oradev01 ~]$ export PATH=/home/oracle/ords/bin:/opt/oracle/product/23ai/dbhomeFree/jdk/bin:$PATH
[oracle@oradev01 ~]$ export JAVA_HOME=/opt/oracle/product/23ai/dbhomeFree/jdk
[oracle@oradev01 ords]$ export ORACLE_HOME=/opt/oracle/product/23ai/dbhomeFree
[oracle@oradev01 ords]$ ords config set mongo.enabled true
[oracle@oradev01 ords]$ ords config set mongo.port 27003
ORDS: Release 24.1 Production on Sat May 04 20:24:41 2024