OracleRAC新增asm磁碟組並設定歸檔位置

thamsyangsw發表於2013-12-15
實驗環境: 

VMware Server2+RHEL4+ASM+10gRAC

新增共享磁碟
OracleRAC新增asm磁碟組並設定歸檔位置OracleRAC新增asm磁碟組並設定歸檔位置OracleRAC新增asm磁碟組並設定歸檔位置OracleRAC新增asm磁碟組並設定歸檔位置OracleRAC新增asm磁碟組並設定歸檔位置OracleRAC新增asm磁碟組並設定歸檔位置
 

編輯rac1節點的.vmx檔案,新增紅色字型部分

disk.locking = "FALSE"

disklib.dataCacheMaxSize = "0"

disklib.dataCacheMaxReadAheadSize = "0"

disklib.dataCacheMinReadAheadSize = "0"

disklib.dataCachePageSize = "4096"

disklib.maxUnsyncedWrites = "0"

scsi1:0.deviceType = "disk"

scsi1:1.deviceType = "disk"

scsi1:2.deviceType = "disk"

scsi1:3.deviceType = "disk"

scsi1:4.deviceType = "disk"

scsi1:5.deviceType = "disk"

編輯rac2節點的.vmx檔案,新增紅色字型部分

disk.locking = "FALSE"

disklib.dataCacheMaxSize = "0"

disklib.dataCacheMaxReadAheadSize = "0"

disklib.dataCacheMinReadAheadSize = "0"

disklib.dataCachePageSize = "4096"

disklib.maxUnsyncedWrites = "0"

scsi1:0.deviceType = "disk"

scsi1:1.deviceType = "disk"

scsi1:2.deviceType = "disk"

scsi1:3.deviceType = "disk"

scsi1:4.deviceType = "disk"

scsi1:5.deviceType = "disk"

scsi1:5.present = "TRUE"

scsi1:5.fileName = "E:\Virtual Machines\ShareStorage\arvhice.vmdk"

scsi1:5.writeThrough = "TRUE"

scsi1:5.mode = "independent-persistent"

啟動兩個節點rac1,rac2
在rac1節點上

[root@rac1 ~]# fdisk -l

… … … …

Disk /dev/sdg: 8589 MB, 8589934592 bytes

255 heads, 63 sectors/track, 1044 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdg doesn't contain a valid partition table

[root@rac1 ~]# fdisk /dev/sdg

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel

Building a new DOS disklabel. Changes will remain in memory only,

until you decide to write them. After that, of course, the previous

content won't be recoverable.

The number of cylinders for this disk is set to 1044.

There is nothing wrong with that, but this is larger than 1024,

and could in certain setups cause problems with:

1) software that runs at boot time (e.g., old versions of LILO)

2) booting and partitioning software from other OSs

   (e.g., DOS FDISK, OS/2 FDISK)

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): n

Command action

   e   extended

   p   primary partition (1-4)

p

Partition number (1-4): 1

First cylinder (1-1044, default 1):

Using default value 1

Last cylinder or +size or +sizeM or +sizeK (1-1044, default 1044):

Using default value 1044

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.
檢視rac2節點的磁碟分割槽情況

[root@rac2 ~]# fdisk -l

… … … …

Disk /dev/sdg: 8589 MB, 8589934592 bytes

255 heads, 63 sectors/track, 1044 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

/dev/sdg1               1        1044     8385898+  83  Linux

在rac1節點上建立asm磁碟

[root@rac1 ~]# service oracleasm createdisk VOL4 /dev/sdg1

Marking disk "VOL4" as an ASM disk: [  OK  ]

[root@rac1 ~]# service oracleasm listdisks

VOL1

VOL2

VOL3

VOL4

重新配置下rac2節點的asm
[root@rac2 ~]# service oracleasm configure

Configuring the Oracle ASM library driver.

This will configure the on-boot properties of the Oracle ASM library

driver.  The following questions will determine whether the driver is

loaded on boot and what permissions it will have.  The current values

will be shown in brackets ('[]').  Hitting without typing an

answer will keep that current value.  Ctrl-C will abort.

Default user to own the driver interface [oracle]:

Default group to own the driver interface [dba]:

Start Oracle ASM library driver on boot (y/n) [y]:

Scan for Oracle ASM disks on boot (y/n) [y]:

Writing Oracle ASM library driver configuration: done

Initializing the Oracle ASMLib driver: [  OK  ]

Scanning the system for Oracle ASMLib disks: [  OK  ]

[root@rac2 ~]# service oracleasm listdisks

VOL1

VOL2

VOL3

VOL4

