Posts

[Oracle 12c] Exploring the Multitenant Architecture: CDBs and PDBs

Hello guys, I have been studying Oracle 12c as a preparation for my upgrade certification. And this will be my second article on Oracle 12c. I have a bunch of scratch notes on 12c but I have a lot of deployments: upgrades and migration to 12c so, I haven't finalize most of them. This simple article presents how to create Pluggable Databases (PDBs) from the seed PDB. Remember that we can also create (clone) PDBs using an existing regular PDB. Let begin by familiarizing ourselves with the root CDB or the CDB$ROOT How to connect to a CDB? [oracle@orcl12c-serv01 ~]$ echo $ORACLE_SID ORCLDB [oracle@orcl12c-serv01 ~]$ echo $ORACLE_HOME /u01/app/oracle/product/12.1.0/db_1 [oracle@orcl12c-serv01 ~]$ sqlplus / as sysdba SQL> show con_name CON_NAME ------------- CDB$ROOT --> This is our current container, which is the ROOT CDB. Connecting to a CDB is the same as you connect with the regular, non-container database (11g and below). Wha

[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