1. 程式人生 > >一步一步教你更換 Oracle 11g RAC 共享儲存

一步一步教你更換 Oracle 11g RAC 共享儲存

該環境為本人測試環境,生產環境該方案仍可使用。

一、伺服器上新增新儲存,根據原來的裸裝置繫結方式對裸盤進行繫結。

KERNEL=="sd*", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VB74b34d9d-2af737fa", NAME="newasm-diskb", OWNER="grid", GROUP="asmadmin", MODE="0660"
這裡使用的是scsi_id進行繫結的,因此新加的盤也使用該方法。

驗證新儲存繫結狀態:

[[email protected] rules.d]# ll /dev/new*
brw-rw----. 1 grid asmadmin 8, 32 Jul 26 11:32 /dev/newasm-diskb
老儲存繫結狀態:
[[email protected] rules.d]# ll /dev/asm*
brw-rw----. 1 grid asmadmin 8, 16 Jul 26 11:34 /dev/asm-diskb

二、grid使用者asmca建立磁碟組

newdata為新增的磁碟組。

三、遷移spfile&控制檔案

3.1 srvctl stop database -d orcl關閉資料庫。

3.2 新增控制檔案到相應路徑

先nomount資料庫:

SQL> startup nomount;
ORACLE instance started.

Total System Global Area 1603411968 bytes
Fixed Size            2228784 bytes
Variable Size         1090522576 bytes
Database Buffers      503316480 bytes
Redo Buffers            7344128 bytes


然後:
[[email protected] ~]$ rman target /

Recovery Manager: Release 11.2.0.3.0 - Production on Tue Jul 26 17:15:43 2016

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORCL (not mounted)

RMAN>  restore controlfile to '+NEWDATA' from '+data/orcl/controlfile/Current.260.918213121';

Starting restore at 26-JUL-16
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=36 instance=orcl1 device type=DISK

channel ORA_DISK_1: copied control file copy
Finished restore at 26-JUL-16

RMAN> restore controlfile to '+NEWDATA' from '+data/orcl/controlfile/Current.260.918213121';

Starting restore at 26-JUL-16
using channel ORA_DISK_1

channel ORA_DISK_1: copied control file copy
Finished restore at 26-JUL-16

3.3 建立pfile,並修改其部分內容

SQL> create pfile='/home/oracle/initorcl.ora' from spfile;

File created.

修改控制檔案位置:

*.control_files='+DATA/orcl/controlfile/current.261.918213119','+DATA/orcl/controlfile/current.260.918213121'

修改建立資料檔案預設位置:

*.db_create_file_dest='+DATA'

修改快速回復區路徑:

*.db_recovery_file_dest='+DATA'

如仍存在包含老磁碟組的引數一併修改掉。

修改完成的結果如下:

orcl1.__db_cache_size=503316480
orcl2.__db_cache_size=587202560
orcl1.__java_pool_size=16777216
orcl2.__java_pool_size=16777216
orcl1.__large_pool_size=16777216
orcl2.__large_pool_size=16777216
orcl1.__pga_aggregate_target=654311424
orcl2.__pga_aggregate_target=654311424
orcl1.__sga_target=956301312
orcl2.__sga_target=956301312
orcl1.__shared_io_pool_size=0
orcl2.__shared_io_pool_size=0
orcl1.__shared_pool_size=369098752
orcl2.__shared_pool_size=318767104
orcl1.__streams_pool_size=33554432
orcl2.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/orcl/adump'
*.audit_trail='db'
*.cluster_database=true
*.compatible='11.2.0.0.0'
*.control_files='+newdata/orcl/controlfile/current.256.918234967','+newdata/orcl/controlfile/current.257.918234949'
*.db_block_size=8192
*.db_create_file_dest='+NEWDATA'
*.db_domain=''
*.db_name='orcl'
*.db_recovery_file_dest='+NEWDATA'
*.db_recovery_file_dest_size=104856551424
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'
orcl1.instance_number=1
orcl2.instance_number=2
*.log_archive_format='%t_%s_%r.dbf'
*.memory_target=1605369856
*.open_cursors=300
*.processes=150
*.remote_listener='hadoop-cluster:1521'
*.remote_login_passwordfile='exclusive'
orcl2.thread=2
orcl1.thread=1
orcl1.undo_tablespace='UNDOTBS1'
orcl2.undo_tablespace='UNDOTBS2'


