Tuesday, August 13, 2013

Oracle Connectivity test with shell script.

Sometimes you might need a script which make connectivity check for database.

Here is example shell script that makes connectivity checks for selected Oracle database.
Add following text in text file with .sh extension (
connectivity_test_shell.sh). And change username , password and database name. You can also change numbers in loop (how many connection tests you want to run). Script creates conn_test.txt file where connection informations are printed (so user must have write permissions in the directory where this script is.).

----


#!/bin/bash

 

for x in {0..10};

do

echo quit | sqlplus testuser/<testuser_password>@<database_name> >> conn_test.txt;

done


----


Give permissions to scripts:
chmod 755 connectivity_test_shell.sh

Run script:
./connectivity_test_shell.sh

No comments:

Post a Comment