Count database processes on Linux:
while true
do
for z in `ps -ef | grep smon | grep -v "grep" | awk '{print $NF}' | cut -f3 -d"_" | sort`
do
CNT=0
for i in `ps -ef | grep ${z} | grep -v "grep" | awk '{print $2}'`
do
A=`ls -al /proc/${i}/status`
if [ $? = 0 ]
then
if [ -z ${A} ]
then
echo "Look at: ${A}"
#ls -al ${A}
fi
else
echo "Nothing to see here..."
echo ${i}
fi
B=`ls -al /proc/${i}/smaps`
if [ $? = 0 ]
then
if [ -z ${B} ]
then
echo "Look at: ${B}"
#ls -al ${B}
fi
else
echo "Nothing to see here..."
echo ${i}
fi
CNT=`expr ${CNT} + 1`
done
echo "Process count for ${z} is: "${CNT}
done
sleep 20
done
Thursday, 22 August 2013
Change DOMAIN name.
Change DOMAIN name in a RAC environment:
for i in `srvctl config | grep ${ORACLE_SID}`
do
CD=`srvctl config database -d ${i} | grep Domain`
echo -e "\n\nCurrent domain is: "${CD}
echo -e "To change this
srvctl modify database -d ${i} -m <your domain name>
and on the database...
alter system set db_domain='<your domain name>' scope=spfile;
\n\n
"
done
A database reboot will be needed to apply the SPFILE changes.
for i in `srvctl config | grep ${ORACLE_SID}`
do
CD=`srvctl config database -d ${i} | grep Domain`
echo -e "\n\nCurrent domain is: "${CD}
echo -e "To change this
srvctl modify database -d ${i} -m <your domain name>
and on the database...
alter system set db_domain='<your domain name>' scope=spfile;
\n\n
"
done
A database reboot will be needed to apply the SPFILE changes.
Archivelog Purges
A simple script to help me purge older archive logs when required:
############################
# Archivelog Purges
############################
for i in 1
do
echo -e "\nEnter number of days to retain: "
read ANS
rman <<END
connect target /
run {
allocate channel D1 type disk;
delete noprompt archivelog until time 'SYSDATE -${ANS}';
}
exit
END
done
############################
# Archivelog Purges
############################
for i in 1
do
echo -e "\nEnter number of days to retain: "
read ANS
rman <<END
connect target /
run {
allocate channel D1 type disk;
delete noprompt archivelog until time 'SYSDATE -${ANS}';
}
exit
END
done
Subscribe to:
Comments (Atom)