Oracle 10g RAC for linux 的完全解除安裝

kuqlan發表於2013-07-06
如下解除安裝過程只針對軟體和清理裸裝置的過程,不涉及使用者、系統引數、信任關係、環境變數、資料庫檔案等資訊。
目的主要是為了透過重複刪除和重新安裝來熟練Oracle Rac的安裝配置過程。[@more@]

1.現有配置資訊的收集:
為了正確解除安裝,對現有配置和路徑進行查詢:

.bash_profile檔案內容如下:
[oracle@dbserv1 ~]$ more .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

export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db
export ORA_ASM_HOME=$ORACLE_BASE/product/10.2.0/asm
export ORA_CRS_HOME=/u01/crs1020
export ORACLE_SID=racdb1
# export ORACLE_SID=racdb2
export PATH=$ORA_CRS_HOME/bin:$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib
export LC_CTYPE=en_US.UTF-8
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export TMPDIR=/tmp
export TMP=/tmp


裸裝置配置資訊及磁碟分割槽情況:

[root@dbserv1 ~]# more /etc/sysconfig/rawdevices
# raw device bindings
# format:
#
# example: /dev/raw/raw1 /dev/sda1
# /dev/raw/raw2 8 5

#OCR
/dev/raw/raw1 /dev/sdb1

#Voting Disk
/dev/raw/raw2 /dev/sdc1

#Ora Disk
/dev/raw/raw3 /dev/sdd1
/dev/raw/raw4 /dev/sde1
/dev/raw/raw5 /dev/sdf1
[root@dbserv1 ~]# fdisk -l

Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 892 7164958+ 83 Linux
/dev/sda2 893 2480 12755610 83 Linux
/dev/sda3 2481 2610 1044225 82 Linux swap / Solaris

Disk /dev/sdb: 321 MB, 321912832 bytes
64 heads, 32 sectors/track, 307 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 2 307 313344 83 Linux

Disk /dev/sdc: 213 MB, 213909504 bytes
64 heads, 32 sectors/track, 204 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

Device Boot Start End Blocks Id System
/dev/sdc1 1 204 208880 83 Linux

Disk /dev/sdd: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdd1 1 391 3140676 83 Linux

Disk /dev/sde: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sde1 1 391 3140676 83 Linux

Disk /dev/sdf: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdf1 1 391 3140676 83 Linux

2.開始解除安裝:

解除安裝之前需要關閉RAC

在所有節點執行如下兩條命令:
crs_stop -all -f
crs_stat -t -v
crsctl stop crs

例如:
[oracle@dbserv1 ~]$ crs_stop -all
Attempting to stop `ora.dbserv1.gsd` on member `dbserv1`
Attempting to stop `ora.RACDB.TEST.RACDB1.srv` on member `dbserv1`
Attempting to stop `ora.RACDB.TEST.cs` on member `dbserv1`
Stop of `ora.dbserv1.gsd` on member `dbserv1` succeeded.
Attempting to stop `ora.dbserv1.ons` on member `dbserv1`
Attempting to stop `ora.RACDB.TEST.RACDB2.srv` on member `dbserv2`
Stop of `ora.RACDB.TEST.RACDB1.srv` on member `dbserv1` succeeded.
Attempting to stop `ora.dbserv2.gsd` on member `dbserv2`
Attempting to stop `ora.dbserv2.ons` on member `dbserv2`
Stop of `ora.dbserv1.ons` on member `dbserv1` succeeded.
Attempting to stop `ora.RACDB.db` on member `dbserv2`
Stop of `ora.RACDB.TEST.RACDB2.srv` on member `dbserv2` succeeded.
Stop of `ora.dbserv2.gsd` on member `dbserv2` succeeded.
Stop of `ora.dbserv2.ons` on member `dbserv2` succeeded.
Stop of `ora.RACDB.TEST.cs` on member `dbserv1` succeeded.

Stop of `ora.RACDB.db` on member `dbserv2` succeeded.
Attempting to stop `ora.dbserv1.LISTENER_DBSERV1.lsnr` on member `dbserv1`
Attempting to stop `ora.dbserv2.LISTENER_DBSERV2.lsnr` on member `dbserv2`
Stop of `ora.dbserv1.LISTENER_DBSERV1.lsnr` on member `dbserv1` succeeded.
`ora.RACDB.RACDB1.inst` is already OFFLINE.
Attempting to stop `ora.dbserv1.ASM1.asm` on member `dbserv1`
...

[root@dbserv1 ~]# cd /u01/crs1020/
[root@dbserv1 crs1020]# cd bin/
[root@dbserv1 bin]# ./crsctl stop
Missing parameter.
[root@dbserv1 bin]# ./crsctl stop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
[root@dbserv1 bin]#


清理裸裝置:

dd if=/dev/zero of=/dev/raw/raw1 bs=1M count=300
dd if=/dev/zero of=/dev/raw/raw2 bs=1M count=300
dd if=/dev/zero of=/dev/raw/raw3 bs=1M count=300
dd if=/dev/zero of=/dev/raw/raw4 bs=1M count=300
dd if=/dev/zero of=/dev/raw/raw5 bs=1M count=300

刪除Oracle database db sofetware:
rm -rf /u01/app/oracle/*

刪除Oracle database clustware sofetware:
rm -rf /u01/crs1020/*


刪除其餘安裝過程中生成的相關檔案:
rm -rf /etc/rc.d/rc5.d/S96init.crs
rm -rf /etc/rc.d/init.d/init.crs
rm -rf /etc/rc.d/rc4.d/K96init.crs
rm -rf /etc/rc.d/rc6.d/K96init.crs
rm -rf /etc/rc.d/rc1.d/K96init.crs
rm -rf /etc/rc.d/rc0.d/K96init.crs
rm -rf /etc/rc.d/rc2.d/K96init.crs
rm -rf /etc/rc.d/rc3.d/S96init.crs

rm -rf /etc/oracle/*
rm -rf /etc/oraInst.loc
rm -rf /etc/oratab

rm -rf /usr/local/bin/coraenv
rm -rf /usr/local/bin/dbhome
rm -rf /usr/local/bin/oraenv

rm -f /etc/init.d/init.cssd
rm -f /etc/init.d/init.crs
rm -f /etc/init.d/init.crsd
rm -f /etc/init.d/init.evmd

rm -f /etc/rc2.d/K96init.crs
rm -f /etc/rc2.d/S96init.crs
rm -f /etc/rc3.d/K96init.crs
rm -f /etc/rc3.d/S96init.crs
rm -f /etc/rc5.d/K96init.crs
rm -f /etc/rc5.d/S96init.crs

rm -f /etc/inittab.crs


還原原有的inittab檔案:
mv /etc/inittab /etc/inittab_bak
cp /etc/inittab.orig /etc/inittab


重新安裝RAC之前,需要在兩個節點分別執行如下命令來啟用使用者等效驗證:
exec /usr/bin/ssh-agent $SHELL
/usr/bin/ssh-add

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/18841027/viewspace-1060668/,如需轉載,請註明出處,否則將追究法律責任。

相關文章