迁移ocr,vote,data到新的磁盘组

余生长醉 提交于 2019-12-24 12:50:09

背景:

原来服务器连接的存储性能低下,现在需要使用一套新的存储.数据库为linux rac 11.2.0.4.

采用挂载新的磁盘组,手工切换ocr,vote  disk和数据盘的方式进行迁移.下面的具体步骤

前提:

需要将新的磁盘组创建完成.下面就不描述创建新磁盘组的过程.

一.检查环境信息

1.检查当前的磁盘组,如下:

 

[grid@suq1 suq1]$ asmcmd
ASMCMD> lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512   4096  1048576      3435     3329                0            3329              0             N  BACKUP/
MOUNTED  NORMAL  N         512   4096  1048576     12288     6276                0            3138              0             N  DATANEW/
MOUNTED  EXTERN  N         512   4096  1048576     12288    12193                0           12193              0             N  LASTDATA/
MOUNTED  NORMAL  N         512   4096  1048576      6144     5859             2048            1905              0             N  LASTOCR/
MOUNTED  EXTERN  N         512   4096  1048576      1458     1058                0            1058              0             Y  SYSTEMDG/

2.检查ocr和vote disk:

 

[root@suq1 ~]# ocrcheck
Status of Oracle Cluster Registry is as follows :
     Version                  :          3
     Total space (kbytes)     :     262120
     Used space (kbytes)      :       3412
     Available space (kbytes) :     258708
     ID                       : 1417062201
     Device/File Name         :  +SYSTEMDG
                                    Device/File integrity check succeeded
                                    Device/File not configured
                                    Device/File not configured
                                    Device/File not configured
                                    Device/File not configured
     Cluster registry integrity check succeeded
     Logical corruption check succeeded
[root@suq1 ~]# crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   34e02ef82a944faebf20eb07ef074379 (/dev/raw/raw1) [SYSTEMDG]

说明:目前有磁盘组backup,datanew,lastdata,lastocr,systemdg,其中systemdg是现在的ocr和votedisk磁盘组.而datanew是现在的数据磁盘组.

现在需要将这两个磁盘组分别替换为lastocr和lastdata

 

二.更换ocr

在11gR2中可以在线替换ocr,但是在操作之前最好先做一个备份.

1.备份ocr

 

[root@suq1 ~]# ocrconfig -manualbackup
suq2     2019/12/08 00:10:41     /u01/11.2.0/grid/cdata/suq-cluster/backup_20191208_001041.ocr

2.添加ocr磁盘组

直接使用ocrconfig -add +LASTOCR来添加ocr,添加完成之后进行检查:

 

[root@suq1 ~]# ocrconfig -add +LASTOCR
[root@suq1 ~]# ocrcheck
Status of Oracle Cluster Registry is as follows :
     Version                  :          3
     Total space (kbytes)     :     262120
     Used space (kbytes)      :       3472
     Available space (kbytes) :     258648
     ID                       : 1417062201
     Device/File Name         :  +SYSTEMDG
                                    Device/File integrity check succeeded
     Device/File Name         :   +LASTOCR
                                    Device/File integrity check succeeded
                                    Device/File not configured
                                    Device/File not configured
                                    Device/File not configured
     Cluster registry integrity check succeeded
     Logical corruption check succeeded

3.删除老的ocr

使用ocrconfig -delete +SYSTEMDG 来删除老的ocr,删除完成之后检查可以发现老的磁盘组已经从ocr中删除:

 

[root@suq1 ~]# ocrconfig -delete  +SYSTEMDG
[root@suq1 ~]# ocrcheck
Status of Oracle Cluster Registry is as follows :
     Version                  :          3
     Total space (kbytes)     :     262120
     Used space (kbytes)      :       3472
     Available space (kbytes) :     258648
     ID                       : 1417062201
     Device/File Name         :   +LASTOCR
                                    Device/File integrity check succeeded
                                    Device/File not configured
                                    Device/File not configured
                                    Device/File not configured
                                    Device/File not configured
     Cluster registry integrity check succeeded
     Logical corruption check succeeded

到此ocr的替换已经完成了,但是此时我们还不能删除老的磁盘组,因为11g中vote disk也还在此磁盘组.

 

三.更换votedisk

1.查看当前的votedisk:

 

