12 luglio 2008

ASM a linea di comando

Ogni tanto arriva qualche e-mail dai lettori di questo blog. La maggior parte delle domande riguarda ASM, il volume manager/filesystem di Oracle dedicato all'immagazzinamento dei dati del suo motore RDBMS.

Forse non tutti sanno che ASM è accessibile anche da linea di comando con asmcmd.

asmcmd è sostanzialmente un prompt dei comandi che si collega all'istanza ASM attiva sulla $ORACLE_HOME impostata nell'ambiente, con il relativo $ORACLE_SID impostato a +ASM o +ASM<n> nel caso di RAC.

Eseguiamo asmcmd:
oracle@host:~> asmcmd -p
ASMCMD [+] >

Il flag -p permette di mostrare il path tra parentesi quadre.
I comandi disponibili sono: cd, du, find, help, ls, lsct, lsdg, mkalias, mkdir, pwd, rm, rmalias.
Per ogni comando si può avere l'help con help <comando>.
All'avvio troviamo l'elenco dei diskgroup montati dall'istanza ASM e in seguito i database montati in notazione OMF:
ASMCMD [+] > ls
DG1/
ASMCMD [+] > ls
ASMCMD [+] > cd DG1
ASMCMD [+DG1] > ls
DBTEST/
ASMCMD [+DG1] >

All'interno delle directory DB troveremo le sottodirectory in notazione OMF come su filesystem ordinario:
ASMCMD [+DG1/DBTEST] > ls
ARCHIVELOG/
CONTROLFILE/
DATAFILE/
ONLINELOG/
PARAMETERFILE/
TEMPFILE/
spfileDBTEST.ora
ASMCMD [+DG1/DBTEST] >

Il comando du mostra l'utilizzo del diskgroup:
ASMCMD [+DG1/DBTEST] > du .  
Used_MB Mirror_used_MB
24529 24529

Il comando lsdg mostra tutti i diskgroup:
ASMCMD [+] > lsdg
State Type Rebal Unbal
Sector Block AU Total_MB
Free_MB Req_mir_free_MB Usable_file_MB
Offline_disks Name
MOUNTED EXTERN N N
512 4096 1048576 347430
322841 0 322841
0 DG1/


Contrariamente a un filesystem normale, esistono i comandi per creare e rimuovere alias mkalias e rmalias.
Gli alias in ASM sono file finti nel filesystem che puntano a file normali che risiedono sempre in ASM; possono essere visti come link simbolici. Ricordiamo infatti che ogni file in un volume ASM è un file OMF, ovvero è un file del database Oracle (controlfile, datafile, redo, e così via) con un nome scelto dal RDBMS, ma non un file ordinario. Per ogni file del db, quindi, esiste uno e un solo file OMF con il nome scelto da Oracle. Per avere file con nomi più leggibili o facili da ricordare si usano gli alias, a cui si può fare riferimento con i comandi DDL da prompt SQL al posto dei file OMF. Gli alias possono risiedere ovunque in ASM.

23 commenti:

Anonimo ha detto...

Ciao Rudy, attualmente ho avuto modo di usare sporadicamente ASM su un RAC Oracle a due nodi dove risulta decisamente utile, tittavia mi chiedevo, su un'installazione single instance è più conveniente usare OMF direttamente su file system, oppure anche qui posso usare ASM e che vantaggi ho, in quest'ultimo caso?

Ciao e grazie, Simone

Rudy ha detto...

Anche su istanza singola puoi usare ASM.
Secondo me hai vantaggi solo con tanti dischi (gestiti da ASM) o con grandi livelli di tolleranza ai guasti.

Vedo che ASM appassiona più di ogni altro argomento.
Penso che seguiranno post sull'argomento, in modo da chiarire diversi aspetti del funzionamento.

Bye

Anonimo ha detto...

Ok, mi hai incuriosito, quindi domani farò una prova con una macchina virtuale con un tot di dischi e vediamo come si comporta ASM.
Nuovi post sull'argomento sono sicuramente i benvenuti, almeno per quanto mi riguarda!
Tra l'altro, se ne avrai occasione, spero di poter vedere, prima o poi, qualche post anche sul comportamento di Oracle in ambiente virtualizzato (io la butto lì :-) )

