Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • usnsql.sql Displays information about UNDO segments with sql statements Oracle
  • scripts to take listener.log backup Linux/Unix
  • switchover for primary database Oracle
  • load SPM baseline from cursor cache Oracle
  • Formatter Explain plan Output 1 Oracle
  • Privileges Required to Create Procedures and Functions that uses objects from other schema. Oracle
  • How to specify 2 arch location to avoid any kind of DB hanging. Oracle
  • tblwopk.sql /* Find Tables Without PK */ Oracle
  • findx.sql /* Find Indexes on specified USER.TABLE_NAME */ Oracle
  • Restoring a user’s original password 1051962.101 Oracle
  • default permission on ~/.ssh/authorized_keys2 or authorized_keys Linux/Unix
  • My Minimum Tuning Programs Oracle
  • block_ident.sql Oracle
  • TOP-N Sql to find Nth max or Top N rows Oracle
  • Creating never expiring DB user accounts in Oracle Oracle

Validating ORACLE_SID againt oratab file.

Posted on 05-Oct-2006 By Admin No Comments on Validating ORACLE_SID againt oratab file.

The following script shows how to check an Oracle SID to be sure that it’s valid. The script expects the SID to be passed in as the first parameter, and it begins by checking to see if a parameter was even passed. The script next counts the number of times the first parameter value appears in the /etc/oratab file. A valid Oracle SID will appear once in that file.

#!/bin/ksh

# Exit if no first parameter $1 passed.

if [ -z “$1” ]

then

echo “Please pass a valid ORACLE_SID

to this script”

exit 99

fi

# Validate the Oracle database name with

# lookup in /etc/oratab.

TEMP=`cat /etc/oratab|grep ^$1:|

cut -f1 -d’:’|wc -l`

tmp=`expr TEMP` # Convert string to number.

if [ $tmp -ne 1 ]

then

echo “Your input $1 is not a valid ORACLE_SID.”

exit 99

fi

Linux/Unix, shell

Post navigation

Previous Post: Some useful Unix Commands
Next Post: Looping for remote servers and find its database from oratab file.

Related Posts

  • default permission on ~/.ssh/authorized_keys2 or authorized_keys Linux/Unix
  • changing kernel parameter in Oracle Enterpise Linux Linux/Unix
  • Sort with ASCII order and Numeric Order Linux/Unix
  • Removing first line Linux/Unix
  • chk_space_SID.ksh Linux/Unix
  • Reading parameter file and printing Linux/Unix

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Categories

  • AWS (2)
  • Azure (1)
  • Linux/Unix (149)
  • Oracle (392)
  • PHP/MYSQL/Wordpress (10)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (17)
  • rman-dataguard (26)
  • shell (149)
  • SQL scripts (341)
  • Uncategorized (0)
  • Videos (0)

Recent Posts

  • load SPM baseline from cursor cache05-Jun-2025
  • Drop all SPM baselines for SQL handle05-Jun-2025
  • Load SPM baseline from AWR05-Jun-2025
  • Drop specific SQL plan baseline – spm05-Jun-2025
  • findinfo.sql (SQL for getting CPU and Active session info)27-May-2025
  • SQL Tracker by SID sqltrackerbysid.sql22-Apr-2025
  • How to connect to Oracle Database with Wallet with Python.21-Mar-2025
  • JSON/XML Types in Oracle18-Mar-2025
  • CPU Core related projections12-Mar-2025
  • Exadata Basics10-Dec-2024

Archives

  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • oracle Dba site Oracle
  • Pending Distributed Transations Oracle
  • find_cons.sql Oracle
  • Handling LOB data in Oracle Oracle
  • Implementation of key based authentications Linux/Unix
  • Find_stale_dr.sql finding stale physical DR.. Oracle
  • Standby Database File Management in 10g with STANDBY_FILE_MANAGEMENT Oracle
  • oracle 10g on linux Linux/Unix

Copyright © 2025 pvmehta.com.

Powered by PressBook News WordPress theme