3.4 在rac中的一個節點(此處用一號結點)指定pfile啟動資料庫到mount狀態以驗證pfile正確定,建立spfile。

SQL> startup force mount pfile='/home/oracle/initorcl.ora';
ORACLE instance started.

Total System Global Area 1603411968 bytes
Fixed Size            2228784 bytes
Variable Size         1090522576 bytes
Database Buffers      503316480 bytes
Redo Buffers            7344128 bytes
Database mounted.

mount成功,建立spfile

SQL> create spfile='+newdata/orcl/spfileorcl.ora' from pfile='/home/oracle/initorcl.ora';

File created.

3.5 srvctl修改資料庫引數檔案位置。

[[email protected] ~]$ srvctl modify database -d orcl -p +newdata/orcl/spfileorcl.ora
[[email protected] ~]$ srvctl config database -d orcl
Database unique name: orcl
Database name: orcl
Oracle home: /u01/app/oracle/product/11.2.0/dbhome_1
Oracle user: oracle
Spfile: +newdata/orcl/spfileorcl.ora
Domain: 
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: orcl
Database instances: orcl1,orcl2
Disk Groups: DATA,NEWDATA
Mount point paths: 
Services: 
Type: RAC
Database is administrator managed

3.6 關閉資料庫用新的spfile以及controlfile啟動一遍,驗證正確性。

