【RAC】RAC卸载——各部件单个卸载+完整卸载

来源:互联网 发布:java 过滤器返回json 编辑:程序博客网 时间:2024/05/18 02:02

一.RAC 删除数据库

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

 

使用DBCA删除数据库实例

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 theOperations page.

 

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

 

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

 

5. Select the database to delete and click Finish.

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

 

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

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

At this point, you have accomplished thefollowing:

·         Deleted the selecteddatabase from the cluster

·         Deleted highavailability services that were assigned to the database

·         Deleted the OracleNet configuration for the database

·         Deleted the OFAdirectory structure from the cluster

·         Deleted the datafilesif the datafiles were not on raw devices

 

 

二.ASM 实例卸载

 

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

 

Solution

 

The outline of the steps involved are :

a) Backupall 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) Removethe ASM pfile/spfile.

f)Removing ASM entry in the file oratab

g) Wipeout 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 respectivedatabases.

 

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

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

 

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

 

5) For each diskgroup listed above:' drop diskgroup <name> including contents'

 

这里要注意的,要先在一个节点上将diskgroup dismount后, 再在另一个节点进行drop。不然会报:

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

 

alter diskgroup<name> dismount;

 

6) Shutdown all (RAC nodes) ASM instances.

 

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

$ORA_CRS_HOME/bin/crs_stat–t

look for ASM resources and make sure thetarget=offline

 

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.

srvctlremove asm -n <nodename>       <- Peform for all nodes of a RAC cluster

crs_stat|more                                             <-make sure no asm resources exists

 

如:srvctl remove asm –n rac1, 如果删除不掉,就加上–f 参数。

 

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

a. oracleasm listdisks

b. oracleasm deletedisks (do this for everydisk listed above)

c. oracleasm listdisks (to verify they havebeen 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 theASM instance

 

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

for example: dd if=/dev/zeroof=/dev/<asm_disk_name> bs=1024k count=50

 

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

1+0records in

1+0records out

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

 

 

三.Clusterware安装失败情况下的卸载

 

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

10g and 11.1 RAC: How to Clean Up After aFailed CRS Install

------------------------------------------------------------

Not cleaning up a failed CRS install cancause problems like node reboots.

Follow these steps to clean up a failed CRSinstall:

 

1. 使用脚本卸载

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

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

 

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

  

2. 手工卸载

Stop the Nodeapps on all nodes:

srvctlstop 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

 

HPTru64:

       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

 

IBMAIX:

       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 CSSprocesses 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 exampleicssvr_daemon process !

 

5. If there is no other Oracle software running (likelisteners, 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.locUsually the ocr.loc can be found at /etc/oracle

 

7. De-install the CRS home in the Oracle UniversalInstaller

 

8. Remove the CRS install location.

 

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

        dd if=/dev/zero of=/dev/rdsk/V1064_vote_01_20m.dbfbs=1M count=256

        dd if=/dev/zeroof=/dev/rdsk/ocrV1064_100m.ora bs=1M count=256

 

  See the Clusterware Installation Guide for sizing requirements... 

 

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

 

   Ifyou are removing the RDBMS installation, also clean out any ASM disks if theyhave already been used.

 

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

 

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

 

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

 

 

Oracle 11g,执行如下操作:

清除home目录:

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磁盘信息:

ddif=/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

为了更好的卸载数据库,最好是保证数据库处于打开状态,这样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,这时会弹出一个对话框,在OracleHomes中有两个对象:OraCrs10g_home和OraDb10g_home。

 

在删除的时候一定要先选择卸载OraDb10g_home,因为还需要运行Cluster目录下的shell脚本来清除CLUSTER对操作系统进行的修改,所以OraCrs10g_home的卸载放到后面的步骤中进行。

 

选中OraDb11g_home点击REMOVE即可进行卸载。

 

4.4用CLUSTER目录下提供的shell来清除CLUSTER系统的所有修改

 

root用户执行如下脚本:

onlocal node:

$ORA_CRS_HOME/install/rootdelete.shlocal nosharedvar nosharedhome

onremote nodes:

$ORA_CRS_HOME/install/rootdelete.shremote 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'.

Shuttingdown Oracle Cluster Ready Services (CRS):

Sep 1713:27:28.917 | INF | daemon shutting down

Stoppingresources. This could take several minutes.

Successfullystopped CRS resources.

StoppingCSSD.

Shuttingdown CSS daemon.

Shutdownrequest successfully issued.

Shutdownhas begun. The daemons should exit soon.

Checkingto see if Oracle CRS stack is down...

OracleCRS stack is not running.

OracleCRS stack is down now.

Removingscript for Oracle Cluster Ready services

Updatingocr file for downgrade

Cleaningup 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'.

Shuttingdown Oracle Cluster Ready Services (CRS):

Sep 1713:29:48.144 | INF | daemon shutting down

Stoppingresources. This could take several minutes.

Successfullystopped CRS resources.

StoppingCSSD.

Shuttingdown CSS daemon.

Shutdownrequest successfully issued.

Shutdownhas begun. The daemons should exit soon.

Checkingto see if Oracle CRS stack is down...

OracleCRS stack is not running.

OracleCRS stack is down now.

Removingscript for Oracle Cluster Ready services

Updatingocr file for downgrade

Cleaningup SCR settings in '/etc/oracle/scls_scr'

 

4.5 清除OCR

只需要用root用户在本地节点执行如下命令:

$ORA_CRS_HOME/install/rootdeinstall.sh

 

一个节点执行即可:

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

Removingcontents from OCR mirror device

2560+0records in

2560+0records out

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

Removingcontents from OCR device

2560+0records in

2560+0records out

10485760bytes (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环境清除工作至此结束,可以重新进行Clusterware和RAC的安装了。这里没有对几个raw设备进行,因为在安装Clusterware的时候,会自动对他们进行格式化。

 

转自Dave的blog:http://blog.csdn.net/tianlesoftware/article/details/5892225








 

 

 


0 0
原创粉丝点击