Total Pageviews

Thursday, September 3, 2020

ORA-00845: MEMORY_TARGET not supported on this system

 SQL*Plus: Release 11.2.0.1.0 Production on Thu Sep 3 11:07:01 2020

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to an idle instance

SQL> startup

ORA-00845: MEMORY_TARGET not supported on this system


Solution:


Connect as root user and execute below command:

-bash-4.1$ sudo su -

[root@oracleserverdb11g ~]# mount -t tmpfs shmfs -o size=7g /dev/shm

[root@oracleserverdb11g ~]#

Thursday, March 5, 2020

ORA-48316,ORA-48122,ORA-27041

Database Characterset is US7ASCII
Drop Relation ADR_CONTROL
Errors in file /u01/app/oracle/diag/rdbms/oracle/oracle/trace/oracle_ora_67199.trc:
ORA-48316: relation [ADR_CONTROL] unavailable or cannot be created
ORA-48122: error with opening the ADR block file [/u01/app/oracle/diag/rdbms/oracle/oracle/metadata/ADR_CONTROL.ams] [0]
ORA-27041: unable to open file
Linux-x86_64 Error: 13: Permission denied
Additional information: 2
Errors in file /u01/app/oracle/diag/rdbms/oracle/oracle/trace/oracle_ora_67199.trc:
ORA-48316: relation [ADR_CONTROL] unavailable or cannot be created
ORA-48122: error with opening the ADR block file [/u01/app/oracle/diag/rdbms/oracle/oracle/metadata/ADR_CONTROL.ams] [0]
ORA-27041: unable to open file
Linux-x86_64 Error: 13: Permission denied
Additional information: 2
Error 48316 happened during db open, shutting down database
USER (ospid: 67199): terminating the instance due to error 48316
Instance terminated by USER, pid = 67199
ORA-1092 signalled during: alter database "oracle" open resetlogs...
opiodr aborting process unknown ospid (67199) as a result of ORA-1092

SOLUTION:

To solve the issue, use the following alternatives:
The anti-virus scanner had additional processes running during the time-frame.  Disabling the anti-virus scanner can resolve this issue
1.  Disable Anti-Virus
2.  Resolve the OS level Anti-Virus privilege issue(s) if there are any
3.  Re-enable Anti-Virus
Note:  There are no OS level permission issue on the directory and even changing permissions to 770 or 777 doesn't resolve the issue.  This is the Anti-Virus which is preventing from writing the ADR logs
To stop McAffe & it's Scanner, do the following:
/etc/init.d/cma stop
/etc/init.d/nails stop

Tuesday, February 18, 2020

How To Send Alert Mail For File System Crossing Threshold Limit.


Make directory script as below:

[oracle@myhost]mkdir /home/oracle/script

[oracle@myhost]cd /home/oracle/script

[oracle@myhost script]$ pwd
/home/oracle/script
Script 1) This is the main script which help us to send the alert mail.
[oracle@myhost script]$ vi fs_space_alert.sh
##!/usr/bin/ksh
# =============================================================================
# NAME
#    fs_space_alert.ksh
#
# DESCRIPTION
#    Check UNIX file system free space and send alert to DBA
#
# USAGE
#    ./ts_free_space.ksh
#
# NOTES
#
# HISTORY
#    ashwani/ashwani - 30-APR-106 - Initial version
#
# =============================================================================

#--------------------------------------------------------------------------------------------------
# Variables
#--------------------------------------------------------------------------------------------------
PROGRAM=$( basename $0 )
DIR=$( dirname $0 )
OS=$(uname)
HOST=myhost
INPUT_FS_ALERT=$DIR/input_fs_alert.txt

# source dba related profile ------------------
. $DIR/.dba_profile

#--------------------------------------------------------------------------------------------------
# Main Program
#--------------------------------------------------------------------------------------------------
if [[ ! -f ${INPUT_FS_ALERT} ]];then
    echo "Space alert baseline file not found, creating empty file: ${INPUT_FS_ALERT}"
    touch ${INPUT_FS_ALERT}
    exit 8
fi

exec 3< $INPUT_FS_ALERT
while read -u3 fs pct
do
    if [[ $OS = 'HP-UX' ]];then
        pct_used=`bdf -b ${fs} | grep -v "^Filesystem" | awk '{print $5}' | sed 's/%//g'`
    elif [[ $OS = 'SunOS' ]];then
        pct_used=`df -k ${fs} | grep -v "^Filesystem" | awk '{print $5}' | sed 's/%//g'`
    else
        pct_used=`df -k ${fs} | grep -v "^Filesystem" | awk '{print $4}' | sed 's/%//g'`
    fi


    if [[ ${pct_used} -ge ${pct} ]];then
       echo "!! A C T I O N !! File System ${fs} is ${pct_used} full on $HOST" | /bin/mail -s "File System Alert from $HOST !!!  A C T I O N  !!! required"  $DBAMAILLIST
    fi
done
exec 3<&-


Script 2) Below script is used for calculating thresh hold of mount point /home and /u01. When these mount reaches to 30% and 90% respectively we will receive mail once the job triggered from cron.


[oracle@myhost script]$vi input_fs_alert.txt
/home 30
/u01 90



[oracle@myhost ~]$ pwd
/home/oracle
[oracle@myhost ~]$ cat .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
# Oracle Settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR

ORACLE_HOSTNAME=myhost.mind.motherson.com; export ORACLE_HOSTNAME
ORACLE_UNQNAME=oracle; export ORACLE_UNQNAME
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1; export ORACLE_HOME
ORACLE_SID=oracle; export ORACLE_SID

PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH


Script 3) Below script will send alert mail to mail id oracleforeinsics4u@gmail.com

[oracle@myhost script]$ vi .dba_profile
. $HOME/.bash_profile
export DIR=/home/oracle/script
export LOGDIR=$DIR/logs

DBAMAILLIST="oracleforeinsics4u@gmail.com"; export DBAMAILLIST


[oracle@myhost script]$ ls -la
total 56
drwxr-xr-x  3 oracle oinstall  4096 Feb 12 20:04 .
drwx------ 48 oracle oinstall 32768 Feb 12 20:04 ..
-rw-r--r--  1 oracle oinstall   141 Feb 12 20:04 .dba_profile
-rw-r--r--  1 oracle oinstall  1811 Feb 12 17:44 fs_space_alert.sh
-rw-r--r--  1 oracle oinstall     9 Feb 12 17:58 input_fs_alert.txt
drwxr-xr-x  2 oracle oinstall  4096 Feb 12 17:56 logs
[oracle@myhost script]$ cat .dba_profile
. $HOME/.bash_profile
export DIR=/home/oracle/script
export LOGDIR=$DIR/logs

DBAMAILLIST="oracleforensics4u@gmail.com"; export DBAMAILLIST


[oracle@myhost script]$ ls -lrth
total 12K
-rw-r--r-- 1 oracle oinstall 1.8K Feb 12 17:44 fs_space_alert.sh
drwxr-xr-x 2 oracle oinstall 4.0K Feb 12 17:56 logs
-rw-r--r-- 1 oracle oinstall    9 Feb 12 17:58 input_fs_alert.txt

[oracle@myhost script]$ crontab -l
00 20 * * * sh /home/oracle/script/fs_space_alert.sh

How to trigger RMAN full backup and get notified by e-mail using powershell for window oracle server


We have below script at location F:\mc_back

F:\mc_back>dir *rman* 

 Volume in drive F is New Volume
 Volume Serial Number is D624-0C00
 Directory of F:\mc_back
17-Feb-20  05:17 PM             1,410 rman_backup_disk_compressed.rman 
17-Feb-20  05:30 PM               769 ps-fullbkp_rman.ps1
               2 File(s)          2,179 bytes
               0 Dir(s)   4,798,963,712 bytes free


Script 1): rman_backup_disk_compressed.rman

sql 'alter system archive log current';
sql "alter session set nls_date_format=''dd.mm.yyyy hh24:mi:ss''";
RUN
{
configure controlfile autobackup on;
set command id to 'DB11GOnlineBackupFull';
ALLOCATE CHANNEL c1 DEVICE TYPE disk;
ALLOCATE CHANNEL c2 DEVICE TYPE disk;
ALLOCATE CHANNEL c3 DEVICE TYPE disk;
ALLOCATE CHANNEL c4 DEVICE TYPE disk;
backup AS COMPRESSED BACKUPSET full database tag DB11G_FULL format 'G:\db11gbkp\%d_%T_%s_%p_FULL';
sql 'alter system archive log current';
backup tag DB11G_ARCHIVE format 'G:\db11gbkp\%d_%T_%s_%p_ARCHIVE' archivelog all delete all input;
backup tag DB11G_CONTROL current controlfile format 'G:\db11gbkp\%d_%T_%s_%p_CONTROL';
release channel c1;
release channel c2;
release channel c3;
release channel c4;
}
  
Script 2): ps-fullbkp_rman.ps1

set-executionpolicy remotesigned
start-job { Set-ExecutionPolicy RemoteSigned -Force } -RunAs32  

# Get script input params
$ORACLE_SID="db11g"
$LOG_DIR="F:\mc_back"
$BIN_DIR="F:\mc_back"

# Assemble other variables
$datetime = get-date -format "MMM.dd.yyyy-HH.m.ss"
$RMAN_TYPE="disk_backup"
$RMAN_LOG = "$LOG_DIR\$ORACLE_SID.$RMAN_TYPE.$datetime.rman.log"
# Start logging to file and then run RMAN command. Echo is an alias for Write-Output.
$newline = "Start Execution of $RMAN_TYPE backup on $ORACLE_SID"
echo $newline | out-file $RMAN_LOG
get-date | out-file $RMAN_LOG -append
 C:\app\ashwanik\product\11.2.0.4\dbhome_1\BIN\rman target sys/oracle_4U@db11g cmdfile= "$BIN_DIR\rman_backup_disk_compressed.rman" using $ORACLE_SID | out-file $RMAN_LOG –append

# Send email. Note that cat is an alias for Get-Content.
$body = cat $RMAN_LOG | out-string
send-mailmessage -to "oracleforensics4u@gmail.com" -from "oracleforensics4u@gmail.com" -body $body -subject "RMAN log output" -smtpserver smtp-apac.service.example.com

# Remove files older than 8 days.
# Note that ls is an alias for Get-ChildItem and del is an alias for Remove-Item.
# Also, ? is an alias for Where-Object and $_ is a built-in variable
# to refer to the collection of objects passed from the previous pipeline.
ls $LOG_DIR\$ORACLE_SID.$RMAN_TYPE.* |? {$_.LastWriteTime -lt (get-date).AddDays(-8)} | del


NOTE: smtp-apac.service.example.com is a smtp server details:


We can schedule these scripts for triggering RMAN backup at stipulate time as below:

Program/Script:



%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe 




Add Arguments:

-command & F:\mc_back\ps-fullbkp_rman.ps1

Start in:

F:\mc_back