下面新增asm磁碟組
OracleRAC新增asm磁碟組並設定歸檔位置OracleRAC新增asm磁碟組並設定歸檔位置OracleRAC新增asm磁碟組並設定歸檔位置OracleRAC新增asm磁碟組並設定歸檔位置OracleRAC新增asm磁碟組並設定歸檔位置OracleRAC新增asm磁碟組並設定歸檔位置OracleRAC新增asm磁碟組並設定歸檔位置

OracleRAC新增asm磁碟組並設定歸檔位置
OracleRAC新增asm磁碟組並設定歸檔位置

在rac1節點上

[root@rac1 ~]# su - oracle

[oracle@rac1 ~]$ export ORACLE_SID=+ASM1

[oracle@rac1 ~]$ asmcmd

ASMCMD> lsdg   

State    Type    Rebal  Unbal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Name

MOUNTED  EXTERN  N      N         512   4096  1048576      8189     8096                0            8096              0  ARCHIVE/

MOUNTED  NORMAL  N      N         512   4096  1048576      8188     5852                0            2926              0  DG1/

MOUNTED  EXTERN  N      N         512   4096  1048576      4094     3760                0            3760              0  RECOVERY/
可以看到rac1節點的asm已經加了archive磁碟組,並且自動mount上該磁碟組
在rac2節點上檢視下,也可以看到archive磁碟組新增成功並mount狀態

[root@rac2 ~]# su - oracle

[oracle@rac2 ~]$ export ORACLE_SID=+ASM2

[oracle@rac2 ~]$ asmcmd

ASMCMD> lsdg

State    Type    Rebal  Unbal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Name

MOUNTED  EXTERN  N      N         512   4096  1048576      8189     8096                0            8096              0  ARCHIVE/

MOUNTED  NORMAL  N      N         512   4096  1048576      8188     5852                0            2926              0  DG1/

MOUNTED  EXTERN  N      N         512   4096  1048576      4094     3760                0            3760              0  RECOVERY/
關掉rac1和rac2兩個例項

[oracle@rac1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Sun Dec 15 16:16:52 2013

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

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, Real Application Clusters, OLAP and Data Mining options

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

[oracle@rac2 ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Sun Dec 15 16:18:19 2013

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

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, Real Application Clusters, OLAP and Data Mining options

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

啟動rac1例項,資料庫到mount狀態

SQL> startup mount;

ORACLE instance started.

Total System Global Area  285212672 bytes

Fixed Size                  1218992 bytes

Variable Size             104859216 bytes

Database Buffers          176160768 bytes

Redo Buffers                2973696 bytes

Database mounted.

檢視例項的歸檔狀態

SQL> archive log list;

Database log mode              No Archive Mode

Automatic archival             Disabled

Archive destination            USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence     5

Current log sequence           6

rac1例項上設定歸檔位置

SQL> alter system set log_archive_dest_1='location=+archive/' sid='*';

System altered.

rac1例項上切換歸檔模式

SQL> alter database archivelog;

Database altered.

rac1例項上開啟資料庫到open狀態

SQL> alter database open;

Database altered.

rac1例項上檢視歸檔模式

SQL> archive log list;

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            +ARCHIVE

Oldest online log sequence     5

Next log sequence to archive   6

Current log sequence           6

開啟rac2例項並檢視歸檔狀態

SQL> startup

ORACLE instance started.

Total System Global Area  285212672 bytes

Fixed Size                  1218992 bytes

Variable Size             121636432 bytes

Database Buffers          159383552 bytes

Redo Buffers                2973696 bytes

Database mounted.

Database opened.

SQL> archive log list;

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            +ARCHIVE

Oldest online log sequence     2

Next log sequence to archive   3

Current log sequence           3

rac1rac2例項上分別手動歸檔線上日誌檔案

rac1例項上

SQL> alter system archive log current;

System altered.

rac2例項上

SQL> alter system archive log current;

System altered.

rac1例項上進行檢視驗證

SQL> exit

Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, Real Application Clusters, OLAP and Data Mining options

[oracle@rac1 ~]$ export ORACLE_SID=+ASM1

[oracle@rac1 ~]$ asmcmd

ASMCMD> lsdg

State    Type    Rebal  Unbal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Name

MOUNTED  EXTERN  N      N         512   4096  1048576      8189     8076                0            8076              0  ARCHIVE/

MOUNTED  NORMAL  N      N         512   4096  1048576      8188     5852                0            2926              0  DG1/

MOUNTED  EXTERN  N      N         512   4096  1048576      4094     3760                0            3760              0  RECOVERY/

ASMCMD> cd +archive/prod/archivelog/2013_12_15

ASMCMD> ls

thread_1_seq_6.256.834252029

thread_1_seq_7.259.834252109

thread_2_seq_3.257.834252091

thread_2_seq_4.258.834252105

可以看到剛剛歸檔的兩個節點的歸檔日誌,Oracle RAC的歸檔模式就切換完畢了。


 

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

相關文章