wiki.getshifting.com

--- Sjoerd Hooft's InFormation Technology ---

User Tools

Site Tools


start

SHIFT-WIKI - Sjoerd Hooft's InFormation Technology

This WIKI is my personal documentation blog. Please enjoy it and feel free to reach out through blue sky if you have a question, remark, improvement or observation. See below for the latest additions, or use the search or tags to browse for content.


Script: Bash: PFILE Backup

Summary: A script for a oracle pfile backup restore.
Date: Around 2013
Refactor: 8 March 2025: Checked links and formatting.

You need a pfile when restoring the Oracle RMAN Backup.

#!/bin/bash
# set -x
 
### Script Variables
WHATAMI=`basename $0`
BASEDIR=`dirname $0`
 
### Oracle Variables
export ORACLE_SID=<oraclesid>
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=/opt/oracle/product/10.2
 
 
### Offsitecopy Variables
. "$BASEDIR/mail.txt"
. "$BASEDIR/offsitecopy.func2"
BACKUPDIR=/var/backup/oracle/pfile
HOSTNAME=`hostname`
HOSTNAME_SHORT=`hostname -s`
LOGFILE="$BACKUPDIR/log.txt"
TOUSER="repluser"
TOHOST="syncserver.company.local"
TODIR="/srv/syncdata/Oracle/${HOSTNAME_SHORT}_${ORACLE_SID}/pfile"
BACKUPFILE="$BACKUPDIR/${HOSTNAME_SHORT}_${ORACLE_SID}-pfile_`date +%Y%m%d%H%M`.pfile"
DOCOPY="1"
 
mailFunction() {
   if [ "$1" == "SUCCESS" ]; then
      cat $LOGFILE | mail -s "Check PFILE Backup, not copied and not checked!" $MAILTOFAIL
   fi
}
 
copyFunction() {
   if [ "$DOCOPY" == "1" ]; then
      offsitecopy "${BACKUPFILE}" "$TOUSER" "$TOHOST" "$TODIR" "$LOGFILE" "$WHATAMI" "$HOSTNAME" "$MAILTOSUCCESS" "$MAILTOFAIL"
   else
      echo
      echo "Copy to offsite location is not enabled."
      echo "Modify the script under Offsitecopy Variables to enable offsitecopy"
      echo
      mailFunction SUCCESS
   fi
}
 
# NOTE: Output of command is always succesful because of the echo!!! Always check $LOGFILE
createPfile() {
   echo "Starting pfile backup..." > $LOGFILE
   echo "create pfile='$BACKUPFILE' from spfile;" | $ORACLE_HOME/bin/sqlplus -S "/ as sysdba" >> $LOGFILE
   echo "Pfile backup done." >> $LOGFILE
}
 
createPfile
copyFunction
 
echo
echo "INFO - PFILE backup finished"
echo

As you can see, there is an external reference to offsitecopy and mail.txt. Both are described in Bash: Function: Offsitecopy.

→ Read more...

2025/06/01 11:59

All Pages

A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
R
S
T
U
V
W

2025/06/01 11:59

Outlook Line Breaks

Summary: How to configure outlook to not remove line breaks in plain text emails.
Date: Around 2014
Refactor: 4 January 2025: Checked links and formatting.

→ Read more...

2025/06/01 11:59

PowerShell: Use Out-GridView To Select Value for Variable

Summary: How to use the Out-GridView powershell commandlet to select a Value for a Variable.
Date: Around 2020
Refactor: 8 March 2025: Checked links and formatting.

Out-GridView allows you to interact with the output from a get commandlet. For example, say you want to select a server from Active Directory and put it in a variable but you can't quite remember the name.
Use the following command to display all AD computers, allowing you to select a server to put it in the variable:

$server = Get-ADComputer -Filter * | Out-GridView -PassThru -Title "Select server:"
Note the importance of the passthru option. If you don't set it, there won't be an option to actually select the server you need, it will just display all the AD computers.

This wiki has been made possible by:

2025/06/01 11:59

<< Newer entries | Older entries >>

This wiki has been made possible by:

start.txt · Last modified: by sjoerd