Вы находитесь на странице: 1из 19

ASM (Automatic Storage Management)

Adding new hard disks to the linux from vmware

1.[root@localhost dev]# ll sda*


brw-r----- 1 root disk 8, 0 Aug 17 11:21 sda
brw-r----- 1 root disk 8, 1 Aug 17 11:22 sda1
brw-r----- 1 root disk 8, 2 Aug 17 11:21 sda2
brw-r----- 1 root disk 8, 3 Aug 17 11:22 sda3
2.[root@localhost dev]# ll sd*
brw-r----- 1 root disk 8, 0 Aug 17 11:21 sda
brw-r----- 1 root disk 8, 1 Aug 17 11:22 sda1
brw-r----- 1 root disk 8, 2 Aug 17 11:21 sda2
brw-r----- 1 root disk 8, 3 Aug 17 11:22 sda3
brw-r----- 1 root disk 8, 16 Aug 17 11:21 sdb
brw-r----- 1 root disk 8, 32 Aug 17 11:21 sdc
brw-r----- 1 root disk 8, 48 Aug 17 11:21 sdd
3.[root@localhost dev]# 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): 1
First cylinder (1-261, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-261, default 261):
Using default value 261
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
4. [root@localhost dev]# ll sd*
brw-r----- 1 root disk 8, 0 Aug 17 11:21 sda
brw-r----- 1 root disk 8, 1 Aug 17 11:22 sda1
brw-r----- 1 root disk 8, 2 Aug 17 11:21 sda2
brw-r----- 1 root disk 8, 3 Aug 17 11:22 sda3
brw-r----- 1 root disk 8, 16 Aug 17 11:43 sdb
brw-r----- 1 root disk 8, 17 Aug 17 11:43 sdb1
brw-r----- 1 root disk 8, 32 Aug 17 11:21 sdc
brw-r----- 1 root disk 8, 48 Aug 17 11:21 sdd
5. [root@localhost dev]# 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): 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)
1

