oracle 10g rac hacmp 遷移到asm實驗步驟

paulyibinyi發表於2010-06-29
1    實驗目的
oracle 11gR2版本開始在建庫選項中不支援裸裝置來建立資料庫,只能用共享檔案系統和asm來建立資料庫,不再支援raw來存放資料檔案。
很多客戶都是用裸裝置來管理資料庫,Oracle 提供了方法把裸裝置遷移到asm中,以下為具體的實驗步驟。
2    實驗環境和原來裸裝置資訊
 
           遷移前的資料庫環境資訊 
資料庫版本        環境      資料庫名    例項名    IP地址    作業系統和主機名
oracle10.2.0.4 hacmp5.5    orcl     orcl1 192.168.3.225    aix6.1+p520
RAC                         orcl     orcl2 192.168.3.223    aix6.1+p650
      
         
       遷移後的資料庫環境資訊
資料庫版本    環境    資料庫名    例項名    IP地址    作業系統和主機名
資料庫版本        環境      資料庫名    例項名    IP地址    作業系統和主機名
oracle10.2.0.4 asm         orcl     orcl1 192.168.3.225    aix6.1+p520
RAC                         orcl     orcl2 192.168.3.223    aix6.1+p650
 
 
      原lv資訊
vg名稱    lv名稱    作用
datavg    ocrnewlv    ocr盤
    rvotenewlv    vote盤
    system_lv    資料庫system表空間
    undo1_lv    節點1 undo表空間
    sysaux_lv    資料庫 sysaux表空間
    user_lv    資料庫 user表空間
    Undo2_lv    節點2 undo 表空間
    temp_lv    資料庫 temp表空間
    redo11_lv    資料庫重做日誌
    redo12_lv    資料庫重做日誌
    redo21_lv    資料庫重做日誌
    redo22_lv    資料庫重做日誌
    control1_lv    資料庫控制檔案
    control2_lv    資料庫控制檔案
    control3_lv    資料庫控制檔案
    spfile_lv    資料庫引數檔案
      
 
 
 
遷移到asm磁碟組資訊
磁碟組名稱    磁碟名稱    作用
    hdisk11    ocr盤
    hdisk10    vote盤
dgtest hdisk5    存放資料檔案,控制檔案,引數檔案,重做日誌檔案
    hdisk6     
    hdisk7     
 
      
 
3    實驗步驟
     前提是hdisk5,hdisk6,hdisk7,hdisk10,hdisk11已經是從儲存中劃分到p520,p650節點上,並且賦予許可權給oracle使用者,並且兩邊節點先建立好asm例項和磁碟組dgtest。
3.1    遷移ocr盤到hdisk11磁碟中
線上做,不需要停crs
檢視當前ocr盤
[oracle@p650:/oracle/app/oracle]$ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          2
         Total space (kbytes)     :     130852
         Used space (kbytes)      :       4636
         Available space (kbytes) :     126216
         ID                       : 1542042236
         Device/File Name         : /dev/rocrnewlv
         Device/File integrity check succeeded
         Cluster registry integrity check succeeded
對當前ocr盤增加鏡象
[root@p650:/crs/app/oracle/product/crs_1/bin]#./ocrconfig -replace ocrmirror /dev/rhdisk11
 
檢視鏡象後的ocr盤
ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          2
         Total space (kbytes)     :     130852
         Used space (kbytes)      :       4636
         Available space (kbytes) :     126216
         ID                       : 1542042236
         Device/File Name         : /dev/rocrnewlv
         Device/File integrity check succeeded
         Device/File Name         : /dev/rhdisk11
         Device/File integrity check succeeded
Cluster registry integrity check succeeded
從ocr盤去掉ocrnewlv裸裝置
[root@p520:/crs/app/oracle/product/crs_1/bin]#./ocrconfig -replace ocr
        檢視最後的設定,成功遷移到hdisk11磁碟中
[root@p520:/crs/app/oracle/product/crs_1/bin]#./ocrcheck 
Status of Oracle Cluster Registry is as follows :
         Version                  :          2
         Total space (kbytes)     :     130852
         Used space (kbytes)      :       4636
         Available space (kbytes) :     126216
         ID                       : 1542042236
         Device/File Name         : /dev/rhdisk11
         Device/File integrity check succeeded
         Device/File not configured
         Cluster registry integrity check succeeded