Ciao, Simone

Anonimo ha detto...

Ciao Rudy, sto facendo qualche prova con ASM ed RMAN in un ambiente virtuale. Ho creato due diskgroup, il primo chiamato DATA su cui finiscono controlfiles, datafiles, ecc e il secondo chiamato ARCH in cui inserisco i backup eseguiti con RMAN. Da quanto capisco, è ASM che esegue il mirroring e lo striping di tali files sui dischi fissi del diskgroup giusto? Quindi se un hd si rompe (ad esempio in una SAN), comunque non perdo i backup proprio grazie ad ASM. E' corretto?

Rudy ha detto...

Per avere striping e/o mirroring servono come minimo 2 dischi per un diskgroup.
È un discorso un po' troppo ampio da trattare in un commento al blog.

C'è un po' di confusione in merito. Vedrò di pubblicare qualcosa a breve :-)

Anonimo ha detto...

lM8I3h http://goedkopebootssale7.webnode.nl/ yK5R8e [url=http://goedkopebootssale7.webnode.nl/]uggs amerika[/url] rW5U5g goedkope uggs tP7A4x
uO7D0w http://naraclub.jp/ugg.php xJ3Q6e [url=http://naraclub.jp/ugg.php]ugg[/url] wL6A4k ugg tC3T3a
vH5A4d http://goedkopebootsonline.webnode.nl/ fS9J8a [url=http://goedkopebootsonline.webnode.nl/]goedkope uggs bestellen[/url] bJ6K4s goedkope uggs bestellen nU2S4h
qZ9G9y http://cheapbootonsale0.webs.com/ gI8Q2i [url=http://cheapbootonsale0.webs.com/]uggs boots outlet[/url] nM6Z7g ugg outlets tR9V7a
vN3O1m http://naraclub.jp/louisvuitton.php hI8T3f [url=http://naraclub.jp/louisvuitton.php]louis vuitton ヴェルニ 財布[/url] bT5G3i louis vuitton ネヴァーフル oK8D6t
sF9X3o http://bottessspascher.webnode.fr/ kP1G7a [url=http://bottessspascher.webnode.fr/]bottes ugg[/url] tI8F7i uggs france fJ6J0r

Anonimo ha detto...

5xUst ghd flat iron
oEex ugg boots on sale
mOrm michael kors bags
7xEmm GHD Hair Straightener
1mSnb burberry on sale
8vBez chaussures ugg
6rSnk ghd nz sale
5fHxq louis vuitton outlet
2gLbz michael kors outlet
4tPfy ghd uk
5rKpt ugg boots cheap
1tEti cheap nfl jerseys
5gGjo michael kors outlet
3fOiq ghd
9yLqi ugg boots sale

Anonimo ha detto...

3aDlu cheap ghd
gWqm ugg store
xRoq michael kors outlet
9zAdz GHD
0iCtb burberry on sale
7uCpg ugg pas cher
2fUbl ghd nz
1bIdd discount louis vuitton
3kXgw michael kors handbags
2aVfd coach factory outlet
7aOou ugg boots uk
1oDwn cheap nfl jerseys
9vDhe michael kors sale
7sBeh styler ghd
0eGwd cheap uggs

Anonimo ha detto...

SxcOfz http://kuroebaggu.com/ AimKgs [url=http://kuroebaggu.com/]クロエ 財布[/url] YafGhv http://saiyasunerubutan.com/ ThzCnl [url=http://saiyasunerubutan.com/]クリスチャンルブタン 財布[/url] BukIwd http://mcmhannbai.com/ GfaPwk [url=http://mcmhannbai.com/]MCM キーケース[/url] MpsZmr http://vuittonkakaku.com/ QezXde [url=http://vuittonkakaku.com/]ルイヴィトン アウトレット[/url] TzoAsd http://chloenihon.com/ RqsUth [url=http://chloenihon.com/]クロエ[/url] UxfNrm http://louboutindendou.com/ AtsXyu [url=http://louboutindendou.com/]クリスチャンルブタン 財布[/url] FjjIqr http://guccisenmon.com/ YszVex [url=http://guccisenmon.com/]グッチ[/url] JhsPtr http://tuminihoo.com/ DjdWny [url=http://tuminihoo.com/]ビジネスバッグ TUMI[/url]

