The below methods can be used to create asm Instance, this is only for learning purpose.
In Linux:-
Step 1)
Check whether we need all the oracleasm packages, if the packages is not installed
download it from the oracle site based on you os and install it in your server.
Required packages are
oracleasm-2.6.9-67.0.0.0.1.ELsmp-2.0.3-2
oracleasm-support-2.0.3-2
oracleasmlib-2.0.4-1.el4
Step 2) Perform the below steps as root user.
Create a physical file using dd command.
# dd if=/dev/zero of=/u01/app/oracle/oradata/asmdisks/disk1 bs=2M count=1024
# dd if=/dev/zero of=/u01/app/oracle/oradata/asmdisks/disk2 bs=2M count=1024
# dd if=/dev/zero of=/u01/app/oracle/oradata/asmdisks/disk1 bs=2M count=1024
The above command will create disk1, disk2 and disk3 with 2gb each, i.e. 2M*1024
which is 2024 MB.
Now we have 3 physical files with 2gb each.
Step 3) Map the loop back devices to the files.
# /sbin/losetup /dev/loop1 /u01/app/oracle/oradata/asmdisks/disk1
# /sbin/losetup /dev/loop2 /u01/app/oracle/oradata/asmdisks/disk2
# /sbin/losetup /dev/loop3 /u01/app/oracle/oradata/asmdisks/disk3
Step 4) Confiure the oracleasm
# /etc/init.d/oracleasm configure
Default user....... : oracle
Default group....... : oinstall
start asm........... : y
.....................: y
Step 5 ) Create ASM Disks
# /etc/init.d/oracleasm createdisk asmdisk1 /dev/loop1
# /etc/init.d/oracleasm createdisk asmdisk2 /dev/loop2
# /etc/init.d/oracleasm createdisk asmdisk3 /dev/loop3
Step 6 ) Add the below entries in /etc/rc.local file inorder to set the configuration
every time the server is rebooted.
# vi /etc/rc.local
/sbin/losetup /dev/loop1 /u01/app/oracle/oradata/asmdisks/disk1
/sbin/losetup /dev/loop2 /u01/app/oracle/oradata/asmdisks/disk2
/sbin/losetup /dev/loop3 /u01/app/oracle/oradata/asmdisks/disk3
/etc/init.d/oracleasm createdisk asmdisk1 /dev/loop1
/etc/init.d/oracleasm createdisk asmdisk2 /dev/loop2
/etc/init.d/oracleasm createdisk asmdisk3 /dev/loop3
Reboot the server and login as oracle user.
Step 7)
Using DBCA
$ dbca
Using the dbca create the asm instance by selecting the configure
ASM option.
Manual Method
Set up the parameter file for ASM instance.
$ vi $ORACLE_HOME/dbs/init+ASM.ora
instance_type= ASM
db_unique_name=+ASM
large_pool_size=16m
asm_diskstring='ORCL:*'
$ export ORACLE_SID=+ASM
$ sqlplus / as sysdba
SQL> startup
ORA-9701 : unable to connect to cluster manager
SQL> exit
Disconnected
$ su - root
password :
# cd /u01/app/oracle/product/10.2.0/db_1/bin
# ./localconfig add
----
---
---
oracle css is installed and running under init(1M)
# su - oracle
$ export ORACLE_SID=+ASM
$ sqlplus / as sysdba
SQL> startup
----
---
ora-15110 no diskgroup mounted
SQL> select path from V$asm_disk;
ORCL:asmdisk1
ORCL:asmdisk2
ORCL:asmdisk3
SQL> create diskgroup data normal redundancy failgroup fg1 disk 'ORCL:asmdisk1'
failgroup fg2 disk 'ORCL:asmdisk2';
SQL> create diskgroup flashback external redundancy disk 'ORCL:asmdisk2';
SQL> shut immediate;
$ sqlplus / as sysdba
SQL> create spfile from pfile;
SQL> startup
---
---
---
Asm diskgroup not mounted
SQL> alter system set asm_diskgroups = 'DATA','FLASHBACK' scope=spfile;
SQL> shut immediate;
SQL> startup
---
---
ASM diskgroup mounted
-------------------
Creating ASM Instance in windows:-
C:\Documents and Settings>D:\oracle\product\10.2.0\db_1\BIN\localconfig add
Step 1: creating new OCR repository
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'administrator', privgrp ''..
Operation successful.
Step 2: creating new CSS service
successfully created local CSS service
successfully added CSS to home
C:\Documents and Settings\Administrator>asmtool -create d:\asmdisks\disk1 1024
C:\Documents and Settings\Administrator>asmtool -create d:\asmdisks\disk2 1024
C:\Documents and Settings\Administrator>oradim -new -asmsid +ASM -startmode auto
Instance created.
Create an parameter file with the below parameters for the ASM instance and save it in oracle home path.
instance_type=ASM
db_unique_name=+ASM
large_pool_size=16m
_asm_allow_only_raw_disks=false
asm_diskstring='D:\asmdisks\*'
C:\Documents and Settings\Administrator>set oracle_sid=+ASM
C:\Documents and Settings\Administrator>sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Nov 23 10:57:49 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ASM instance started
Total System Global Area 88080384 bytes
Fixed Size 1247444 bytes
Variable Size 61667116 bytes
ASM Cache 25165824 bytes
ORA-15110: no diskgroups mounted
SQL> select path from V$asm_disk;
PATH
--------------------------------------------------------------------------------
D:\ASMDISKS\DISK2
D:\ASMDISKS\DISK1
SQL> create diskgroup data normal redundancy failgroup fg1 disk 'D:\ASMDISKS\DISK1' failgroup fg2 disk 'D:\ASMDISKS\DISK2';
Diskgroup created.
SQL> shut immediate;
ASM diskgroups dismounted
ASM instance shutdown
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
C:\Documents and Settings\Administrator>sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Nov 23 11:01:07 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> create spfile from pfile;
File created.
SQL> startup ;
ASM instance started
Total System Global Area 88080384 bytes
Fixed Size 1247444 bytes
Variable Size 61667116 bytes
ASM Cache 25165824 bytes
ORA-15110: no diskgroups mounted
SQL> alter system set asm_diskgroups='DATA' scope=spfile;
System altered.
SQL> shut immediate;
ORA-15100: invalid or missing diskgroup name
ASM instance shutdown
SQL> startup ;
ASM instance started
Total System Global Area 88080384 bytes
Fixed Size 1247444 bytes
Variable Size 61667116 bytes
ASM Cache 25165824 bytes
ASM diskgroups mounted
SQL> select name, total_mb, free_mb , usable_file_mb from V$asm_diskgroup;
NAME TOTAL_MB FREE_MB USABLE_FILE_MB
------------------------------ ---------- ---------- --------------
DATA 2048 1946 973
End of Creating ASM instance in Linux and Windows Server (Testing/Learning Purpose only)
No comments:
Post a Comment