[root@suq1 ~]# crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   34e02ef82a944faebf20eb07ef074379 (/dev/raw/raw1) [SYSTEMDG]
Located 1 voting disk(s).

2.使用crsctl replace votedisk +LASTOCR来直接替换为新的votedisk

 

[root@suq1 ~]# crsctl replace votedisk +LASTOCR
Successful addition of voting disk 760cf80025964f18bfb1d1adda56884a.
Successful addition of voting disk 3ec1054a09d34f30bf35f3b0296c614c.
Successful addition of voting disk 57745829baca4f21bf22a78fa6e82a57.
Successful deletion of voting disk 34e02ef82a944faebf20eb07ef074379.
Successfully replaced voting disk group with +LASTOCR.
CRS-4266: Voting file(s) successfully replaced
[root@suq1 ~]# crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   760cf80025964f18bfb1d1adda56884a (/dev/raw/newocr1) [LASTOCR]
 2. ONLINE   3ec1054a09d34f30bf35f3b0296c614c (/dev/raw/newocr2) [LASTOCR]
 3. ONLINE   57745829baca4f21bf22a78fa6e82a57 (/dev/raw/newocr3) [LASTOCR]
Located 3 voting disk(s).

3.重建asm 参数文件

注意:上面的替换了ocr之后,并不会复制asm参数文件,所以需要手工重建参数文件

 

                         1
SQL> show parameter pfile;
NAME                     TYPE    VALUE
------------------------------------ ----------- ------------------------------
spfile                   string  +SYSTEMDG/suq-cluster/asmparam
                         eterfile/registry.253.85093439
                         1

重建asm pfile:

 

SQL> create pfile='/u01/11.2.0/grid/dbs/init+asm.ora' from spfile;
File created.
SQL> create spfile='+LASTOCR' from pfile='/u01/11.2.0/grid/dbs/init+asm.ora';
File created.

上面操作后会自动修改spfile的位置,查看重建后的spfile位置:

 

[grid@suq1 suq1]$ asmcmd spget
+LASTOCR/suq-cluster/asmparameterfile/registry.253.1026434025

如果还不对可以在asmcmd中使用spset命令手工指定spfile位置.

4.重启crs,确认磁盘组能正常打开使用

 

[root@suq1 ~]# crsctl stat res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.BACKUP.dg
               ONLINE  ONLINE       suq1                                         
               ONLINE  ONLINE       suq2                                         
ora.DATANEW.dg
               ONLINE  ONLINE       suq1                                         
               ONLINE  ONLINE       suq2                                         
ora.LASTDATA.dg
               ONLINE  ONLINE       suq1                                         
               ONLINE  ONLINE       suq2                                         
ora.LASTOCR.dg
               ONLINE  ONLINE       suq1                                         
               ONLINE  ONLINE       suq2                                         
ora.LISTENER.lsnr
               ONLINE  ONLINE       suq1                                         
               ONLINE  ONLINE       suq2                                         
ora.SYSTEMDG.dg
               ONLINE  OFFLINE      suq1                                         
               ONLINE  OFFLINE      suq2                                         
ora.asm
               ONLINE  ONLINE       suq1                     Started             
               ONLINE  ONLINE       suq2                     Started             
ora.gsd
               OFFLINE OFFLINE      suq1                                         
               OFFLINE OFFLINE      suq2                                         
ora.net1.network
               ONLINE  ONLINE       suq1                                         
               ONLINE  ONLINE       suq2                                         
ora.ons
               ONLINE  ONLINE       suq1                                         
               ONLINE  ONLINE       suq2                                         
ora.registry.acfs
               ONLINE  ONLINE       suq1                                         
               ONLINE  ONLINE       suq2                                         
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       suq1                                         
ora.cvu
      1        ONLINE  ONLINE       suq1                                         
ora.oc4j
      1        ONLINE  ONLINE       suq1                                         
ora.scan1.vip
      1        ONLINE  ONLINE       suq1                                         
ora.suq.db
      1        ONLINE  ONLINE       suq1                     Open                
      2        ONLINE  ONLINE       suq2                     Open                
ora.suq1.vip
      1        ONLINE  ONLINE       suq1                                         
ora.suq2.vip
      1        ONLINE  ONLINE       suq2 

