четверг, 19 февраля 2009 г.

OAS

На промышленном сервере:

15 01 * * 0 ${HOME}/bin/stop_app_all.sh > /dev/null 2>&1
30 02 * * 0 ${HOME}/bin/start_app_all.sh > /dev/null 2>&1
50 01 * * 1-5 ${HOME}/bin/pkg/ias_cold_backup/_run.sh > /dev/null 2>&1


$ more start_app_all.sh
#!/bin/bash

. ${HOME}/bin/.env
emctl start iasconsole
${ORACLE_HOME}/opmn/bin/opmnctl startall
###${ORACLE_HOME}/dcm/bin/dcmctl start -co myapp -a myapp
###${ORACLE_HOME}/dcm/bin/dcmctl start -co myapptest -a myapptest


$ more stop_app_all.sh
#!/bin/bash
. ${HOME}/bin/.env

###${ORACLE_HOME}/dcm/bin/dcmctl stop -co myapptest -a myapptest
${ORACLE_HOME}/dcm/bin/dcmctl stop -co myapp -a myapp

${ORACLE_HOME}/opmn/bin/opmnctl shutdown

emctl stop iasconsole


$ more backup_app_all.sh
#!/bin/bash
. ${HOME}/bin/.env
###${HOME}/bin/stop_app_all.sh
cd ${ORACLE_BASE}/
mv ${ORACLE_BASE}/backups/full/ora_j2ee.tar ${ORACLE_BASE}/backups/full/old_ora_j2ee.tar
tar -cvf ${ORACLE_BASE}/backups/full/ora_j2ee.tar ora_j2ee
###${HOME}/bin/start_app_all.sh


$ more copy_app_all.sh
#!/bin/bash
. ${HOME}/bin/.env
scp ${ORACLE_BASE}/backups/full/ora_j2ee.tar remote-serv:${ORACLE_BASE}/backups/full/ora_j2ee.tar


$cd ${HOME}/bin/pkg/ias_cold_backup/

$ more body.sh

echo "`date +%T` Begin IAS Cold Backup"
${HOME}/bin/pkg/ias_cold_backup/stop_app_all.sh
cd ${ORACLE_BASE}/
mv /oradata/backups/full/ora_j2ee.tar /oradata/backups/full/old_ora_j2ee.tar
tar -cf /oradata/backups/full/ora_j2ee.tar ora_j2ee
${HOME}/bin/pkg/ias_cold_backup/start_app_all.sh
scp /oradata/backups/full/ora_j2ee.tar remote-srv:/oradata/backups/full/ora_j2ee.tar
echo "`date +%T` End IAS Cold Backup"


На резервном сервере:

00 05 * * 1-5 ${HOME}/bin/pkg/refresh_ias/_run.sh > /dev/null 2>> /tmp/crontab_oracle.err


$cd ${HOME}/bin/pkg/refresh_ias/
$more body.sh

echo "`date +%T` Begin IAS Refresh"
${HOME}/bin/pkg/refresh_ias/stop_app_all.sh
sleep 30
ps -fu oracle
echo '******************************************************'
cd ${ORACLE_BASE}

if [ -d "ora_j2ee" ] ; then
rm -rf ora_j2ee
echo "test"
fi
#exit
tar -xf /opt/oracle/backups/full/ora_j2ee.tar

rm /opt/oracle/ora_j2ee/j2ee/myapp/config/myapp-data-sources.xml
cp /home/oracle/datasources/myapp-data-sources.xml /opt/oracle/ora_j2ee/j2ee/myapp/config/

${ORACLE_HOME}/chgip/scripts/chgiphost.sh -mid -silent -oldhost srv-app1.msk.sun.com -newhost srv-app2.msk.sun.com -oldip 192.168.22.1 -newip 192.168.22.2
mv ${ORACLE_HOME}/opmn/conf/opmn.xml ${ORACLE_HOME}/opmn/conf/old_opmn.xml
cat ${ORACLE_HOME}/opmn/conf/old_opmn.xml |sed '1,$s/app1/app2/' >${ORACLE_HOME}/opmn/conf/opmn.xml
mv ${ORACLE_HOME}/sysman/emd/targets.xml ${ORACLE_HOME}/sysman/emd/old_targets.xml
cat ${ORACLE_HOME}/sysman/emd/old_targets.xml |sed '1,$s/app1/app2/' >${ORACLE_HOME}/sysman/emd/targets.xml
mv ${ORACLE_HOME}/config/ias.properties ${ORACLE_HOME}/config/old_ias.properties
cat ${ORACLE_HOME}/config/old_ias.properties |sed '1,$s/app1/app2/' >${ORACLE_HOME}/config/ias.properties

ps -fu oracle

rm /opt/oracle/ora_j2ee/Apache/Apache/htdocs/index.html
cp /home/oracle/datasources/index.html /opt/oracle/ora_j2ee/Apache/Apache/htdocs/
cp /home/oracle/datasources/logo3.gif /opt/oracle/ora_j2ee/j2ee/myapp/applications/myapp/ecl/images/

sudo /bin/cp -p /home/oracle/datasources/.apachectl /opt/oracle/ora_j2ee/Apache/Apache/bin/.apachectl

sleep 5
${HOME}/bin/pkg/refresh_ias/start_app_all.sh

echo "`date +%T` End IAS Refresh"


Комментариев нет:

Отправить комментарий