Upload
holisaliberoit
View
215
Download
0
Embed Size (px)
Citation preview
8/18/2019 How to Set Up Oracle ASM on Ubuntu Gutsy Gibbon
1/5
w To Set Up Oracle ASM on Ubuntu Gutsy Gibbon
ps://www.pythian.com/blog/howto-set-up-oracle-asm-on-ubuntu-gutsy-gibbon/[25/02/2016 14:42:45]
HOW TO SET UP ORACLE ASM ON UBUNTU GUTSY GIBBONby Grégory Guillou
Posted in: Technical Track
Tags: OracleI’ve recently moved to Ubuntu Linux, and this post describes my attempt to play
around with Oracle ASM on Ubuntu. For this demonstration, I used Oracle 11.1.0.6
on Gutsy Gibbon. I hope it will be useful to somebody out there.
I m p o r t a n t N o t i c e : What I describe below is among the worst thing you can ever
do with ASM. You can use it to play around but n e v e r use it with anything other
than test data. If you lose something because of me, you’ll be the only one to
blame !
Question #1: How do you simulate a disk from a file?
If you have a free partition or disk to be used as an ASM disk, just skip this step. If
you don’t, you can create a file with the dd command and create a device that
actually loops to the file with the l oset up command.
Let’s assume you’ve created a directory named / asmdi sks (and you have write
access to it). Run the command below to create a file named disk1 that is 3GB in
size:
$ dd if=/dev/zero of=/asmdisks/disk1 bs=1024k count=3072
3072+0 records i n
3072+0 r ecor ds out
3221225472 byt es ( 3. 2 GB) copi ed, 80. 9113 seconds, 39. 8 MB/ s
Once you’ve created the file, map it to a device named loopN in / dev. You can list
the used loop devices with the l oset up - a command.
Once you’ve made sure the one you plan to used is free, e.g. / dev/ l oop1, you can
map the device to the file with the following commands (you have to be root) :
# losetup /dev/loop1 /asmdisks/disk1
# losetup -a
/ dev/ l oop1: [ 0802] : 7438407 ( / asmdi sks/ di sk1)
Question #2: How do you create an interface to the disk that is
usable by ASM?
Actually, the preferred way to access a disk from ASM on Linux is ASMLib. To be
fair, I must say I didn’t even give it a try. Of course, I’d be more than interested if
February 7, 2008|
https://www.pythian.com/blog/author/arkzoyd/https://www.pythian.com/blog/technical-track/https://www.pythian.com/blog/tag/oracle/http://www.ubuntu.com/http://releases.ubuntu.com/7.10/http://oss.oracle.com/projects/oracleasm/http://oss.oracle.com/projects/oracleasm/http://releases.ubuntu.com/7.10/http://www.ubuntu.com/https://www.pythian.com/blog/tag/oracle/https://www.pythian.com/blog/technical-track/https://www.pythian.com/blog/author/arkzoyd/
8/18/2019 How to Set Up Oracle ASM on Ubuntu Gutsy Gibbon
2/5
8/18/2019 How to Set Up Oracle ASM on Ubuntu Gutsy Gibbon
3/5
w To Set Up Oracle ASM on Ubuntu Gutsy Gibbon
ps://www.pythian.com/blog/howto-set-up-oracle-asm-on-ubuntu-gutsy-gibbon/[25/02/2016 14:42:45]
Note 3: If you want the CSSD daemon to startup automatically, you’ll have to create
a service in Ubuntu.
Question #4: How do you create the ASM instance, add a
diskgroup, etc?
This is not really the subject of this post, but assuming you’ve already installed Oracle 11g accordingly to Augusto’s Installing Oracle 11g on Ubuntu Linux 7.10
(Gutsy Gibbon) and you’ve setup the PATH, ORACLE_HOME and ORACLE_BASE
variables, you can do everything in one command:
$ dbca - si l ent - conf i gur eASM \
- asmSysPassword change_on_i nst al l \
- di skSt r i ng "/ dev/ l oop*" \
- di skLi st / dev/ l oop1 \
- di skGr oupName DG1 \ - r edundancy EXTERNAL
Once that is done, you can connect to the ASM instance with SQL*Plus:
$ source oraenv
ORACLE_SI D = [ or acl e] ?+ASM
The Or acl e base f or ORACLE_HOME=/ u01/ app/ or acl e/ pr oduct / 11. 1. 0/ db_1 i s
/ u01/ app/ or acl e
$ sql pl us / as sysdba
SQL> sel ect NAME, TOTAL_MB
f r om v$asm_di skgr oup;
NAME TOTAL_MB
- - - - - - - - - - - -
DG1 3072
Or you can use ASMCMD as below:
$ source oraenvORACLE_SI D = [ or acl e] ?+ASM
The Or acl e base f or ORACLE_HOME=/ u01/ app/ or acl e/ pr oduct / 11. 1. 0/ db_1 i s
/ u01/ app/ or acl e
$ asmcmd
ASMCMD> l s
DG1/
Question #5: How do you create a database that uses ASM?I cannot resist providing the syntax for 11g (t ot al Memory will have to be replaced
by memor yPer cent age in 10g):
http://www.pythian.com/blogs/654/installing-oracle-11g-on-ubuntu-linux-710-gutsy-gibbon/http://www.pythian.com/blogs/654/installing-oracle-11g-on-ubuntu-linux-710-gutsy-gibbon/http://www.pythian.com/blogs/654/installing-oracle-11g-on-ubuntu-linux-710-gutsy-gibbon/http://www.pythian.com/blogs/654/installing-oracle-11g-on-ubuntu-linux-710-gutsy-gibbon/
8/18/2019 How to Set Up Oracle ASM on Ubuntu Gutsy Gibbon
4/5
w To Set Up Oracle ASM on Ubuntu Gutsy Gibbon
ps://www.pythian.com/blog/howto-set-up-oracle-asm-on-ubuntu-gutsy-gibbon/[25/02/2016 14:42:45]
$ dbca -silent -createDatabase \
-templateName General_Purpose.dbc \
-gdbName BLUJ \
-sysPassword change_on_install \
-systemPassword manager \
-emConfiguration NONE \
-storageType ASM \
-asmSysPassword change_on_install \
-diskGroupName DG1 \
-characterSet WE8ISO8859P15 \
-totalMemory 250
ul i mi t : 1: I l l egal opt i on - u
ul i mi t : 1: I l l egal opt i on - u
ul i mi t : 1: I l l egal opt i on - u
ul i mi t : 1: I l l egal opt i on - u
Copyi ng dat abase f i l es
1% compl ete
3% compl ete
37% compl ete
Cr eat i ng and st ar t i ng Or acl e i nst ance
40% compl ete
45% compl ete
50% compl ete55% compl ete
56% compl ete
60% compl ete
62% compl ete
Compl et i ng Database Cr eat i on
66% compl ete
70% compl ete
73% compl ete77% compl ete
88% compl ete
100% compl et e
Look at t he l og f i l e "/ u01/ app/ or acl e/ cf gt ool l ogs/ dbca/ BLUJ / BLUJ . l og"
f or f ur t her det ai l s .
Question #2 (Revisited): How do you create an interface to the
disk that is usable by ASM ?For 11g ASM offline tests, raw devices can actually be useful. And, despite the
missing pieces, creating a raw device that maps the loop device (or real
8/18/2019 How to Set Up Oracle ASM on Ubuntu Gutsy Gibbon
5/5
w To Set Up Oracle ASM on Ubuntu Gutsy Gibbon
// hi /bl /h l b ibb /[25/02/2016 14 42 45]
disk/partition) is straightforward. The first step consists in filling the holes in
Ubuntu, i.e. in creating some character files that are not created by default on
Gutsy Gibbon (r awct l , r aw0 . . . r aw1).
Run the set of commands below as r oot :
# mknod / dev/ r awct l c 162 0
# mknod / dev/ r aw/ r aw0 c 162 1
# mknod / dev/ r aw/ r aw1 c 162 2
# l n - s / dev/ r awct l / dev/ r aw/ r awct l
Once the missing pieces rebuilt, mapping a raw devices to your disk or loop
interface is as easy as:
# r aw / dev/ r aw/ r aw1 / dev/ l oop1
Or if you use a partition named / dev/ sdb1:
# r aw / dev/ r aw/ r aw1 / dev/ sdb1
You can display the result of your settings with the command below.
# raw -qa
/ dev/ r aw/ r aw1: bound t o maj or 7, mi nor 0
The raw devices won’t change anything but the path to the device when you’ll go
from Question #3 to Question #5.
Note 4: If you want the raw devices to be setup automatically at boot time, you’ll
have to define the correct rules in /etc/udev/rules.d .
Conclusion
What I really like about Oracle is that once you’ve done something, you have ten
different ways to go. I hope this post will enable you to explore some 11g’s new
features on your favorite operating system.
Related Posts:
1. Breaking News: How Fast Can Your Query be With Exadata?
2. Adding Columns with Default Values and Not Null in Oracle 11g
3. Log Buffer #152: A Carnival of the Vanities for DBAs
4. Performance Problems with Dynamic Statistics in Oracle 12c
Interested in working with Grégory? Schedule a tech call.
https://www.pythian.com/blog/how-fast-can-your-query-be-with-exadata/https://www.pythian.com/blog/adding-columns-with-default-values-and-not-null-in-oracle-11g/https://www.pythian.com/blog/log-buffer-152-a-carnival-of-the-vanities-for-dbas/https://www.pythian.com/blog/performance-problems-with-dynamic-statistics-in-oracle-12c/http://www.pythian.com/contacthttp://www.pythian.com/contacthttps://www.pythian.com/blog/performance-problems-with-dynamic-statistics-in-oracle-12c/https://www.pythian.com/blog/log-buffer-152-a-carnival-of-the-vanities-for-dbas/https://www.pythian.com/blog/adding-columns-with-default-values-and-not-null-in-oracle-11g/https://www.pythian.com/blog/how-fast-can-your-query-be-with-exadata/