Wednesday, March 4, 2009

Step by step setup ASM using os files in 11g

http://alexzeng.wordpress.com/2008/11/07/step-by-step-setup-asm-using-os-files-in-11g/

Environment: Windows
DB version: 11.1.0.6

–Creating the ASM Instance Manually, using dbca is also ok
–create CSS service if it doesn’t exist in services
WINNT> \bin\localconfig add

–create 2 1000MB os files as asmdisk
asmtool -create D:\asm\asmdisk1 1000
asmtool -create D:\asm\asmdisk2 1000

–if get an error msg, using commnd “net helpmsg errornumber” to know why
–create spfile
file: \database\init+ASM.ora
INSTANCE_TYPE=ASM
DB_UNIQUE_NAME=+ASM
ASM_DISKSTRING=’D:\asm\*’
LARGE_POOL_SIZE=16M
_ASM_ALLOW_ONLY_RAW_DISKS= FALSE

–Note: The undocumented parameter _ASM_ALLOW_ONLY_RAW_DISKS is used to
– make the instance recognize virtual disks created in previous step.

–create ASM instance service
ORADIM -NEW -ASMSID +ASM -STARTMODE auto

–add diskgroup
SET ORACLE_SID=+ASM
sqlplus / as sysdba
startup nomount
create diskgroup dgroup1 external redundancy
disk ‘D:\asm\asmdisk1′,’D:\asm\asmdisk2′;

–note: using ‘D:\asm\asmdisk*’ to add all

–startup ASM, use NOMOUNT, MOUNT, RESTRICT and FORCE options
–cannot use the STARTUP OPEN syntax
SET ORACLE_SID=+ASM
sqlplus / as sysdba
SYS@+ASM>startup force
ASM instance started

Total System Global Area 535662592 bytes
Fixed Size 1334380 bytes
Variable Size 509162388 bytes
ASM Cache 25165824 bytes
ASM diskgroups mounted

–add a 2000M new disk and drop the old 2 disks
–create the new one using asmtool
asmtool -create D:\oracle\oradata\asm\asmdisk1 2000

–change the asm_diskstring to find the new disk
alter system set asm_diskstring=’D:\asm\*’,'D:\oracle\oradata\asm\*’

–add the new one
ALTER DISKGROUP dgroup1 ADD DISK ‘D:\oracle\oradata\asm\asmdisk1′;
–check the status
select name,path,state,mode_status,MOUNT_STATUS from V$asm_disk;
NAME
———————————————————–
PATH
———————————————————–
————
STATE MODE_STATUS MOUNT_STATUS
———————— ——————— ————
DGROUP1_0000
D:\ASM\ASMDISK1
NORMAL ONLINE CACHED

DGROUP1_0001
D:\ASM\ASMDISK2
NORMAL ONLINE CACHED

DGROUP1_0002
D:\ORACLE\ORADATA\ASM\ASMDISK1
NORMAL ONLINE CACHED

–drop the old 2
ALTER DISKGROUP dgroup1 DROP DISK DGROUP1_0000,DGROUP1_0001;

–check the status, it is dropping
select name,path,state,mode_status,MOUNT_STATUS from V$asm_disk;
NAME
———————————————————–
PATH
———————————————————–
————
STATE MODE_STATUS MOUNT_STATUS
———————— ——————— ————
DGROUP1_0000
D:\ASM\ASMDISK1
DROPPING ONLINE CACHED

DGROUP1_0001
D:\ASM\ASMDISK2
DROPPING ONLINE CACHED

DGROUP1_0002
D:\ORACLE\ORADATA\ASM\ASMDISK1
NORMAL ONLINE CACHED

–after a while,check status with group number
SYS@+ASM>select group_number,path,state,mode_status,MOUNT_STATUS from V$asm_disk

GROUP_NUMBER
————
PATH
——————————————————————————–
————
STATE MODE_STATUS MOUNT_STATUS
———————— ——————— ———————
0
D:\ASM\ASMDISK1
NORMAL ONLINE CLOSED

0
D:\ASM\ASMDISK2
NORMAL ONLINE CLOSED

1
D:\ORACLE\ORADATA\ASM\ASMDISK1
NORMAL ONLINE CACHED

–it is ok now. let’s change the parameter asm_diskstring
alter system set asm_diskstring=’D:\oracle\oradata\asm\*’;
–views
V$ASM_DISKGROUP
V$ASM_CLIENT
V$ASM_DISK
V$ASM_FILE
V$ASM_TEMPLATE

–asm command
asmcmd
asmtool

–FTP and HTTP Access
–Using ORACLE_HOME/rdbms/admin/catxdbdbca to create file mapping
–the first parameter is ftp port, the second one is http port
sqlplus>@catxdbdbca 7777 8888

ftp localhost 7777
http://localhost:8888

–create ASM based database bye setting 2 initial parameters
DB_CREATE_FILE_DEST = ‘+dgroup1′
DB_RECOVERY_FILE_DEST = ‘+dgroup2′

No comments: