ORASOLU TOOLBOX · AUTOMATION & DEVOPS

Shell & CLI

Practical command-line workflows for Oracle administration, Linux operations and repeatable troubleshooting.

ORASOLU TOOLBOX · AUTOMATION & DEVOPS

Use the command line to make routine work repeatable

Shell and CLI workflows are useful when database administration involves repeated checks, file handling and operational tasks. These examples provide practical starting points for repeatable Oracle and Linux administration.

01 · DATABASE

Check Oracle environment

Review the Oracle environment variables and client context used by a shell session.

printf 'ORACLE_SID=%s\nORACLE_HOME=%s\nPATH=%s\n' "$ORACLE_SID" "$ORACLE_HOME" "$PATH"
02 · INSTANCE

Check database instance

Confirm the instance name and status from a command-line SQL session.

sqlplus -s / as sysdba <<'SQL'
SET PAGESIZE 0 FEEDBACK OFF VERIFY OFF HEADING OFF
SELECT instance_name || ' ' || status
FROM v$instance;
EXIT
SQL
03 · STORAGE

Check filesystem usage

Review filesystem capacity before database files or backups consume available space.

df -h
printf '\nFilesystem usage above 80%%:\n'
df -P | awk 'NR > 1 && $5+0 >= 80 {print}'
04 · PROCESSES

Review Oracle processes

Review Oracle-related processes from the operating system when investigating instance activity.

ps -ef | grep '[o]ra_' | sort
05 · LOGGING

Capture command output

Capture command output to a timestamped log for repeatable operational evidence.

LOG_DIR=/tmp/oracle_checks
mkdir -p "$LOG_DIR"
LOG_FILE="$LOG_DIR/check_$(date +%Y%m%d_%H%M%S).log"

{
  date
  hostname
  id
  df -h
} | tee "$LOG_FILE" 
06 · SCRIPTING

Run a repeatable check

Use a small shell function to standardize a frequently repeated database check.

check_instance() {
  sqlplus -s / as sysdba <<'SQL'
SET PAGESIZE 0 FEEDBACK OFF HEADING OFF
SELECT instance_name || ' ' || status
FROM v$instance;
EXIT
SQL
}

check_instance
ORASOLU TOOLBOX · AUTOMATION & DEVOPS

Good automation starts with a repeatable command.

Use command-line checks to establish a known workflow, then add validation and logging before turning the process into scheduled or unattended automation.