top of page

List of 25 shell scripts for managing Exadata X9M servers

Here is a comprehensive list of 25 shell scripts for managing Exadata X9M servers. These scripts cover various aspects of Exadata management, including monitoring, performance tuning, backups, security, and maintenance.


### 1. **System Health Check Script**

```bash

#!/bin/bash

# System Health Check Script for Exadata X9M


echo "Running system health check..."

echo "Checking CPU usage..."

sar -u 1 5


echo "Checking memory usage..."

free -m


echo "Checking disk usage..."

df -h


echo "Checking network interfaces..."

ifconfig -a


echo "System health check completed."

```


### 2. **Database Performance Monitoring Script**

```bash

#!/bin/bash

# Database Performance Monitoring Script


echo "Running AWR report..."

sqlplus / as sysdba <<EOF

@$ORACLE_HOME/rdbms/admin/awrrpt.sql

EOF


echo "Database performance monitoring completed."

```


### 3. **Backup Script**

```bash

#!/bin/bash

# Backup Script for Exadata X9M


BACKUP_DIR="/backup/$(date +%F)"

mkdir -p $BACKUP_DIR


echo "Starting RMAN backup..."

rman target / <<EOF

RUN {

ALLOCATE CHANNEL ch1 DEVICE TYPE DISK FORMAT '$BACKUP_DIR/full_%U';

BACKUP DATABASE PLUS ARCHIVELOG;

DELETE OBSOLETE;

RELEASE CHANNEL ch1;

}

EOF


echo "Backup completed. Backup files are stored in $BACKUP_DIR."

```


### 4. **ASM Disk Group Usage Script**

```bash

#!/bin/bash

# ASM Disk Group Usage Script


echo "Checking ASM disk group usage..."

asmcmd lsdg


echo "ASM disk group usage check completed."

```


### 5. **Exadata Storage Server (Cell) Monitoring Script**

```bash

#!/bin/bash

# Exadata Storage Server (Cell) Monitoring Script


CELLS=$(cat /opt/oracle/cell/network-config/cellip.ora | awk -F= '{print $2}')

for CELL in $CELLS; do

echo "Checking cell $CELL..."

ssh root@$CELL 'cellcli -e list cell detail'

done


echo "Exadata Storage Server monitoring completed."

```


### 6. **Grid Infrastructure Status Check Script**

```bash

#!/bin/bash

# Grid Infrastructure Status Check Script


echo "Checking CRS status..."

crsctl check crs


echo "Checking ASM instance status..."

srvctl status asm


echo "Checking database instance status..."

srvctl status database -d <DB_UNIQUE_NAME>


echo "Grid Infrastructure status check completed."

```


### 7. **Log Cleanup Script**

```bash

#!/bin/bash

# Log Cleanup Script for Exadata X9M


LOG_DIR="/var/log"

RETENTION_DAYS=30


echo "Cleaning up logs older than $RETENTION_DAYS days in $LOG_DIR..."

find $LOG_DIR -type f -name "*.log" -mtime +$RETENTION_DAYS -exec rm -f {} \;


echo "Log cleanup completed."

```


### 8. **Network Configuration Check Script**

```bash

#!/bin/bash

# Network Configuration Check Script


echo "Checking network interfaces..."

ifconfig -a


echo "Checking for dropped packets..."

netstat -i | grep -i drop


echo "Network configuration check completed."

```


### 9. **Patch Management Script**

```bash

#!/bin/bash

# Patch Management Script


PATCH_DIR="/patches"

cd $PATCH_DIR


echo "Applying patches..."

# Example of applying a patch using OPatch

# opatch apply <patch_id>


echo "Patch application completed."

```


### 10. **Tablespace Usage Script**

```bash

#!/bin/bash

# Tablespace Usage Script


echo "Checking tablespace usage..."

sqlplus / as sysdba <<EOF

SET PAGESIZE 100

SET LINESIZE 200

COLUMN TABLESPACE_NAME FORMAT A30

COLUMN USED_MB FORMAT 999,999,999

COLUMN FREE_MB FORMAT 999,999,999

SELECT

TABLESPACE_NAME,

ROUND(SUM(BYTES)/1024/1024) USED_MB,

ROUND(SUM(MAXBYTES-BYTES)/1024/1024) FREE_MB

FROM

DBA_DATA_FILES

GROUP BY

TABLESPACE_NAME;

EOF


echo "Tablespace usage check completed."

```


### 11. **Alert Log Monitoring Script**

