RAC解除安裝說明

dawn009發表於2014-07-15

今天本來是打算做RAC RMAN 備份的實驗的。 可是有個問題一直沒有解決,是之前安裝RAC時遺留的。 因為這個給操作帶來了很多麻煩,所以決定先把這個問題了。

      

       上次安裝的時候沒有注意順序,結果是ASM2 例項在RAC1 節點上, ASM1 RAC2 節點上。 這樣每次啟動RAC 環境的時候都會很麻煩。  要解決這個問題只能先解除安裝資料庫例項,在解除安裝ASM. 在重新安裝。  在網上google搜了一下,整理如下,順便做個實驗,驗證一下。  

 

 

 

一.RAC 刪除資料庫

This section explains how to delete a RAC database with the DBCA. This process deletes a database and removes a database's initialization parameter files, instances, OFA structure, and Oracle network configuration. However, this process does not remove datafiles if you placed the files on raw devices or on raw partitions.

To delete a database with the DBCA:

1.      Start the DBCA on one of the nodes:

The DBCA Welcome page appears.

2.      Select Oracle Real Application Clusters and click Next.

After you click Next, the DBCA displays the Operations page.

3.      Select Delete a database, click Next, and the DBCA displays the List of Cluster Databases page.

4.      If your user ID and password are not operating-system authenticated, then the List of Cluster Databases page displays the user name and password fields. If these fields appear, then enter a user ID and password that has SYSDBA privileges.

5.      Select the database to delete and click Finish.

After you click Finish, the DBCA displays a dialog to confirm the database and instances that the DBCA is going to delete.

6.      Click OK to begin the deletion of the database and its associated files, services, and environment settings, or click Cancel to stop the operation.

When you click OK, the DBCA continues the operation and deletes all of the associated instances for this database. The DBCA also removes the parameter files, password files, and oratab entries.

At this point, you have accomplished the following:

·         Deleted the selected database from the cluster

·         Deleted high availability services that were assigned to the database

·         Deleted the Oracle Net configuration for the database

·         Deleted the OFA directory structure from the cluster

·         Deleted the datafiles if the datafiles were not on raw devices

 

二. ASM 例項解除安裝

 

How to drop the ASM instance installed in a seperate Oracle Home for both RAC and non-RAC installations.

 

Solution

 

The outline of the steps involved are :
a) Backup all the ASM client database files stored on the diskgroups.
b) Dropping all the diskgroups.
c) Removing ASM resource from CRS (* RAC specific)
d) Removing ASM disk signature (In case of asmlib)
e) Remove the ASM pfile/spfile.
f) Removing ASM entry in the file oratab
g) Wipe out the disks header using dd

 

Following are the steps to be followed:
1) Log into the ASM instance and do 'select * from v$asm_client;'

      

2) For each instance listed above, stop the respective databases.

 

3) Backup all the datafiles, logfiles, controlfiles, archive logs, etc. that are currently using ASM storage, to tape or to filesystem (using RMAN). This needs to be done for every database (ASM client) using ASM.

** NOTE: Please make sure you have the data secure before continuing to the next step.

 

4) Find all the diskgroups: 'select * from v$asm_diskgroup'

5) For each diskgroup listed above:

' drop diskgroup including contents'

 

這裡要注意的,要先在一個節點上將diskgroup dismount後, 在另一個節點進行drop。不然會報:

       ORA-15073: diskgroup DATA is mounted by another ASM instance

 

alter diskgroup  dismount;

 

6) Shutdown all(RAC nodes) ASM instances.

 

7) On RAC install verify that all asm instances are stopped

$ORA_CRS_HOME/bin/crst_stat |more 

 

8) For single instance install run the following script:

$ORACLE_HOME/bin/localconfig  delete

* This cleans up the CSSD configuration.

 

9) Invoke OUI, and now de-install the ASM Oracle home.

 

10) For RAC install, remove the asm related resource.

srvctl remove asm -n   

crs_stat |more 

 

       如:srvctl remove asm –n rac1, 如果刪除不掉,就加上 –f 引數。

 