3.2    遷移vote盤到hdisk10中
需要兩邊節點停止crs
檢視當前vote盤
[root@p520:/crs/app/oracle/product/crs_1/bin]#./crsctl query css votedisk
0.     0    /dev/rvotenewv
located 1 votedisk(s).
       增加vote鏡象盤
[root@p520:/crs/app/oracle/product/crs_1/bin]#./crsctl add css votedisk '/dev/rhdisk10' -force
Now formatting voting disk: /dev/rhdisk10
successful addition of votedisk /dev/rhdisk10
       檢視鏡象後的vote盤
[root@p520:/crs/app/oracle/product/crs_1/bin]#./crsctl query css votedisk
 0.     0    /dev/rvotenewlv
 1.     0    /dev/rhdisk10
從vote盤中刪除votenewlv裸裝置
[root@p520:/crs/app/oracle/product/crs_1/bin]#./crsctl delete css votedisk '/dev/rvotenewlv' -force
successful deletion of votedisk /dev/rvotenewlv
      檢視最後vote盤,成功遷移到hdisk10磁碟中
[root@p650:/crs/app/oracle/product/crs_1/bin]#./crsctl query css votedisk
 0.     0    /dev/rhdisk10
located 1 votedisk(s).
兩邊節點啟動crs
檢視兩邊節點資源狀態
crs_stat  -t
 
3.3    設定引數到asm磁碟組中
控制檔案,資料檔案,和日誌檔案到磁碟中。
sqlplus “/as sysdba”
SQL> alter system set db_create_file_dest='+dgtest' scope=spfile;
System altered.
SQL> alter system set db_create_online_log_dest_1='+dgtest' scope=spfile;
System altered.
SQL> alter system set db_create_online_log_dest_2='+dgtest' scope=spfile;
System altered.
SQL> alter system set control_files='+dgtest/orcl/control01.ctl' scope=spfile;
System altered.
3.4    遷移控制檔案到磁碟組中 
關閉p520例項,在p650例項中做遷移
關閉p650例項,啟動到nomount狀態,恢復控制檔案到asm磁碟組中
[oracle@p650:/oracle/app/oracle]$rman target /
Recovery Manager: Release 10.2.0.4.0 - Production on Fri May 28 18:12:36 2010
Copyright (c) 1982, 2007, Oracle.  All rights reserved.
connected to target database (not started)
RMAN> startup nomount;
Oracle instance started
Total System Global Area    4982833152 bytes
Fixed Size                     2090856 bytes
Variable Size                889194648 bytes
Database Buffers            4076863488 bytes
Redo Buffers                  14684160 bytes
RMAN> restore controlfile from '/dev/rcontrol1_lv';
Starting restore at 28-MAY-10
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=147 instance=orcl2 devtype=DISK
channel ORA_DISK_1: copied control file copy
output filename=+DGTEST/orcl/control01.ctl
Finished restore at 28-MAY-10
 
RMAN> alter database mount;   --把資料庫啟動到mount狀態
database mounted
released channel: ORA_DISK_1
 
3.5    遷移資料檔案到asm磁碟組中
RMAN> backup as copy database format '+dgtest';
Starting backup at 28-MAY-10
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile fno=00001 name=/dev/rsystem_lv
output filename=+DGTEST/orcl/datafile/system.257.720209735 tag=TAG20100528T181535 recid=1 stamp=720209766
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting datafile copy
input datafile fno=00002 name=/dev/rundo1_lv
output filename=+DGTEST/orcl/datafile/undotbs1.258.720209771 tag=TAG20100528T181535 recid=2 stamp=720209792
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile copy
input datafile fno=00005 name=/dev/rundo2_lv
output filename=+DGTEST/orcl/datafile/undotbs2.259.720209797 tag=TAG20100528T181535 recid=3 stamp=720209816
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile copy
input datafile fno=00003 name=/dev/rsysaux_lv
output filename=+DGTEST/orcl/datafile/sysaux.260.720209821 tag=TAG20100528T181535 recid=4 stamp=720209834
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile fno=00004 name=/dev/ruser_lv
output filename=+DGTEST/orcl/datafile/users.261.720209837 tag=TAG20100528T181535 recid=5 stamp=720209837
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting datafile copy
copying current control file
output filename=+DGTEST/orcl/controlfile/backup.262.720209837 tag=TAG20100528T181535 recid=6 stamp=720209838
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 28-MAY-10
channel ORA_DISK_1: finished piece 1 at 28-MAY-10
piece handle=+DGTEST/orcl/backupset/2010_05_28/nnsnf0_tag20100528t181535_0.263.720209843 tag=TAG20100528T181535 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 28-MAY-10
 
