Guenadi N Jilevski's Oracle BLOG

Oracle RAC, DG, EBS, DR and HA DBA BLOG

ASM on Linux on Single Disk

http://www.pitcorp.com/Oracle10gASM.html

Automatic Storage Management (ASM) on Red Hat Linux 3.0 on a single disk.

This article explains easy and affordable way to setup an ASM if there are no free partitions on the disk or no free disk device is available without the use Oracle Corp provided Linux specific ASM library and its associated driver.

by Guenadi Nedkob Jilevski (gjilevski@gmail.com)

If you are an Senior Oracle DBA or a system architect experienced to the Linux Operating System and introduced to the ASM technology this article shall give you un-expensive environment for setup of an ASM solution by using a single disk without any partitions available.

Background / Overview

 

The article uses a step by step approach from both Red Hat Linux 3.0 System administration and Oracle 10g DBA perspective to set-up an ASM environment. In details is described creation of devices on existing file system. Use of dbca to create an ASM instance for management of the devices is explained. Two alternative ways database creation utilizing ASM are described profound manner using dbca and manual database cretion using the create database statement.

The article starts with the step-by-step instructions for set-up of devices on Red Hat Linux 3.0. After that using dbca an ASM instance is created and an Oracle database is created using dbca using the ASM. At the end manual ASM disk groups are created and a database is created manually using the crate database statement. The

Step 1: Step-by-step instructions for setup of devices on Red Hat Linux.

In the first step as oracle user create the files to be used as an ASM devices:

[oracle10@pub1 oracle10]$ cd /a02/oradata

[oracle10@pub1 oradata]$ ls

AA  +ASM  CSSFile  OCRFile  orc  orcl

 [oracle10@pub1 oradata]$ dd if=/dev/zero of=F_file_disk5 bs=1k count=20000000

20000000+0 records in

20000000+0 records out

[oracle10@pub1 oradata]$ ls -l F_file_disk5

-rw-r–r–    1 oracle10 dba      20480000000 Oct 23 16:51 F_file_disk5

[oracle10@pub1 oradata]$ dd if=/dev/zero of=F_file_disk6 bs=1k count=20000000

20000000+0 records in

20000000+0 records out

[oracle10@pub1 oradata]$ ls -l F_file_disk6

-rw-r–r–    1 oracle10 dba      20480000000 Oct 23 17:06 F_file_disk6

Repeat the steps above on mount points where there is free space. In my case I created in /a01/oradata files F_file_disk1,  F_file_disk2, F_file_Disk3, F_file_Disk4.

With second step using ‘losetup’ command, we will associate a loop device   with a file. This time, the root account needs to execute these commands.

root@pub1 root]# losetup /dev/loop5 /a02/oradata/F_file_disk5

[root@pub1 root]# losetup /dev/loop6 /a02/oradata/F_file_disk6

 [root@pub1 root]#

Repeat the steps for the F_file_disk1, F_file_disk2, F_file_Disk3, F_file_Disk4 and associate loop devices /dev/loop1, /dev/loop2, /dev/loop3, /dev/loop4

In the third step as a root  utility called ‘raw’ (see ‘man raw’) can be used to bind a raw device    to an existing block device.

[root@pub1 root]# raw /dev/raw/raw5 /dev/loop5

/dev/raw/raw5:  bound to major 7, minor 5

[root@pub1 root]# raw /dev/raw/raw6 /dev/loop6

/dev/raw/raw6:  bound to major 7, minor 6

[root@pub1 root]#

Repeat the same for the for the /dev/loop1, /dev/loop2, /dev/loop3, /dev/loop4

In the fourth step change the ownership of the raw devices.

[root@pub1 root]# chown oracle10:dba /dev/raw/raw5

[root@pub1 root]# chown oracle10:dba /dev/raw/raw6

[root@pub1 root]# chmod 660 /dev/raw/raw5

[root@pub1 root]# chmod 660 /dev/raw/raw6

[root@pub1 root]#

From OS point of view, the task is completed. Now  there are free ‘devices’

available for ASM.

Step 2: A Step-by-step instructions for ASM instance creation and automatical Oracle database creation using dbca deploying ASM.

Using the dbca an ASM instance is started and ZZZZ database is created using ASM  storage management option.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Step 3: Step-by-step instructions for a ASM disk groups creation and manual database creation.

