sqlplus / as sysdba ---------------------> from the host server
sqlplus user/passwd@service_or_sid ---------------------> from remote server
sqlplus user/passwd@host:1521/service_or_sid ---------------------> remote server
to check database status:-
sudo -iu oracle----> tnsping servicename ----> thats it as per tnsnames.ora entries
to check server status :-
ping server as per /etc/hosts entries
from shell script
export OH
export OS
export PATH
export LD_LIBRARY_PATH
sqlplus \/nolog <<< !! > output.txt
conn $constring;
$query;
exit;
!!