Linux下卸载oracle_RAC

来源:互联网 发布:高清混合矩阵价格 编辑:程序博客网 时间:2024/06/05 13:33


RAC卸载说明 

一.RAC删除数据库

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

To deletea database with the DBCA:

1.     Start the DBCA on oneof the nodes:

The DBCA Welcome pageappears.

2.     Select Oracle RealApplication Clusters and click Next.

After you click Next,the DBCA displays theOperationspage.

3.     Select Delete adatabase, click Next, and the DBCA displays theList of Cluster Databases page.

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

5.     Select the databaseto delete and click Finish.

After you click Finish,the DBCA displays adialog toconfirm 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 the operationand deletes all of the associated instances for this database. The DBCA alsoremoves the parameter files, password files, and oratab entries.

At this point, you have accomplished the following:

·        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 datafiles if the datafiles were not on raw devices

 

二. ASM实例卸载

 

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

 

Solution

 

The outline of the steps involved are :
a) Backup all theASM 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 ASMinstance and do'select * from v$asm_client;'

    

2) For each instance listed above, stop the respectivedatabases.

 

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

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

 

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


5) For each diskgroup listed above:

' drop diskgroup <name> includingcontents'

 

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

    ORA-15073: diskgroup DATA is mounted byanother ASM instance

 

alter diskgroup<name>dismount;

 

6) Shutdown all(RAC nodes) ASM instances.

 

7) On RAC install verify that all asm instances arestopped

$ORA_CRS_HOME/bin/crst_stat |more <- look for ASM resources and make surethe target=offline

 

8) Forsingle instance install run the following script:

$ORACLE_HOME/bin/localconfig delete

* This cleans up theCSSD configuration.

 

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

 

10) ForRAC install, remove the asm related resource.

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

crs_stat |more <- make sure no asm resources exists

 

    如:srvctl remove asmn 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 deletedtoo)
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 tothe ASM 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+0 records in

1+0 records out

1048576 bytes (1.0 MB) copied, 0.026078 seconds, 40.2MB/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 a Failed CRSInstall
------------------------------------------------------------
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 therootdeinstall.sh script from the $ORA_CRS_HOME/install directory on any nodesyou are removing CRS from. 

    Running thesescripts should be sufficent to clean up your CRS install. Rootdelete.sh accepts options likenosharedvar/sharedvar, and nosharedhome/sharedhome. Make yourself familiar with these options byreading the Oracle Clusterware and Oracle Real Application Clusters Administrationand Deployment Guide.If you have any problems with these scripts please open aservice request. 

If for some reason you have to manually remove the install due to problems withthe 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, andCSS processes or reboot the node:

    ps -ef | grepcrs 

    kill

    ps -ef | grepevm

    kill

    ps -ef | grepcss 

    kill

 

  Do not kill anyOS processes, for example icssvr_daemon process !

 

 

5. If there is no other Oracle software running (likelisteners, DB's, etc...),youcan 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 UniversalInstaller

 

8. Remove the CRS install location.

 

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

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


  See theClusterware Installation Guide for sizing requirements... 


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


  If you areremoving the RDBMS installation, also clean out any ASM disks if they havealready been used.


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


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


12. If you would like to re-install CRS, follow the stepsin 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软件

    4CLUSTER目录下提供的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@rac1install]# ./rootdeinstall.sh

Removing contentsfrom OCR mirror device

2560+0 records in

2560+0 records out

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

Removing contentsfrom OCR device

2560+0 records in

2560+0 records out

10485760 bytes (10MB) 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的时候,会自动对他们进行格式化。

 






此文转自:http://blog.csdn.net/tianlesoftware/article/details/5892225

 

0 0
原创粉丝点击