11) If using asmlib (on Linux only), then

a. oracleasm listdisks
b. oracleasm deletedisks (do this for every disk listed above)
c. oracleasm listdisks (to verify they have been deleted)
d. on other RAC nodes: oracleasm listdisks (to verify they have been deleted too)
e. On all nodes(RAC) : 
As root run:
# /etc/init.d/oracleasm stop
# /etc/init.d/oracleasm disable

 

12) delete the ASM pfile or spfile

 

13) in the file /etc/oratab, remove the line relative to the ASM instance

 

14) clean out the disks headers using the dd command:

for example: dd if=/dev/zero of=/dev/ bs=1024k count=50

 

[root@rac2 ~]# dd if=/dev/zero of=/dev/sdd1 bs=1024k count=1

1+0 records in

1+0 records out

1048576 bytes (1.0 MB) copied, 0.026078 seconds, 40.2 MB/s

 

 

.  Clusterware安裝失敗情況下的解除安裝

 

How to Clean Up After a Failed 10g or 11.1 Oracle Clusterware Installation

10g and 11.1 RAC: How to Clean Up After a Failed CRS Install
------------------------------------------------------------
Not cleaning up a failed CRS install can cause problems like node reboots.
Follow these steps to clean up a failed CRS install:


1. Run the rootdelete.sh script then the rootdeinstall.sh script from the $ORA_CRS_HOME/install directory on any nodes you are removing CRS from. 

       Running these scripts should be sufficent to clean up your CRS install.  Rootdelete.sh accepts options like nosharedvar/sharedvar, and nosharedhome/sharedhome. Make yourself familiar with these options by reading the Oracle Clusterware and Oracle Real Application Clusters Administration and Deployment Guide.If you have any problems with these scripts please open a service request.  

If for some reason you have to manually remove the install due to problems with the scripts, continue to step 2:

   

2. Stop the Nodeapps on all nodes:

          srvctl stop nodeapps -n

 

3. Prevent CRS from starting when the node boots.  To do this issue the following as root:

 

Sun:

       rm /etc/init.d/init.cssd

       rm /etc/init.d/init.crs

       rm /etc/init.d/init.crsd

       rm /etc/init.d/init.evmd

       rm /etc/rc3.d/K96init.crs

       rm /etc/rc3.d/S96init.crs

        rm -Rf /var/opt/oracle/scls_scr

        rm -Rf /var/opt/oracle/oprocd

       rm /etc/inittab.crs

       cp /etc/inittab.orig /etc/inittab

 

