如何完全刪載與清除oracle 10grac(rhel4) cluster_db_instance

wisdomone1發表於2010-03-16
rac 完全刪除

分為兩個方面
刪除rac 資料庫軟體及asm
刪除rac clusterware

下面我們進行詳細描述講解,步驟很多,哈哈,一步步來吧,別急!

1,透過檢視oratab檔案確認oracle home依存的例項(在/etc/目錄下)
2,執行dbca,選擇刪除資料庫,刪除所有的資料庫
3,如果未使用asm方式儲存管理,請進行下一步
  -bash-3.00$ export ORACLE_SID=+ASM1
-bash-3.00$ sqlplus '/as sysdba'

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Mar 15 00:15:19 2010

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


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options

SQL> select instance_name from gv$asm_client;--進入asm例項,檢視使用它的所有資料庫例項

INSTANCE_NAME
----------------------------------------------------------------
capitek1
capitek1
capitek2
capitek2
-bash-3.00$ srvctl stop database -d capitek ---根據以上查詢資訊,停止使用asm的資料庫;當然,為了保險,你可以再次執行gv$asm_client檢視是否仍有使用asm例項的資料庫例項
-bash-3.00$ crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora....k1.inst application    OFFLINE   OFFLINE               
ora....k2.inst application    OFFLINE   OFFLINE               
ora.capitek.db application    OFFLINE   OFFLINE               
ora....SM1.asm application    ONLINE    ONLINE    capitek1    
ora....K1.lsnr application    ONLINE    ONLINE    capitek1    
ora....ek1.gsd application    ONLINE    ONLINE    capitek1    
ora....ek1.ons application    ONLINE    ONLINE    capitek1    
ora....ek1.vip application    ONLINE    ONLINE    capitek1    
ora....SM2.asm application    ONLINE    ONLINE    capitek2    
ora....K2.lsnr application    ONLINE    ONLINE    capitek2    
ora....ek2.gsd application    ONLINE    ONLINE    capitek2    
ora....ek2.ons application    ONLINE    ONLINE    capitek2    
ora....ek2.vip application    ONLINE    ONLINE    capitek2    
ora.ocfs2.db   application    OFFLINE   OFFLINE               
ora....21.inst application    OFFLINE   OFFLINE               
ora....22.inst application    OFFLINE   OFFLINE   

  oracle官方推薦你備份使用asm儲存的資料檔案,我僅為測試,不備份了,生產中一定要備份

SQL> select group_number,name from v$asm_diskgroup;

GROUP_NUMBER NAME
------------ ------------------------------
           1 DG1
           2 RECOVERY
SQL> drop diskgroup dg1 including contents;--大家也看到了報錯了,因為是rac環境,兩個節點(準確講是兩個asm例項同時載入了diskgroup,故報錯,請看下面處理)
drop diskgroup dg1 including contents
*
ERROR at line 1:
ORA-15039: diskgroup not dropped
ORA-15073: diskgroup DG1 is mounted by another ASM instance


SQL> alter diskgroup dg1 dismount;---在一個節點上dismount磁碟組,可理解為把磁碟組在一個節點的asm例項中dismount

Diskgroup altered.
SQL> drop diskgroup dg1 including contents;--在另一個節點上進行刪除磁碟組,不再報錯;recovery磁碟組同理操作

Diskgroup dropped.


停掉asm例項(rac環境下)
-bash-3.00$ srvctl stop asm -n capitek1
-bash-3.00$ srvctl stop asm -n capitek2
-bash-3.00$ crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora....k1.inst application    OFFLINE   OFFLINE               
ora....k2.inst application    OFFLINE   OFFLINE               
ora.capitek.db application    OFFLINE   OFFLINE               
ora....SM1.asm application    OFFLINE   OFFLINE               
ora....K1.lsnr application    ONLINE    ONLINE    capitek1    
ora....ek1.gsd application    ONLINE    ONLINE    capitek1    
ora....ek1.ons application    ONLINE    ONLINE    capitek1    
ora....ek1.vip application    ONLINE    ONLINE    capitek1    
ora....SM2.asm application    OFFLINE   OFFLINE               
ora....K2.lsnr application    ONLINE    ONLINE    capitek2    
ora....ek2.gsd application    ONLINE    ONLINE    capitek2    
ora....ek2.ons application    ONLINE    ONLINE    capitek2    
ora....ek2.vip application    ONLINE    ONLINE    capitek2    
ora.ocfs2.db   application    OFFLINE   OFFLINE               
ora....21.inst application    OFFLINE   OFFLINE               
ora....22.inst application    OFFLINE   OFFLINE               
-bash-3.00$