Invalid partition number for type `1'


Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-261, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-261, default 261):
Using default value 261
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
6. [root@localhost dev]# 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-261, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-261, default 261):
Using default value 261
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
7. [root@localhost dev]# ll sd*
brw-r----- 1 root disk 8, 0 Aug 17 11:21 sda
brw-r----- 1 root disk 8, 1 Aug 17 11:22 sda1
brw-r----- 1 root disk 8, 2 Aug 17 11:21 sda2
brw-r----- 1 root disk 8, 3 Aug 17 11:22 sda3
brw-r----- 1 root disk 8, 16 Aug 17 11:43 sdb
brw-r----- 1 root disk 8, 17 Aug 17 11:43 sdb1
brw-r----- 1 root disk 8, 32 Aug 17 11:44 sdc
brw-r----- 1 root disk 8, 33 Aug 17 11:44 sdc1
brw-r----- 1 root disk 8, 48 Aug 17 11:45 sdd
brw-r----- 1 root disk 8, 49 Aug 17 11:45 sdd1

to download rpms follow the site below :http://www.oracle.com/technetwork/server-storage/linux/downloads/rhel5-084877.html


[root@localhost dev]# cd /mnt
[root@localhost mnt]# cd hgfs
[root@localhost hgfs]# ll
total 2
drwxrwxrwx 1 root root 4096 Aug 17 11:09 asm_32bit
[root@localhost hgfs]# cd asm_32bit
[root@localhost asm_32bit]# ll
total 4
drwxrwxrwx 1 root root 0 Aug 13 17:29 common rpms
drwxrwxrwx 1 root root 4096 Aug 13 17:29 kernel 2.6.18-128.el5 rpm drivers
drwxrwxrwx 1 root root 4096 Aug 13 17:27 kernel 2.6.18-238.e15 rpm drivers
[root@localhost asm_32bit]# cd common\ rpms/
[root@localhost common rpms]# ll
total 49
-rwxrwxrwx 1 root root 13929 Jun 28 2013 oracleasmlib-2.0.4-1.el5.i386.rpm
-rwxrwxrwx 1 root root 85303 Jun 28 2013 oracleasm-support-2.1.8-1.el5.i386.rpm
[root@localhost common rpms]# rpm -ivh oracleasm-support-2.1.8-1.el5.i386.rpm
warning: oracleasm-support-2.1.8-1.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing...
########################################### [100%]
1:oracleasm-support ########################################### [100%]
[root@localhost asm_32bit]# cd
common rpms/
kernel 2.6.18-238.e15 rpm drivers/
kernel 2.6.18-128.el5 rpm drivers/
[root@localhost asm_32bit]# cd kernel\ 2.6.18-238.e15\ rpm\ drivers/
[root@localhost kernel 2.6.18-238.e15 rpm drivers]# ll
total 257
-rwxrwxrwx 1 root root 131209 Aug 13 16:50 oracleasm-2.6.18-238.el5-2.0.5-1.el5.i686.rpm
-rwxrwxrwx 1 root root 132119 Aug 13 16:50 oracleasm-2.6.18-238.el5debug-2.0.5-1.el5.i686.rpm
-rwxrwxrwx 1 root root 131297 Aug 13 16:50 oracleasm-2.6.18-238.el5PAE-2.0.5-1.el5.i686.rpm
-rwxrwxrwx 1 root root 128815 Aug 13 16:50 oracleasm-2.6.18-238.el5xen-2.0.5-1.el5.i686.rpm
[root@localhost kernel 2.6.18-238.e15 rpm drivers]# rpm -ivh oracleasm-2.6.18-238.el5-2.0.51.el5.i686.rpm
warning: oracleasm-2.6.18-238.el5-2.0.5-1.el5.i686.rpm: Header V3 DSA signature: NOKEY, key ID
1e5e0159
Preparing...
########################################### [100%]
1:oracleasm-2.6.18-238.el########################################### [100%]
[root@localhost kernel 2.6.18-238.e15 rpm drivers]# cd ..
[root@localhost asm_32bit]# cd common\ rpms/
[root@localhost common rpms]# rpm -ivh oracleasmlib-2.0.4-1.el5.i386.rpm
warning: oracleasmlib-2.0.4-1.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing...
########################################### [100%]
1:oracleasmlib
########################################### [100%]
[root@localhost common rpms]# xhost +
access control disabled, clients can connect from any host

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

Note:- the os user must have the primary group as oinstall and not primary group as dba
Default user to own the driver interface [test]: exam
Default group to own the driver interface [dba]: oinstall
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@orawave6 common rpms]# /etc/init.d/oracleasm createdisk VOL1 /dev/sdb1
Marking disk "VOL1" as an ASM disk:

[ OK ]

[root@orawave6 common rpms]# /etc/init.d/oracleasm createdisk VOL2 /dev/sdc1


Marking disk "VOL2" as an ASM disk:

[ OK ]

[root@orawave6 common rpms]# /etc/init.d/oracleasm createdisk VOL3 /dev/sdd1


Marking disk "VOL3" as an ASM disk:

[ OK ]

[root@orawave6 common rpms]# cd


[root@orawave6 ~]# xhost +
[root@orawave6 ~]# su - exam
[exam@localhost ~]# cd /dev/oracleasm/disks/
[exam@localhost disks]# ll
total 3
brw-rw---- 1 exam oinstall 8, 17 Aug 17 13:55 VOL1
brw-rw---- 1 exam oinstall 8, 17 Aug 17 13:56 VOL2
brw-rw---- 1 exam oinstall 8, 17 Aug 17 13:57 VOL3
[exam@localhost disks]# cd
[exam@localhost ~]# cd /mnt/hgfs/11.2.0.3/grid/ #### in 11.2.0.3 folder the third file 3 of 7 extract it
creates grid directory
[exam@localhost grid]# ./runInstaller

Kernel Parameters set and size check up


Save response file
Software installation complete

/////////////////////////////////////////////script run ///////////////////////////////////////////////////


[root@localhost grid]# /u02/asm/exam/11.2.0/root.sh
Performing root user operation for Oracle 11g
The following environment variables are set as:
ORACLE_OWNER= exam
ORACLE_HOME= /u02/asm/exam/11.2.0
Enter the full pathname of the local bin directory: [/usr/local/bin]:
The contents of "dbhome" have not changed. No need to overwrite.
The file "oraenv" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]:
The file "coraenv" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]:
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Using configuration parameter file: /u02/asm/exam/11.2.0/crs/install/crsconfig_params
Creating trace directory
LOCAL ADD MODE
Creating OCR keys for user 'exam', privgrp 'oinstall'..
Operation successful.
LOCAL ONLY MODE
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
CRS-4664: Node localhost successfully pinned.
Adding Clusterware entries to inittab
localhost 2014/08/17 15:23:43
/u02/asm/exam/11.2.0/cdata/localhost/backup_20140817_152343.olr
Successfully configured Oracle Grid Infrastructure for a Standalone Server
You have new mail in /var/spool/mail/root
[root@localhost grid]#
////////////////////////////////////after completion of software installation//////////////////////////////
[exam@localhost bin]$ ./crsctl status resource -t
-------------------------------------------------------------------------------NAME
TARGET STATE
SERVER
STATE_DETAILS
-------------------------------------------------------------------------------Local Resources
-------------------------------------------------------------------------------ora.DATA.dg
ONLINE ONLINE
localhost

ora.LISTENER.lsnr
ONLINE ONLINE
localhost
ora.asm
ONLINE ONLINE
localhost
Started
ora.ons
OFFLINE OFFLINE localhost
-------------------------------------------------------------------------------Cluster Resources
-------------------------------------------------------------------------------ora.cssd
1
ONLINE ONLINE
localhost
ora.diskmon
1
OFFLINE OFFLINE
ora.evmd
1
ONLINE ONLINE
localhost
[exam@localhost bin]$ clear
[exam@localhost bin]$ ./crsctl status resource -t
-------------------------------------------------------------------------------NAME
TARGET STATE
SERVER
STATE_DETAILS
-------------------------------------------------------------------------------Local Resources
-------------------------------------------------------------------------------ora.DATA.dg
ONLINE ONLINE
localhost
ora.LISTENER.lsnr
ONLINE ONLINE
localhost
ora.asm
ONLINE ONLINE
localhost
Started
ora.ons
OFFLINE OFFLINE localhost
-------------------------------------------------------------------------------Cluster Resources
-------------------------------------------------------------------------------ora.cssd
1
ONLINE ONLINE
localhost
ora.diskmon
1
OFFLINE OFFLINE
ora.evmd
1
ONLINE ONLINE
localhost
[exam@localhost bin]$ vi /etc/oratab
+ASM:/u02/exam/11.2.0:n
Asmdb:/u02/exam/11.2.0:n
/////////////////////////////////////////pfile creation //////////////////////////////////////////////
[exam@localhost dbs]$ cat initasmdb.ora
db_name=asmdb
db_create_file_dest='+DATA'
db_create_online_log_dest_1='+DATA'
undo_management=auto
sga_target=700m

////////////////////////////////////////////////////////////////////////////////////////////////////////
[exam@localhost bin]$ cd
[exam@localhost ~]$ cd 11.2.0/dbs
[exam@localhost dbs]$ vi initasmdb
[exam@localhost dbs]$ vi initasmdb.ora
[exam@localhost dbs]$ cd
[exam@localhost ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Fri Aug 22 16:06:27 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 732352512 bytes
Fixed Size
1339036 bytes
Variable Size
205521252 bytes
Database Buffers
520093696 bytes
Redo Buffers
5398528 bytes
SQL> create database asmdb;
Database created.
SQL> select name from v$database;
NAME
--------ASMDB
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
///////////////////////////////////////////// connecting to asm group /////////////////////////////
[exam@localhost ~]$ . oraenv
ORACLE_SID = [asmdb] ? +ASM
The Oracle base for ORACLE_HOME=/u02/asm/exam/11.2.0 is /u02/exam
[exam@localhost ~]$ asmcmd
ASMCMD> lsdg
State Type Rebal Sector Block
AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB
Offline_disks Voting_files Name
MOUNTED EXTERN N
512 4096 1048576 2047 1560
0
1560
0
DATA/
ASMCMD> ls
DATA/
ASMCMD> cd DATA/

ASMCMD> cd ASMDB/
ASMCMD> ls
CONTROLFILE/
DATAFILE/
ONLINELOG/
////////////////////////////// list the no of clients using the asm instance ///////////////////////
ASMCMD> lsct
DB_Name Status Software_Version Compatible_version Instance_Name Disk_Group
asmdb CONNECTED
11.2.0.1.0
11.2.0.0.0 asmdb
DATA
//////////////////////////////////////////// shift ctrl tab /////////////////////////////////////
[root@localhost ~]# ps -ef|grep +ASM
exam 5406 1 0 13:05 ?
00:00:03 asm_pmon_+ASM
exam 5410 1 0 13:05 ?
00:00:00 asm_psp0_+ASM
exam 5415 1 0 13:05 ?
00:00:04 asm_vktm_+ASM
exam 5421 1 0 13:05 ?
00:00:00 asm_gen0_+ASM
exam 5425 1 0 13:05 ?
00:00:00 asm_diag_+ASM
exam 5429 1 0 13:05 ?
00:00:08 asm_dia0_+ASM
exam 5433 1 0 13:05 ?
00:00:00 asm_mman_+ASM
exam 5437 1 0 13:05 ?
00:00:00 asm_dbw0_+ASM
exam 5441 1 0 13:05 ?
00:00:00 asm_lgwr_+ASM
exam 5445 1 0 13:05 ?
00:00:00 asm_ckpt_+ASM
exam 5449 1 0 13:05 ?
00:00:00 asm_smon_+ASM
exam 5453 1 0 13:05 ?
00:00:00 asm_rbal_+ASM
exam 5457 1 0 13:05 ?
00:00:04 asm_gmon_+ASM
exam 5461 1 0 13:05 ?
00:00:00 asm_mmon_+ASM
exam 5465 1 0 13:05 ?
00:00:00 asm_mmnl_+ASM
exam 5470 1 0 13:05 ?
00:00:00 oracle+ASM
(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
exam 12824 1 0 16:15 ?
00:00:00 oracle+ASM_asmb_asmdb
(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
exam 13102 13092 0 16:23 ?
00:00:00 oracle+ASM
(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
root 13316 13285 0 16:30 pts/2 00:00:00 grep +ASM
////////////////////////////////////////////////////////////////////////////////////////////////////////////
ASMCMD> exit
[exam@localhost ~]$ sqlplus / as sysasm
SQL*Plus: Release 11.2.0.3.0 Production on Fri Aug 22 16:37:10 2014
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Automatic Storage Management option

SQL> SQL> desc v$asm_disk;


Name
Null? Type
----------------------------------------- -------- ---------------------------GROUP_NUMBER
NUMBER
DISK_NUMBER
NUMBER
COMPOUND_INDEX
NUMBER
INCARNATION
NUMBER
MOUNT_STATUS
VARCHAR2(7)
HEADER_STATUS
VARCHAR2(12)
MODE_STATUS
VARCHAR2(7)
STATE
VARCHAR2(8)
REDUNDANCY
VARCHAR2(7)
LIBRARY
VARCHAR2(64)
OS_MB
NUMBER
TOTAL_MB
NUMBER
FREE_MB
NUMBER
HOT_USED_MB
NUMBER
COLD_USED_MB
NUMBER
NAME
VARCHAR2(30)
FAILGROUP
VARCHAR2(30)
LABEL
VARCHAR2(31)
PATH
VARCHAR2(256)
UDID
VARCHAR2(64)
PRODUCT
VARCHAR2(32)
CREATE_DATE
DATE
MOUNT_DATE
DATE
REPAIR_TIMER
NUMBER
READS
NUMBER
WRITES
NUMBER
READ_ERRS
NUMBER
WRITE_ERRS
NUMBER
READ_TIME
NUMBER
WRITE_TIME
NUMBER
BYTES_READ
NUMBER
BYTES_WRITTEN
NUMBER
PREFERRED_READ
VARCHAR2(1)
HASH_VALUE
NUMBER
HOT_READS
NUMBER
HOT_WRITES
NUMBER
HOT_BYTES_READ
NUMBER
HOT_BYTES_WRITTEN
NUMBER
COLD_READS
NUMBER
COLD_WRITES
NUMBER
COLD_BYTES_READ
NUMBER
COLD_BYTES_WRITTEN
NUMBER
VOTING_FILE
VARCHAR2(1)
SECTOR_SIZE
NUMBER
FAILGROUP_TYPE
VARCHAR2(7)

SQL> select NAME,PATH,TOTAL_MB,HEADER_STATUS from v$asm_disk;


NAME PATH
TOTAL_MB
HEADER_STATU
-------------------------------------------------------------------------------VOL1 ORCL:VOL1
2047
MEMBER
VOL2 ORCL:VOL2
2047
MEMBER
SQL> alter diskgroup data add disk 'orcl:vol3';
diskgroup altered

SQL> select NAME,PATH,TOTAL_MB,HEADER_STATUS from v$asm_disk;


NAME PATH
TOTAL_MB
HEADER_STATU
-------------------------------------------------------------------------------VOL1 ORCL:VOL1
2047
MEMBER
VOL2 ORCL:VOL2
2047
MEMBER
VOL3 ORCL:VOL3
2047
MEMBER
SQL> alter diskgroup data drop disk 'VOL3';
Diskgroup altered.
SQL> select path,FREE_MB,TOTAL_MB from v$asm_disk;
PATH
FREE_MB TOTAL_MB
---------- ------------------------------------------------------------------ORCL:VOL3
0
0
ORCL:VOL1

2612

2047

ORCL:VOL2

2611

2047

SQL> alter diskgroup data add disk 'ORCL:VOL3';


Diskgroup altered.
SQL> select path,FREE_MB,TOTAL_MB from v$asm_disk;
PATH
---------- ---------ORCL:VOL1

FREE_MB TOTAL_MB
1739

2047

ORCL:VOL2

1740

2047

ORCL:VOL3

1744

2047

SQL> select NAME,TOTAL_MB,FREE_MB,USABLE_FILE_MB from v$asm_diskgroup;


NAME

TOTAL_MB FREE_MB USABLE_FILE_MB

------------------------------ ---------- ---------- -------------DATA


6141
5223
5223
SQL> select GROUP_NUMBER,SECTOR_SIZE from v$asm_diskgroup;
GROUP_NUMBER SECTOR_SIZE
------------ ----------1
512
SQL> select STATE,TYPE from v$asm_diskgroup;
STATE
TYPE
----------- -----MOUNTED EXTERN
SQL> select OFFLINE_DISKS,COMPATIBILITY,VOTING_FILES from v$asm_diskgroup;
OFFLINE_DISKS COMPATIBILITY
V
------------- ------------------------------------------------------------ 0 11.2.0.0.0
N
SQL> alter diskgroup data drop disk 'VOL3';
Diskgroup altered.
SQL> select path,FREE_MB,TOTAL_MB from v$asm_disk;
PATH
FREE_MB TOTAL_MB
---------- ---------- ---------------------------------------ORCL:VOL3
0
0
ORCL:VOL1

2612

2047

ORCL:VOL2

2611

2047

SQL> alter diskgroup data add disk 'ORCL:VOL3';


Diskgroup altered.
SQL> select path,FREE_MB,TOTAL_MB from v$asm_disk;
PATH
FREE_MB TOTAL_MB
---------- ---------ORCL:VOL1
1742
2047
ORCL:VOL2

1738

2047

ORCL:VOL3

1743

2047

Вам также может понравиться