RMAN> switch database to copy;
 
datafile 1 switched to datafile copy "+DGTEST/orcl/datafile/system.257.720209735"
datafile 2 switched to datafile copy "+DGTEST/orcl/datafile/undotbs1.258.720209771"
datafile 3 switched to datafile copy "+DGTEST/orcl/datafile/sysaux.260.720209821"
datafile 4 switched to datafile copy "+DGTEST/orcl/datafile/users.261.720209837"
datafile 5 switched to datafile copy "+DGTEST/orcl/datafile/undotbs2.259.720209797"
RMAN> recover database;
RMAN> alter database open;
 
3.6    遷移temp檔案到asm磁碟組中
SQL> alter tablespace temp add tempfile '+dgtest' size 100M;
Tablespace altered.
SQL> alter database tempfile '/dev/rtemp_lv' drop;
Database altered.  
 
 
3.7    遷移重做日誌到asm磁碟組中
SQL> alter database add logfile thread 1 group  5 size 50m;
Database altered.
SQL> alter database add logfile thread 1 group 6 size 50m; 
Database altered.
SQL> alter database add logfile thread 2 group 7 size 50m; 
Database altered.
SQL> alter database add logfile thread 2 group 8 size 50m;
Database altered.
SQL> alter database drop logfile group 1;
Database altered.
SQL> alter database drop logfile group 2;
Database altered.
SQL> alter database drop logfile group 3;
Database altered.
SQL> alter database drop logfile group 4;
Database altered.
3.8    對控制檔案做鏡象
SQL> alter system set control_files='+dgtest/orcl/control01.ctl','+dgtest/orcl/control02.ctl' scope=spfile;
Database altered.
SQL>  alter database backup controlfile to '+dgtest/orcl/control02.ctl';       
Database altered.
 
3.9    檢查是否全部遷移到asm磁碟組中
[oracle@p520:/oracle/app/oracle/admin/orcl/bdump]$rman target /
Recovery Manager: Release 10.2.0.4.0 - Production on Fri May 28 19:04:58 2010
Copyright (c) 1982, 2007, Oracle.  All rights reserved.
connected to target database: ORCL (DBID=1247702683)
RMAN> report schema;
using target database control file instead of recovery catalog
Report of database schema
List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    300      SYSTEM               ***     +DGTEST/orcl/datafile/system.257.720209735
2    200      UNDOTBS1             ***     +DGTEST/orcl/datafile/undotbs1.258.720209771
3    120      SYSAUX               ***     +DGTEST/orcl/datafile/sysaux.260.720209821
4    5        USERS                ***     +DGTEST/orcl/datafile/users.261.720209837
5    200      UNDOTBS2             ***     +DGTEST/orcl/datafile/undotbs2.259.720209797
 
List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
2    100      TEMP                 100         +DGTEST/orcl/tempfile/temp.264.720210427
資料檔案已經全部遷移到asm磁碟組中
SQL> select member from v$logfile;
 
MEMBER
--------------------------------------------------------------------------------
+DGTEST/orcl/onlinelog/group_5.265.720210499
+DGTEST/orcl/onlinelog/group_5.266.720210503
+DGTEST/orcl/onlinelog/group_6.267.720210527
+DGTEST/orcl/onlinelog/group_6.268.720210531
+DGTEST/orcl/onlinelog/group_7.269.720210549
+DGTEST/orcl/onlinelog/group_7.270.720210553
+DGTEST/orcl/onlinelog/group_8.271.720210575
+DGTEST/orcl/onlinelog/group_8.272.720210579
日誌檔案已經全部遷移到asm磁碟組中
8 rows selected.
 
 
SQL> select name from v$tempfile;
 
NAME
--------------------------------------------------------------------------------
+DGTEST/orcl/tempfile/temp.264.720210427
臨時資料檔案已經全部遷移到asm磁碟組中
 
SQL> select name from v$controlfile;
NAME
+DGTEST/orcl/control01.ctl
+DGTEST/orcl/control02.ctl
控制檔案已經全部遷移到asm磁碟組中
 
3.10    啟動另外一節點
sqlplus “/as sysdba”
startup
 
遷移完畢
3.11    測試
兩邊節點關閉crs和重新啟動crs
crsctl stop crs
crsctl start crs

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7199859/viewspace-666643/,如需轉載,請註明出處,否則將追究法律責任。

相關文章