清除asmlib下面配置的vol磁碟資訊,在所有的rac節點執行如下命令
[root@capitek2 ~]# oracleasm listdisks
VOL1
VOL2
VOL3
[root@capitek2 ~]# oracleasm deletedisk VOL1
Disk "VOL1" defines an unmarked device
Dropping disk: done
[root@capitek2 ~]# oracleasm deletedisk VOL2
Disk "VOL2" defines an unmarked device
Dropping disk: done
[root@capitek2 ~]# oracleasm deletedisk VOL3
Disk "VOL3" defines an unmarked device
Dropping disk: done
[root@capitek2 ~]# oracleasm listdisks

繼續在rac各節點執行如下命令
[root@capitek1 etc]# /etc/init.d/oracleasm stop
Dropping Oracle ASMLib disks: [  OK  ]
Shutting down the Oracle ASMLib driver: [  OK  ]
[root@capitek1 etc]# /etc/init.d/oracleasm disable
Writing Oracle ASM library driver configuration: done
Dropping Oracle ASMLib disks: [  OK  ]
Shutting down the Oracle ASMLib driver: [  OK  ]
[root@capitek1 etc]#


在所有rac節點執行如下命令,從ocr清除asm資訊
srvctl remove asm -n capitek1
srvctl remove asm -n capitek2

若oracle_home採用了叢集檔案系統,請執行如下命令
rm -f $ORACLE_HOME/dbs/*ASM*
rm -r $ORACLE_BASE/admin/+ASM


若oracle_home未採用叢集檔案系統,刪除oracle_home的相關oratab記錄資訊



4,如果沒有顯著的依賴關係,執行netca命令,清除listener及oracle clusterware資源資訊
用xmanager啟動喲
netca /deinst /nodeinfo capitek1,capitek2

5,執行$ORACLE_HOME/oui/bin/runInstaller,選擇deinstall products,刪除oracle home,記得不要連oracle cluster 也一併選中,哈哈


6,真正開始刪除oracle clusterware了,分如下幾個子步驟
      1. --執行這步出錯,請參看我上一篇的blog,有空再別行分析下,我採用了其它方法是清除/etc/inittab相關內容,禁用crs(/etc/init.d/init.crs disable)

      Run the command CRS_home/install/rootdelete.sh to disable the Oracle Clusterware applications that are running on the cluster node. The rootdelete.sh script. requires three arguments. If you are running this command on a remote node of the cluster, then use remote as the first argument, otherwise use local as the first argument. If the ocr.loc file is on a shared file system, then use sharedvar. Otherwise use nosharedvar as the second argument. If the Oracle Clusterware home is on a shared file system, then use sharedhome. Otherwise, use nosharedhome as the third argument. Repeat this step on each node of the cluster from which you want to de-install Oracle Clusterware.

      Note:
      A node is a local node if you plan to run step 2 and step 3 on that node. Removing shared OCR contents and the Oracle Clusterware home is done on the local node after you complete removal of other nodes in the cluster.
   2.

      Run the script. CRS_home/install/rootdeinstall.sh on a local node to remove the OCR. You only need to run this script. once.
   3.--執行這個也是報了好多的permission deny,我想是可能我以oracle使用者執行吧

      Start OUI. In the Welcome page, click Deinstall Products to display the list of installed products. Select the Oracle Clusterware home to de-install.

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

相關文章