AS oracle user perform the following activities. At the end of the section will be the initYYYY.ora file for the YYYY instance.

[oracle10@pub1 oracle10]$ export ORACLE_SID=+ASM1

 [oracle10@pub1 oracle10]$ sqlplus ‘/ as sysdba’

SQL*Plus: Release 10.1.0.2.0 – Production on Sat Oct 23 18:00:19 2004

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

Connected to:

Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 – Production

With the Partitioning, Real Application Clusters, OLAP and Data Mining options

 

SQL> create diskgroup orcl_data1 normal redundancy failgroup controller1 disk ‘/dev/raw/raw5’ failgroup controller2 disk ‘/dev/raw/raw6’;

Diskgroup created.

SQL>

SQL> select name, state, total_mb, free_mb, path from v$asm_disk;

NAME                           STATE      TOTAL_MB    FREE_MB

—————————— ——– ———- ———-

PATH

——————————————————————————–

ORCL_DATA_0000                 NORMAL         9765       8870

/dev/raw/raw4

 

ORCL_DATA_0001                 NORMAL         9765       8870

/dev/raw/raw3

 

ORACLE_DATA1_0000              NORMAL         9765       8739

/dev/raw/raw2

 

 

NAME                           STATE      TOTAL_MB    FREE_MB

—————————— ——– ———- ———-

PATH

——————————————————————————–

ORACLE_DATA1_0001              NORMAL         9765       8739

/dev/raw/raw1

 

ORCL_DATA1_0001                NORMAL        19531      19481

/dev/raw/raw6

 

ORCL_DATA1_0000                NORMAL        19531      19481

/dev/raw/raw5

 

 

6 rows selected.

 

SQL>

 

SQL> select * from v$asm_diskgroup;

 

GROUP_NUMBER NAME                           SECTOR_SIZE BLOCK_SIZE

———— —————————— ———– ———-

ALLOCATION_UNIT_SIZE STATE       TYPE     TOTAL_MB    FREE_MB

——————– ———– —— ———- ———-

           1 ORACLE_DATA1                           512       4096

             1048576 MOUNTED     NORMAL      19530      17478

 

           2 ORCL_DATA                              512       4096

             1048576 MOUNTED     NORMAL      19530      17740

 

           3 ORCL_DATA1                             512       4096

             1048576 MOUNTED     NORMAL      39062      38962

 

 

[oracle10@pub1 db_2]$ cd $ORACLE_BASE

[oracle10@pub1 oracle]$ cd admin

[oracle10@pub1 admin]$ mkdir YYYY

[oracle10@pub1 admin]$ cd YYYY

[oracle10@pub1 YYYY]$ mkdir udump

[oracle10@pub1 YYYY]$ mkdir udump

