檢查資料庫連線
1. tnsping
NOTE: tnspin just check if the LISTENER service on the DB server is running
$> tnsping <TNS-Alias> or $> tnsping <db-server-ip>:1521/<SID>
2. check_db_up.sql
whenever sqlerror exit 1; connect username/password@<<TNS alias>> select 1 from dual; exit 0;
Run your bash like the follows
sqlplus /nolog @check_db_up.sq
If that returns 1, there was an error and the database isn't up.