四.删除老的ocr磁盘组

重启之后老的磁盘组默认为nomount的,你需要mount,然后执行删除:

 

SQL> select name,state from v$asm_diskgroup;
NAME                   STATE
------------------------------ -----------
BACKUP                 MOUNTED
DATANEW                MOUNTED
LASTOCR                MOUNTED
LASTDATA               MOUNTED
SYSTEMDG               DISMOUNTED
SQL> drop diskgroup systemdg including contents;
drop diskgroup systemdg including contents
*
ERROR at line 1:
ORA-15039: diskgroup not dropped
ORA-15001: diskgroup "SYSTEMDG" does not exist or is not mounted
SQL> alter diskgroup systemdg mount;
Diskgroup altered.
SQL> drop diskgroup systemdg including contents;
Diskgroup dropped.
SQL> select name,state from v$asm_diskgroup;
NAME                   STATE
------------------------------ -----------
BACKUP                 MOUNTED
DATANEW                MOUNTED
LASTOCR                MOUNTED
LASTDATA               MOUNTED

 

五.使用rman copy备份数据库(不需要停机)

在准备备份之前,可以先把归档日志的路径切换到新的磁盘组

建议在准备切换之前做,选择 业务量低的时候,这样滚日志的时间较短:

 

[oracle@suq1 ~]$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Sun Dec 8 01:01:57 2019
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
connected to target database: SUQ (DBID=1469685490)
RMAN> backup as copy database format '+LASTDATA';
Starting backup at 08-DEC-2019 01:02:24
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=30 instance=suq1 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=+DATANEW/suq/datafile/system.256.994003137
output file name=+LASTDATA/suq/datafile/system.256.1026435747 tag=TAG20191208T010226 RECID=36 STAMP=1026435761
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=+DATANEW/suq/datafile/sysaux.257.994003173
output file name=+LASTDATA/suq/datafile/sysaux.257.1026435763 tag=TAG20191208T010226 RECID=37 STAMP=1026435778
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=+DATANEW/suq/datafile/undotbs1.258.994003207
output file name=+LASTDATA/suq/datafile/undotbs1.258.1026435787 tag=TAG20191208T010226 RECID=38 STAMP=1026435792
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=+DATANEW/suq/datafile/undotbs2.259.994003223
output file name=+LASTDATA/suq/datafile/undotbs2.259.1026435795 tag=TAG20191208T010226 RECID=39 STAMP=1026435795
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting datafile copy
copying current control file
output file name=+LASTDATA/suq/controlfile/backup.260.1026435797 tag=TAG20191208T010226 RECID=40 STAMP=1026435797
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=+DATANEW/suq/datafile/users.260.994003227
output file name=+LASTDATA/suq/datafile/users.261.1026435799 tag=TAG20191208T010226 RECID=41 STAMP=1026435798
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 08-DEC-2019 01:03:19
channel ORA_DISK_1: finished piece 1 at 08-DEC-2019 01:03:20
piece handle=+LASTDATA/suq/backupset/2019_12_08/nnsnf0_tag20191208t010226_0.262.1026435799 tag=TAG20191208T010226 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 08-DEC-2019 01:03:20

 

六.切换数据库到新的磁盘组(需要停机)

 

[oracle@suq1 ~]$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Sun Dec 8 01:06:54 2019
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
connected to target database (not started)
RMAN> startup mount; 
Oracle instance started
database mounted
Total System Global Area     784998400 bytes
Fixed Size                     2257352 bytes
Variable Size                306187832 bytes
Database Buffers             469762048 bytes
Redo Buffers                   6791168 bytes
RMAN> switch database to copy;
using target database control file instead of recovery catalog
datafile 1 switched to datafile copy "+LASTDATA/suq/datafile/system.256.1026435747"
datafile 2 switched to datafile copy "+LASTDATA/suq/datafile/sysaux.257.1026435763"
datafile 3 switched to datafile copy "+LASTDATA/suq/datafile/undotbs1.258.1026435787"
datafile 4 switched to datafile copy "+LASTDATA/suq/datafile/users.261.1026435799"
datafile 5 switched to datafile copy "+LASTDATA/suq/datafile/undotbs2.259.1026435795"
RMAN> recover database;
Starting recover at 08-DEC-2019 01:07:45
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=141 instance=suq1 device type=DISK
starting media recovery
media recovery complete, elapsed time: 00:00:01
Finished recover at 08-DEC-2019 01:07:47
RMAN>  alter database open;
database opened

 

