如何完全删载与清除oracle 10grac(rhel4) cluster_db_instance

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/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/9240380/viewspace-629567/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值