Lưu ý quan trọng: Bài đăng này chỉ áp dụng cho Cơ sở dữ liệu Oracle 11gR2 trở đi. Các bước cho 11gR1 và các phiên bản trước đó là khác nhau. Ngoài ra các bước này dành cho các đĩa OCR và voting disk được lưu trữ trên hệ thống cluster file được chứng nhận . Nếu bạn đang sử dụng thiết bị ASM hoặc Raw để lưu trữ các tệp này thì các tác vụ chuẩn bị ban đầu có thể khác
Xin lưu ý rằng Oracle Cluster yêu cầu duy trì trong suốt quá trình hoạt động này. Để an toàn hơn, chúng tôi đã tắt cơ sở dữ liệu trong thời gian này nhưng điều này là không bắt buộc. Các cụm đã được lên và chạy trong hoạt động này.
Di chuyển đĩa OCR (Oracle Cluster Registry)
1) Kiểm tra các đĩa OCR hiện có
root@rachost1 # /app/oracle/11.2.0/grid/bin/ocrcheck
-co
|
-nfig
|
Oracle Cluster Registry configuration is :
Device/File Name : /u01/racfiles/ocr
Device/File Name : /u02/racfiles/ocr
Device/File Name : /u03/racfiles/ocr
2) Chuẩn bị đĩa mới
root@rachost1 # mkdir
/u04/racfiles
root@rachost1 # chown
root:dba /u04/racfiles/
root@rachost1 # touch
/u04/racfiles/ocr
root@rachost1 # chown
root:dba /u04/racfiles/ocr
root@rachost1 # chmod 640
/u04/racfiles/ocr
3) Kiểm tra các bản sao lưu hiện tại cho OCR
root@rachost1 # /app/oracle/11.2.0/grid/bin/ocrconfig
-showbackup
rachost1 2014/04/16 11:26:48
/app/oracle/11.2.0/grid/cdata/cluster/backup00.ocr
rachost1 2014/04/16 07:26:47
/app/oracle/11.2.0/grid/cdata/cluster/backup01.ocr
rachost1 2014/04/16 03:26:46
/app/oracle/11.2.0/grid/cdata/cluster/backup02.ocr
rachost1 2014/04/15 03:26:41
/app/oracle/11.2.0/grid/cdata/cluster/day.ocr
rachost1 2014/04/03 03:25:47
/app/oracle/11.2.0/grid/cdata/cluster/week.ocr
PROT-25: Manual backups for the Oracle Cluster Registry are not
available
4) Thực hiện một bản sao lưu thủ công nếu cần
root@rachost1 # /app/oracle/11.2.0/grid/bin/ocrconfig
-manualbackup
rachost1 2014/04/16 11:40:47
/app/oracle/11.2.0/grid/cdata/cluster/backup_20140416_114047.ocr
root@rachost1 # /app/oracle/11.2.0/grid/bin/ocrconfig
-showbackup
rachost1 2014/04/16 11:26:48
/app/oracle/11.2.0/grid/cdata/cluster/backup00.ocr
rachost1 2014/04/16 07:26:47
/app/oracle/11.2.0/grid/cdata/cluster/backup01.ocr
rachost1 2014/04/16 03:26:46
/app/oracle/11.2.0/grid/cdata/cluster/backup02.ocr
rachost1 2014/04/15 03:26:41
/app/oracle/11.2.0/grid/cdata/cluster/day.ocr
rachost1 2014/04/03 03:25:47
/app/oracle/11.2.0/grid/cdata/cluster/week.ocr
rachost1 2014/04/16 11:40:47
/app/oracle/11.2.0/grid/cdata/cluster/backup_20140416_114047.ocr
5) Thêm đĩa OCR mới
Note: Since OCR
allows 1+4 OCR mirror files and we already have 3 existing OCR files, so we
will add 2 new disks now and then later add 3rd one
after removing existing disks
root@rachost1 # /app/oracle/11.2.0/grid/bin/ocrconfig
-add /u04/racfiles/ocr
root@rachost1 # /app/oracle/11.2.0/grid/bin/ocrcheck
-config
Oracle Cluster Registry configuration is :
Device/File Name : /u01/racfiles/ocr
Device/File Name : /u02/racfiles/ocr
Device/File Name : /u03/racfiles/ocr
Device/File Name : /u04/racfiles/ocr
root@rachost1 # mkdir
/u05/racfiles
root@rachost1 # chown
root:dba /u05/racfiles
root@rachost1 # touch
/u05/racfiles/ocr
root@rachost1 # chown
root:dba /u05/racfiles/ocr
root@rachost1 # chmod 640
/u05/racfiles/ocr
root@rachost1 # /app/oracle/11.2.0/grid/bin/ocrconfig
-add /u05/racfiles/ocr
6) Kiểm tra cấu hình OCR mới
root@rachost1 # /app/oracle/11.2.0/grid/bin/ocrcheck
-config
Oracle Cluster Registry configuration is :
Device/File Name : /u01/racfiles/ocr
Device/File Name : /u02/racfiles/ocr
Device/File Name : /u03/racfiles/ocr
Device/File Name : /u04/racfiles/ocr
Device/File Name : /u05/racfiles/ocr
root@rachost1 # /app/oracle/11.2.0/grid/bin/ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 3
Total space (kbytes) : 262120
Used space (kbytes) : 2632
Available space (kbytes) : 259488
ID : 1510948299
Device/File Name : /u01/racfiles/ocr
Device/File integrity check succeeded
Device/File Name : /u02/racfiles/ocr
Device/File integrity check succeeded
Device/File Name : /u03/racfiles/ocr
Device/File integrity check succeeded
Device/File Name : /u04/racfiles/ocr
Device/File integrity check succeeded
Device/File Name : /u05/racfiles/ocr
Device/File integrity check succeeded
Cluster registry integrity check succeeded
Logical corruption check succeeded
7) Xóa tệp OCR hiện có
root@rachost1 # /app/oracle/11.2.0/grid/bin/ocrconfig
-delete /u03/racfiles/ocr
root@rachost1 # /app/oracle/11.2.0/grid/bin/ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 3
Total space (kbytes) : 262120
Used space (kbytes) : 2632
Available space (kbytes) : 259488
ID : 1510948299
Device/File Name : /u01/racfiles/ocr
Device/File integrity check succeeded
Device/File Name : /u02/racfiles/ocr
Device/File integrity check succeeded
Device/File Name : /u04/racfiles/ocr
Device/File integrity check succeeded
Device/File Name : /u05/racfiles/ocr
Device/File integrity check succeeded
Device/File not configured
Cluster registry integrity check succeeded
Logical corruption check succeeded
8) Thêm tệp OCR mới và xóa các tệp OCR còn lại (nếu cần)
root@rachost1 # mkdir
/u06/racfiles
root@rachost1 # chown
root:dba /u06/racfiles
root@rachost1 # touch
/u06/racfiles/ocr
root@rachost1 # chown
root:dba /u06/racfiles/ocr
root@rachost1 # chmod 640
/u06/racfiles/ocr
root@rachost1 # /app/oracle/11.2.0/grid/bin/ocrconfig
-add /u06/racfiles/ocr
root@rachost1 # /app/oracle/11.2.0/grid/bin/ocrconfig
-delete /u02/racfiles/ocr
root@rachost1 # /app/oracle/11.2.0/grid/bin/ocrconfig
-delete /u01/racfiles/ocr
I) Cuối cùng kiểm tra cấu hình OCR sau khi thêm và xóa
root@rachost1 # /app/oracle/11.2.0/grid/bin/ocrcheck
-config
Oracle Cluster Registry configuration is :
Device/File Name : /u04/racfiles/ocr
Device/File Name : /u05/racfiles/ocr
Device/File Name : /u06/racfiles/ocr
root@rachost1 # /app/oracle/11.2.0/grid/bin/ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 3
Total space (kbytes) : 262120
Used space (kbytes) : 2632
Available space (kbytes) : 259488
ID : 1510948299
Device/File Name : /u04/racfiles/ocr
Device/File integrity check succeeded
Device/File Name : /u05/racfiles/ocr
Device/File integrity check succeeded
Device/File Name : /u06/racfiles/ocr
Device/File integrity check succeeded
Device/File not configured
Device/File not configured
Cluster registry integrity check succeeded
Logical corruption check succeeded
9) Thực hiện sao lưu thủ công khác nếu cần
root@rachost1 # /app/oracle/11.2.0/grid/bin/ocrconfig
-manualbackup
rachost1 2014/04/16 12:04:10
/app/oracle/11.2.0/grid/cdata/cluster/backup_20140416_120410.ocr
rachost1 2014/04/16 11:40:47
/app/oracle/11.2.0/grid/cdata/cluster/backup_20140416_114047.ocr
Di chuyển voting disk: Dừng CRS trước khi thực hiện
For Voting disks (11gR2 onwards), wchúng tôi không cần sao lưu vì sao lưu được tự động thực hiện trong quá trình sao lưu OCR và trong mọi thao tác thêm/xóa cho các voting disk. Ngoài ra, chúng tôi không cần chuẩn bị trước các đĩa như chúng tôi đã làm cho các đĩa OCR
1) Kiểm tra voting disk hiện có
root@rachost1 # /app/oracle/11.2.0/grid/bin/crsctl
query css votedisk
## STATE File Universal Id File Name Disk group
— —– —————– ——— ———
1. ONLINE a6b7e116f7fd4f7abfd1b85386655bde (/u01/racfiles/vdisk)
[]
2. ONLINE 627187c834d64fc0bf8bf27290054c13 (/u02/racfiles/vdisk)
[]
3. ONLINE 5242884e87334f58bf536e322ba9d557 (/u03/racfiles/vdisk)
[]
Located 3 voting disk(s).
2) Thêm voting disk
root@rachost1 # /app/oracle/11.2.0/grid/bin/crsctl
add css votedisk /u04/racfiles/vdisk
Now formatting voting disk: /u04/racfiles/vdisk.
CRS-4603: Successful addition of voting disk
/u04/racfiles/vdisk.
root@rachost1 # /app/oracle/11.2.0/grid/bin/crsctl
add css votedisk /u05/racfiles/vdisk
Now formatting voting disk: /u05/racfiles/vdisk.
CRS-4603: Successful addition of voting disk
/u05/racfiles/vdisk.
root@rachost1 # /app/oracle/11.2.0/grid/bin/crsctl
add css votedisk /u06/racfiles/vdisk
Now formatting voting disk: /u06/racfiles/vdisk.
CRS-4603: Successful addition of voting disk
/u06/racfiles/vdisk.
3) Xóa voting disk hiện có được yêu cầu di chuyển
root@rachost1 # /app/oracle/11.2.0/grid/bin/crsctl
query css votedisk
## STATE File Universal Id File Name Disk group
— —– —————– ——— ———
1. ONLINE a6b7e116f7fd4f7abfd1b85386655bde (/u01/racfiles/vdisk)
[]
2. ONLINE 627187c834d64fc0bf8bf27290054c13 (/u02/racfiles/vdisk)
[]
3. ONLINE 5242884e87334f58bf536e322ba9d557 (/u03/racfiles/vdisk)
[]
4. ONLINE 5e842268d1f34fd5bf2eee25a7529233 (/u04/racfiles/vdisk)
[]
5. ONLINE aa02617e01804fe7bf5cd40d5da6bc8e (/u05/racfiles/vdisk)
[]
6. ONLINE 0ac52c14753e4ff7bf79e8e013e530b6 (/u06/racfiles/vdisk)
[]
Located 6 voting disk(s).
4) Xóa Voting Disks hiện có được yêu cầu di chuyển
root@rachost1 # /app/oracle/11.2.0/grid/bin/crsctl
delete css votedisk /u03/racfiles/vdisk
CRS-4611: Successful deletion of voting disk
/u03/racfiles/vdisk.
root@rachost1 # /app/oracle/11.2.0/grid/bin/crsctl
delete css votedisk /u02/racfiles/vdisk
CRS-4611: Successful deletion of voting disk
/u02/racfiles/vdisk.
root@rachost1 # /app/oracle/11.2.0/grid/bin/crsctl
delete css votedisk /u01/racfiles/vdisk
CRS-4611: Successful deletion of voting disk
/u01/racfiles/vdisk.
5) CKiểm tra cấu hình Voting disks mới
root@rachost1 # /app/oracle/11.2.0/grid/bin/crsctl
query css votedisk
## STATE File Universal Id File Name Disk group
— —– —————– ——— ———
1. ONLINE 5e842268d1f34fd5bf2eee25a7529233 (/u04/racfiles/vdisk)
[]
2. ONLINE aa02617e01804fe7bf5cd40d5da6bc8e (/u05/racfiles/vdisk)
[]
3. ONLINE 0ac52c14753e4ff7bf79e8e013e530b6 (/u06/racfiles/vdisk)
[]
Located 3 voting disk(s).
Thay thế
6) Khởi động lại dịch vụ Cluster để đảm bảo rằng mọi thứ đều ổn sau chuyển đổi
root@rachost1 # /app/oracle/11.2.0/grid/bin/crs_stop
-all
root@rachost1 # /app/oracle/11.2.0/grid/bin/crsctl
stop crs
root@rachost2 # /app/oracle/11.2.0/grid/bin/crsctl stop crs
root@rachost1 # /app/oracle/11.2.0/grid/bin/crsctl
start crs
root@rachost2 # /app/oracle/11.2.0/grid/bin/crsctl start crs
root@rachost1 # /app/oracle/11.2.0/grid/bin/crs_stat
-t
Name Type Target State Host
————————————————————
ora….ER.lsnr ora….er.type OFFLINE OFFLINE
ora….N1.lsnr ora….er.type OFFLINE OFFLINE
ora….SM1.asm application OFFLINE OFFLINE
ora….01.lsnr application OFFLINE OFFLINE
ora….h01.gsd application OFFLINE OFFLINE
ora….h01.ons application ONLINE ONLINE rachost1
ora….h01.vip ora….t1.type OFFLINE OFFLINE
ora….SM2.asm application OFFLINE OFFLINE
ora….02.lsnr application OFFLINE OFFLINE
ora….h02.gsd application OFFLINE OFFLINE
ora….h02.ons application ONLINE ONLINE rachost2
ora….h02.vip ora….t1.type OFFLINE OFFLINE
ora.asm ora.asm.type OFFLINE OFFLINE
ora.eons ora.eons.type ONLINE ONLINE rachost1
ora.gsd ora.gsd.type OFFLINE OFFLINE
ora….network ora….rk.type ONLINE ONLINE rachost1
ora.oc4j ora.oc4j.type OFFLINE OFFLINE
ora.ons ora.ons.type ONLINE ONLINE rachost1
ora.scan1.vip ora….ip.type OFFLINE OFFLINE
root@rachost1 # /app/oracle/11.2.0/grid/bin/crs_start
-all
root@rachost1 # /app/oracle/11.2.0/grid/bin/crs_stat
-t
Name Type Target State Host
————————————————————
ora….ER.lsnr ora….er.type ONLINE ONLINE rachost1
ora….N1.lsnr ora….er.type ONLINE ONLINE rachost1
ora….SM1.asm application ONLINE ONLINE rachost1
ora….01.lsnr application ONLINE ONLINE rachost1
ora….h01.gsd application OFFLINE OFFLINE
ora….h01.ons application ONLINE ONLINE rachost1
ora….h01.vip ora….t1.type ONLINE ONLINE rachost1
ora….SM2.asm application ONLINE ONLINE rachost2
ora….02.lsnr application ONLINE ONLINE rachost2
ora….h02.gsd application OFFLINE OFFLINE
ora….h02.ons application ONLINE ONLINE rachost2
ora….h02.vip ora….t1.type ONLINE ONLINE rachost2
ora.asm ora.asm.type ONLINE ONLINE rachost1
ora.eons ora.eons.type ONLINE ONLINE rachost1
ora.gsd ora.gsd.type OFFLINE OFFLINE
ora….network ora….rk.type ONLINE ONLINE rachost1
ora.oc4j ora.oc4j.type OFFLINE OFFLINE
ora.ons ora.ons.type ONLINE ONLINE rachost1
ora.scan1.vip ora….ip.type ONLINE ONLINE rachost1
-bash-3.2$ srvctl status
database -d dbname
Instance dbname1 is running on node rachost1
Instance dbname2 is running on node rachost2