Professional Documents
Culture Documents
INDEX
Summary.......................................................................................................................................................................2
Create a Flash Recovery Area Diskgroup on The Available Block Devices.................................................................3
Remove raw devices configuration...............................................................................................................................4
Stop rawdevices and reboot the servers.......................................................................................................................6
Label the devices as oracle asm disks .........................................................................................................................8
Start the database and Check.....................................................................................................................................10
Scripts..........................................................................................................................................................................13
1/16
ASM HANDS-ON TRAINING
Lab 9 Migrating Raw and Block Devices to ASMLib
Summary
ASMLib is best practice on Linux, it may happen that a database server that was configured a couple of years ago with
ASM 10g R1 is still using raw devices, or that a new ASM 10g R2 or even 11g was configured using block devices instead
of ASM.
The first step is to install ASMLib rpm’s and to configure ASMLib on the server. We already finish that part of the
procedure on lab 2 “Install and Configure ASMLib”
2/16
ASM HANDS-ON TRAINING
Lab 9 Migrating Raw and Block Devices to ASMLib
SQL> @chkblk.sql
Connect to the ASM instance and create a diskgroup and move the database Flash Recovery Area to it.
Diskgroup created.
SQL> @chkblk
Connect to database sati’s and set it’s Flash recovery Area to be located on the FRADG diskgroup
3/16
ASM HANDS-ON TRAINING
Lab 9 Migrating Raw and Block Devices to ASMLib
SQL> show parameters recovery_file_dest
System altered.
@chkraw;
DISK_NUMBER MOUNT_S HEADER_STATU MODE_ST STATE PATH
----------- ------- ------------ ------- -------- ------------------------------
1 CACHED MEMBER ONLINE NORMAL /dev/raw/raw4
0 CACHED MEMBER ONLINE NORMAL /dev/raw/raw3
1 CACHED MEMBER ONLINE NORMAL /dev/raw/raw2
0 CACHED MEMBER ONLINE NORMAL /dev/raw/raw1
@chkdgraw;
PATH NAME
4/16
ASM HANDS-ON TRAINING
Lab 9 Migrating Raw and Block Devices to ASMLib
--------------- ------
/dev/raw/raw4 ARCHDG
/dev/raw/raw3 ARCHDG
/dev/raw/raw2 DATADG
/dev/raw/raw1 DATADG
On our Linux 5 environment they are binded to loop devices on startup using the raw command.
We will change the script that make the binding so that they will remain as loop devices only
raw -qa
chmod 660 /dev/raw/raw[1-4]
chown oracle:dba /dev/raw/raw[1-4]
5/16
ASM HANDS-ON TRAINING
Lab 9 Migrating Raw and Block Devices to ASMLib
Then we will change the startup script on /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
/opt/desktop/obi_cc_script/obidata.sh
ls /dev/sd?1 | grep -v sda | xargs chown oracle:dba
ls /dev/sd?1 | grep -v sda | xargs chmod 660
Database dismounted.
ORACLE instance shut down.
6/16
ASM HANDS-ON TRAINING
Lab 9 Migrating Raw and Block Devices to ASMLib
[root@asmxpt ~]# reboot
Once the system comes up, check the loop devices, we did configure loop devices from 1 to 4
7/16
ASM HANDS-ON TRAINING
Lab 9 Migrating Raw and Block Devices to ASMLib
8/16
ASM HANDS-ON TRAINING
Lab 9 Migrating Raw and Block Devices to ASMLib
VOLBLK2
VOLBLK3
VOLOOP1
VOLOOP2
VOLOOP3
VOLOOP4
9/16
ASM HANDS-ON TRAINING
Lab 9 Migrating Raw and Block Devices to ASMLib
ASM Cache 25165824 bytes
ASM diskgroups mounted
We can see that all disk groups were successfully mounted. We had set the parameter asm_diskstring to include the
string “ORCL:VOL*” that worked fine for all the stamped devices.
10/16
ASM HANDS-ON TRAINING
Lab 9 Migrating Raw and Block Devices to ASMLib
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
System altered.
SQL> exit
Check that the current log was archived on the FRADG disk group
11/16
ASM HANDS-ON TRAINING
Lab 9 Migrating Raw and Block Devices to ASMLib
thread_1_seq_80.257.678595665
thread_1_seq_81.258.678595667
thread_1_seq_82.259.678596379
12/16
ASM HANDS-ON TRAINING
Lab 9 Migrating Raw and Block Devices to ASMLib
Scripts
Chkraw.sql
-- chkraw.sql
-- Check ASM disks configured on raw devices
set pages 50000 lines 120
col path for a15
select disk_number,mount_status,header_status,mode_status,state,path
from v$asm_disk
where path like '%raw%';
Chkblk.sql
-- chkblk.sql
-- Check ASM disks configured on block devices
set pages 50000 lines 120
col path for a15
select disk_number,mount_status,header_status,mode_status,state,path
from v$asm_disk
where path like '%sd%';
Chkdgraw.sql
-- chkdgraw.sql
-- Check ASM diskgroup built on raw devices
set pages 50000 lines 120
col path for a15
select a.path,b.NAME from v$asm_disk a, v$asm_diskgroup b
where a.GROUP_NUMBER=b.GROUP_NUMBER and
13/16
ASM HANDS-ON TRAINING
Lab 9 Migrating Raw and Block Devices to ASMLib
a.path like '%raw%' ;
Chkasmdisks
#!/bin/ksh
# chkasmdisks
# Map ASM disks to its base devices
# ---------------------------------
/etc/init.d/oracleasm querydisk `/etc/init.d/oracleasm listdisks` | cut -f2,10,11 -d" " |
perl -pe 's/"(.*)".*\[(.*), *(.*)\]/$1 $2 $3/g;' | while read v_asmdisk v_minor v_major
do
v_device=`ls -la /dev | grep " $v_minor, *$v_major " | awk '{print $10}'`
echo "ASM disk $v_asmdisk based on /dev/$v_device [$v_minor, $v_major]"
done
Startlsnr
#!/bin/ksh
# ---------
# startlsnr
# ---------
export ORACLE_BASE=/u01/app/oracle/10g_db
export ORACLE_HOME=/u01/app/oracle/10g_db
export BASE_PATH=/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/java/jre1.5.0_10/bin:
/home/oracle/bin:/sbin:/usr/sbin:/etc/init.d:/home/oracle
export PATH=${ORACLE_HOME}/bin:${BASE_PATH}
clear
lsnrctl start LISTENER_ASMXPT
lsnrctl status LISTENER_ASMXPT
lsnrctl services LISTENER_ASMXPT
14/16
ASM HANDS-ON TRAINING
Lab 9 Migrating Raw and Block Devices to ASMLib
# ---------
# eof startlsnr
Startasm
#!/bin/ksh
# ---------
# startasm
# ---------
export ORACLE_BASE=/u01/app/oracle/10g_db
export ORACLE_HOME=/u01/app/oracle/10g_db
export ORACLE_SID=+ASM
export BASE_PATH=/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/java/jre1.5.0_10/bin:
/home/oracle/bin:/sbin:/usr/sbin:/etc/init.d:/home/oracle
export PATH=${ORACLE_HOME}/bin:${BASE_PATH}
clear
sqlplus -s / as sysdba<<eof
startup
exit
eof
# ---------
# eof startasm
Startsati
#!/bin/ksh
# ---------
# startsati
# ---------
export ORACLE_BASE=/u01/app/oracle/10g_db
15/16
ASM HANDS-ON TRAINING
Lab 9 Migrating Raw and Block Devices to ASMLib
export ORACLE_HOME=/u01/app/oracle/10g_db
export ORACLE_SID=sati
export BASE_PATH=/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/java/jre1.5.0_10/bin:
/home/oracle/bin:/sbin:/usr/sbin:/etc/init.d:/home/oracle
export PATH=${ORACLE_HOME}/bin:${BASE_PATH}
clear
sqlplus -s / as sysdba<<eof
startup
exit
eof
# ---------
# eof startsati
End of Lab9
16/16