Posts

Showing posts from September, 2015

[Script] Tablespace Usage Alert

Hi, This is another variation of the previous scripts presented in this blog site. The building blocks of this script is the same as the Disk Space and ASM Diskgroup Space Monitoring scripts. This will alert you via email if a certain tablespace  reaches the set threshold. Let's share and make others love Oracle, too. For tablespace monitoring alert scripts. We have the following: Tablespace Monitoring Script You will notice that there is a pattern in the scripts creation presented in this blog.  Part 1: Report Generation : Here it is the tablespace report Part 2: Report output string process : Scripts are created to process further report into columns. Conditional statement was created to test the values in the report. Part 3: Check if the file generates alert : Email is sent if entities met the threshold. # # # # # #----- Start of Script -----###### #!/bin/bash  # Report tablespace usage  sqlplus "/ as sysdba" << EOF SET LINES 700 SET

[Script] ASM Diskgroup Space Usage Alert

Hi Again, Another important task that a DBA should do is to monitor the ASM diskgroup usage. We do not just add space to tablespaces, create more tablespaces or resize datafiles to increase storage without checking if there is space to our ASM diskgroup. Also, when we perform RMAN backups stored in ASM or Datapump Exports stored in ASM, we have to monitor and get alerts if we are running out of space. This is a simple monitoring script. I hope this could help you. Let's share and make others love Oracle, too. ASM Diskgroup  Space Monitoring ######--- Start of Script -----###### #!/bin/bash  # Report ASM Diskgroup space usage  #NOTES:  # 1. There is really a slash on the v$asm_diskgroup so Unix interpreter will treat dollar sign as a literal $ # 2. Set your tablespace threshold by changing the value of the AND clause  " >= 80" sqlplus "/ as sysdba" << EOF SET LINES 700 SET FEEDBACK OFF SET TRIMSPOOL ON SET ECHO OFF SPOOL /tmp/ASMs

[Script] Simple Disk Space Monitoring Alert

Hello Everyone, Recently, I was tasked to create some simple monitoring scripts using Unix. Well, I must admit that I am not a Unix-expert but being a resourceful Oracle DBA, I was able to create simple monitoring scripts by combining different articles and sources online. I hope you find some of them useful. Let's share and make others love Oracle, too. Disk Space Monitoring Script ######---Start of Script---t##### #!/bin/bash  # Report disk space usage threshold="80"  i=2  diskresult=`df -h |grep -v "Filesystem" | awk '{ print $5 }' | sed 's/%//g'`  for percent in $diskresult; do  if ((percent > threshold))  then partition=`df -h | head -$i | tail -1| awk '{print $6}'`  echo "Warning: $partition is ${percent}% used."  fi  let i=$i+1  done ######---End of Script---##### Note: This Disk Space monitoring script will capture all your mount points that are more than 80% utilized.  What if I would

Copy and Delete Dumpfiles from ASM to Local Filesystem Automatically

Hello Everyone, So someone ask you to create a script to take a logical backup of your database and store it in ASM. You decided to create an Export DataPump script that will: 1. Take a full export of the database to +FRA 2. Take a full metadata export of the database and store it in +FRA 3. Copy the dumpfiles in +FRA to your local disk (in case the ASM instace fails) 4. Delete old dumpfiles in +FRA and in the local disk if they are past the retention period. The script provided below will: 1. Perform export datapump and store the dumpfiles in ASM 2. The dumpfiles stored in ASM will be copied to the local disk. The script will read the logfile generated by the export job. If you will take a look at the end of the export logfile, you will see there the list of dumpfiles generated, we just need to extract these string and process it using Unix scripts. Then we can form an ASMCMD command from here. When running ASMCMD command, just make sure you switch to the GRID environmen

Step by Step: Deploy RMAN Backup Strategy for Oracle Database 11g

Image
Portable  RMAN  Scripts for Oracle Database 11g Hello Guys, So here I am again, I would like to share this deployment guide which I created in 2012! This deployment guide is cool as you can use and re-use the scripts and deploy it from one server to another by just changing the parameter values and creating the required directories. For RAC deployments, it is just the same, just use your ASM diskgroup (i.e. +FRA) as you backup storage location. By the way, if you want to use multiple channels to make backup faster, you can use: RUN {   ALLOCATE CHANNEL disk1 DEVICE TYPE DISK FORMAT '/disk1/%U';    ALLOCATE CHANNEL disk2 DEVICE TYPE DISK FORMAT '/disk2/%U';    BACKUP DATABASE PLUS ARCHIVELOG; } If you have questions, clarifications or additional information, please feel free to comment. Let's share and make others love Oracle, too. What is the purpose of Backup and Recovery? As a backup administrator, your principal duty is to devise,