Linux:

        rm /etc/oracle/*

       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 -Rf /etc/oracle/scls_scr

       rm -f /etc/inittab.crs

       cp /etc/inittab.orig /etc/inittab

 

HP-UX:

       rm /sbin/init.d/init.cssd

       rm /sbin/init.d/init.crs

       rm /sbin/init.d/init.crsd

       rm /sbin/init.d/init.evmd

        rm /sbin/rc2.d/K960init.crs

        rm /sbin/rc2.d/K001init.crs

       rm /sbin/rc3.d/K960init.crs

       rm /sbin/rc3.d/S960init.crs

        rm -Rf /var/opt/oracle/scls_scr

        rm -Rf /var/opt/oracle/oprocd

       rm /etc/inittab.crs

       cp /etc/inittab.orig /etc/inittab

 

HP Tru64:

       rm /sbin/init.d/init.cssd

       rm /sbin/init.d/init.crs

       rm /sbin/init.d/init.crsd

       rm /sbin/init.d/init.evmd

       rm /sbin/rc3.d/K96init.crs

       rm /sbin/rc3.d/S96init.crs

        rm -Rf /var/opt/oracle/scls_scr

        rm -Rf /var/opt/oracle/oprocd

       rm /etc/inittab.crs

       cp /etc/inittab.orig /etc/inittab

 

IBM AIX:

       rm /etc/init.cssd

       rm /etc/init.crs

       rm /etc/init.crsd

       rm /etc/init.evmd

       rm /etc/rc.d/rc2.d/K96init.crs

       rm /etc/rc.d/rc2.d/S96init.crs

        rm -Rf /etc/oracle/scls_scr

        rm -Rf /etc/oracle/oprocd

       rm /etc/inittab.crs

       cp /etc/inittab.orig /etc/inittab

 

4. If they are not already down, kill off EVM, CRS, and CSS processes or reboot the node:

       ps -ef | grep crs

       kill

       ps -ef | grep evm

       kill

       ps -ef | grep css      

       kill

 

   Do not kill any OS processes, for example icssvr_daemon process !


 

5. If there is no other Oracle software running (like listeners, DB's, etc...), you can remove the files in /var/tmp/.oracle or /tmp/.oracle.  Example:

        rm -f /var/tmp/.oracle/*

        or

        rm -f /tmp/.oracle/*

 

6. Remove the ocr.loc Usually the ocr.loc can be found at /etc/oracle

 

7. De-install the CRS home in the Oracle Universal Installer

 

8. Remove the CRS install location.

 

9. Clean out the OCR and Voting Files with dd commands.  Example:

        dd if=/dev/zero of=/dev/rdsk/V1064_vote_01_20m.dbf bs=1M count=256
        dd if=/dev/zero of=/dev/rdsk/ocrV1064_100m.ora bs=1M count=256

   See the Clusterware Installation Guide for sizing requirements...  

   If you placed the OCR and voting disk on a shared filesystem, remove them.

   If you are removing the RDBMS installation, also clean out any ASM disks if they have already been used.

10. The /tmp/CVU* dir should be cleaned also to avoid the cluvfy misreporting.

11. It is good practice to reboot the node before starting the next install.

12. If you would like to re-install CRS, follow the steps in the RAC Installation manual.



Oracle 11g,執行如下操作:

清除家目錄:

rm -rf /u01/app/grid_home

rm -rf /home/oracle

清除相關檔案:

rm -rf /tmp/.oracle

rm -rf /var/tmp/.oracle

rm -rf /etc/init/oracle-ohasd.conf

rm -rf /etc/init.d/ohasd

rm -rf /etc/init.d/init.ohasd

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

rm -rf /etc/oracle

清除ASM磁碟資訊:

dd if=/dev/zero of=/dev/sdxx bs=8192 count=128000


 

 

四.      RAC解除安裝步驟

 

上面三個分別介紹了單獨解除安裝的方法。 現在來看一下,如何來解除安裝一個安裝成功的RAC 環境。

 

 

解除安裝步驟:

       1 刪除資料庫

       2 利用Netca工具刪除監聽設定

       3 刪除Oracle 軟體

       4 CLUSTER目錄下提供的shell來清除CLUSTER系統的所有修改

       5 清除OCR中的資訊

       6 解除安裝ClusterWare

 

 

4.1 刪除資料庫

      

為了更好的解除安裝資料庫,最好是保證資料庫處於開啟狀態,這樣DBCA就可以根據讀取Oracle資料檔案的資訊並進行刪除。 啟動DBCA圖形介面,選擇Oracle Real Application Cluster database選擇。 選擇Delete a Databasese。 然後選擇FINISH,刪除整個資料庫檔案。

 

操作方法和第一節一樣.

 

4.2 利用NETCA工具刪除監聽設定。

      

 

4.3 刪除Oracle 軟體

 

進入$ORACLE_HOME/oui/bin/ 目錄,執行runInstaller命令。 進入WELCOME介面後,直接點選Installed Products,這時會彈出一個對話方塊,在Oracle Homes中有兩個物件:OraCrs10g_homeOraDb10g_home

 

在刪除的時候一定要先選擇解除安裝OraDb10g_home,因為還需要執行Cluster目錄下的shell指令碼來清除CLUSTER對作業系統進行的修改,所以OraCrs10g_home的解除安裝放到後面的步驟中進行。

 

選中OraDb11g_home點選REMOVE即可進行解除安裝。

 

4.4CLUSTER目錄下提供的shell來清除CLUSTER系統的所有修改

 

root使用者執行如下指令碼:

on local node:
$ORA_CRS_HOME/install/rootdelete.sh local nosharedvar nosharedhome

on remote nodes:
$ORA_CRS_HOME/install/rootdelete.sh remote nosharedvar nosharedhome

 

執行時,可以加上 -force 引數。

 

注意:這裡的操作必須一個節點一個節點的執行,不能並行操作,就如同安裝的時候執行root.sh一樣!

 

rac1節點執行:

 

[root@rac1 ~]# cd /u01/app/oracle/product/crs/install

[root@rac1 install]# ./rootdelete.sh local nosharedvar nosharedhome

CRS-0210: Could not find resource 'ora.rac1.LISTENER_RAC1.lsnr'.

Shutting down Oracle Cluster Ready Services (CRS):

Sep 17 13:27:28.917 | INF | daemon shutting down

Stopping resources. This could take several minutes.

Successfully stopped CRS resources.

Stopping CSSD.

Shutting down CSS daemon.

Shutdown request successfully issued.

Shutdown has begun. The daemons should exit soon.

Checking to see if Oracle CRS stack is down...

Oracle CRS stack is not running.

Oracle CRS stack is down now.

Removing script for Oracle Cluster Ready services

Updating ocr file for downgrade

Cleaning up SCR settings in '/etc/oracle/scls_scr'

 

rac2節點執行:

 

[root@rac2 ~]#  cd /u01/app/oracle/product/crs/install

[root@rac2 install]# ./rootdelete.sh remote nosharedvar nosharedhome

CRS-0210: Could not find resource 'ora.rac2.LISTENER_RAC2.lsnr'.

Shutting down Oracle Cluster Ready Services (CRS):

Sep 17 13:29:48.144 | INF | daemon shutting down

Stopping resources. This could take several minutes.

Successfully stopped CRS resources.

Stopping CSSD.

Shutting down CSS daemon.

Shutdown request successfully issued.

Shutdown has begun. The daemons should exit soon.

Checking to see if Oracle CRS stack is down...

Oracle CRS stack is not running.

Oracle CRS stack is down now.

Removing script for Oracle Cluster Ready services

Updating ocr file for downgrade

Cleaning up SCR settings in '/etc/oracle/scls_scr'

 

4.5 清除OCR

只需要用root使用者在本地節點執行如下命令:

$ORA_CRS_HOME/install/rootdeinstall.sh

 

在一個節點執行即可:

[root@rac1 install]# ./rootdeinstall.sh

Removing contents from OCR mirror device

2560+0 records in

2560+0 records out

10485760 bytes (10 MB) copied, 0.774432 seconds, 13.5 MB/s

Removing contents from OCR device

2560+0 records in

2560+0 records out

10485760 bytes (10 MB) copied, 1.36228 seconds, 7.7 MB/s

 

4.6 解除安裝clusterware

 

進入$ORA_CRS_HOME/oui/bin/ 目錄,執行runInstaller命令進入WELCOME介面後,點選Installed Products,在彈出的對話方塊中選擇OraCrs10g_home,然後點選REMOVE

 

刪除/var/opt目錄下的Oracle資訊和ORACLE_BASE目錄:

 

# rm -rf /data/oracle

# rm -rf /var/opt/oracle

 

刪除/usr/local/bin目錄下的設定:

 

# rm /usr/local/bin/dbhome

# rm /usr/local/bin/oraenv

# rm /usr/local/bin/coraenv

 

利用作業系統命令檢查一下,系統中是否還殘留一些Oracle的設定:

 

 

# find / -name oracle

 

 

整個Oracle資料庫和RAC環境清除工作至此結束,可以重新進行ClusterwareRAC的安裝了。這裡沒有對幾個raw裝置進行,因為在安裝Clusterware的時候,會自動對他們進行格式化。
---&gt>轉載於:http://blog.csdn.net/tianlesoftware/article/details/5892225

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

相關文章