七.修改controlfile和参数文件(需要停机)

上面完成之后是完成了数据文件的修改,还有控制文件,参数文件,日志文件,临时文件还放在原来的磁盘组中.

由于控制文件和参数文件不能在线修改,所以这里先修改控制文件,和参数文件,后面的日志文件和临时文件可以在线修改,放到后面再修改.

1.修改参数文件

在asmcmd中找到原来参数文件的位置,然后cp到新的位置,注意这里拷贝的是真实的spfile,而不是链接文件,例如:

 

ASMCMD> cp spfilesuq.ora.265.994003619 +LASTDATA/suq/spfilesuq.ora
copying +datanew/asm/PARAMETERFILE/spfilesuq.ora.265.994003619 -> +LASTDATA/suq/spfilesuq.ora

复制完成之后修改连个节点的$ORACLE_HOME/dbs/initSID.ora,将spfile指定到新的文件位置,例如:

 

spfile='+LASTDATA/suq/spfilesuq.ora'

如果集群中指定了spfile,则还需要修改集群中的参数文件位置

srvctl modify database -d suq -p '+LASTDATA/suq/spfilesuq.ora'

 

2.修改控制文件

同参数文件的,将控制文件拷贝到新的磁盘组的位置:

 

ASMCMD> cp control01.ctl +LASTDATA/suq/controlfile/control01.ctl
copying +DATANEW/suq/datafile/control01.ctl -> +LASTDATA/suq/controlfile/control01.ctl
ASMCMD> cp control01.ctl +LASTDATA/suq/controlfile/control02.ctl
copying +DATANEW/suq/datafile/control01.ctl -> +LASTDATA/suq/controlfile/control02.ctl

再在参数文件中修改控制文件的位置:

 

SQL> alter system set control_files='+LASTDATA/suq/controlfile/control01.ctl','+LASTDATA/suq/controlfile/control02.ctl' scope=spfile;

最后重启数据库:

 

[grid@suq1 ~]$ srvctl start database -d suq

到此数据库停机部分已经完成.检查参数文件和控制文件:

 