[[email protected] ~]$ srvctl start database -d orcl
[[email protected] ~]$ 
[[email protected] ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Tue Jul 26 17:29:22 2016

Copyright (c) 1982, 2011, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.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	 +NEWDATA/orcl/spfileorcl.ora
SQL> show parameter control 

NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time	     integer	 7
control_files			     string	 +NEWDATA/orcl/controlfile/curr
						 ent.256.918234967, +NEWDATA/or
						 cl/controlfile/current.257.918
						 234949

四、遷移資料檔案

保證資料庫處於歸檔模式。rman進行backup as copy 操作

[[email protected] ~]$ rman target /

Recovery Manager: Release 11.2.0.3.0 - Production on Tue Jul 26 17:32:21 2016

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORCL (DBID=1445993855)

RMAN> backup as copy database format '+NEWDATA';

Starting backup at 26-JUL-16
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=53 instance=orcl1 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=+DATA/orcl/datafile/system.256.918213045
output file name=+NEWDATA/orcl/datafile/system.260.918235957 tag=TAG20160726T173235 RECID=2 STAMP=918235979
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=+DATA/orcl/datafile/sysaux.257.918213045
output file name=+NEWDATA/orcl/datafile/sysaux.261.918235981 tag=TAG20160726T173235 RECID=3 STAMP=918236002
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=+DATA/orcl/datafile/example.267.918213155
output file name=+NEWDATA/orcl/datafile/example.262.918236007 tag=TAG20160726T173235 RECID=4 STAMP=918236019
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=+DATA/orcl/datafile/undotbs1.258.918213045
output file name=+NEWDATA/orcl/datafile/undotbs1.263.918236023 tag=TAG20160726T173235 RECID=5 STAMP=918236026
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile file number=00006 name=+DATA/orcl/datafile/undotbs2.268.918213341
output file name=+NEWDATA/orcl/datafile/undotbs2.264.918236029 tag=TAG20160726T173235 RECID=6 STAMP=918236030
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
copying current control file
output file name=+NEWDATA/orcl/controlfile/backup.265.918236033 tag=TAG20160726T173235 RECID=7 STAMP=918236034
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=+DATA/orcl/datafile/users.259.918213045
output file name=+NEWDATA/orcl/datafile/users.266.918236035 tag=TAG20160726T173235 RECID=8 STAMP=918236035
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 26-JUL-16
channel ORA_DISK_1: finished piece 1 at 26-JUL-16
piece handle=+NEWDATA/orcl/backupset/2016_07_26/nnsnf0_tag20160726t173235_0.267.918236037 tag=TAG20160726T173235 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 26-JUL-16

srvctl stop database -d orcl -o immediate
[[email protected] ~]$ srvctl stop database -d orcl -o immediate
[[email protected] ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Tue Jul 26 17:35:54 2016

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup mount 
ORACLE instance started.

Total System Global Area 1603411968 bytes
Fixed Size		    2228784 bytes
Variable Size		 1090522576 bytes
Database Buffers	  503316480 bytes
Redo Buffers		    7344128 bytes
Database mounted.
SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
[[email protected] ~]$ rman target /

Recovery Manager: Release 11.2.0.3.0 - Production on Tue Jul 26 17:36:28 2016

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORCL (DBID=1445993855, not open)

RMAN> switch database to copy;

using target database control file instead of recovery catalog
datafile 1 switched to datafile copy "+NEWDATA/orcl/datafile/system.260.918235957"
datafile 2 switched to datafile copy "+NEWDATA/orcl/datafile/sysaux.261.918235981"
datafile 3 switched to datafile copy "+NEWDATA/orcl/datafile/undotbs1.263.918236023"
datafile 4 switched to datafile copy "+NEWDATA/orcl/datafile/users.266.918236035"
datafile 5 switched to datafile copy "+NEWDATA/orcl/datafile/example.262.918236007"
datafile 6 switched to datafile copy "+NEWDATA/orcl/datafile/undotbs2.264.918236029"

RMAN> 

switch完成後一定要recover一下

[[email protected] ~]$ rman target /

Recovery Manager: Release 11.2.0.3.0 - Production on Tue Jul 26 17:40:51 2016

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORCL (DBID=1445993855, not open)

RMAN> recover database;

Starting recover at 26-JUL-16
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=35 instance=orcl1 device type=DISK

starting media recovery
media recovery complete, elapsed time: 00:00:02

Finished recover at 26-JUL-16

RMAN> exit


Recovery Manager complete.

然後srvctl方式啟動資料庫。

[[email protected] ~]$ srvctl start database -d orcl

五、遷移臨時檔案

檢視臨時表空間

select * from dba_tablespaces where contents = 'TEMPORARY';


檢視臨時檔案

select * from V$TEMPFILE;


為臨時表空間新增臨時檔案

SQL> alter tablespace temp add tempfile size 18M;

Tablespace altered.

由於db_create_file_dest引數設定為+newdata,所以新臨時檔案會自動建立在newdata磁碟組上

刪除老儲存上的臨時檔案。

[[email protected] ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Tue Jul 26 17:50:16 2016

Copyright (c) 1982, 2011, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> alter tablespace temp add tempfile size 18M;

Tablespace altered.

SQL> ALTER DATABASE TEMPFILE '+DATA/orcl/tempfile/temp.266.918213143' DROP INCLUDING DATAFILES;

Database altered.

六、遷移online redo log

ALTER DATABASE ADD LOGFILE THREAD 1 GROUP 5 SIZE 50M;

ALTER DATABASE ADD LOGFILE THREAD 1 GROUP 6 SIZE 50M;

ALTER DATABASE ADD LOGFILE THREAD 2 GROUP 7 SIZE 50M;

ALTER DATABASE ADD LOGFILE THREAD 2 GROUP 8 SIZE 50M;

ALTER DATABASE DROP LOGFILE GROUP 1;

ALTER DATABASE DROP LOGFILE GROUP 2;

ALTER DATABASE DROP LOGFILE GROUP 3;

ALTER DATABASE DROP LOGFILE GROUP 4; 

遇到線上日誌或未回檔的日誌採用如下命令:

alter system switch logfile;

alter system checkpoint;

七、遷移OCR&voting disk&ASM spfile

[[email protected] ~]# crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   4b1a5effbe514f46bfd6a45c20c06935 (/dev/asm-diskb) [DATA]
Located 1 voting disk(s).
[[email protected] ~]# crsctl replace votedisk +newdata
Successful addition of voting disk 350eddf550034f2bbfb890dd05d80ed0.
Successful deletion of voting disk 4b1a5effbe514f46bfd6a45c20c06935.
Successfully replaced voting disk group with +newdata.
CRS-4266: Voting file(s) successfully replaced
[[email protected] ~]# crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   350eddf550034f2bbfb890dd05d80ed0 (/dev/newasm-diskb) [NEWDATA]
Located 1 voting disk(s).

voting disk 遷移完成。
[[email protected] ~]# ocrcheck
Status of Oracle Cluster Registry is as follows :
     Version                  :          3
     Total space (kbytes)     :     262120
     Used space (kbytes)      :       2864
     Available space (kbytes) :     259256
     ID                       : 1844481808
     Device/File Name         :      +DATA
                                    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

[[email protected] ~]# ocrconfig -add +newdata
[[email protected] ~]# ocrconfig -delete +data
[[email protected] ~]# ocrcheck
Status of Oracle Cluster Registry is as follows :
     Version                  :          3
     Total space (kbytes)     :     262120
     Used space (kbytes)      :       2864
     Available space (kbytes) :     259256
     ID                       : 1844481808
     Device/File Name         :   +newdata
                                    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遷移完成。

如遇到CRS-4602,CRS-1638  錯誤,傳送門-->http://blog.csdn.net/u011478909/article/details/51972303

SQL> create pfile='/tmp/pfile.asm' from spfile;

File created.

SQL>  create spfile='+NEWDATA' from pfile='/tmp/pfile.asm';

File created.

八、解除安裝老磁碟組

asmca dismount +data磁碟組 然後將其drop


至此,oracle rac儲存更換完成。

相關推薦

更換 Oracle 11g RAC 共享儲存

該環境為本人測試環境,生產環境該方案仍可使用。 一、伺服器上新增新儲存,根據原來的裸裝置繫結方式對裸盤進行繫結。 KERNEL=="sd*", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --dev

篇文章,學會Git

eba 時有 當前目錄 文件 展示 遠程分支 amend 解釋 很好 在日常工作中,經常會用到Git操作。但是對於新人來講,剛上來對Git很陌生,操作起來也很懵逼。本篇文章主要針對剛開始接觸Git的新人,理解Git的基本原理,掌握常用的一些命令。 一、Git工作流程

記阿里巴巴的次面試,怎樣應對到來的“金三銀四”!

浪費了“黃金五年”的Java程式設計師,還有救嗎? >>>   

oracle 11g RAC 的基本操作()------啟動與關閉

執行 同時 man sources monit vip nag 查看數據庫 resource 啟動RAC 手工啟動按照HAS, cluster, database的順序啟動,具體命令如下: 啟動HAS(High Availability Servi

建立Oracle複合索引(精)

什麼是複合索引? 複合索引顧名思義,區別於單列索引,是由兩個或多個列一起構成的索引。其在B樹上的資料結構是什麼樣?如下圖,是一個包含兩列的複合索引。 如果你觀察仔細,還會發現它的葉子節點是ASC遞增排序的。現根據第一個值排序,然後根據第二個值排序。查的時候也一樣,先查第一個值,在查

純乾貨:手把手地搭建Oracle Sharding資料庫分片技術

select TABLESPACE_NAME, BYTES/1024/1024 MB from sys.dba_data_files order by tablespace_name;   TABLESPACE_NAME                        MB ------------------

oracle 11g RAC ASM磁碟被強制下線搶修

又有一段時間沒寫有關oracle的文章了,恐怕這也是不能成為高手的原因之一,偶有典型性拖延症和懶癌。 今天要講的一個栗子又一個現場case,中午吃飯的時候看到來自同事的未接,處於職業敏感感覺是資料中心出問題了,撥過去第一通電話告訴我儲存壞掉一塊盤,然後NBU有

centos 6.5 部署 oracle 11G RAC+DG-------部署RAC部分(

VMware Workstation 搭建11g RAC 規劃 11g OCR與votedisk放在一個磁碟組,大小1G夠用,12C需要 6G以上 OCR根據不同的冗餘型別需要的磁碟數規則如下: external

4.5萬字手把手實現MySQL TB級資料儲存!!

## 寫在前面 業界對系統的高可用有著基本的要求,簡單的說,這些要求可以總結為如下所示。 * 系統架構中不存在單點問題。 * 可以最大限度的保障服務的可用性。 一般情況下系統的高可用可以用幾個9來評估。所謂的幾個9就是系統可以保證對外提供的服務的時間達到總時間的百分比。例如如果需要達到99.99的高可用

oracle 11g rac dbca建庫時提示創建監聽

oracle 監聽 listener oracle rac Oracle 11g rac dbca建庫時提示創建監聽在安裝oracle 11g rac時,使用dbca建庫的過程中提示需要創建監聽:Default Listener "LISTENER" is not configured in

oracle 11g rac 筆記(VMware 和esxi主機都可以使用)

oracle 11g rac這個只是筆記,防止丟失,沒事見整理在vmware安裝目錄 創建磁盤:vmware-vdiskmanager.exe -c -s 1000Mb -a lsilogic -t 2 D:\VMWARE\racsharedisk\ocr.vmdkvmware-vdiskmanager.ex

Oracle 11g單實例RMAN恢復到Oracle 11g RAC

oracle 遷移 oracle rac 一、環境說明操作系統版本: RHEL 6.5 x641. 源數據庫服務器Oracle版本: Oracle 11g 11.2.0.4 64位(單機)Oracle_SID: orcl db_name : orcl背景:一臺生產oracle10g(10.2

oracle 11g rac 修改字符集

can data 64bit 復數 查看字符集 str edit root sql 系統版本:Oracle Linux Server release 5.7數據庫版本:Oracle Database 11g Enterprise Edition Release 11.2.0

oracle 11g RAC crfclust.bdb過大的處理

oracle ora.crf過大find / -type f -size +500M | xargs du -hm | sort -nrora.crf服務是為Cluster Health Monitor(以下簡稱CHM)提供服務的,用來自動收集操作系統的資源(CPU、內存、SWAP、進程、I/O以及網絡等

oracle 11g rac 監聽無法啟動

right dom ice 文件 gen roo ssa disk inux 1.數據庫啟動集群報錯 [root@db1 bin]# ./crs_stat -t -v Name Type R/RA F/FT Targe

ORACLE 11G RAC ASM磁盤組全部丟失後的恢復

實例 ice mat dns 禁用 buffers bit allocated event 一、環境描述(1)Oracle 11.2.0.3 RAC ON Oracle Linux 6 x86_64,只有一個ASM外部冗余磁盤組——DATA;(2)OCR,VOTEDISK,

轉載:細說oracle 11g rac 的ip地址

捕獲 ted 失效 服務 修改 機器 發生 操作 自己 本文轉載自:細說oracle 11g rac 的ip地址 http://blog.sina.com.cn/s/blog_4fe6d4250102v5fa.html 以前搭建oracle rac的時候(自己摸索搭建),對

Oracle 11g rac新增刪除叢集資料庫

部落格文章除註明轉載外,均為原創。轉載請註明出處。本文連結地址:http://blog.chinaunix.net/uid-31396856-id-5790357.html好記性不如爛筆頭,     記錄新增叢集資料庫和刪除叢集資料庫的關鍵步驟:主要是通過srvctl命令來管理叢集的

Oracle 11g RAC的體系結構與啟動順序

參考:https://blog.csdn.net/zhang123456456/article/details/53872060  CSSD(心跳):      ASM SPFILE(不是通過ASM例項,通過ASM驅動直接從磁碟讀取。普通ASM檔案) -&

Redhat 6.1 配置Linux multipath安裝oracle 11g rac

一、安裝配置儲存節點(略) 二、資料庫節點連線儲存節點 2.1、資料庫節點安裝ISCSI啟動器 yum install iscsi* 2.2、配置啟動器 vim /etc/iscsi/initiatorname.iscsi 2.3、發起連線 # iscsiadm