mkdir: cannot create directory `udump’: File exists

[oracle10@pub1 YYYY]$ mkdir bdump

[oracle10@pub1 YYYY]$ mkdir cdump

[oracle10@pub1 YYYY]$

 

 

 

SQL> connect / as sysdba

Connected to an idle instance.

SQL> startup nomount;

ORACLE instance started.

 

Total System Global Area  188743680 bytes

Fixed Size                   778036 bytes

Variable Size             162537676 bytes

Database Buffers           25165824 bytes

Redo Buffers                 262144 bytes

SQL> CREATE DATABASE YYYY

  2  CONTROLFILE REUSE

  3  LOGFILE

  4  GROUP 1 (‘+ORCL_DATA1/YYYY/redo04.log’) SIZE 10M,

  5  GROUP 2 (‘+ORCL_DATA1/YYYY/redo05.log’) SIZE 10M,

  6  GROUP 3 (‘+ORCL_DATA1/YYYY/redo06.log’) SIZE 10M

  7  ARCHIVELOG

DATAFILE ‘+ORCL_DATA1/YYYY/system01.dbf’

  8    9  SIZE 300M AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED

 10  EXTENT MANAGEMENT LOCAL

 11  SYSAUX DATAFILE ‘+ORCL_DATA1/YYYY/sysaux01.dbf’ SIZE 120M

 12  DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE ‘+ORCL_DATA1/YYYY/temp01.dbf’ SIZE 50M

 13  UNDO TABLESPACE UNDOTBS1 DATAFILE ‘+ORCL_DATA1/YYYY/undotbs01.dbf’ SIZE 100M

 14  CHARACTER SET UTF8

 15  USER SYS IDENTIFIED BY sys1 USER SYSTEM IDENTIFIED BY sys1;

 

Database created.

 

SQL>

 

 

SQL> CREATE TABLESPACE USERS DATAFILE ‘+ORCL_DATA1/YYYY/users01.dbf’

SIZE 100M EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;

  2

 

Tablespace created.

 

SQL> SQL>

 

SQL> alter database default tablespace users;

 

Database altered.

 

SQL>

 

SQL> !ls $ORACLE_HOME/dbs/initYYYY.ora

/a02/app/oracle/product/10.1.0/db_2/dbs/initYYYY.ora

 

SQL> create spfile from pfile=’/a02/app/oracle/product/10.1.0/db_2/dbs/initYYYY.

ora’;

 

File created.

 

SQL>

 

SQL> !cat /a02/app/oracle/product/10.1.0/db_2/dbs/initYYYY.ora

*.background_dump_dest=’/a02/app/oracle/admin/YYYY/bdump’

*.compatible=’10.1.0.2.0′

*.control_files=’+ORCL_DATA1/YYYY/control01.ctl’,’+ORCL_DATA1/YYYY/control02.ctl’,’+ORCL_DATA1/YYYY/control03.ctl’

*.core_dump_dest=’/a02/app/oracle/admin/YYYY/cdump’

*.db_block_size=8192

*.db_cache_size=25165824

*.db_domain=”

*.db_file_multiblock_read_count=16

*.db_name=’YYYY’

*.db_recovery_file_dest=’+ORCL_DATA1′

*.db_recovery_file_dest_size=2147483648

*.dispatchers='(PROTOCOL=TCP) (SERVICE=YYYYXDB)’

*.java_pool_size=50331648

*.job_queue_processes=10

*.large_pool_size=8388608

*.log_archive_dest_1=’LOCATION=+ORCL_DATA1/YYYY/’

*.log_archive_format=’%t_%s_%r.dbf’

*.open_cursors=300

*.pga_aggregate_target=25165824

*.processes=250

*.remote_login_passwordfile=’NONE’

*.shared_pool_size=99614720

*.sort_area_size=65536

*.undo_management=’AUTO’

*.undo_tablespace=’UNDOTBS1′

*.user_dump_dest=’/a02/app/oracle/admin/YYYY/udump’

 

 

 

Conclusion

Having implemented the solution described above the reader probably have noticed that has under his/hers belt a fully functional very cost effective ASM enabled Oracle database for testing, prototyping and prove of concept. The article s extremely suitable for in-house training, consultants sand desk labs and class trainings which can not afford expensive SAN, NAS or multiple disks. Once a solution is piloted and configurations tested next essential step will be to build a real test and production environments resulting in considerable reduction of the time, cost solution reusability and much faster learning curve and plenty of hands on knowledge in the course of rolling over into production versus a full fledged prototyping requiring the pairs of servers for clusters and shared disk storage.

 

 At the end of the file, after the text of the article, please supply the following:

§         Configuration File samples /etc/rc.d/rc.local

touch /var/lock/subsys/local

losetup /dev/loop1 /a01/app/oradata/F_file_disk1

losetup /dev/loop2 /a01/app/oradata/F_file_disk2

losetup /dev/loop3 /a01/app/oradata/F_file_Disk3

losetup /dev/loop4 /a01/app/oradata/F_file_Disk4

losetup /dev/loop5 /a02/app/oradata/F_file_disk5

losetup /dev/loop6 /a02/app/oradata/F_file_disk6

raw /dev/raw/raw1 /dev/loop1

raw /dev/raw/raw2 /dev/loop2

raw /dev/raw/raw3 /dev/loop3

raw /dev/raw/raw4 /dev/loop4

raw /dev/raw/raw5 /dev/loop5

raw /dev/raw/raw6 /dev/loop6

§         Links to more information about the technology : otn.oracle.com, metalink.oracle.com

§         Guenadi Nedkov Jilevski (gjilevski@gmail.com) is a [Senior Infrastructure Specialist ] at Perot Systems, (http://www.ps.com) a [Lake Success, NY] based [global provider of technology-based business solutions].

 

April 27, 2009 - Posted by | oracle | , , ,

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: