Thursday, 5 December 2013

How to install asm

------------------------------------------------------------------------
installing Kernal rpm
-------------------------------------------------------------------------

[oracle@localhost ~]$ su -
Password:
[root@localhost ~]# cd /home/oracle/Desktop/asm/rpm\ kernal\ 2.6.18-8.el5/
[root@localhost rpm kernal 2.6.18-8.el5]# ls
oracleasm-2.6.18-8.el5-2.0.4-1.el5.i686.rpm
oracleasmlib-2.0.4-1.el5.i386.rpm
oracleasm-support-2.1.8-1.el5.i386.rpm
[root@localhost rpm kernal 2.6.18-8.el5]# rpm -ivh oracleasm*
warning: oracleasmlib-2.0.4-1.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing...                ########################################### [100%]
   1:oracleasm-support      ########################################### [ 33%]
   2:oracleasm-2.6.18-8.el5 ########################################### [ 67%]
   3:oracleasmlib           ########################################### [100%]
[root@localhost rpm kernal 2.6.18-8.el5]#

---------------------------------------------------------------
partition created
---------------------------------------------------------------


[root@localhost ~]# fdisk

Usage: fdisk [-l] [-b SSZ] [-u] device
E.g.: fdisk /dev/hda  (for the first IDE disk)
  or: fdisk /dev/sdc  (for the third SCSI disk)
  or: fdisk /dev/eda  (for the first PS/2 ESDI drive)
  or: fdisk /dev/rd/c0d0  or: fdisk /dev/ida/c0d0  (for RAID devices)
  ...
[root@localhost ~]# ls /dev/sd*
/dev/sda    /dev/sda11  /dev/sda4  /dev/sda7  /dev/sdb  /dev/sde  /dev/sdh
/dev/sda1   /dev/sda2   /dev/sda5  /dev/sda8  /dev/sdc  /dev/sdf  /dev/sdh1
/dev/sda10  /dev/sda3   /dev/sda6  /dev/sda9  /dev/sdd  /dev/sdg
[root@localhost ~]#
[root@localhost ~]# 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): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-913, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-913, default 913):
Using default value 913

Command (m for help): p

Disk /dev/sdb: 7516 MB, 7516192768 bytes
255 heads, 63 sectors/track, 913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         913     7333641   83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]# fdisk /dev/sdc
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): 1
First cylinder (1-913, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-913, default 913):
Using default value 913

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]# fdisk /dev/sdd
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): 1
First cylinder (1-913, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-913, default 913):
Using default value 913

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]# fdisk /dev/sde
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): 1
First cylinder (1-913, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-913, default 913):
Using default value 913

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]# fdisk /dev/sdf
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): 1
First cylinder (1-913, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-913, default 913):
Using default value 913

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

[root@localhost ~]# 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.

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-913, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-913, default 913):
Using default value 913

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]# ls /dev/sd*
/dev/sda    /dev/sda2  /dev/sda6  /dev/sdb   /dev/sdd   /dev/sdf   /dev/sdh
/dev/sda1   /dev/sda3  /dev/sda7  /dev/sdb1  /dev/sdd1  /dev/sdf1  /dev/sdh1
/dev/sda10  /dev/sda4  /dev/sda8  /dev/sdc   /dev/sde   /dev/sdg
/dev/sda11  /dev/sda5  /dev/sda9  /dev/sdc1  /dev/sde1  /dev/sdg1
[root@localhost ~]#
[root@localhost ~]#

------------------------------------------------------------------------------
Configure Oracleasm
------------------------------------------------------------------------------

[root@localhost ~]# partprobe
Warning: Unable to open /dev/hdc read-write (Read-only file system).  /dev/hdc has been opened read-only.
[root@localhost ~]# /etc/i
init.d/   iproute2/
[root@localhost ~]# /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 <ENTER> 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) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver:                     [  OK  ]
Scanning the system for Oracle ASMLib disks:               [  OK  ]
[root@localhost ~]#
[root@localhost ~]# /etc/init.d/oracleasm scandisks
Scanning the system for Oracle ASMLib disks:               [  OK  ]
[root@localhost ~]#
[root@localhost ~]# /etc/init.d/oracleasm enable
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver:                     [  OK  ]
Scanning the system for Oracle ASMLib disks:               [  OK  ]
[root@localhost ~]#
[root@localhost ~]# /etc/init.d/oracleasm start
Initializing the Oracle ASMLib driver:                     [  OK  ]
Scanning the system for Oracle ASMLib disks:               [  OK  ]
[root@localhost ~]#
[root@localhost ~]# /etc/init.d/oracleasm status
Checking if ASM is loaded: yes
Checking if /dev/oracleasm is mounted: yes
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#


------------------------------------------------------------------------
Disk created
-------------------------------------------------------------------------

[root@localhost ~]# /etc/init.d/oracleasm createdisk asm_disk1 /dev/sdb1
Marking disk "asm_disk1" as an ASM disk:                   [  OK  ]
[root@localhost ~]# /etc/init.d/oracleasm createdisk asm_disk2 /dev/sdc1
Marking disk "asm_disk2" as an ASM disk:                   [  OK  ]
[root@localhost ~]# /etc/init.d/oracleasm createdisk asm_disk3 /dev/sdd1
Marking disk "asm_disk3" as an ASM disk:                   [  OK  ]
[root@localhost ~]# /etc/init.d/oracleasm createdisk asm_disk4 /dev/sde1
Marking disk "asm_disk4" as an ASM disk:                   [  OK  ]
[root@localhost ~]# /etc/init.d/oracleasm createdisk asm_disk5 /dev/sdf1
Marking disk "asm_disk5" as an ASM disk:                   [  OK  ]
[root@localhost ~]# /etc/init.d/oracleasm createdisk asm_disk6 /dev/sdg1
Marking disk "asm_disk6" as an ASM disk:                   [  OK  ]
[root@localhost ~]# cd /u01/app/oracle/product/10.2.0/db_1/bin
[root@localhost bin]# ./localconfig add
/etc/oracle does not exist. Creating it now.
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
Configuration for local CSS has been initialized

Adding to inittab
Startup will be queued to init within 90 seconds.
Checking the status of new Oracle init process...
Expecting the CRS daemons to be up within 600 seconds.
CSS is active on these nodes.
        localhost
CSS is active on all nodes.
Oracle CSS service is installed and running under init(1M)
[root@localhost bin]#
[root@localhost bin]# exit

-----------------------------------------------------------------
create folder this location
-----------------------------------------------------------------

[oracle@localhost ~]$ cd /u01/app/oracle/admin/
[oracle@localhost admin]$ mkdir +ASM
[oracle@localhost admin]$ cd +ASM/
[oracle@localhost +ASM]$ mkdir bdump cdump udump
[oracle@localhost +ASM]$ touch /u01/app/oracle/product/10.2.0/db_1/dbs/init+ASM.ora
[oracle@localhost +ASM]$ vi /u01/app/oracle/product/10.2.0/db_1/dbs/init+ASM.ora

=================================================
typing this code in init+ASM.ora file
==================================================
+ASM.asm_diskgroups='DG1'#Manual Mount
*.asm_diskgroups='DG1'
*.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'
============================================================

----------------------------------------------------------
open new terminal
-----------------------------------------------------------

[oracle@localhost ~]$ export ORACLE_SID=+ASM
[oracle@localhost ~]$ sqlplus

SQL*Plus: Release 10.2.0.1.0 - Production on Fri Sep 27 04:53:02 2013

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

Enter user-name: /as sysdba
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-15032: not all alterations performed
ORA-15063: ASM discovered an insufficient number of disks for diskgroup "DG1"


SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
+ASM

SQL> select path from v$asm_disk;

PATH
--------------------------------------------------------------------------------
ORCL:ASM_DISK1
ORCL:ASM_DISK2
ORCL:ASM_DISK6
ORCL:ASM_DISK4
ORCL:ASM_DISK5
ORCL:ASM_DISK3

6 rows selected.

SQL>

SQL> create diskgroup DG1 normal redundancy
  2  failgroup f_group1 disk
  3  'ORCL:ASM_DISK1',
  4  'ORCL:ASM_DISK2'
  5  failgroup f_group2 disk
  6  'ORCL:ASM_DISK3',
  7  'ORCL:ASM_DISK4'
  8  failgroup f_group2 disk
  9  'ORCL:ASM_DISK5',
 10  'ORCL:ASM_DISK6';

Diskgroup created.

SQL> shutdown immediate;
ASM diskgroups dismounted
ASM instance shutdown
SQL>
SQL> startup
ASM instance started

Total System Global Area   83886080 bytes
Fixed Size                  1217836 bytes
Variable Size              57502420 bytes
ASM Cache                  25165824 bytes
ASM diskgroups mounted
SQL>

SQL> SELECT NAME,STATE,TYPE,TOTAL_MB FROM V$ASM_DISKGROUP;

NAME                           STATE       TYPE     TOTAL_MB
------------------------------ ----------- ------ ----------
DG1                            MOUNTED     NORMAL      42966

SQL> select name,failgroup,redundancy,state from v$asm_disk;

NAME                           FAILGROUP                      REDUNDA STATE
------------------------------ ------------------------------ ------- --------
ASM_DISK1                      F_GROUP1                       UNKNOWN NORMAL
ASM_DISK2                      F_GROUP1                       UNKNOWN NORMAL
ASM_DISK3                      F_GROUP2                       UNKNOWN NORMAL
ASM_DISK4                      F_GROUP2                       UNKNOWN NORMAL
ASM_DISK5                      F_GROUP2                       UNKNOWN NORMAL
ASM_DISK6                      F_GROUP2                       UNKNOWN NORMAL

6 rows selected.

SQL>  select a.name "diskgroup",b.name "disk",b.header_status "disk_condition",b.mode_status "status",b.total_mb,b.free_mb from v$asm_diskgroup a,v$asm_disk b where a.group_number=b.group_number;

diskgroup  disk            disk_conditi status    TOTAL_MB    FREE_MB
---------- --------------- ------------ ------- ---------- ----------
DG1        ASM_DISK2       MEMBER       ONLINE        5114       3719
DG1        ASM_DISK1       MEMBER       ONLINE       10236       8841

SQL>

SQL> shutdown immediate;
ASM diskgroups dismounted
ASM instance shutdown
SQL>
SQL>
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
[oracle@localhost ~]$
[oracle@localhost ~]$
-------------------------------------------------------------
Manually ASM Database Created from dbca
----------------------------------------------------------------

[oracle@localhost ~]$ dbca

General purpose--database name--next--password--ASM Storage Management--Asm password(oracle)--select disk group-- use oracle-managed file--next--next--next--memory-next--Data Storage--Finish--Ok
-------------------------------------------------------------------------
To see the location of CONTROLFILE, DATAFILE, ONLINELOG, PARAMETERFILE, TEMPFILE, spfileasmor.ora => +DG1/AS
--------------------------------------------------------------------------
                                                
                                                
[oracle@localhost ~]$ export ORACLE_SID=+ASM
[oracle@localhost ~]$ asmcmd
ASMCMD> ls -ltr
State    Type    Rebal  Unbal  Name
MOUNTED  NORMAL  N      N      DG1/
ASMCMD> cd dg1
ASMCMD> ls -ltr
Type  Redund  Striped  Time             Sys  Name
                                        Y    ASMOR/
ASMCMD> cd asmor
ASMCMD> ls -ltr
Type           Redund  Striped  Time             Sys  Name
                                                 Y    CONTROLFILE/
                                                 Y    DATAFILE/
                                                 Y    ONLINELOG/
                                                 Y    PARAMETERFILE/
                                                 Y    TEMPFILE/
                                                 N    spfileasmor.ora => +DG1/ASMOR/PARAMETERFILE/spfile.270.827215531
ASMCMD> ls controlfile       
Current.260.827215343
Current.261.827215339
ASMCMD>
ASMCMD> ls datafile
EXAMPLE.269.827215391
SYSAUX.257.827215265
SYSTEM.256.827215265
UNDOTBS1.258.827215267
USERS.259.827215267
ASMCMD>
ASMCMD> ls -ltr controlfile
Type         Redund  Striped  Time             Sys  Name
CONTROLFILE  HIGH    FINE     SEP 27 06:00:00  Y    Current.260.827215343
CONTROLFILE  HIGH    FINE     SEP 27 06:00:00  Y    Current.261.827215339
ASMCMD>
ASMCMD> ls -ltr datafile
Type      Redund  Striped  Time             Sys  Name
DATAFILE  MIRROR  COARSE   SEP 27 06:00:00  Y    EXAMPLE.269.827215391
DATAFILE  MIRROR  COARSE   SEP 27 06:00:00  Y    SYSAUX.257.827215265
DATAFILE  MIRROR  COARSE   SEP 27 06:00:00  Y    SYSTEM.256.827215265
DATAFILE  MIRROR  COARSE   SEP 27 06:00:00  Y    UNDOTBS1.258.827215267
DATAFILE  MIRROR  COARSE   SEP 27 06:00:00  Y    USERS.259.827215267
ASMCMD>


---------------------------------------------------------------------
some important views
---------------------------------------------------------------

SQL> desc v$asm_disk;

SQL> desc v$asm_diskgroup;

SQL> desc v$asm_file;

SQL> desc v$asm_client;

SQL> desc v$asm_operation;






 

No comments:

Post a Comment