[oracle@suq1 dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Sun Dec 8 01:23:38 2019
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> show parameter spfile
NAME                     TYPE    VALUE
------------------------------------ ----------- ------------------------------
spfile                   string  +LASTDATA/suq/spfilesuq.ora
SQL> show parameter control
NAME                     TYPE    VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time        integer     7
control_files                string  +LASTDATA/suq/controlfile/cont
                         rol01.ctl, +LASTDATA/suq/contr
                         olfile/control02.ctl
control_management_pack_access       string  DIAGNOSTIC+TUNING

 

八,修改日志文件和临时文件

此时的日志文件和临时文件都还在老的磁盘组中:

 

SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
+DATANEW/suq/datafile/redo01.log
+DATANEW/suq/datafile/redo02.log
+DATANEW/suq/datafile/redo03.log
+DATANEW/suq/datafile/redo08.log
+DATANEW/suq/datafile/redo09.log
+DATANEW/suq/datafile/redo10.log
6 rows selected.
SQL> select name from v$tempfile;
NAME
--------------------------------------------------------------------------------
+DATANEW/suq/tempfile/temp2.264.994003965

这些文件可以在线重建.

1.重建temp表空间,注意tempfile目录需要先创建

 

1.创建新的临时表空间
SQL> create temporary tablespace temp2 tempfile '+LASTDATA';
Tablespace created.
2.将数据库的默认临时表空间设置到新的临时表空间
SQL> alter database default temporary tablespace temp2;
Database altered.
3.删除老的临时表空间
SQL> drop tablespace temp including contents and datafiles;
Tablespace dropped.
SQL> select name from v$tempfile;
NAME
--------------------------------------------------------------------------------
+LASTDATA/suq/tempfile/temp.266.1026437279

2.重建redo log group

这里采用在原来的log group中添加新的member到磁盘组,然后再删除老的member的方法:

 

SQL> select 'alter database add logfile member ''+LASTDATA/suq/onlinelog'||substr(member,length(member)-INSTR(reverse(member),'/')+1,INSTR(reverse(member),'/'))||''' to group '||group#||';' from v$logfile where type='ONLINE';
'ALTERDATABASEADDLOGFILEMEMBER''+LASTDATA/SUQ/ONLINELOG'||SUBSTR(MEMBER,LENGTH(MEMBER)-INSTR(REVERSE(MEMBER),'/')+1,INSTR(REVERSE(MEMBER),'/'))||'''TOGROUP'||GROUP#||';'
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
alter database add logfile member '+LASTDATA/suq/onlinelog/redo01.log' to group 1;
alter database add logfile member '+LASTDATA/suq/onlinelog/redo02.log' to group 2;
alter database add logfile member '+LASTDATA/suq/onlinelog/redo03.log' to group 3;
alter database add logfile member '+LASTDATA/suq/onlinelog/redo08.log' to group 8;
alter database add logfile member '+LASTDATA/suq/onlinelog/redo09.log' to group 9;
alter database add logfile member '+LASTDATA/suq/onlinelog/redo10.log' to group 10;

首先将redo日志进行多切换几组,然后再删除,如果遇到current的group,则将日志再进行切换:

 

SQL> select 'alter database drop logfile member '''||member||''';' from v$logfile where member not like '+LASTDATA%' and type='ONLINE';
'ALTERDATABASEDROPLOGFILEMEMBER'''||MEMBER||''';'
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
alter database drop logfile member '+DATANEW/suq/datafile/redo01.log';
alter database drop logfile member '+DATANEW/suq/datafile/redo02.log';
alter database drop logfile member '+DATANEW/suq/datafile/redo03.log';
alter database drop logfile member '+DATANEW/suq/datafile/redo08.log';
alter database drop logfile member '+DATANEW/suq/datafile/redo09.log';
alter database drop logfile member '+DATANEW/suq/datafile/redo10.log';

到此所有的文件都已经完成了切换,下面开始检查所有的文件:

 

SQL> select status from v$instance;   
STATUS
------------
OPEN
SQL> select name from v$datafile;
NAME
----------------------------------------------------------------------
+LASTDATA/suq/datafile/system.256.1026435747
+LASTDATA/suq/datafile/sysaux.257.1026435763
+LASTDATA/suq/datafile/undotbs1.258.1026435787
+LASTDATA/suq/datafile/users.261.1026435799
+LASTDATA/suq/datafile/undotbs2.259.1026435795
SQL> select name from v$tempfile;
NAME
----------------------------------------------------------------------
+LASTDATA/suq/tempfile/temp.266.1026437279
SQL> select member from v$logfile;
MEMBER
-------------------------------------------------------------------
+LASTDATA/suq/onlinelog/redo01.log
+LASTDATA/suq/onlinelog/redo02.log
+LASTDATA/suq/onlinelog/redo03.log
+LASTDATA/suq/onlinelog/redo08.log
+LASTDATA/suq/onlinelog/redo09.log
+LASTDATA/suq/onlinelog/redo10.log
6 rows selected.
SQL> show parameter spfile
NAME                     TYPE    VALUE
------------------------------------ ----------- ------------------------------
spfile                   string  +LASTDATA/suq/spfilesuq.ora
SQL> show parameter control;
NAME                     TYPE    VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time        integer     7
control_files                string  +LASTDATA/suq/controlfile/cont
                         rol01.ctl, +LASTDATA/suq/contr
                         olfile/control02.ctl
control_management_pack_access       string  DIAGNOSTIC+TUNING

 

九.删除老的数据磁盘组

查看当前的集群状态:

 

[root@suq1 ~]# crsctl stat res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.BACKUP.dg
               ONLINE  ONLINE       suq1                                         
               ONLINE  ONLINE       suq2                                         
ora.DATANEW.dg
               ONLINE  ONLINE       suq1                                         
               ONLINE  ONLINE       suq2                                         
ora.LASTDATA.dg
               ONLINE  ONLINE       suq1                                         
               ONLINE  ONLINE       suq2                                         
ora.LASTOCR.dg
               ONLINE  ONLINE       suq1                                         
               ONLINE  ONLINE       suq2                                         
ora.LISTENER.lsnr
               ONLINE  ONLINE       suq1                                         
               ONLINE  ONLINE       suq2                                         
ora.asm
               ONLINE  ONLINE       suq1                     Started             
               ONLINE  ONLINE       suq2                     Started             
ora.gsd
               OFFLINE OFFLINE      suq1                                         
               OFFLINE OFFLINE      suq2                                         
ora.net1.network
               ONLINE  ONLINE       suq1                                         
               ONLINE  ONLINE       suq2                                         
ora.ons
               ONLINE  ONLINE       suq1                                         
               ONLINE  ONLINE       suq2                                         
ora.registry.acfs
               ONLINE  ONLINE       suq1                                         
               ONLINE  ONLINE       suq2                                         
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       suq1                                         
ora.cvu
      1        ONLINE  ONLINE       suq1                                         
ora.oc4j
      1        ONLINE  ONLINE       suq1                                         
ora.scan1.vip
      1        ONLINE  ONLINE       suq1                                         
ora.suq.db
      1        ONLINE  ONLINE       suq1                     Open                
      2        ONLINE  ONLINE       suq2                     Open                
ora.suq1.vip
      1        ONLINE  ONLINE       suq1                                         
ora.suq2.vip
      1        ONLINE  ONLINE       suq2                         

需要先在另一个节点将磁盘组dismount,然后进行删除:

 

SQL> drop diskgroup datanew including contents;
drop diskgroup datanew including contents
*
ERROR at line 1:
ORA-15039: diskgroup not dropped
ORA-15073: diskgroup DATANEW is mounted by another ASM instance
SQL>  drop diskgroup datanew including contents;
Diskgroup dropped

磁盘组删除完成之后,但是集群资源中还有,因此还需要在集群中删除磁盘组资源

 

[root@suq1 ~]# srvctl config database -d suq -a
Database unique name: suq
Database name: suq
Oracle home: /u01/app/oracle/product/11.2.0/db_1
Oracle user: oracle
Spfile: 
Domain: 
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: suq
Database instances: suq1,suq2
Disk Groups: DATANEW,LASTDATA
Mount point paths: 
Services: 
Type: RAC
Database is enabled
Database is administrator managed
#先将磁盘组关联的资源解除
[root@suq1 ~]# srvctl modify database -d suq -a LASTDATA
#再进场删除
[root@suq1 ~]# srvctl remove diskgroup -g DATANEW

 

到此,所有的迁移操作都已经完成:

 

[root@suq1 ~]# crsctl stat res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.BACKUP.dg
               ONLINE  ONLINE       suq1                                         
               ONLINE  ONLINE       suq2                                         
ora.LASTDATA.dg
               ONLINE  ONLINE       suq1                                         
               ONLINE  ONLINE       suq2                                         
ora.LASTOCR.dg
               ONLINE  ONLINE       suq1                                         
               ONLINE  ONLINE       suq2                                         
ora.LISTENER.lsnr
               ONLINE  ONLINE       suq1                                         
               ONLINE  ONLINE       suq2                                         
ora.asm
               ONLINE  ONLINE       suq1                     Started             
               ONLINE  ONLINE       suq2                     Started             
ora.gsd
               OFFLINE OFFLINE      suq1                                         
               OFFLINE OFFLINE      suq2                                         
ora.net1.network
               ONLINE  ONLINE       suq1                                         
               ONLINE  ONLINE       suq2                                         
ora.ons
               ONLINE  ONLINE       suq1                                         
               ONLINE  ONLINE       suq2                                         
ora.registry.acfs
               ONLINE  ONLINE       suq1                                         
               ONLINE  ONLINE       suq2                                         
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       suq1                                         
ora.cvu
      1        ONLINE  ONLINE       suq1                                         
ora.oc4j
      1        ONLINE  ONLINE       suq1                                         
ora.scan1.vip
      1        ONLINE  ONLINE       suq1                                         
ora.suq.db
      1        ONLINE  ONLINE       suq1                     Open                
      2        ONLINE  ONLINE       suq2                     Open                
ora.suq1.vip
      1        ONLINE  ONLINE       suq1                                         
ora.suq2.vip
      1        ONLINE  ONLINE       suq2                              

你可以重启crs或者重启服务器,检查集群能否正常启动,数据库能否正常启动.

 

 

 

 

 

 

 

 

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!