Script bash - Insertion of data into MariaDB from Oracle database
0
votes
1
answer
61
views
This script bash makes the data extraction to Oracle DB (another server), processing it and insert into MariaDB (my server), but the insertion it's misaligned and let it some columns in blank.
* This is the code:
-bash
#!/bin/bash
ORACLE_USER="user"
ORACLE_PASSWORD="password"
ORACLE_DB="IP/SID"
MYSQL_USER="user"
MYSQL_PASSWORD="password"
MYSQL_DB="DB"
echo "Fetching data from Oracle..."
ORACLE_DATA=$(sqlplus -s "$ORACLE_USER/$ORACLE_PASSWORD@$ORACLE_DB" > SALIDA.TXT
echo "Data insertion completed."
* And the results are like this:
Region:
Central:
Nombre_Banco:
Modelo:
Bateria:
Tecnologia:
Amperaje_CA:
Medido:
Porcentaje:
Voltaje:
Voltaje_AC:
Creado:
Region: REGION 7
Central: LERFIC
Nombre_Banco: 7LERFICCT1B6
Modelo: BATERIA GNB ABSOLYTE, 100A-19 896AH
Bateria:
Tecnologia:
Amperaje_CA:
Medido:
Porcentaje:
Voltaje:
Voltaje_AC:
Creado:
Region: J10B
Central: TYPHOON(TY1)
Nombre_Banco: 0
Modelo: 2016-12-30
Bateria: 54.45
Tecnologia: 2.25
Amperaje_CA: 0
Medido: 2017-01-10
Porcentaje:
Voltaje:
Voltaje_AC:
Creado:
Asked by Gatito
(3 rep)
Oct 29, 2024, 05:38 PM
Last activity: Oct 30, 2024, 09:56 AM
Last activity: Oct 30, 2024, 09:56 AM