Anonimo ha detto...

Hi, diazepam price - diazepam without prescription http://www.9oul.com/, [url=http://www.9oul.com/]diazepam without prescription[/url]

Anonimo ha detto...

Howdy I am so glad I found your blog, I really found you by accident, while I
was browsing on Aol for something else, Regardless I am here
now and would just like to say cheers for a incredible post
and a all round interesting blog (I also love the theme/design), I don’t have time to go
through it all at the minute but I have saved it
and also added in your RSS feeds, so when I have time I will be
back to read a lot more, Please do keep up the awesome b.

Also visit my webpage hemorrhoids home remedies

Anonimo ha detto...

I was suggested this blog by my cousin. I am not sure whether this post is written by him as nobody else know such detailed about my difficulty.
You're amazing! Thanks!

Feel free to visit my web page - maxoderm reviews

Anonimo ha detto...

Excellent post. I was checking constantly this blog and
I'm impressed! Extremely helpful information particularly the last part :) I care for such info a lot. I was looking for this particular info for a long time. Thank you and best of luck.

My blog :: slimming plan

Anonimo ha detto...

What's up to every one, it's in fact a nice for me to pay a quick visit this web page, it includes precious Information.


My webpage - http://www.mustedit.com

Anonimo ha detto...

It's really a cool and useful piece of info. I'm glad that you shared this useful info with
us. Please keep us up to date like this. Thank you for sharing.


my web page ... enhancement for men

Anonimo ha detto...

hello there and thank you for your info – I've definitely picked up anything new from right here. I did however expertise some technical issues using this web site, since I experienced to reload the site many times previous to I could get it to load properly. I had been wondering if your web host is OK? Not that I'm complaining, but sluggish
loading instances times will often affect your placement in google
and could damage your high-quality score if advertising and marketing
with Adwords. Anyway I'm adding this RSS to my email and could look out for a lot more of your respective exciting content. Make sure you update this again very soon.

Visit my web blog - best natural male enhancement reviews

Anonimo ha detto...

constantly i used to read smaller content which as well clear their motive, and that is also happening with this piece of writing which I am
reading at this place.

Feel free to visit my web-site buy xtremeno

Anonimo ha detto...

I'm not sure why but this weblog is loading incredibly slow for me. Is anyone else having this issue or is it a problem on my end? I'll check back later on and see if the problem
still exists.

Feel free to visit my web site buy alta white

Anonimo ha detto...

Great article.

Take a look at my blog: wordpress.com

Anonimo ha detto...

Hey I know this is off topic but I was wondering if you knew of
any widgets I could add to my blog that automatically tweet my newest twitter updates.
I've been looking for a plug-in like this for quite some time and was hoping maybe you would have some experience with something like this. Please let me know if you run into anything. I truly enjoy reading your blog and I look forward to your new updates.

Also visit my weblog ... Buy Venapro

Anonimo ha detto...

I loved as much as you will receive carried out right here.
The sketch is tasteful, your authored subject
matter stylish. nonetheless, you command get bought an nervousness over that you wish be delivering the following.
unwell unquestionably come more formerly again since exactly the same nearly a lot often inside case you
shield this hike.

Stop by my blog post - venapro cheap

Anonimo ha detto...

Please let me know if you're looking for a author for your blog. You have some really great articles and I believe I would be a good asset. If you ever want to take some of the load off, I'd really like to write some articles for your blog in exchange for a link back to mine.

Please blast me an email if interested. Many thanks!


Here is my page :: meratol.beep.com

Anonimo ha detto...

WOW just what I was searching for. Came here by searching for enhancement pills

My website :: vigrx plus canada