Home » Infrastructure » Linux » df command insert into sqlplus and table databas (Linux)
df command insert into sqlplus and table databas [message #662469] Tue, 02 May 2017 21:16 Go to previous message
diomahardhika
Messages: 18
Registered: March 2017
Junior Member
#!/bin/bash
TEMP=/home/dbpro/dfinsert.tmp

sql=$(df /Aplikasi | awk '{if (NR!=1){print}}' | sed -e 's/\S\+/:/G' > ${TEMP}
while IFS == read -r col1 col2 col3 col4 col5 col6;
 do
        MOUNT=$(printf '%s\n' $col6 )
        PCT=$(printf '%s\n' $col5)
        AVAILABLE=$(printf '%s\n' $col4)
        USED=$(printf '%s\n' $col3)
        MEMORY_CAPACITY=$(printf '%s\n' $col2))

        sqlplus / "as sysdba" << EOF
        insert into df_test
        values ('$MOUNT','$PCT','$AVAILABLE','$USED','$MEMORY_CAPACITY');
        commit;
        exit;
        EOF

done






when i executed the program it was running but it was not insert to the database table.
did I missing something with that code? please help, thank you.
  • Attachment: table.PNG
    (Size: 10.63KB, Downloaded 2781 times)
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: oracle load testing
Next Topic: sudo sqlplus -v returns "Error 6 initializing SQL*Plus"
Goto Forum:
  


Current Time: Fri May 10 08:43:17 CDT 2024