Skip to main content

Posts

Showing posts from May, 2016

Wrapper script to run sql statements

Wrapper script to run any sql statement in all databases hosted on that server runsql.sh #!/bin/bash echo " <___________enter your title here___________> " export ORAENV_ASK='NO' for ORACLE_SID in  <___________enter all SIDs, space seporated___________> do export ORACLE_SID . oraenv > /dev/null echo " =============== $ORACLE_SID : ===============" sqlplus -s / as sysdba @<___________enter your .sql file___________>  #it runs as sysdba, change login details as per your requirement. echo " =============================== Completed for the database $ORACLE_SID. " read -p "Press Enter to continue or Ctrl+c to exit ..." done unset ORAENV_ASK

Patching using Datapatch from 12c

From 12c on wards we don’t need to run Patching post  installation scripts  postinstall.sql  &  @catbundle.sql psu apply   and validate log files manually .. All we need to do is just run   datapatch   after applying patch. ****************************** *********************** In 11G  After applying patch we need to run like following order .. postinstall.sql    =>  for OJVM in upgrade mode @catbundle.sql psu apply  =>  for PSU in normal startup mode ****************************** *********************** But from 12c datapatch will take care of post scripts work. ./datapatch –verbose Please see log for datapatch. [oracle@s24-oratl15  OPatch ]$  ./datapatch -verbose SQL Patching tool version 12.1.0.2.0 on Tue May  3 01:50:33 2016 Copyright (c) 2015, Oracle.  All rights reserved. Log file for this invocation: /u01/app/oracle/base/ cfgtoo...

Purge trace files using ADR

adr_purge.sh # Purge ADR contents (adr_purge.sh) echo "INFO: adrci purge started at `date`" adrci exec="show homes"|grep -v : | while read file_line do echo "INFO: adrci purging diagnostic destination " $file_line echo "INFO: purging ALERT older than 30 days" adrci exec="set homepath $file_line;purge -age 720 -type ALERT" echo "INFO: purging INCIDENT older than 30 days" adrci exec="set homepath $file_line;purge -age 43200 -type INCIDENT" echo "INFO: purging TRACE older than 30 days" adrci exec="set homepath $file_line;purge -age 720 -type TRACE" echo "INFO: purging CDUMP older than 30 days" adrci exec="set homepath $file_line;purge -age 43200 -type CDUMP" echo "INFO: purging HM older than 30 days" adrci exec="set homepath $file_line;purge -age 43200 -type HM" echo "" echo "" done echo echo "INFO: adrci purge fin...