```bash

#!/bin/bash

# Alert Log Monitoring Script


ALERT_LOG_DIR="/u01/app/oracle/diag/rdbms/yourdb/alert"

LOGFILE="/var/log/alert_log_monitor.log"


echo "Monitoring alert logs for errors..."

tail -F $ALERT_LOG_DIR/alert*.log | grep -i error >> $LOGFILE &

```


### 12. **Cell Disk Usage Script**

```bash

#!/bin/bash

# Cell Disk Usage Script


CELLS=$(cat /opt/oracle/cell/network-config/cellip.ora | awk -F= '{print $2}')

for CELL in $CELLS; do

echo "Checking cell disk usage on $CELL..."

ssh root@$CELL 'cellcli -e list celldisk detail'

done

```


### 13. **Network Throughput Script**

```bash

#!/bin/bash

# Network Throughput Script


echo "Checking network throughput..."

sar -n DEV 1 5

```


### 14. **ASM Rebalance Monitoring Script**

```bash

#!/bin/bash

# ASM Rebalance Monitoring Script


echo "Monitoring ASM rebalance operations..."

sqlplus / as sysdba <<EOF

SELECT * FROM v$asm_operation;

EOF

```


### 15. **Database Connection Count Script**

```bash

#!/bin/bash

# Database Connection Count Script


echo "Checking database connection count..."

sqlplus / as sysdba <<EOF

SELECT username, COUNT(*) FROM v$session GROUP BY username;

EOF

```


### 16. **Data Guard Status Check Script**

```bash

#!/bin/bash

# Data Guard Status Check Script


echo "Checking Data Guard status..."

dgmgrl sys/<password> <<EOF

SHOW CONFIGURATION;

EOF

```


### 17. **Database Parameter Check Script**

```bash

#!/bin/bash

# Database Parameter Check Script


PARAMETER=$1

echo "Checking database parameter $PARAMETER..."

sqlplus / as sysdba <<EOF

SHOW PARAMETER $PARAMETER;

EOF

```


### 18. **File System Space Check Script**

```bash

#!/bin/bash

# File System Space Check Script


echo "Checking file system space usage..."

df -h | grep /u01

```


### 19. **Inactive Sessions Kill Script**

```bash

#!/bin/bash

# Inactive Sessions Kill Script


echo "Killing inactive sessions..."

sqlplus / as sysdba <<EOF

BEGIN

FOR r IN (SELECT sid, serial# FROM v$session WHERE status = 'INACTIVE' AND last_call_et > 3600) LOOP

EXECUTE IMMEDIATE 'ALTER SYSTEM KILL SESSION ''' || r.sid || ',' || r.serial# || ''' IMMEDIATE';

END LOOP;

END;

/

EOF

```


### 20. **Database Listener Status Check Script**

```bash

#!/bin/bash

# Database Listener Status Check Script


echo "Checking listener status..."

lsnrctl status

```


### 21. **Database Restart Script**

```bash

#!/bin/bash

# Database Restart Script


echo "Restarting database..."

sqlplus / as sysdba <<EOF

SHUTDOWN IMMEDIATE;

STARTUP;

EOF

```


### 22. **System Load Average Check Script**

```bash

#!/bin/bash

# System Load Average Check Script


echo "Checking system load average..."

uptime

```


### 23. **Exadata Cell Metrics Collection Script**

```bash

#!/bin/bash

# Exadata Cell Metrics Collection Script


CELLS=$(cat /opt/oracle/cell/network-config/cellip.ora | awk -F= '{print $2}')

for CELL in $CELLS; do

echo "Collecting metrics from cell $CELL..."

ssh root@$CELL 'cellcli -e list metriccurrent'

done

```


### 24. **Exadata Storage Index Statistics Script**

```bash

#!/bin/bash

# Exadata Storage Index Statistics Script


echo "Checking Exadata storage index statistics..."

sqlplus / as sysdba <<EOF

SELECT table_name, storage_index_smart_scan FROM dba_tables;

EOF

```


### 25. **Exadata Flash Cache Statistics Script**

```bash

#!/bin/bash

# Exadata Flash Cache Statistics Script


echo "Checking Exadata flash cache statistics..."

sqlplus / as sysdba <<EOF

SELECT cell_name, flashcachehit_percent FROM v$cell_flashcache;

EOF

```


These scripts provide a comprehensive set of tools for managing and monitoring Exadata X9M servers. They can be customized further to meet specific requirements and integrated into automation workflows for better efficiency and reliability.

18 views

Recent Posts

See All

Comments


AiTech

©2023 by AiTech

bottom of page