用vmware體驗Oracle10g的ASM資料庫
vmware版本:vmware server console 1.0.5
資料庫版本:10.2.0.1
OS版本:rhel4 u4
參考
資料庫是之前就安裝好的,準備增加幾個ASM裝置來體驗一下ASM管理的資料檔案
1.先用vmware的vdiskmanager工具建立了六個磁碟
C:Program FilesVMwareVMware Server>vmware-vdiskmanager.exe -c -s 100Mb -a lsilo
gic -t 2 D:Virtual Machinessingle RHEL4_31asmasm01.vmdk
Using log file C:DOCUME~1L5MLOCALS~1Tempvmware-L5Mvdiskmanager.log
Creating monolithic preallocated disk 'D:Virtual Machinessingle RHEL4_31asmasm01.vmdk'
Create: 100% done.
Virtual disk creation successful.
C:Program FilesVMwareVMware Server>vmware-vdiskmanager.exe -c -s 100Mb -a lsilo
gic -t 2 D:Virtual Machinessingle RHEL4_31asmasm02.vmdk
Using log file C:DOCUME~1L5MLOCALS~1Tempvmware-L5Mvdiskmanager.log
Creating monolithic preallocated disk 'D:Virtual Machinessingle RHEL4_31asmasm02.vmdk'
Create: 100% done.
Virtual disk creation successful.
C:Program FilesVMwareVMware Server>vmware-vdiskmanager.exe -c -s 100Mb -a lsilo
gic -t 2 D:Virtual Machinessingle RHEL4_31asmasm03.vmdk
Using log file C:DOCUME~1L5MLOCALS~1Tempvmware-L5Mvdiskmanager.log
Creating monolithic preallocated disk 'D:Virtual Machinessingle RHEL4_31asmasm03.vmdk'
Create: 100% done.
Virtual disk creation successful.
C:Program FilesVMwareVMware Server>vmware-vdiskmanager.exe -c -s 100Mb -a lsilo
gic -t 2 D:Virtual Machinessingle RHEL4_31asmasm04.vmdk
Using log file C:DOCUME~1L5MLOCALS~1Tempvmware-L5Mvdiskmanager.log
Creating monolithic preallocated disk 'D:Virtual Machinessingle RHEL4_31asmasm04.vmdk'
Create: 100% done.
Virtual disk creation successful.
C:Program FilesVMwareVMware Server>vmware-vdiskmanager.exe -c -s 100Mb -a lsilo
gic -t 2 D:Virtual Machinessingle RHEL4_31asmasm05.vmdk
Using log file C:DOCUME~1L5MLOCALS~1Tempvmware-L5Mvdiskmanager.log
Creating monolithic preallocated disk 'D:Virtual Machinessingle RHEL4_31asmasm05.vmdk'
Create: 100% done.
Virtual disk creation successful.
C:Program FilesVMwareVMware Server>vmware-vdiskmanager.exe -c -s 100Mb -a lsilo
gic -t 2 D:Virtual Machinessingle RHEL4_31asmasm06.vmdk
Using log file C:DOCUME~1L5MLOCALS~1Tempvmware-L5Mvdiskmanager.log
Creating monolithic preallocated disk 'D:Virtual Machinessingle RHEL4_31asmasm06.vmdk'
Create: 100% done.
Virtual disk creation successful.
2.在虛擬機器的Red Hat Enterprise Linux 4.vmx檔案裡增加以下內容
scsi1.present = "TRUE"
scsi1.virtualDev = "lsilogic"
scsi1.sharedBus = "virtual"
scsi1:1.present = "TRUE"
scsi1:1.mode = "independent-persistent"
scsi1:1.filename = "D:Virtual Machinessingle RHEL4_31asmasm01.vmdk"
scsi1:1.deviceType = "disk"
scsi1:2.present = "TRUE"
scsi1:2.mode = "independent-persistent"
scsi1:2.filename = "D:Virtual Machinessingle RHEL4_31asmasm02.vmdk"
scsi1:2.deviceType = "disk"
scsi1:3.present = "TRUE"
scsi1:3.mode = "independent-persistent"
scsi1:3.filename = "D:Virtual Machinessingle RHEL4_31asmasm03.vmdk"
scsi1:3.deviceType = "disk"
scsi1:4.present = "TRUE"
scsi1:4.mode = "independent-persistent"
scsi1:4.filename = "D:Virtual Machinessingle RHEL4_31asmasm04.vmdk"
scsi1:4.deviceType = "disk"
scsi1:5.present = "TRUE"
scsi1:5.mode = "independent-persistent"
scsi1:5.filename = "D:Virtual Machinessingle RHEL4_31asmasm05.vmdk"
scsi1:5.deviceType = "disk"
scsi1:6.present = "TRUE"
scsi1:6.mode = "independent-persistent"
scsi1:6.filename = "D:Virtual Machinessingle RHEL4_31asmasm06.vmdk"
scsi1:6.deviceType = "disk"
disk.locking = "false"
diskLib.dataCacheMaxSize = "0"
diskLib.dataCacheMaxReadAheadSize = "0"
diskLib.DataCacheMinReadAheadSize = "0"
diskLib.dataCachePageSize = "4096"
diskLib.maxUnsyncedWrites = "0"
3.啟動虛擬機器,安裝ASM包
[root@rhel131 source]# rpm -ivh oracleasm-support-2.0.3-1.i386.rpm
Preparing... ########################################### [100%]
1:oracleasm-support ########################################### [100%]
[root@rhel131 source]# rpm -ivh oracleasm-2.6.9-42.ELsmp-2.0.3-1.i686.rpm
Preparing... ########################################### [100%]
1:oracleasm-2.6.9-42.ELsm############################################### [100%]
[root@rhel131 source]# rpm -ivh oracleasmlib-2.0.2-1.i386.rpm
Preparing... ########################################### [100%]
1:oracleasmlib ########################################### [100%]
4.建立ASM
建立ASM之前,需要將幾個磁碟fdisk成分割槽,否則ASM不認。
[root@rhel131 source]# fdisk /dev/sdb
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.
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):
Value out of range.
Partition number (1-4): 1
First cylinder (1-130, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-130, default 130):
Using default value 130
Command (m for help): w
The partition table has been altered!
5.用oracleasm建立ASM所能識別的盤
[root@rhel131 source]# /etc/init.d/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 []: oinstall
Start Oracle ASM library driver on boot (y/n) [n]: y
Fix permissions of Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: [ OK ]
Creating /dev/oracleasm mount point: [ OK ]
Loading module "oracleasm": [ OK ]
Mounting ASMlib driver filesystem: [ OK ]
Scanning system for ASM disks: [ OK ]
[root@rhel131 source]# /etc/init.d/oracleasm createdisk VOL1 /dev/sdb1
Marking disk "/dev/sdb1" as an ASM disk: [ OK ]
[root@rhel131 source]# /etc/init.d/oracleasm createdisk VOL2 /dev/sdc1
Marking disk "/dev/sdc1" as an ASM disk: [ OK ]
[root@rhel131 source]# /etc/init.d/oracleasm createdisk VOL3 /dev/sdd1
Marking disk "/dev/sdd1" as an ASM disk: [ OK ]
[root@rhel131 source]# /etc/init.d/oracleasm createdisk VOL4 /dev/sde1
Marking disk "/dev/sde1" as an ASM disk: [ OK ]
[root@rhel131 source]# /etc/init.d/oracleasm createdisk VOL5 /dev/sdf1
Marking disk "/dev/sdf1" as an ASM disk: [ OK ]
[root@rhel131 source]# /etc/init.d/oracleasm createdisk VOL6 /dev/sdg1
Marking disk "/dev/sdg1" as an ASM disk: [ OK ]
驗正一下
[root@rhel131 rc3.d]# /etc/init.d/oracleasm listdisks
VOL1
VOL2
VOL3
VOL4
VOL5
VOL6
6.建立ASM例項
我是用DBCA建立的ASM例項,在建立例項之前需要執行一個指令碼配置CSS
$ORACLE_HOME/bin/localconfig add
ASM例項建好後在$ORACLE_HOME/dbs下會有AS例項的SPFILE
[oracle@rhel131 dbs]$ cat spfile+ASM.ora
*.background_dump_dest='/u01/app/oracle/admin/+ASM/bdump'
*.core_dump_dest='/u01/app/oracle/admin/+ASM/cdump'
*.instance_type='asm'
*.large_pool_size=12M
*.remote_login_passwordfile='SHARED'
*.user_dump_dest='/u01/app/oracle/admin/+ASM/udump'
7.啟動ASM例項
[oracle@rhel131 dbs]$ export ORACLE_SID=+ASM
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Feb 16 20:04:50 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ASM instance started
Total System Global Area 83886080 bytes
Fixed Size 1217836 bytes
Variable Size 57502420 bytes
ASM Cache 25165824 bytes
ORA-15110: no diskgroups mounted
SQL>
8.建立ASM diskgroup
SQL> create diskgroup dgroup1 normal redundancy
2 failgroup fgroup1 disk 'ORCL:VOL1','ORCL:VOL2'
3 failgroup fgroup2 disk 'ORCL:VOL3','ORCL:VOL4';
Diskgroup created.
SQL> select GROUP_NUMBER,NAME,SECTOR_SIZE,BLOCK_SIZE,ALLOCATION_UNIT_SIZE,STATE,TOTAL_MB,FREE_MB from v$asm_diskgroup;
GROUP_NUMBER NAME SECTOR_SIZE BLOCK_SIZE ALLOCATION_UNIT_SIZE STATE TOTAL_MB FREE_MB
------------ ---------- ----------- ---------- -------------------- ----------- ---------- ----------
1 DGROUP1 512 4096 1048576 MOUNTED 396 290
SQL> alter diskgroup dgroup1 add disk 'ORCL:VOL5';
Diskgroup altered.
SQL> select group_number,disk_number,mount_status,header_status,state,total_mb,free_mb,name,failgroup from v$asm_disk
2 order by disk_number;
GROUP_NUMBER DISK_NUMBER MOUNT_S HEADER_STATU STATE TOTAL_MB FREE_MB NAME FAILGROUP
------------ ----------- ------- ------------ -------- ---------- ---------- ---------- ------------------------------
1 0 CACHED MEMBER NORMAL 99 73 VOL1 FGROUP1
1 1 CACHED MEMBER NORMAL 99 72 VOL2 FGROUP1
1 2 CACHED MEMBER NORMAL 99 72 VOL3 FGROUP2
1 3 CACHED MEMBER NORMAL 99 73 VOL4 FGROUP2
1 4 CACHED MEMBER NORMAL 99 48 VOL5 VOL5
0 5 CLOSED PROVISIONED NORMAL 99 0
6 rows selected.
Since no FAILGROUP clauses are included in the ALTER DISKGROUP statement, each disk is assigned to its own failgroup. The NAME clauses assign names to the disks, otherwise they would have been assigned system generated names.
如果在增加disk時沒有指定failgroup子句,則failgroup則是增加的磁碟自己。
SQL> alter diskgroup dgroup1 drop disk VOL5;
Diskgroup altered.
SQL> ALTER DISKGROUP DGROUP1 ADD FAILGROUP FGROUP1 DISK 'ORCL:VOL5' FAILGROUP FGROUP2 DISK 'ORCL:VOL6';
Diskgroup altered.
SQL> select group_number,disk_number,mount_status,header_status,state,total_mb,free_mb,name,failgroup from v$asm_disk order by PATH;
GROUP_NUMBER DISK_NUMBER MOUNT_S HEADER_STATU STATE TOTAL_MB FREE_MB NAME FAILGROUP
------------ ----------- ------- ------------ -------- ---------- ---------- ---------- ------------------------------
1 0 CACHED MEMBER NORMAL 99 81 VOL1 FGROUP1
1 1 CACHED MEMBER NORMAL 99 80 VOL2 FGROUP1
1 2 CACHED MEMBER NORMAL 99 80 VOL3 FGROUP2
1 3 CACHED MEMBER NORMAL 99 81 VOL4 FGROUP2
1 4 CACHED MEMBER NORMAL 99 81 VOL5 FGROUP1
1 5 CACHED MEMBER NORMAL 99 81 VOL6 FGROUP2
6 rows selected.
在alter期間可以透過v$asm_operation檢視檢查資料庫的auto rebalance工作進度,資料庫已將原來分佈在兩個磁碟上的資料平均分配到三個磁碟上
SQL> alter diskgroup dgroup1 drop disk 'VOL5';
Diskgroup altered.
SQL> select group_number,disk_number,mount_status,header_status,state,total_mb,free_mb,name,failgroup from v$asm_disk order by PATH;
GROUP_NUMBER DISK_NUMBER MOUNT_S HEADER_STATU STATE TOTAL_MB FREE_MB NAME FAILGROUP
------------ ----------- ------- ------------ -------- ---------- ---------- ---------- ------------------------------
1 0 CACHED MEMBER NORMAL 99 73 VOL1 FGROUP1
1 1 CACHED MEMBER NORMAL 99 72 VOL2 FGROUP1
1 2 CACHED MEMBER NORMAL 99 80 VOL3 FGROUP2
1 3 CACHED MEMBER NORMAL 99 82 VOL4 FGROUP2
0 0 CLOSED FORMER NORMAL 99 0
1 5 CACHED MEMBER NORMAL 99 80 VOL6 FGROUP2
6 rows selected.
刪除掉FAILGROUP FGROUP2其中一個disk後,此時FGROUP1有兩個磁碟,而FGROUP2有三個磁碟,這說明每個FAILGROUP的磁碟個數不必相同。
9.TEMPLATE的測試
Available attributes include:
UNPROTECTED - No mirroring or striping regardless of the redundancy setting.
MIRROR - Two-way mirroring for normal redundancy and three-way mirroring for high redundancy. This attribute cannot be set for external redundancy.
COARSE - Specifies lower granuality for striping. This attribute cannot be set for external redundancy.
FINE - Specifies higher granularity for striping. This attribute cannot be set for external redundancy.
SQL> ALTER DISKGROUP dgroup1 ADD TEMPLATE reliable ATTRIBUTES (MIRROR FINE);
Diskgroup altered.
SQL> select * From V$ASM_TEMPLATE where name='RELIABLE';
GROUP_NUMBER ENTRY_NUMBER REDUND STRIPE S NAME
------------ ------------ ------ ------ - ----------
1 13 MIRROR FINE N RELIABLE
SQL> ALTER DISKGROUP dgroup1 add TEMPLATE unreliable ATTRIBUTES (UNPROTECTED);
Diskgroup altered.
SQL> select * From V$ASM_TEMPLATE where name='UNRELIABLE';
GROUP_NUMBER ENTRY_NUMBER REDUND STRIPE S NAME
------------ ------------ ------ ------ - ----------
1 14 UNPROT COARSE N UNRELIABLE
SQL> alter diskgroup dgroup1 alter template reliable attributes(COARSE);
Diskgroup altered.
SQL> select * From V$ASM_TEMPLATE where name='RELIABLE';
GROUP_NUMBER ENTRY_NUMBER REDUND STRIPE S NAME
------------ ------------ ------ ------ - ----------
1 13 MIRROR COARSE N RELIABLE
10.建立一個目錄供別名使用
SQL> ALTER DISKGROUP dgroup1 ADD DIRECTORY '+dgroup1/mydir';
Diskgroup altered.
可用rename子句修改目錄
SQL> alter DISKGROUP dgroup1 rename directory '+dgroup1/mydir' to '+dgroup1/yourdir';
Diskgroup altered.
刪除目錄
SQL> alter diskgroup dgroup1 drop directory '+dgroup1/yourdir';
Diskgroup altered.
11.由於我ASM裡面沒有任何的檔案,我無法建立別名,這個待以後來建立吧。
先把語法放在這,
ALTER DISKGROUP dgroup1 ADD ALIAS '+dgroup1/mydir/second.dbf'
FOR '+dgroupA/sample/datafile/mytable.342.3';
或
ALTER DISKGROUP dgroup1 ADD ALIAS '+dgroup1/mydir/second.dbf'
FOR '+dgroupA.342.3';
12.檢查diskgroup後設資料的內部一致性
SQL> ALTER DISKGROUP dgroup1 CHECK ALL;
Diskgroup altered.
沒有任何錯誤返回說明diskgroup是正常的,如diskgroup有問題的話會返回錯誤資訊,並將錯誤資訊記錄在alert.log.
ASSM自動檢驗任何錯誤,除非你指定了NOREPAIR子句。
13.有關ASM的檢視:
View
ASM Instance
DB Instance
V$ASM_ALIAS
Displays a row for each alias present in every disk group mounted by the ASM instance.
Returns no rows
V$ASM_CLIENT
Displays a row for each database instance using a disk group managed by the ASM instance.
Displays a row for the ASM instance if the database has open ASM files.
V$ASM_DISK
Displays a row for each disk discovered by the ASM instance, including disks which are not part of any disk group.
Displays a row for each disk in disk groups in use by the database instance.
V$ASM_DISKGROUP
Displays a row for each disk group discovered by the ASM instance.
Displays a row for each disk group mounted by the local ASM instance.
V$ASM_FILE
Displays a row for each file for each disk group mounted by the ASM instance.
Displays no rows.
V$ASM_OPERATION
Displays a row for each file for each long running operation executing in the ASM instance.
Displays no rows.
V$ASM_TEMPLATE
Displays a row for each template present in each disk group mounted by the ASM instance.
Displays a row for each template present in each disk group mounted by the ASM instance with which the database instance communicates.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/271283/viewspace-1017727/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 建立 Oracle10g ASM 資料庫(1)OracleASM資料庫
- 將資料庫遷移到ASM的實驗記錄資料庫ASM
- Oracle10g RAC (ASM) 資料庫及服務開啟關閉OracleASM資料庫
- 建立ASM資料庫ASM資料庫
- VMWARE+OCFS2+ASM+10GRAC實驗ASM
- ASM之建立ASM例項及ASM資料庫ASM資料庫
- 建立ASM例項及ASM資料庫ASM資料庫
- ASM FTP 功能複製 ASM資料庫ASMFTP資料庫
- 虛谷資料庫初體驗資料庫
- MySQL資料庫初體驗_gwMySql資料庫
- 資料庫遷移到ASM資料庫ASM
- 【RAC】刪除RAC資料庫節點(四)——刪除資料庫軟體及ASM軟體資料庫ASM
- oracle10G新特性之ASM的應用OracleASM
- 談談資料從sql server資料庫匯入mysql資料庫的體驗(轉)Server資料庫MySql
- ASM資料庫的一個測試ASM資料庫
- 遷移資料庫到ASM資料庫ASM
- rman 全庫恢復asm資料庫ASM資料庫
- DBeaverEE for Mac免啟用企業版:卓越的資料庫開發體驗Mac資料庫
- 資料庫從檔案系統轉移至ASM實驗記錄資料庫ASM
- Oracle 資料庫官方不支援VMWareOracle資料庫
- oracle10g手工建立資料庫Oracle資料庫
- ASM的資料庫遷移回到DISK上ASM資料庫
- 資料庫上雲教程(體驗有禮)資料庫
- SequoiaDB資料庫之體驗sql功能資料庫SQL
- oracle 資料庫ASM功能詳解Oracle資料庫ASM
- oracle 遷移資料庫到asmOracle資料庫ASM
- 建立ASM例項和資料庫ASM資料庫
- 【資料庫資料恢復】ASM磁碟組掉線的Oracle資料庫資料恢復案例資料庫資料恢復ASMOracle
- 資料庫從檔案系統轉移至ASM實驗記錄[zt]資料庫ASM
- 【ASM學習】普通資料庫向ASM例項的遷移(二)ASM資料庫
- 【ASM學習】普通資料庫向ASM例項的遷移(一)ASM資料庫
- 【資料遷移】RMAN遷移資料庫到ASM(一)建立ASM磁碟組資料庫ASM
- 如何驗證/啟用記憶體資料庫配置? (文件 ID 2178918.1)記憶體資料庫
- 用rman從檔案系統遷移資料庫到asm資料庫ASM
- Oracle 資料庫官方申明不支援VmwareOracle資料庫
- 資料庫實驗五 資料庫的安全性資料庫
- 【資料庫資料恢復】ASM例項不能掛載的Oracle資料庫資料恢復案例資料庫資料恢復ASMOracle
- 【資料遷移】RMAN遷移資料庫到ASM(二)切換資料檔案到ASM資料庫ASM