| |
|
开发:
C++知识库
Java知识库
JavaScript
Python
PHP知识库
人工智能
区块链
大数据
移动开发
嵌入式
开发工具
数据结构与算法
开发测试
游戏开发
网络协议
系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程 数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁 |
-> 系统运维 -> 11g RAC 磁盘组迁移Normal到external(ASMLIB) -> 正文阅读 |
|
[系统运维]11g RAC 磁盘组迁移Normal到external(ASMLIB) |
一、环境介绍 操作系统:Red Hat Enterprise Linux Server release 6.4 (Santiago) 数据库:Oracle 11.2.0.4.0 - 64bit Production(grid和oracle软件版本一致) RAC实例名称:RACDB 现有磁盘组: 备注:原有磁盘组(OCR、DATA、FRA)都是Normal方式 添加磁盘组DGOCR、DGDATA、DGFRA以External方式(ASMLIB方式) Disk /dev/sdc: 69.8 GB, 69793218560 bytes 255 heads, 63 sectors/track, 8485 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0xffdbacb6 ?? Device Boot????? Start???????? End????? Blocks?? Id? System /dev/sdc1?????????????? 1??????? 2612??? 20980858+? 83? Linux /dev/sdc2??????????? 2613??????? 5224??? 20980890?? 83? Linux /dev/sdc3??????????? 5225??????? 7836??? 20980890?? 83? Linux 创建ASMLIB磁盘 [root@host03 oracle]# cat initdisk8.sh ## Delete asmdisk on host03 /etc/init.d/oracleasm deletedisk asmdisk8p1 /etc/init.d/oracleasm deletedisk asmdisk8p2 /etc/init.d/oracleasm deletedisk asmdisk8p3 ## Create disk asmdisk on host03 /etc/init.d/oracleasm createdisk asmdisk8p1 /dev/sdc1 /etc/init.d/oracleasm createdisk asmdisk8p2 /dev/sdc2 /etc/init.d/oracleasm createdisk asmdisk8p3 /dev/sdc3 ## Scan disk asmdisk on host03 /etc/init.d/oracleasm scandisks /etc/init.d/oracleasm listdisks ## Scan disk asmdisk on host04 ssh host04 /etc/init.d/oracleasm scandisks ssh host04 /etc/init.d/oracleasm listdisks 查看磁盘(host03、host04) [root@host03 oracle]# ll /dev/oracleasm/disks/ total 0 brw-rw---- 1 grid asmadmin 8, 49 Sep? 6 20:04 ASMDISK1P1 brw-rw---- 1 grid asmadmin 8, 50 Sep? 6 20:04 ASMDISK1P2 brw-rw---- 1 grid asmadmin 8, 51 Sep? 6 20:04 ASMDISK1P3 brw-rw---- 1 grid asmadmin 8, 53 Sep? 6 20:04 ASMDISK1P4 brw-rw---- 1 grid asmadmin 8, 54 Sep? 6 20:04 ASMDISK1P5 brw-rw---- 1 grid asmadmin 8, 55 Sep? 6 20:04 ASMDISK1P6 brw-rw---- 1 grid asmadmin 8, 56 Sep? 6 20:04 ASMDISK1P7 brw-rw---- 1 grid asmadmin 8, 57 Sep? 6 20:04 ASMDISK1P8 brw-rw---- 1 grid asmadmin 8, 58 Sep? 6 20:04 ASMDISK2P1 brw-rw---- 1 grid asmadmin 8, 59 Sep? 6 20:04 ASMDISK2P2 brw-rw---- 1 grid asmadmin 8, 33 Sep? 6 20:03 ASMDISK8P1 brw-rw---- 1 grid asmadmin 8, 34 Sep? 6 20:03 ASMDISK8P2 brw-rw---- 1 grid asmadmin 8, 35 Sep? 6 20:03 ASMDISK8P3 挂载磁盘 二、目标换磁盘组将原来Normal 变成External方式 1、备份现有库 run{ allocate channel c1 device type disk; allocate channel c2 device type disk; allocate channel c3 device type disk; sql 'alter system switch logfile'; backup as compressed backupset format '/home/oracle/backup/full_%U_%d.bak' database plus archivelog format '/home/oracle/backup/archive_%U_%d'; backup current controlfile format '/home/oracle/backup/controlfile_%U_%d.bak'; backup spfile? format '/home/oracle/backup/spfile_%U_%d.bak'; release channel c1; release channel c2; release channel c3; } 2、备份OCR、VOTING、ASM spfile文件 镜像OCR配置: [root@host03 bin]# ./ocrcheck Status of Oracle Cluster Registry is as follows : ???????? Version????????????????? :????????? 3 ???????? Total space (kbytes)???? :???? 262120 ???????? Used space (kbytes)????? :?????? 3268 ???????? Available space (kbytes) :???? 258852 ???????? ID?????????????????????? : 1185425206 ???????? Device/File Name???????? :?????? +OCR ??????????????????????????????????? Device/File integrity check succeeded ???????? Device/File Name???????? :?????? +FRA ??????????????????????????????????? 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 添加镜像OCR [root@host03 bin]# ./ocrconfig -add +DGOCR [root@host03 bin]# ./ocrcheck Status of Oracle Cluster Registry is as follows : ???????? Version????????????????? :????????? 3 ???????? Total space (kbytes)???? :???? 262120 ???????? Used space (kbytes)????? :?????? 3268 ???????? Available space (kbytes) :???? 258852 ???????? ID???????????????? ??????: 1185425206 ???????? Device/File Name???????? :?????? +OCR ??????????????????????????????????? Device/File integrity check succeeded ???????? Device/File Name???????? :?????? +FRA ??????????????????????????????????? Device/File integrity check succeeded ???????? Device/File Name???????? :???? +DGOCR ??????????????????????????????????? Device/File integrity check succeeded ??????????????????????????????????? Device/File not configured ??????????????????????????????????? Device/File not configured ???????? Cluster registry integrity check succeeded ???????? Logical corruption check succeeded 删除ocr信息在+FRA、+OCR [root@host03 bin]# ./ocrconfig -delete? +OCR [root@host03 bin]# ./ocrconfig -delete? +FRA 查看OCR信息 [root@host03 bin]# ./ocrconfig -add +DGFRA [root@host03 bin]# ./ocrcheck Status of Oracle Cluster Registry is as follows : ???????? Version????????????????? :????????? 3 ???????? Total space (kbytes)???? :???? 262120 ???????? Used space (kbytes)????? :?????? 3268 ???????? Available space (kbytes) :???? 258852 ???????? ID?????????????????????? : 1185425206 ???????? Device/File Name???????? :???? +DGOCR ??????????????????????????????????? Device/File integrity check succeeded ???????? Device/File Name???????? :???? +DGFRA ??????????????????????????????????? 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 迁移VOTDISK表决磁盘到OCRDG(External磁盘) [root@host03 bin]# ./crsctl query css votedisk ##? STATE??? File Universal Id??????????????? File Name Disk group --? -----??? -----------------??????????????? --------- --------- ?1. ONLINE? 5dbabc26412a4f97bf56cbdc5abfc329 (/dev/oracleasm/disks/ASMDISK1P1) [OCR] ?2. ONLINE?? 76ce14408c434fbdbf73af3aa3cf43f7 (/dev/oracleasm/disks/ASMDISK1P2) [OCR] ?3. ONLINE?? 19c3b8e4afc64f58bf382cff08775ed8 (/dev/oracleasm/disks/ASMDISK1P3) [OCR] Located 3 voting disk(s). [root@host03 bin]# ./crsctl replace votedisk +DGOCR Successful addition of voting disk 68994379e59b4f82bf591a4e11db65de. Successful deletion of voting disk 5dbabc26412a4f97bf56cbdc5abfc329. Successful deletion of voting disk 76ce14408c434fbdbf73af3aa3cf43f7. Successful deletion of voting disk 19c3b8e4afc64f58bf382cff08775ed8. Successfully replaced voting disk group with +DGOCR. CRS-4266: Voting file(s) successfully replaced [root@host03 bin]# ./crsctl query css votedisk???? ##? STATE??? File Universal Id??????????????? File Name Disk group --? -----??? -----------------??????????????? --------- --------- ?1. ONLINE?? 68994379e59b4f82bf591a4e11db65de (/dev/oracleasm/disks/ASMDISK8P1) [DGOCR] Located 1 voting disk(s). 备份asm spfile文件:(迁移spfile? 由旧签到新的磁盘组) [root@host03 bin]# su - grid -bash-4.1$ sqlplus / as sysasm SQL*Plus: Release 11.2.0.4.0 Production on Mon Sep 6 20:41:14 2021 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 Real Application Clusters and Automatic Storage Management options SQL> show parameter spfile; NAME????? TYPE ??????VALUE ------------------------------------ ----------- ------------------------ spfile ??string????? +OCR/rac-scan/asmparameterfile/registry.253.1081294865 create pfile='/home/grid/asmpfile.ora' from spfile; create spfile='+DGOCR' from pfile='/home/grid/asmpfile.ora'; 停止集群 [root@host03 bin]# ./crsctl stop crs [root@host04 bin]# ./crsctl stop crs 查看asm spfile文件位置是否已经修改 SQL> show parameter spfile; NAME???????????????????????????????? TYPE??????? VALUE ------------------------------------ ----------- ------------------------------ spfile?????????????????????????????? string????? +DGOCR/rac-scan/asmparameterfi ???????????????????????????????????????????????? le/registry.253.1080079355 [root@host03 bin]# ./srvctl? start database -d racdb [oracle@host03 ~]$ srvctl? status database -d racdb Instance RACDB1 is running on node host03 Instance RACDB2 is running on node host04 删除OCR磁盘组 [root@host03 bin]# su - grid -bash-4.1$ sqlplus / as sysasm SQL*Plus: Release 11.2.0.4.0 Production on Mon Sep 6 21:33:59 2021 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 Real Application Clusters and Automatic Storage Management options SQL> alter diskgroup ocr dismount; Diskgroup altered. [root@host04 bin]# su - grid -bash-4.1$ sqlplus / as sysasm SQL*Plus: Release 11.2.0.4.0 Production on Mon Sep 6 21:36:07 2021 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 Real Application Clusters and Automatic Storage Management options SQL> alter diskgroup ocr dismount; Diskgroup altered. [root@host03 bin]# su - grid -bash-4.1$ sqlplus / as sysasm SQL> drop diskgroup ocr force including contents; Diskgroup dropped. crs删除磁盘组 [oracle@host03 ~]$ srvctl remove diskgroup -g OCR [oracle@host03 ~]$ crsctl status res -t????????? -------------------------------------------------------------------------------- NAME?????????? TARGET? STATE??????? SERVER?????????????????? STATE_DETAILS?????? -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.DATA.dg ?????????????? ONLINE? ONLINE?????? host03?????????????????????????????????????? ?????????????? ONLINE? ONLINE?????? host04?????????????????????????????????????? ora.DGDATA.dg ?????????????? ONLINE? ONLINE?????? host03??????????????? ??????????????????????? ?????????????? ONLINE? ONLINE?????? host04?????????????????????????????????????? ora.DGFRA.dg ?????????????? ONLINE? ONLINE?????? host03?????????????????????????????????????? ?????????????? ONLINE? ONLINE?????? host04???????????? ?????????????????????????? ora.DGOCR.dg ?????????????? ONLINE? ONLINE?????? host03?????????????????????????????????????? ?????????????? ONLINE? ONLINE?????? host04?????????????????????????????????????? ora.FRA.dg ?????????????? ONLINE? ONLINE?????? host03?????????????????????????????????????? ?????????????? ONLINE? ONLINE?????? host04?????????????????????????????????????? ora.LISTENER.lsnr ?????????????? ONLINE? ONLINE?????? host03?????????????????????????????????????? ?????????????? ONLINE? ONLINE?????? host04?????????????????????????????????????? ora.asm ?????????????? ONLINE? ONLINE?????? host03?????????????????? Started???????????? ?????????????? ONLINE? ONLINE?????? host04?????????????????? Started???????????? ora.gsd ?????????????? OFFLINE OFFLINE????? host03?????????????????????????????????????? ?????????????? OFFLINE OFFLINE????? host04?????????????????????????????????????? ora.net1.network ?????????????? ONLINE? ONLINE?????? host03?????????????????????????? ???????????? ?????????????? ONLINE? ONLINE?????? host04?????????????????????????????????????? ora.ons ?????????????? ONLINE? ONLINE?????? host03?????????????????????????????????????? ?????????????? ONLINE? ONLINE?????? host04???????????????????????????? ?????????? ora.registry.acfs ?????????????? ONLINE? ONLINE?????? host03?????????????????????????????????????? ?????????????? ONLINE? ONLINE?????? host04?????????????????????????????????????? -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.LISTENER_SCAN1.lsnr ????? 1??????? ONLINE? ONLINE?????? host04?????????????????????????????????????? ora.cvu ????? 1??????? ONLINE? ONLINE?????? host04?????????????????????????????????????? ora.host03.vip ????? 1??????? ONLINE? ONLINE?????? host03?????????????????????????????????????? ora.host04.vip ????? 1??????? ONLINE? ONLINE?????? host04?????????????????????????????????????? ora.oc4j ????? 1??????? ONLINE? ONLINE?????? host04?????????????????????????????????????? ora.racdb.db ????? 1??????? ONLINE? ONLINE?????? host03?????????????????? Open??????????????? ????? 2??????? ONLINE? ONLINE?????? host04?????????????????? Open??????????????? ora.scan1.vip ????? 1??????? ONLINE? ONLINE?????? host04 检查启动磁盘组情况 [root@host03 bin]# ./crsctl status res ora.racdb.db -f START_DEPENDENCIES=hard(ora.OCR.dg,ora.DATA.dg,ora.FRA.dg) weak(type:ora.listener.type,global:type:ora.scan_listener.type,uniform:ora.ons,global:ora.gns) pullup(ora.OCR.dg,ora.DATA.dg,ora.FRA.dg) 修改为: ./srvctl modify database -d racdb -a "DGOCR,DATA,FRA"; 重新启动实例,查看磁盘组信息 [root@host03 bin]# ./crsctl status res -t -------------------------------------------------------------------------------- NAME?????????? TARGET? STATE??????? SERVER?????????????????? STATE_DETAILS?????? -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.DATA.dg ?????????????? ONLINE? ONLINE?????? host03?????????????????????????????????????? ?????????????? ONLINE? ONLINE?????? host04?????????????????????????????????? ???? ora.DGDATA.dg ?????????????? ONLINE? ONLINE?????? host03?????????????????????????????????????? ?????????????? ONLINE? ONLINE?????? host04?????????????????????????????????????? ora.DGFRA.dg ?????????????? ONLINE? ONLINE?????? host03????????????????? ????????????????????? ?????????????? ONLINE? ONLINE?????? host04?????????????????????????????????????? ora.DGOCR.dg ?????????????? ONLINE? ONLINE?????? host03?????????????????????????????????????? ?????????????? ONLINE? ONLINE?????? host04?????????????????????????????????????? ora.FRA.dg ?????????????? ONLINE? ONLINE?????? host03?????????????????????????????????????? ?????????????? ONLINE? ONLINE?????? host04?????????????????????????????????????? ora.LISTENER.lsnr ????????? ?????ONLINE? ONLINE?????? host03?????????????????????????????????????? ?????????????? ONLINE? ONLINE?????? host04?????????????????????????????????????? ora.asm ?????????????? ONLINE? ONLINE?????? host03?????????????????? Started???????????? ??????????? ???ONLINE? ONLINE?????? host04?????????????????? Started???????????? ora.gsd ?????????????? OFFLINE OFFLINE????? host03?????????????????????????????????????? ?????????????? OFFLINE OFFLINE????? host04?????????????????????????????????????? ora.net1.network ?????????????? ONLINE? ONLINE?????? host03?????????????????????????????????????? ?????????????? ONLINE? ONLINE?????? host04?????????????????????????????????????? ora.ons ?????????????? ONLINE? ONLINE?????? host03?????????????????????????????????????? ?????????????? ONLINE? ONLINE?????? host04?????????????????????????????????????? ora.registry.acfs ?????????????? ONLINE? ONLINE?????? host03?????????????????????????????????????? ?????????????? ONLINE? ONLINE?????? host04?????????????????????????????? ???????? -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.LISTENER_SCAN1.lsnr ????? 1??????? ONLINE? ONLINE?????? host03 ?????????????????????????????????????? ora.cvu ????? 1??????? ONLINE? ONLINE?????? host03?????????????????????????????????????? ora.host03.vip ????? 1??????? ONLINE? ONLINE?????? host03?????????????????????????????????????? ora.host04.vip ????? 1??????? ONLINE? ONLINE?????? host04?????????????????????????????????????? ora.oc4j ????? 1??????? ONLINE? ONLINE?????? host03?????????????????????????????????????? ora.racdb.db ? ????1??????? ONLINE? ONLINE?????? host03?????????????????? Open??????????????? ????? 2??????? ONLINE? ONLINE?????? host04?????????????????? Open??????????????? ora.scan1.vip ????? 1??????? ONLINE? ONLINE?????? host03? 3、迁移oracle参数文件、控制文件 修改参数文件位置 SQL> show parameter spfile; NAME???????????????????????????????? TYPE??????? VALUE ------------------------------------ ----------- ------------------------------ spfile?????????????????????????????? string????? +DATA/racdb/spfileracdb.ora SQL> create pfile='/home/oracle/pfile1.ora' from spfile; File created. SQL>create spfile='+DGDATA/racdb/spfileracdb.ora' from pfile='/home/oracle/pfile1.ora'; File created. 修改initRACDB1.ora? initRACDB2.ora文件 [oracle@host03 dbs]$ vi initRACDB1.ora SPFILE='+DGDATA/racdb/spfileracdb.ora' [oracle@host04 dbs]$ vi initRACDB1.ora SPFILE='+DGDATA/racdb/spfileracdb.ora' 修改OCR中spfile位置 srvctl modify database -d racdb -p '+DGDATA/racdb/spfileracdb.ora' [oracle@host03 dbs]$ srvctl config database -d racdb Database unique name: RACDB Database name: RACDB Oracle home: /u01/app/oracle/product/11.2.0/dbhome_1 Oracle user: oracle Spfile: +DGDATA/racdb/spfileracdb.ora Domain: Start options: open Stop options: immediate Database role: PRIMARY Management policy: AUTOMATIC Server pools: RACDB Database instances: RACDB1,RACDB2 Disk Groups: DGOCR,DATA,FRA,DGDATA Mount point paths: Services: Type: RAC Database is administrator managed 重新启动数据库,检查spfile文件位置 SQL> show parameter spfile; NAME???????????????????????????? ????TYPE??????? VALUE ------------------------------------ ----------- ------------------------------ spfile?????????????????????????????? string????? +DGDATA/racdb/spfileracdb.ora 4、修改控制文件位置 SQL> show parameter control NAME????????????????????????????? ???TYPE??????? VALUE ------------------------------------ ----------- ------------------------------ control_file_record_keep_time??????? integer???? 7 control_files??????????????????????? string????? +DATA/racdb/controlfile/curren ??????????????????????? ?????????????????????????t.258.1082152397, +FRA/racdb/c ???????????????????????????????????????????????? ontrolfile/current.257.1082152 ???????????????????????????????????????????????? 407 control_management_pack_access?????? string????? DIAGNOSTIC+TUNING 停止数据库实例 [oracle@host03 dbs]$ srvctl? stop? database -d racdb????????? [oracle@host03 dbs]$ srvctl? status? database -d racdb? Instance RACDB1 is not running on node host03 Instance RACDB2 is not running on node host04 将host03启动到nomount状态 SQL> startup nomount; ORACLE instance started. Total System Global Area 3340451840 bytes Fixed Size????????????????? 2257840 bytes Variable Size??????????? 1962937424 bytes Database Buffers???????? 1358954496 bytes Redo Buffers?????????????? 16302080 bytes SQL> quit Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, Real Application Clusters, OLAP, Data Mining and Real Application Testing options 恢复控制文件到指定位置 [oracle@host03 dbs]$ rman target / Recovery Manager: Release 11.2.0.4.0 - Production on Mon Sep 6 22:31:50 2021 Copyright (c) 1982, 2011, Oracle and/or its affiliates.? All rights reserved. connected to target database: RACDB (not mounted) RMAN> restore controlfile to '+DGDATA' from '+DATA/racdb/controlfile/current.258.1082152397'; Starting restore at 06-SEP-21 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=97 instance=RACDB1 device type=DISK channel ORA_DISK_1: copied control file copy Finished restore at 06-SEP-21 RMAN> restore controlfile to '+DGFRA' from '+FRA/racdb/controlfile/current.257.1082152407'; Starting restore at 06-SEP-21 using channel ORA_DISK_1 channel ORA_DISK_1: copied control file copy Finished restore at 06-SEP-21 查找具体控制文件名称 +dgdata/racdb/controlfile/current.258.1082586725 +dgfra/racdb/controlfile/current.256.1082586735 启动host03到mount状态 SQL> alter database mount ; Database altered. 修改参数文件中控制文件的位置 alter system set control_files='+dgdata/racdb/controlfile/current.258.1082586725','+dgfra/racdb/controlfile/current.256.1082586735' scope=spfile sid='*'; 关闭host03库 SQL> shutdown immediate; ORA-01109: database not open Database dismounted. ORACLE instance shut down. 开启库 [oracle@host03 ~]$ srvctl? start? database -d racdb?? [oracle@host03 ~]$ srvctl? status? database -d racdb Instance RACDB1 is running on node host03 Instance RACDB2 is running on node host04 [oracle@host03 ~]$ srvctl? stop database -d racdb [oracle@host03 ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Mon Sep 6 22:41:34 2021 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 control; NAME???????????????????????????????? TYPE??????? VALUE ------------------------------------ ----------- ------------------------------ control_file_record_keep_time??????? integer???? 7 control_files??????????????????????? string????? +DGDATA/racdb/controlfile/curr ???????????????????????????????????????????? ????ent.258.1082586725, +DGFRA/rac ???????????????????????????????????????????????? db/controlfile/current.256.108 ???????????????????????????????????????????????? 2586735 control_management_pack_access?????? string????? DIAGNOSTIC+TUNING 5、迁移数据文件backup as copy(host03库启动到mount状态) SQL> select file_name from dba_data_files; FILE_NAME -------------------------------------------------------------------------------- +DATA/racdb/datafile/users.264.1082152951 +DATA/racdb/datafile/undotbs1.261.1082152943 +DATA/racdb/datafile/sysaux.260.1082152929 +DATA/racdb/datafile/system.259.1082152913 +DATA/racdb/datafile/undotbs2.262.1082152945 SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> startup mount; ORACLE instance started. Total System Global Area 3340451840 bytes Fixed Size????????????????? 2257840 bytes Variable Size??????????? 1962937424 bytes Database Buffers???????? 1358954496 bytes Redo Buffers?????????????? 16302080 bytes Database mounted. 迁移数据文件: RMAN> backup as copy database format '+DGDATA'; RMAN> switch database to copy; datafile 1 switched to datafile copy "+DGDATA/racdb/datafile/system.259.1082587719" datafile 2 switched to datafile copy "+DGDATA/racdb/datafile/sysaux.260.1082587727" datafile 3 switched to datafile copy "+DGDATA/racdb/datafile/undotbs1.261.1082587735" datafile 4 switched to datafile copy "+DGDATA/racdb/datafile/users.264.1082587741" datafile 5 switched to datafile copy "+DGDATA/racdb/datafile/undotbs2.262.1082587735" SQL> alter database open; Database altered. SQL> select file_name from dba_data_files; FILE_NAME -------------------------------------------------------------------------------- +DGDATA/racdb/datafile/users.264.1082587741 +DGDATA/racdb/datafile/undotbs1.261.1082587735 +DGDATA/racdb/datafile/sysaux.260.1082587727 +DGDATA/racdb/datafile/system.259.1082587719 +DGDATA/racdb/datafile/undotbs2.262.1082587735 [oracle@host03 ~]$ srvctl? start? database -d racdb?? [oracle@host03 ~]$ srvctl? status? database -d racdb?? Instance RACDB1 is running on node host03 Instance RACDB2 is running on node host04 SQL> select tablespace_name from dba_tablespaces; TABLESPACE_NAME ------------------------------ SYSTEM SYSAUX UNDOTBS1 TEMP USERS UNDOTBS2 6 rows selected. 替换临时文件 SQL> create temporary tablespace temp01 tempfile '+DGDATA' size 100M autoextend on maxsize 2g; Tablespace created. SQL> alter database default temporary tablespace temp01; Database altered. SQL> select tablespace_name from dba_tablespaces; TABLESPACE_NAME ------------------------------ SYSTEM SYSAUX UNDOTBS1 TEMP USERS UNDOTBS2 TEMP01 7 rows selected. SQL> drop tablespace temp including contents and datafiles; Tablespace dropped. SQL> select tablespace_name from dba_tablespaces; TABLESPACE_NAME ------------------------------ SYSTEM SYSAUX UNDOTBS1 USERS UNDOTBS2 TEMP01 6 rows selected. 修改redo文件位置(不改变组,添加组成员) QL> select group#,thread#,bytes,members from v$log; ??? GROUP#??? THREAD#????? BYTES??? MEMBERS ---------- ---------- ---------- ---------- ???????? 1????????? 1?? 52428800????????? 2 ???????? 2????????? 1?? 52428800????????? 2 ???????? 3????????? 2?? 52428800????????? 2 ???????? 4????????? 2?? 52428800??? ??????2 SQL> select group#,status,member from v$logfile; ??? GROUP# STATUS? MEMBER ---------- ------- ------------------------------------------------------------ ???????? 1???????? +DATA/racdb/onlinelog/group_1.268.1082155395 ???????? 2???????? +DATA/racdb/onlinelog/group_2.269.1082155415 ???????? 3???????? +DATA/racdb/onlinelog/group_3.270.1082155421 ???????? 4???????? +DATA/racdb/onlinelog/group_4.271.1082155429 ???????? 1???????? +DATA/racdb/onlinelog/group_1.266.1082155057 ???????? 2???????? +DATA/racdb/onlinelog/group_2.267.1082155067 ???????? 3???????? +FRA/racdb/onlinelog/group_3.258.1082155073 ???????? 4???????? +FRA/racdb/onlinelog/group_4.259.1082155079 添加日志组 alter database add logfile member '+DGDATA' to group 1; alter database add logfile member '+DGDATA' to group 2; alter database add logfile member '+DGDATA' to group 3; alter database add logfile member '+DGDATA' to group 4; alter database add logfile member '+DGDATA' to group 1; alter database add logfile member '+DGDATA' to group 2; alter database add logfile member '+DGDATA' to group 3; alter database add logfile member '+DGDATA' to group 4; 查看日志组 SQL> select group#,thread#,bytes,members from v$log; ??? GROUP#??? THREAD#????? BYTES??? MEMBERS ---------- ---------- ---------- ---------- ???????? 1????????? 1?? 52428800????????? 4 ???????? 2????????? 1?? 52428800????????? 4 ???????? 3????????? 2?? 52428800????????? 4 ???????? 4????????? 2?? 52428800????????? 4 SQL> select group#,status,member from v$logfile; ? ??GROUP# STATUS? MEMBER ---------- ------- ------------------------------------------------------------ ???????? 1???????? +DATA/racdb/onlinelog/group_1.268.1082155395 ???????? 2???????? +DATA/racdb/onlinelog/group_2.269.1082155415 ???????? 3???????? +DATA/racdb/onlinelog/group_3.270.1082155421 ???????? 4???????? +DATA/racdb/onlinelog/group_4.271.1082155429 ???????? 1 INVALID +DGDATA/racdb/onlinelog/group_1.267.1082588959 ???????? 1???????? +DATA/racdb/onlinelog/group_1.266.1082155057 ???????? 2???????? +DATA/racdb/onlinelog/group_2.267.1082155067 ???????? 3???????? +FRA/racdb/onlinelog/group_3.258.1082155073 ???????? 2 INVALID +DGDATA/racdb/onlinelog/group_2.268.1082588967 ???????? 3 INVALID +DGDATA/racdb/onlinelog/group_3.269.1082588975 ???????? 4 INVALID +DGDATA/racdb/onlinelog/group_4.270.1082588981 ??? GROUP# STATUS? MEMBER ---------- ------- ------------------------------------------------------------ ???????? 4???????? +FRA/racdb/onlinelog/group_4.259.1082155079 ???????? 1 INVALID +DGDATA/racdb/onlinelog/group_1.271.1082589049 ???????? 2 INVALID +DGDATA/racdb/onlinelog/group_2.272.1082589057 ???????? 3 INVALID +DGDATA/racdb/onlinelog/group_3.273.1082589063 ???????? 4 INVALID +DGDATA/racdb/onlinelog/group_4.274.1082589069 删除组成员: Alter database drop logfile member ‘+DATA/racdb/onlinelog/group_1.268.1082155395’; 通过切换日志组,删除日志成员; SQL> select group#,status,member from v$logfile; ??? GROUP# STATUS? MEMBER ---------- ------- ------------------------------------------------------------ ???????? 1???????? +DGDATA/racdb/onlinelog/group_1.267.1082588959 ???????? 2???????? +DGDATA/racdb/onlinelog/group_2.268.1082588967 ???????? 3???????? +DGDATA/racdb/onlinelog/group_3.269.1082588975 ???????? 4???????? +DGDATA/racdb/onlinelog/group_4.270.1082588981 ???????? 1???????? +DGDATA/racdb/onlinelog/group_1.271.1082589049 ???????? 2???????? +DGDATA/racdb/onlinelog/group_2.272.1082589057 ???????? 3???????? +DGDATA/racdb/onlinelog/group_3.273.1082589063 ???????? 4???????? +DGDATA/racdb/onlinelog/group_4.274.1082589069 [oracle@host03 ~]$ srvctl? stop? database -d racdb???? [oracle@host03 ~]$ srvctl? start? database -d racdb [oracle@host03 ~]$ srvctl? status? database -d racdb? Instance RACDB1 is running on node host03 Instance RACDB2 is running on node host04 检查磁盘文件一致: [oracle@host03 ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Mon Sep 6 23:30:08 2021 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????? +DGDATA/racdb/spfileracdb.ora SQL> select file_name from dba_data_files; FILE_NAME -------------------------------------------------------------------------------- +DGDATA/racdb/datafile/users.264.1082587741 +DGDATA/racdb/datafile/undotbs1.261.1082587735 +DGDATA/racdb/datafile/sysaux.260.1082587727 +DGDATA/racdb/datafile/system.259.1082587719 +DGDATA/racdb/datafile/undotbs2.262.1082587735 SQL> select file_name from dba_temp_files; FILE_NAME -------------------------------------------------------------------------------- +DGDATA/racdb/tempfile/temp01.266.1082588257 SQL> SQL> SQL> show parameter control; NAME???????????????????????????????? TYPE??????? VALUE ------------------------------------ ----------- ------------------------------ control_file_record_keep_time??????? integer???? 7 control_files??????????????????????? string????? +DGDATA/racdb/controlfile/curr ???????????????????????????????????????????????? ent.258.1082586725, +DGFRA/rac ???????????????????????????????????????????????? db/controlfile/current.256.108 ???????????????????????????????????????????????? 2586735 control_management_pack_access?????? string????? DIAGNOSTIC+TUNING 6、删除磁盘组DATA、FRA(host03.host04节点) [root@host03 ~]# su - grid -bash-4.1$ sqlplus / as sysasm SQL*Plus: Release 11.2.0.4.0 Production on Mon Sep 6 23:32:18 2021 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 Real Application Clusters and Automatic Storage Management options SQL> alter diskgroup DATA dismount; Diskgroup altered. SQL> alter diskgroup fra dismount; Diskgroup altered. 删除ASM磁盘组 SQL> drop diskgroup DATA force including contents; Diskgroup dropped. SQL> drop diskgroup FRA force including contents; Diskgroup dropped. CRS删除磁盘组 [oracle@host03 ~]$ srvctl remove diskgroup -g data -f [oracle@host03 ~]$ srvctl remove diskgroup -g fra -f [oracle@host03 ~]$ crsctl status res -t????????????? -------------------------------------------------------------------------------- NAME???????? ??TARGET? STATE??????? SERVER?????????????????? STATE_DETAILS?????? -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.DGDATA.dg ?????????????? ONLINE? ONLINE?????? host03?????????????????????????????????????? ?????????????? ONLINE? ONLINE?????? host04?????????????????????????????????????? ora.DGFRA.dg ?????????????? ONLINE? ONLINE?????? host03??????????????????????????????? ??????? ?????????????? ONLINE? ONLINE?????? host04?????????????????????????????????????? ora.DGOCR.dg ?????????????? ONLINE? ONLINE?????? host03?????????????????????????????????????? ?????????????? ONLINE? ONLINE?????? host04???????????????????????????? ?????????? ora.LISTENER.lsnr ?????????????? ONLINE? ONLINE?????? host03?????????????????????????????????????? ?????????????? ONLINE? ONLINE?????? host04?????????????????????????????????????? ora.asm ?????????????? ONLINE? ONLINE?????? host03???????????? ??????Started???????????? ?????????????? ONLINE? ONLINE?????? host04?????????????????? Started???????????? ora.gsd ?????????????? OFFLINE OFFLINE????? host03?????????????????????????????????????? ?????????????? OFFLINE OFFLINE????? host04?????????????????????????????????????? ora.net1.network ?????????????? ONLINE? ONLINE?????? host03?????????????????????????????????????? ?????????????? ONLINE? ONLINE?????? host04?????????????????????????????????????? ora.ons ?????????????? ONLINE? ONLINE?????? host03?????????????????????????????????????? ?????????????? ONLINE? ONLINE?????? host04?????????????????????????????????????? ora.registry.acfs ?????????????? ONLINE? ONLINE?????? host03?????????????????????????????????????? ?????? ????????ONLINE? ONLINE?????? host04?????????????????????????????????????? -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.LISTENER_SCAN1.lsnr ????? 1??????? ONLINE? ONLINE?????? host03?????????????????????????????????????? ora.cvu ????? 1??????? ONLINE? ONLINE?????? host03?????????????????????????????????????? ora.host03.vip ????? 1??????? ONLINE? ONLINE?????? host03??? ??????????????????????????????????? ora.host04.vip ????? 1??????? ONLINE? ONLINE?????? host04?????????????????????????????????????? ora.oc4j ????? 1??????? ONLINE? ONLINE?????? host03?????????????????????????????????????? ora.racdb.db ????? 1??????? ONLINE? ONLINE?????? host03?????????????????? Open??????????????? ????? 2??????? ONLINE? ONLINE?????? host04?????????????????? Open??????????????? ora.scan1.vip ????? 1??????? ONLINE? ONLINE?????? host03 更新CRS信息 [oracle@host03 ~]$ srvctl modify database -d racdb -a "DGOCR,DGDATA,DGFRA"; 7、重新启动数据库,查看状态 SQL> select instance_name,status from gv$instance; INSTANCE_NAME??? STATUS ---------------- ------------ RACDB2?????????? OPEN RACDB1?????????? OPEN 检查rman备份配置 RMAN> SHOw all; RMAN configuration parameters for database with db_unique_name RACDB are: CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default CONFIGURE BACKUP OPTIMIZATION OFF; # default CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '+FRA'; CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE MAXSETSIZE TO UNLIMITED; # default CONFIGURE ENCRYPTION FOR DATABASE OFF; # default CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default CONFIGURE SNAPSHOT CONTROLFILE NAME TO '+DGFRA/snapcf_RACDB.f'; 备份一份数据(上面脚本) 8、删除硬件磁盘 [root@host03 oracle]# cat initdiskdel1.sh ## Delete asmdisk on host03 /etc/init.d/oracleasm deletedisk asmdisk1p1 /etc/init.d/oracleasm deletedisk asmdisk1p2 /etc/init.d/oracleasm deletedisk asmdisk1p3 /etc/init.d/oracleasm deletedisk asmdisk1p4 /etc/init.d/oracleasm deletedisk asmdisk1p5 /etc/init.d/oracleasm deletedisk asmdisk1p6 /etc/init.d/oracleasm deletedisk asmdisk1p7 /etc/init.d/oracleasm deletedisk asmdisk1p8 /etc/init.d/oracleasm deletedisk asmdisk2p1 /etc/init.d/oracleasm deletedisk asmdisk2p2 ## Create disk asmdisk on host03 ## Scan disk asmdisk on host03 /etc/init.d/oracleasm scandisks /etc/init.d/oracleasm listdisks ## Scan disk asmdisk on host04 ssh host04 /etc/init.d/oracleasm scandisks ssh host04 /etc/init.d/oracleasm listdisks 检查asm磁盘情况 [root@host03 oracle]# ll /dev/oracleasm/disks/ total 0 brw-rw---- 1 grid asmadmin 8, 33 Sep? 7 00:00 ASMDISK8P1 brw-rw---- 1 grid asmadmin 8, 34 Sep? 7 00:00 ASMDISK8P2 brw-rw---- 1 grid asmadmin 8, 35 Sep? 7 00:00 ASMDISK8P3 [oracle@host04 ~]$ ll /dev/oracleasm/disks/ total 0 brw-rw---- 1 grid asmadmin 8, 33 Sep? 7 00:00 ASMDISK8P1 brw-rw---- 1 grid asmadmin 8, 34 Sep? 7 00:00 ASMDISK8P2 brw-rw---- 1 grid asmadmin 8, 35 Sep? 7 00:00 ASMDISK8P3 |
|
|
上一篇文章 下一篇文章 查看所有文章 |
|
开发:
C++知识库
Java知识库
JavaScript
Python
PHP知识库
人工智能
区块链
大数据
移动开发
嵌入式
开发工具
数据结构与算法
开发测试
游戏开发
网络协议
系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程 数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁 |
360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年11日历 | -2024/11/15 14:25:28- |
|
网站联系: qq:121756557 email:121756557@qq.com IT数码 |