lunedì 3 agosto 2009

Configurazione dei Virtual Hosts (alias) con Apache2 su Debian ETCH

Premessa

Questo tutorial non intende in nessun modo sostituire la reference ufficiale di Apache, per cui descrizioni dettagliate delle singole parti dei files di configurazione possono essere trovate nel sito ufficiale di Apache.


Introduzione

Nella guida precedente abbiamo parlato dell'installazione e la configurazione di un server LAMP con Debian, Apache2, MySQL e PHP, passiamo adesso alla configurazione dei singoli virtual hosts (ovvero degli hosts virtuali).


Il VirtualHosting consente la gestione di più domini basandosi sul loro nome ma non sul loro IP ed è una pratica ampiamente utilizzata in quanto è facile immaginare il gap di guadagno semplicemente immaginando il costo di una farm costituita da una serie di server che ospitano ciascuno un dominio diverso ed un solo server che ospita diversi domini diversi. L'unico appunto che può essere fatto a questa metodologia di gestione è che effettivamente se si ha un dominio molto attivo esso potrebbe monopolizzare le risorse di sistema lasciando solo la rimanenza delle risorse agli altri domini hostati difatti questo tipo di configurazione abitualmente è utilizzata per ospitare domini che non generano traffico eccessivo.


Se avete seguito la guida sull'installazione e la configurazione di un server LAMP con Debian non è necessario altro infatti l'intento di questo tutorial è dare le basi per la configurazione dei virtual hosts.


Per prima cosa prendiamo nota della DocumentRoot impostata nel file di configurazione di Apache2 digitando:


cat /etc/apache2/apache2.conf | grep DocumentRoot


di default la DocumentRoot è /var/www e utilizzerò questo riferimento nel resto del tutorial, tuttavia può essere facilmente modificata editando /etc/apache2/apache2.conf cercando la riga contenente DocumentRoot (per esempio con vim vi basterà digitare /DocumentRoot ) e modificando il percorso (ricordatevi che dovete creare la directory interessata prima di procedere al riavvio di apache tramite il comando /etc/init.d/apache2 reload ).

Cerchiamo di configurare l'ambiente per un dominio generico che con un po' di fantasia chiameremo miodominio.com . Adesso che conosciamo la nostra DocumentRoot possiamo creare una directory al suo interno:


mkdir /var/www/miodominio.com


che non renderemo pubblica ed una directory public che invece renderemo pubblica per cui:


mkdir /var/www/miodominio.com/public


creiamo anche una directory che useremo per l'utilizzo degli script CGI e vedremo in seguito come utilizzarla:


mkdir /var/www/miodominio.com/cgi-bin


e quindi procediamo con la creazione del file di configurazione per il dominio che vogliamo configurare, quindi creiamo e cominciamo a compilare il file suddetto col comando


vim /etc/apache2/sites-available/miodominio.com


inserendovi il seguente testo che analizzeremo riga per riga:


<VirtualHost *:80 >

ServerAdmin webmaster@miodominio.com

ServerName www.miodominio.com

DocumentRoot /var/www/miodominio.com/public

Alias /phpmyadmin "/usr/share/phpmyadmin"

<Directory "/var/www/miodominio.com/public">

Order Deny,Allow

Allow from all

Options -Indexes

</Directory>

<Directory "/var/www/miodominio.com/cgi-bin">

AllowOverride None

Options ExecCGI -MultiViews +SymLinksIfOwnerMatch -Indexes

Order allow,deny

Allow from all

</Directory>

ErrorLog /var/log/apache2/error_miodominio.net.log

LogLevel warn

CustomLog /var/log/apache2/access_miodominio.net.log combined

ServerSignature On

</VirtualHost>


procediamo all'analisi della configurazione riga per riga:


<VirtualHost *:80 >

è il tag che indica che devono essere processate le richieste indirizzate alla porta 80 (che comunque è quella di default) di tutti gli IP configurati nella macchina


ServerAdmin webmaster@miodominio.com

serve per indirizzare correttamente le richieste di supporto in caso di errori (pagine mancanti, richieste con accesso negato, ecc)


ServerName www.miodominio.com

viene utilizzato per configurare il nome di dominio da gestire e che lo distinguerà dagli altri


DocumentRoot /var/www/miodominio.com/public

ci dice in quale directory saranno indirizzate le richieste di connessione per il nome di dominio specificato nella riga precedente ed è anche la directory che quindi dovrebbe contenere l'index


Alias /phpmyadmin "/usr/share/phpmyadmin"

in questo modo impostiamo un alias di dominio ovvero digitando sul browser www.miodominio.com/phpmyadmin verremo indirizzati a quella directory che contiene il software phpmyadmin e quindi potremo amministrare il database


<Directory "/var/www/miodominio.com/public">

con questo tag cominciamo la configurazione dei permessi della directory public


Order Deny,Allow

definisce l'ordine di processamento dei permessi; nella fattispecie prima le negazioni di servizio (nel caso ci dovessero essere) e poi gli accessi


Allow from all

siccome nel nostro esempio non ci preoccupiamo di negare l'accesso in quanto vogliamo che il sito sia perfettamente accessibile dall'esterno consentiamo l'accesso a tutti


Options -Indexes

serve per restituire un messaggio di errore se nella directory nella quale si tenta l'accesso non è presente un file index , ciò serve per evitare di rendere pubblico materiale al quale non sono presenti collegamenti diretti


</Directory>

chiude il tag aperto poco prima


<Directory "/var/www/miodominio.com/cgi-bin">

con questo tag cominciamo a configurare la directory che conterrà gli script cgi


AllowOverride None

con questa opzione diciamo esplicitamente ad apache di non leggere il file .htaccess anche se presente perchè di fatto in questa directory non serve


Options ExecCGI -MultiViews +SymLinksIfOwnerMatch -Indexes

la descrizione di questa direttiva è un po' più lunga delle altre perchè ci sono un paio di opzioni di cui parlare (rimando al sito ufficiale per la documentazione dettagliata ed in inglese). Con ExecCGI consentiamo l'esecuzione di scripts CGI se è abilitato il modulo mod_cgi; con -MultiViews facciamo in modo che quando viene richiamata tramite browser la directory /var/www/miodominio.net/cgi-bin/qualcosa e questa directory non esistesse apache NON (vedi il - antecedente l'opzione) cerca un qualunque file in /var/www/miodominio.net/cgi-bin/ del tipo qualcosa.* ; con +SymLinksIfOwnerMatch facciamo in modo che Apache segua i links simbolici di sistema contenuti in questa directory solo se il proprietario del file o della directory di destinazione è lo stesso utente proprietario del link ; la -Indexes l'abbiamo vista prima


Order allow,deny

Allow from all

</Directory>


queste tre righe le abbiamo analizzate prima


ErrorLog /var/log/apache2/error_miodominio.net.log

questa riga serve per specificare il file in cui scrivere gli errori di apache che vengono riscontrati dagli utenti in fase di navigazione; è bene impostare un nome di questo file diverso per ogni dominio per facilitarne la lettura


LogLevel warn

con questa opzione dichiariamo il livello "verbosità" dei log e possiamo scegliere tra debug, info, notice, warn, error, crit, alert, emerg


CustomLog /var/log/apache2/access_miodominio.net.log combined

questa direttiva serve per tenere traccia delle richiesta al server apache


ServerSignature On

indica al server di includere la "firma" nel footer dei messaggi di errore, che include il nome del server ed il tipo di sistema operativo che si sta utilizzando


</VirtualHost>

questa indica la chiusura del tag VirtualHost


Per abilitare finalmente il nostro dominio sul server bastano due soli comandi


a2ensite miodominio.com

/etc/init.d/apache2 reload


col primo abilitiamo il nostro dominio creando un symlink a /etc/apache2/sites-available/miodominio.com in /etc/apache2/sites-enabled/miodominio.com e per disabilitarlo possiamo utilizzare i comandi


a2dissite miodominio.com

/etc/init.d/apache2 reload


ricordiamo sempre di ricaricare la cache di configurazione di apache ogni volta che viene modificato un file di configurazione.


Fatto ciò se i DNS sono aggiornati il nuovo sito sarà raggiungibile all'indirizzo www.miodominio.com.

WebServer LAMP (Linux, Apache 2, MySQL 5 e PHP 5) su Debian ETCH

Introduzione

Cosa è un "server LAMP"?

Nonostante molti di voi sperano che sia qualcosa di commestibile ahimè le vostra speranze stanno per crollare.. (per la cronaca.. non ha nemmeno a che fare con l'illuminazione della vostra scrivania).

Un server LAMP è quello che comunemente viene chiamato Webserver e consiste nell'installazione di software per la visualizzazione di pagine web e gestione dinamica di database; nello specifico LAMP sta per Linux, Apache, MySQL and PHP il che ci da un'idea su quali sono i software che servono per la realizzazione di server di questo tipo.

Linux bhè... è GNU/Linux... leggendo il resto del blog capirete da soli di che si tratta!


Apache è un daemon ovvero un programma che gira in background e serve per supportare connessioni di tipo HTTP ((HyperText Transfer Protocol)) che sarebbe il protocollo che generalmente si utilizza per la navigazione su internet e ci permette di vedere sul nostro Browser le pagine HTML ((HyperText Markup Language)) avete presente quella estensione che a volte si vede alla fine dell'URL?

PHP ha una definizione che viene detta ricorsiva perché nella stessa definizione viene ripetuto il termine PHP ed infatti sta per "PHP Hypertext Preprocessor" e consente ai webmaster di creare webapplications e pagine dinamiche in quanto è un vero e proprio linguaggio di programmazione (volendo anche ad aggetti) che viene interpretato dal motore Zend.

MySQL è il DataBase ovvero una specie di BancaDati più nello specifico è un software che ci permette di amministrare agevolmente dati disposti in tabelle tramite l'esecuzione di query.


Ingredienti


1.Debian 4.0 (ETCH)

2.Un editor di testo da linea di comando visto che probabilmente ci lavoreremo da remoto (consiglio vivamente VIM)

3.Un po' di pazienza




Installazione dell'ambiente

Passiamo al sodo.

Verifichiamo il contenuto di /etc/apt/sources.list e vediamo se sono presenti i seguenti mirror:



##ETCH (Stable)

deb http://ftp.it.debian.org/debian/ etch main contrib non-free

deb-src http://ftp.it.debian.org/debian/ etch main contrib non-free

##SECURITY UPDATES (Etch)

deb http://security.debian.org/ etch/updates main contrib non-free

deb-src http://security.debian.org/ etch/updates main contrib non-free


e diamo un bel

aptitude update

e poi

aptitude upgrade

Da root (ormai tutti sapete chi è root vero?) digitiamo:

apt-get install apache2 apache2-mpm-prefork php5-mysql mysql-server php5 libapache2-mod-php5 php5-cgi php5-gd php5-cli phpmyadmin

Durante la fase di installazione apt vi chiederà delle cose come:

Should MySQL start on boot? (Il server MySQL deve essere lanciato in fase di avvio?)

Io consiglio di selezionare SI in modo da avere il database sempre funzionante nonostante il server venga riavviato.


Facendo ciò la nostra cara Debian GNU/Linux box installerà Apache2, PHP5, MySQL5 e vari moduli per Apache e PHP per interfacciarsi tra di loro e col database.

Se pensate che sia finita qui (nonostante gran parte del lavoro sia gi?à stato fatto) vi sbagliate di grosso! Adesso comincia il bello!


Configurazione

Configurazione di Apache2

Aprite il file /etc/apache2/apache2.conf con VIM scrivendo sempre da root:

vim /etc/apache2/apache2.conf

e digitate "I" per passare alla modalità di inserimento del testo e scrivete nell'ultima riga:

ServerName localhost

per scrivere i cambiamenti ed uscire premete il tasto Esc e scrivete:

:wq

la lettera w indica a VIM di scrivere le modifiche ed il comando q gli dice di uscire dopo averlo fatto; mi raccomando i : prima di wq.

Adesso che avete capito penso/spero quali sono le funzioni base di VIM mi limiterò a dire "scrivete" e "salvate".

Le directory che vi serviranno per l'amministrazione sono:

/var/www che è impostata di default come webroot (vedremo in seguito come cambiarla)

/etc/apache2 che contiene i files di configurazione di apache2

/etc/apache2/sites-enabled e che contiene una serie di links simbolici ai files di configurazione degli hosts virtuali che si trovano in /etc/apache2/sites-available

Dei comandi utili per la gestione di apache sono:

/etc/init.d/apache2 start

/etc/init.d/apache2 stop

/etc/init.d/apache2 restart

che rispettivamente lancia, ferma, riavvia il demone apache2 .


E' utile anche abilitare alcuni moduli tra cui ssl e rewrite per cui scriviamo sul trminale da root:

a2enmod ssl rewrite

e poi riavviare il daemon digitando:

/etc/init.d/apache2 restart


Configurazione di MySQL

Adesso ci occupiamo di cambiare la password dell'utente root di MySQL scrivendo da root:

mysqladmin -u root password <lamiapassword>


ovviamente sostituendo <lamiapassword> con la vostra password preferita.

Spero che sia inutile dirvi di utilizzare caratteri maiuscoli e minuscoli, numeri e caratteri speciali come "@#][.," ecc..

Ritengo sia utile creare al volo un utente (diverso da root) da poter far accedere al database con privilegi limitati, ma lo vedremo tra un po'.

Dei comandi utili per la gestione del DataBase abbiamo:


/etc/init.d/mysql start

/etc/init.d/mysql stop

/etc/init.d/mysql restart


che rispettivamente, guarda un po', lancia, ferma e riavvia il daemon MySQL.


Varie

Da notare che durante l'installazione è stato installato anche phpmyadmin (l'ultima parola inserita nel comando che vi ho detto prima) che se volete potete anche omettere. PhpMyAdmin è uno script in php che serve per la gestione "grafica" del database MySQL senza aver bisogno dell'accesso via terminale alla macchina.


Test

Se avete eseguito correttamente i passi precedenti puntate il vostro browser preferito (spero si tratti di Iceweasel) su

http://<indirizzolocaledelserver>/phpmyadmin

dove <indirizzolocaledelserver> dovrebbe essere qualcosa del tipo: 192.168.1.2 e dovreste vedere lo script phpmyadmin in esecuzione che vi chiede username e password (Username: root e Password: quellacheavetesceltoprima).

Se per caso vi si dovesse aprire una finestra di download per un file probabilmente avete sbagliato qualcosa nei passi precedenti per cui consiglio di rivedere accuratamente la guida.


Una volta eseguito il login da root prendete dimestichezza con la grafica e tornate nella home di phpmyadmin quindi aggiungete un utente cliccando su "Privilegi" e poi su "Aggiungi nuovo utente" e seguite le indicazioni per completare la procedura.


Da ora in poi vi consiglio vivamente di utilizzare il nuovo utente per effettuare gli accessi al database.


Nella prossima guida parlerò della configurazione nel dettaglio dei files degli hosts in Apache2 (che per intenderci sono quelli contenuti in /etc/apache2/sites-available)

Installazione di shroudBNC con supporto SSL su un sistema Debian GNU/Linux

Introduzione


In questa guida vedremo come installare shroudBNC, l'ormai noto bouncer (abbrev. BNC).


I bouncer per la rete IRC, solitamente, vengono installati su server remoti, e la loro principale funzione è quella di mascherare l'indirizzo IP di chi si collega ad uno dei tantissimi server di IRC, sostituendo il proprio IP proprio come fa un proxy.


Perché tutto questo? Principalmente per proteggere la vostra privacy, ma soprattutto per prevenire i tanto temuti attacchi DoS (Denial-of-Service). Oltre a questo il bouncer su un server remoto vi permetterà di stare collegati sui vostri network IRC preferiti 24h su 24h.


Sperando di avervi fatto capire in poche parole cosa sia un bouncer, credo sia arrivato il momento del via!


Installazione


Vediamo intanto i pacchetti necessari per l'installazione di shroudBNC sulla nostra macchina Debian GNU/Linux. Per installarli lanciate da root:


apt-get install tcl8.4 tcl8.4-dev make gcc g++ openssl libssl-dev


Solitamente chi fornisce questi servizi su server remoti ha già installati questi pacchetti.


Fatte queste necessarie premesse, entriamo nel cuore operativo dell'installazione.

Dopo aver eseguito il login sul nostro server remoto, tramite SSH o altre shell remote, ed essere entrati nella nostra directory di utente con il semplice comando:


cd /home/tuadirectory


possiamo scaricare dal web il nostro shroudBNC eseguendo il comando:


wget http://mirror.shroudbnc.info/sbnc-1.2.tar.gz


Una volta terminato il download sarà necessario scompattare il nostro file così:


tar xvfz sbnc-1.2.tar.gz


Dopo aver scompattato, spostiamoci dentro la directory appena creata con:


cd sbnc-1.2/


e lanciamo il comando necessario per l'installazione di shroudBNC con il supporto per SSL


./configure --enable-ssl


seguito da:


make


e da:


make install


Fatto ciò spostiamoci nella cartella sbnc con il comando


cd ~/sbnc/


Primo avvio e configurazione


Terminata l'installazione, è arrivato il momento della configurazione del nostro shroudBNC


./sbnc


Ci verrà chiesto di inserire la porta sulla quale lavorerà il nostro BNC, ossia:


Which port should the bouncer listen on (valid ports are in the range 1025 - 65535):

dopodiché ci verrà chiesto di inserire l'identd


What should the first user's name be?

e la password associata all'identd


Please enter a password for the first user:

Please confirm your password by typing it again:

Ricordateli perché con questi dati accederete a shroudBNC, e sono gli stessi che imposterete sul vostro client IRC.


Configurazione delle chiavi SSL


Terminato l'inserimento, è giunto il momento di abilitare l'SSL per collegarci al nostro shroudBNC. Modifichiamo intanto il file sbnc.conf così:


nano -w sbnc.conf


sostituiamo la voce system.port con system.sslport


salviamo e chiudiamo con CTRL-X


Fatto ciò è necessario generare il nostro certificato SSL; per fare ciò utilizziamo tre semplici comandi:


openssl genrsa -des3 -out sbnc.key 2048


ci verrà richiesto di inserire una passphrase. Inseriamo una passphrase facile da ricordare, ma difficile da indovinare per eventuali malintenzionati


openssl rsa -in sbnc.key -out sbnc.key


Reinseriamo la passphrase precedente, e per terminare:


openssl req -new -x509 -days 3600 -key sbnc.key -out sbnc.crt


Qui ci verrà chiesto di inserire alcuni dati relativi al certificato SSL. Potete tranquillamente accettare con il tasto INVIO senza inserire nulla per tutte le successive richieste.


Secondo avvio e primi settaggi


Terminato il tutto, e sperando di non aver commesso errori nei passi precedenti, possiamo avviare il nostro shroudBNC impartendo il comando


./sbnc


Perfetto! Il nostro shroudBNC è attivo e funzionante! Adesso basta aprire il nostro client ed inserire i corretti parametri per la connessione al BNC.


Una volta collegati al BNC ci verrà chiesto di settare un server IRC al quale connetterci. In ogni caso, vi consiglio caldamente di creare un utente diverso da quello di amministrazione per accedere ai vari server IRC, e di lasciare l'user di amministrazione libero.


Per avere una panoramica esaustiva di tutti i comandi disponibili con shroudBNC, basta eseguire il comando /sbnc help dal vostro client IRC. Quindi creiamo velocemente il nostro nuovo user rispettando la sintassi:


/sbnc adduser <username> [password]


dove username sarà il nostro identd e non il nickname (attenzione!!), e la password ovviamente relativa all'user creato. Impostiamo questi parametri su una nuova scheda server del vostro client ed accediamo. Una volta aver effettuato il login digitiamo:


/sbnc set server host.deltuoserver.irc numeroporta


(es: /sbnc set server calvino.freenode.net 6667)


Aspettiamo i 120 secondi necessari affinchè shroudBNC si colleghi al server e joinate i vostri canali preferiti!


Buon divertimento!

Installazione dei plugin e script per il riavvio automatico di shroudBNC

Eccoci qui dopo aver visto come installare e fare le configurazioni iniziali del nostro shroudBNC, passiamo all'installazione di un plugin e di un utile script; procediamo con ordine, ed iniziamo con l'installazione del nostro plugin ossia nickserv.tcl, ma è corretto prima di partire con l'installazione capire perché usare questo plugin e cosa fa.


Sappiamo tutti cosa è un server IRC e qual è il suo scopo, ma non tutti sanno che su alcuni network di IRC vengono messi a disposizione degli utenti del network dei servizi utilissimi ad esempio ChanServ, che controlla le registrazioni nei canali e le informazioni di accesso, oppure MemoServ, che tiene traccia dei memos personali, dei canali oppure globali mandati dall'admin del server IRC al quale si è connessi e fra tutti questi servizi messi a disposizione di un server IRC c'è anche il nostro NickServ.



A cosa server NickServ?

Con NickServ è possibile registrare il proprio nickname associandolo ad una password, così da essere identificati ed evitare che qualcun altro si appropri del nostro nickname ed inoltre con NickServ è possibile ottenere delle informazioni anche sui nickname degli altri utenti registrati sul server. Bene, capito cosa è ed a cosa serve il NickServ passiamo all'installazione del nostro plugin.


Installazione del plugin

Per installare nickserv.tcl sul nostro shroudBNC è necessario effettuare il login al server e lanciare sul terminale:


wget --output-document=~/sbnc/scripts/nickserv.tcl http://khobbits.net/sbnc/sbnc/nickserv.tcl


Una volta scaricato il plugin nella directory scripts di shroudBNC è necessario attivarlo quindi modifichiamo il file sbnc.tcl, quindi diamo:


nano -w /home/tuoutente/sbnc/sbnc.tcl


ed aggiungiamo alla fine del file la riga:


source "scripts/nickserv.tcl"


poi ctrl+x chiudiamo e salviamo


Fatto questo torniamo al nostro client IRC connesso al BNC e diamo:


/sbnc tcl :rehash


per ricaricare tutti i plugin disponibili.


Configurazione

Bene adesso il plugin è disponibile e se si da un /sbnc help sempre dal client IRC si nota la presenza della voce nickserv, adesso non bisogna far altro che impostare il plugin per ogni singolo user del nostro shroudBNC e per far ciò basta dare i comandi:


/sbnc nickserv set reply ns

/sbnc nickserv set nick <tuonick>

/sbnc nickserv set password <tuapass>


dove ns (o anche nickserv) è il comando che si darebbe per identificarsi.


Perfetto il nostro plugin nickserv.tcl adesso è attivo e funzionante.


Installazione dello script per il riavvio automatico

Ora passiamo all'installazione del nostro semplice script che permette di far ripartire automaticamente il nostro shroudBNC anche dopo il crash del server che lo ospita, accediamo via SSH al nostro server e ci posizionamo nella cartella del nostro sbnc con:


cd sbnc/


Seguito da:


nano -w sbncchk.sh


e scriviamo dentro il nostro file queste semplici righe di codice:


#!/bin/sh
SBNCPATH=/home/username/sbnc

if test -r $SBNCPATH/sbnc.pid; then
SBNCPID=$(cat $SBNCPATH/sbnc.pid)
if $(kill -CHLD $SBNCPID >/dev/null 2>&1)
then
exit 0
fi
fi
cd $SBNCPATH
./sbnc &>/dev/null

Facendo molta attenzione a sostituire alla riga:


SBNCPATH=/home/username/sbnc


al posto di username il nostro nome utente, ovviamente.

Fatto ciò diamo ctrl+x salviamo ed usciamo.


Poi cambiamo i permessi del file di script sbncchk.sh appena creato con:


chmod +x sbncchk.sh


Adesso editiamo il nostro crontab con il comando:


crontab -e


ed aggiungiamo al crontab le righe:


@reboot $HOME/sbnc/sbncchk.sh > /dev/null 2>&1

*/10 * * * * $HOME/sbnc/sbncchk.sh > /dev/null 2>&1


Salviamo ed usciamo. Bene abbiamo terminato anche con l'installazione dello script, così anche se il server nel quale risiede il nostro shroudBNC dovesse crashare, il nostro BNC è in grado di ritornare su da solo, dato che il nostro script non fa altro che controllare ogni 10 minuti se sbnc è avviato e se non lo è, lo riavvia.

Se volete cambiare l'intervallo di tempo per il controllo basta sostituire alla riga appena inserita in crontab ed esattamente questa riga:


*/10 * * * * $HOME/sbnc/sbncchk.sh > /dev/null 2>&1


al posto di 10 i minuti che desiderate voi. Ovviamente dopo aver effettuato la modifica di crontab salvate ed uscite.


Se vi può interessare sono disponibili all'indirizzo: http://khobbits.net/sbnc/ altri plugin interessanti per il nostro shroudBNC.


Buon divertimento ^_^

giovedì 7 maggio 2009

Major difference between Linux and Solaris

Introduction


Most readers coming here are more familiar with Linux than Solaris. This little page is designed to give those users some tips for running a Solaris box.
It is in no way intended as a definitive guide, and there may be lot better ways of doing things. Feel free to contribute.

ps

ps -ef on Linux will give the full command line, but with Solaris you don't get it all.
This is particularly critical when looking at java processes.
Fortunately Solaris retains the BSD style binaries in /usr/ucb, so execute:


 /usr/ucb/ps wwaux|grep java


instead


bash

/bin/sh on Solaris is a POSIX complaint bourne shell. If you have written bash-centric scripts, replace #!/bin/sh with #!/bin/bash

NFS

Starting of NFS daemon

Instead of

# service nfsserver start


one does:

# svcadm enable network/nfs/server

Exports

Instead of the file /etc/exports, under Solaris the file /etc/dfs/dfstab needs to be edited.

Sharing with zfs

Nowadays, you would probably use zfs sharenfs eg:



# zfs set sharenfs=on zpool/sharedfolder
# zfs sharenfs=rw=server.fqdn.ch,rw=otherserver.fqdn.ch zpool/sharedfolder


An attempt at a matrix





























































Linux command Solaris similar command Comments
top prstat You can compile top on Solaris, but you can't rely on it's accuracy
free vmstat  
cat /proc/meminfo prtconf | grep Memory  
cat /proc/cpuinfo psrinfo -v you can also use prtconf
netstat -p lsof -i lsof is not a default command. You need the package
uname -a isainfo -b to determine how many bits your os is
java -d64 java -d64 Start java with a default of 64 bit. Linux seems to do this by default though.
cat /etc/redhat-release cat /etc/release
  sysdef sysdef holds a lot of system info including kernel tunables
lsmod modinfo  
strace truss  

Another matrix




RHEL
Solaris


Shutdown


shutdown -h now (or) poweroff
shutdown -y -g0 -i5 (or) init 5


reboot
reboot (or) shutdown -y -g0 -i6 (or) init 6


halt
halt


Kernel


/sbin/lsmod
modinfo


/sbin/insmod
modload


/sbin/rmmod
modunload


scanpci
/usr/X11/bin/scanpci (or) prtconf -v


Printing


lp (or) lpr
lp (or /usr/ucb/lpr)


lpstat (or) lpq
lpstat (or /usr/ucb/lpq)


Services


/sbin/service --status-all
svcs -a



/sbin/service sendmail stop
svcadm disable sendmail


/sbin/service sendmail start
svcadm enable sendmail



/sbin/service sendmail status
svcs sendmail


/sbin/chkconfig --list
svcs -a


/sbin/chkconfig --add /etc/rc3.d/f00

svccfg import f00.xml


/sbin/chkconfig sendmail on
svcadm enable sendmail


Monitoring



top
prstat


cat /proc/cpuinfo
psrinfo -v



cat /proc/meminfo
prtconf


NFS


exportfs
exportfs (or) share



(edit /etc/exports)
share /home (or) zfs sharenfs=on


(edit /etc/exports) unshare /home (or) zfs sharenfs=off


Networking



/sbin/mii-tool
ndd (or) /sbin/dladm show-dev


ifconfig
ifconfig -a



/sbin/ethtool
ndd


/sbin/dhclient
dhcpagent



iptables
ipfilter


Storage


fdisk
fdisk (and) format



parted
format


mkfs -t ext3 /dev/hda1
mkfs -F ufs /dev/rdsk/c0t0d0s0 (or) newfs /dev/rdsk/c0t0d0s0



cdrecord dev=2,0 f00.iso cdrw -i f00.iso


tar xfvj f00.tar.bz2
gtar xfvj f00.tar.bz2


lvm/pv*/lv*/vg*

meta*


Dev


(edit /etc/ld.so.conf)
crle



gcc
/opt/csw/bin/gcc


ld
/usr/ccs/bin/ld

mercoledì 6 maggio 2009

Configurando Sun Cluster 3.2 con Oracle 10g RAC y ASM

Diego E. Aguirre, octubre 2008



Esta instalación fue realizada en el siguiente escenario:


2 Dominios físicos de two servidores Sun Fire 25K, cada uno con:

  • 64 Gbyte de RAM
  • 8 UltraSPARC IV+ CPU dual-core de 1.8 MHz
  • 4 discos internos
  • Conectado a Storage EMC mediante una SAN (SAN EMC Symmetrix DMX3)
  • Solaris 10 08/07 release plus OEM
  • Base de Datos Oracle versión 10.2.0.3
  • Veritas Storage Foundation 5.0 MP1 by Symantec

Importante: Verificar que no este el Patch 126106-13 instalado ya que existe un bug con recursos escalables a la hora de la registración de los mismos.



Requerimientos de Solaris:

Tener instalados los paquetes de la Distribución Full Plus OEM.

Crear una partición de 512 Mbyte en el slice 6 del disco de S.O. y
montarla como /globaldevices.

Asegurarse de tener instalados todos los paquetes y patches de la SAN Foundation Suite.

Asegurarse que la property local_only del rpcbind este seteada en false.



nodo1
# svcprop network/rpc/bind:default|grep local_
config/local_only boolean false

Si no esta seteado en false, ejecutar:




svccfg
svc:>select network/rpc/bind
svc:/network/rpc/bind> setprop config/local_only=false
svc:/network/rpc/bind> quit

svcadm refresh network/rpc/bind:default

En el NODO1, comenzar la instalación del Sun Cluster 3.2.




nodo1 # scinstall

*** Main Menu ***

Please select from one of the following (*) options:

* 1) Create a new cluster or add a cluster node
2) Configure a cluster to be JumpStarted from this install server
3) Manage a dual-partition upgrade
4) Upgrade this cluster node
5) Print release information for this cluster node
* ?) Help with menu options
* q) Quit

Option: 1

*** New Cluster and Cluster Node Menu ***

Please select from any one of the following options:

1) Create a new cluster
2) Create just the first node of a new cluster on this machine
3) Add this machine as a node in an existing cluster
?) Help with menu options
q) Return to the Main Menu

Option: 1

*** Create a New Cluster ***

This option creates and configures a new cluster.
You must use the Java Enterprise System (JES) installer to install the
Sun Cluster framework software on each machine in the new cluster
before you select this option.
If the "remote configuration" option is unselected from the JES
installer when you install the Sun Cluster framework on any of the new
nodes, then you must configure either the remote shell (see rsh(1)) or
the secure shell (see ssh(1)) before you select this option. If rsh or
ssh is used, you must enable root access to all of the new member
nodes from this node.

Press Control-d at any time to return to the Main Menu.

Do you want to continue (yes/no) [yes]? yes

>>> Typical or Custom Mode <<<

This tool supports two modes of operation, Typical mode and Custom.
For most clusters, you can use Typical mode. However, you might need
to select the Custom mode option if not all of the Typical defaults
can be applied to your cluster.
For more information about the differences between Typical and Custom
modes, select the Help option from the menu.

Please select from one of the following options:

1) Typical
2) Custom
?) Help
q) Return to the Main Menu

Option [1]: 2

>>> Cluster Name <<<

Each cluster has a name assigned to it. The name can be made up of any
characters other than whitespace. Each cluster name should be unique
within the namespace of your enterprise.

What is the name of the cluster you want to establish [CLUSTER2]?

>>> Cluster Nodes <<<

This Sun Cluster release supports a total of up to 16 nodes.
Please list the names of the other nodes planned for the initial
cluster configuration. List one node name per line. When finished,

type Control-D:

Node name: nodo1
Node name: nodo2

Node name (Control-D to finish): ^D

This is the complete list of nodes:

nodo1
nodo2

Is it correct (yes/no) [yes]? yes

Attempting to contact "nodo2" ... done
Searching for a remote configuration method ... done

The Sun Cluster framework is able to complete the configuration
process without remote shell access.

Press Enter to continue:

>>> Authenticating Requests to Add Nodes <<<

Once the first node establishes itself as a single node cluster, other
nodes attempting to add themselves to the cluster configuration must
be found on the list of nodes you just provided. You can modify this
list by using claccess(1CL) or other tools once the cluster has been
established.
By default, nodes are not securely authenticated as they attempt to
add themselves to the cluster configuration. This is generally
considered adequate, since nodes which are not physically connected to
the private cluster interconnect will never be able to actually join
the cluster. However, DES authentication is available. If DES
authentication is selected, you must configure all necessary
encryption keys before any node will be allowed to join the cluster

(see keyserv(1M), publickey(4)).

Do you need to use DES authentication (yes/no) [no]? no

>>> Network Address for the Cluster Transport <<<

The cluster transport uses a default network address of 172.16.0.0. If
this IP address is already in use elsewhere within your enterprise,
specify another address from the range of recommended private
addresses (see RFC 1918 for details).

The default netmask is 255.255.248.0. You can select another netmask,
as long as it minimally masks all bits that are given in the network
address.

The default private netmask and network address result in an IP
address range that supports a cluster with a maximum of 64 nodes and
10 private networks.

Is it okay to accept the default network address (yes/no) [no]?
What network address do you want to use [33.33.33.128]?
The combination of private netmask and network address will dictate
the maximum number of both nodes and private networks that can be
supported by a cluster. Given your private network address, this
program will generate a range of recommended private netmasks that are
based on the maximum number of nodes and private networks that you
anticipate for this cluster.

In specifying the anticipated maximum number of nodes and private
networks for this cluster, it is important that you give serious
consideration to future growth potential. While both the private
netmask and network address can be changed later, the tools for making
such changes require that all nodes in the cluster be booted in
noncluster mode.

Maximum number of nodes anticipated for future growth [2]?

Maximum number of private networks anticipated for future growth [2]?

Specify a netmask of 255.255.255.224 to meet anticipated future
requirements of 2 cluster nodes and 2 private networks.
To accommodate more growth, specify a netmask of 255.255.255.192 to
support up to 4 cluster nodes and 4 private networks.
What netmask do you want to use [255.255.255.224]? 255.255.255.128

>>> Minimum Number of Private Networks <<<

Each cluster is typically configured with at least two private
networks. Configuring a cluster with just one private interconnect
provides less availability and will require the cluster to spend more
time in automatic recovery if that private interconnect fails.

Should this cluster use at least two private networks (yes/no) [yes]? yes

>>> Point-to-Point Cables <<<

The two nodes of a two-node cluster may use a directly-connected
interconnect. That is, no cluster switches are configured. However,
when there are greater than two nodes, this interactive form of
scinstall assumes that there will be exactly one switch for each
private network.

Does this two-node cluster use switches (yes/no) [yes]? yes

>>> Cluster Switches <<<

All cluster transport adapters in this cluster must be cabled to a
"switch". And, each adapter on a given node must be cabled to a
different switch. Interactive scinstall requires that you identify one
switch for each private network in the cluster.

What is the name of the first switch in the cluster [switch1]?

What is the name of the second switch in the cluster [switch2]?

>>> Cluster Transport Adapters and Cables <<<

You must configure the cluster transport adapters for each node in the
cluster. These are the adapters which attach to the private cluster
interconnect.

Select the first cluster transport adapter for "nodo1":

1) ce1
2) ce3
3) ce4
4) ce5
5) eri0
6) eri1
7) Other

Option: 1

Will this be a dedicated cluster transport adapter (yes/no) [yes]? yes

Adapter "ce1" is an Ethernet adapter.

Searching for any unexpected network traffic on "ce1" ... done
Unexpected network traffic was seen on "ce1".
"ce1" may be cabled to a public network.

Do you want to use "ce1" anyway (yes/no) [no]? yes

The "dlpi" transport type will be set for this cluster.

For node "nodo1",

Name of the switch to which "ce1" is connected [switch1]?
Each adapter is cabled to a particular port on a switch. And, each
port is assigned a name. You can explicitly assign a name to each
port. Or, for Ethernet and Infiniband switches, you can choose to
allow scinstall to assign a default name for you. The default port
name assignment sets the name to the node number of the node hosting
the transport adapter at the other end of the cable.

For node "nodo1",

Use the default port name for the "ce1" connection (yes/no) [yes]? yes

Select the second cluster transport adapter for "nodo1":

1) ce1
2) ce3
3) ce4
4) ce5
5) eri0
6) eri1
7) Other

Option: 2

Will this be a dedicated cluster transport adapter (yes/no) [yes]? yes

Adapter "ce3" is an Ethernet adapter.

Searching for any unexpected network traffic on "ce3" ... done
Unexpected network traffic was seen on "ce3".
"ce3" may be cabled to a public network.

Do you want to use "ce3" anyway (yes/no) [no]? yes

For node "nodo1",

Name of the switch to which "ce3" is connected [switch2]?

For node "nodo1",

Use the default port name for the "ce3" connection (yes/no) [yes]? yes
For all other nodes, Autodiscovery is the best method for configuring the cluster
transport. However, you can choose to manually configure the remaining
adapters and cables.

Is it okay to use autodiscovery for the other nodes (yes/no) [yes]? no

For node "nodo2",

What is the name of the first cluster transport adapter? ce1

Will this be a dedicated cluster transport adapter (yes/no) [yes]? yes

Adapter "ce1" is an Ethernet adapter.

For node "nodo2",

Name of the switch to which "ce1" is connected [switch1]?

For node "nodo2",

Use the default port name for the "ce1" connection (yes/no) [yes]? yes

For node "nodo2",

What is the name of the second cluster transport adapter? ce3

Will this be a dedicated cluster transport adapter (yes/no) [yes]? yes

Adapter "ce3" is an Ethernet adapter.

For node "nodo2",

Name of the switch to which "ce3" is connected [switch2]?

For node "nodo2",

Use the default port name for the "ce3" connection (yes/no) [yes]? yes

>>> Quorum Configuration <<<

Every two-node cluster requires at least one quorum device. By
default, scinstall will select and configure a shared SCSI quorum disk
device for you.
This screen allows you to disable the automatic selection and
configuration of a quorum device.

The only time that you must disable this feature is when ANY of the
shared storage in your cluster is not qualified for use as a Sun
Cluster quorum device. If your storage was purchased with your
cluster, it is qualified. Otherwise, check with your storage vendor to
determine whether your storage device is supported as Sun Cluster
quorum device.

Do you want to disable automatic quorum device selection (yes/no) [no]? yes

>>> Global Devices File System <<<

Each node in the cluster must have a local file system mounted on
/global/.devices/node before it can successfully participate
as a cluster member. Since the "nodeID" is not assigned until
scinstall is run, scinstall will set this up for you.
You must supply the name of either an already-mounted file system or
raw disk partition which scinstall can use to create the global
devices file system. This file system or partition should be at least
512 MB in size.
If an already-mounted file system is used, the file system must be
empty. If a raw disk partition is used, a new file system will be
created for you.

The default is to use /globaldevices.

For node "nodo1",

Is it okay to use this default (yes/no) [yes]? yes

Testing for "/globaldevices" on "nodo1" ... done

For node "nodo2",

Is it okay to use this default (yes/no) [yes]? yes

Testing for "/globaldevices" on "nodo2" ... done

Is it okay to create the new cluster (yes/no) [yes]? yes

During the cluster creation process, sccheck is run on each of the new
cluster nodes. If sccheck detects problems, you can either interrupt
the process or check the log files after the cluster has been
established.

Interrupt cluster creation for sccheck errors (yes/no) [no]? no

Cluster Creation

Log file - /var/cluster/logs/install/scinstall.log.5518

Started sccheck on "nodo1".
Started sccheck on "nodo2".

sccheck completed with no errors or warnings for "nodo1".
sccheck completed with no errors or warnings for "nodo2".

Configuring "nodo2" ... done
Rebooting "nodo2" ... done
Configuring "nodo1" ... done

Rebooting "nodo1" ...
Log file - /var/cluster/logs/install/scinstall.log.5518
Rebooting ...

Pasos para configurar IPMP



En el nodo1, agregar las siguientes lineas en el /etc/hosts:



10.77.55.110 nodo1 nodo1.dominio.com loghost
10.77.55.108 nodo1-ce0-test
10.77.55.109 nodo1-ce2-test
10.77.55.111 nodo1-virtual
10.77.55.125 nodo2-virtual
10.77.55.124 nodo2
10.77.55.187 cluster-siebel
### Red Privada Oracle Rac
10.33.33.186 nodo1-priv-test0
10.33.33.187 nodo1-priv-test1
10.33.33.188 nodo1-priv
### Sun cluster interconnect ( clprivnet0 )
10.33.33.66 nodo1-priv-sc
10.10.33.65 nodo2-priv-sc


Crear en el /etc
los siguientes archivos:



/etc/hostname.ce0. Agregar lo siguiente:



nodo1-ce0-test group SIEBEL -failover deprecated \
netmask + broadcast + up

/etc/hostname.ce2. Agregar lo siguiente:




nodo1 group SIEBEL netmask + broadcast + up
addif nodo1-ce2-test -failover deprecated \
netmask + broadcast + up

/etc/hostname.ce4. Agregar lo siguiente:



nodo1-priv-test0 group rac -failover deprecated \
netmask + broadcast + up

/etc/hostname-ce5. Agregar lo siguiente:



nodo1-priv group rac netmask + broadcast + up
addif nodo1-priv-test1 -failover deprecated \
netmask + broadcast + up

Luego rebootear y chequear con ifconfig -a (luego repetir los mismos pasos en el nodo2).




nodo1 # ifconfig -a
ce0:flags=9040843
mtu 1500 index 2 inet 10.77.55.108 netmask ffffff00 broadcast 10.77.55.255
groupname SIEBEL ether 0:14:4f:67:ad:52
ce0:1: flags=1040843 mtu 1500 index 2
inet 10.77.55.187 netmask ffffff00 broadcast 10.77.55.255
ce1: flags=1008843 mtu 1500 index 8
inet 10.33.33.18 netmask fffffff8 broadcast 10.33.33.23 ether 0:14:4f:67:ad:53
ce2: flags=1000843 mtu 1500 index 3
inet 10.77.55.110 netmask ffffff00 broadcast 10.77.55.255
groupname SIEBEL ether 0:14:4f:68:50:d0
ce2:1: flags=9040843 mtu 1500 index 3 inet 10.77.55.109 netmask ffffff00 broadcast 10.77.55.255
ce2:2: flags=1040843 mtu 1500 index 3
inet 10.77.55.111 netmask ffffff00 broadcast 10.77.100.255
ce3: flags=1008843 mtu 1500 index 7
inet 10.33.33.10 netmask fffffff8 broadcast 10.33.33.15 ether 0:14:4f:68:50:d1
ce4: flags=9040843 mtu 1500 index 4 inet 10.33.33.186 netmask ffffffc0 broadcast 10.33.33.255
groupname rac ether 0:14:4f:68:50:d2
ce5: flags=1000843 mtu 1500 index 5
inet 10.33.33.188 netmask ffffffc0 broadcast 10.33.33.255
dman0: flags=1008843 mtu 1500 index 4
inet 10.2.1.7 netmask ffffffe0 broadcast 10.2.1.31 ether 0:0:be:aa:40:d5
clprivnet0: flags=1009843 mtu 1500 index 7
inet 10.33.33.66 netmask ffffffe0 broadcast 10.33.33.95 ether 0:0:0:0:0:2


Configurar el Quórum Devices, via clsetup (si todavía no esta creado):



nodo1 # didadm -L
1 nodo2:/dev/rdsk/c0t8d0 /dev/did/rdsk/d1
2 nodo2:/dev/rdsk/c0t9d0 /dev/did/rdsk/d2
3 nodo2:/dev/rdsk/c10t60060480000290101637533030353533d0 /dev/did/rdsk/d3
3 nodo1:/dev/rdsk/c2t60060480000290101637533030353533d0 /dev/did/rdsk/d3
4 nodo2:/dev/rdsk/c10t60060480000290101637533030344544d0 /dev/did/rdsk/d4
4 nodo1:/dev/rdsk/c2t60060480000290101637533030344544d0 /dev/did/rdsk/d4
5 nodo2:/dev/rdsk/c10t60060480000290101637533030344435d0 /dev/did/rdsk/d5
5 nodo1:/dev/rdsk/c2t60060480000290101637533030344435d0 /dev/did/rdsk/d5
6 nodo2:/dev/rdsk/c10t60060480000290101637533030344537d0 /dev/did/rdsk/d6
6 nodo1:/dev/rdsk/c2t60060480000290101637533030344537d0 /dev/did/rdsk/d6
7 nodo2:/dev/rdsk/c10t60060480000290101637533030344442d0 /dev/did/rdsk/d7
7 nodo1:/dev/rdsk/c2t60060480000290101637533030344442d0 /dev/did/rdsk/d7
8 nodo2:/dev/rdsk/c10t60060480000290101637533030344531d0 /dev/did/rdsk/d8
8 nodo1:/dev/rdsk/c2t60060480000290101637533030344531d0 /dev/did/rdsk/d8
9 nodo2:/dev/rdsk/c10t60060480000290101637533030353532d0 /dev/did/rdsk/d9
9 nodo1:/dev/rdsk/c2t60060480000290101637533030353532d0 /dev/did/rdsk/d9
10 nodo2:/dev/rdsk/c10t60060480000290101637533031393430d0 /dev/did/rdsk/d10
11 nodo2:/dev/rdsk/c10t60060480000290101637533031393246d0 /dev/did/rdsk/d11
11 nodo1:/dev/rdsk/c2t60060480000290101637533031393246d0 /dev/did/rdsk/d11
12 nodo2:/dev/rdsk/c8t5006048452A66157d0 /dev/did/rdsk/d12
12 nodo2:/dev/rdsk/c6t5006048452A66168d0 /dev/did/rdsk/d12
12 nodo1:/dev/rdsk/c4t5006048C52A66147d0 /dev/did/rdsk/d12
12 nodo1:/dev/rdsk/c6t5006048C52A66168d0 /dev/did/rdsk/d12
13 nodo2:/dev/rdsk/c10t60060480000290101637533031393335d0 /dev/did/rdsk/d13
13 nodo1:/dev/rdsk/c2t60060480000290101637533031393335d0 /dev/did/rdsk/d13
14 nodo2:/dev/rdsk/c0t10d0 /dev/did/rdsk/d14
15 nodo2:/dev/rdsk/c0t11d0 /dev/did/rdsk/d15
16 nodo1:/dev/rdsk/c0t8d0 /dev/did/rdsk/d16
17 nodo1:/dev/rdsk/c0t9d0 /dev/did/rdsk/d17
18 nodo1:/dev/rdsk/c0t10d0 /dev/did/rdsk/d18
19 nodo1:/dev/rdsk/c0t11d0 /dev/did/rdsk/d19
20 nodo1:/dev/rdsk/c2t60060480000290101637533031393342d0 /dev/did/rdsk/d20
8191 nodo2:/dev/rmt/0 /dev/did/rmt/1

nodo1 # clsetup
>>> Initial Cluster Setup <<<
This program has detected that the cluster "installmode" attribute is
still enabled. As such, certain initial cluster setup steps will be
performed at this time. This includes adding any necessary quorum
devices, then resetting both the quorum vote counts and the
"installmode" property.
Please do not proceed if any additional nodes have yet to join the
cluster.
Is it okay to continue (yes/no) [yes]? yes
Do you want to add any quorum devices (yes/no) [yes]? yes
Following are supported Quorum Devices types in Sun Cluster. Please
refer to Sun Cluster documentation for detailed information on these
supported quorum device topologies.

What is the type of device you want to use?
1) Directly attached shared disk
2) Network Attached Storage (NAS) from Network Appliance
3) Quorum Server
q) Return to the quorum menu

Option: 1
>>> Add a SCSI Quorum Disk <<<
A SCSI quorum device is considered to be any Sun Cluster supported
attached storage which connected to two or more nodes of the cluster.
Dual-ported SCSI-2 disks may be used as quorum devices in two-node
clusters. However, clusters with more than two nodes require that
SCSI-3 PGR disks be used for all disks with more than two node-to-disk
paths.
You can use a disk containing user data or one that is a member of a
device group as a quorum device.
For more information on supported quorum device topologies, see the
Sun Cluster documentation.
Is it okay to continue (yes/no) [yes]? yes
Which global device do you want to use (d)? d3
Is it okay to proceed with the update (yes/no) [yes]? yes

clquorum add d3

Command completed successfully.

Press Enter to continue:
Do you want to add another quorum device (yes/no) [yes]? no
Once the "installmode" property has been reset, this program will skip
"Initial Cluster Setup" each time it is run again in the future.
However, quorum devices can always be added to the cluster using the
regular menu options. Resetting this property fully activates quorum
settings and is necessary for the normal and safe operation of the cluster.
Is it okay to reset "installmode" (yes/no) [yes]? yes
clquorum reset
claccess deny-all
Cluster initialization is complete.

Type ENTER to proceed to the main menu:

*** Main Menu ***
Please select from one of the following options:

1) Quorum
2) Resource groups
3) Data Services
4) Cluster interconnect
5) Device groups and volumes
6) Private hostnames
7) New nodes
8) Other cluster tasks
?) Help with menu options
q) Quit

Option: q


Habilitar el reboot automático de los nodos, si TODOS (ALL) los monitores Path de Discos Fallan.




nodo1 # clnode set -p reboot_on_path_failure=enable nodo1 nodo2

Deshabilitar el monitoreo en todos los discos locales.



nodo1 # cldev status

Cluster DID Devices ===

Device Instance Node Status
--------------- ---- ------
/dev/did/rdsk/d1 nodo2 Ok
/dev/did/rdsk/d10 nodo2 Ok
/dev/did/rdsk/d11 nodo2 Ok
nodo1 Ok
/dev/did/rdsk/d12 nodo2 Ok
nodo1 Ok
/dev/did/rdsk/d13 nodo2 Ok
nodo1 Ok
/dev/did/rdsk/d14 nodo2 Ok
/dev/did/rdsk/d15 nodo2 Ok
/dev/did/rdsk/d16 nodo1 Ok
/dev/did/rdsk/d17 nodo1 Ok
/dev/did/rdsk/d18 nodo1 Ok
/dev/did/rdsk/d19 nodo1 Ok
/dev/did/rdsk/d2 nodo2 Ok
/dev/did/rdsk/d20 nodo1 Ok
/dev/did/rdsk/d3 nodo2 Ok
nodo1 Ok
/dev/did/rdsk/d4 nodo2 Ok
nodo1 Ok
/dev/did/rdsk/d5 nodo2 Ok
nodo1 Ok
/dev/did/rdsk/d6 nodo2 Ok
nodo1 Ok
/dev/did/rdsk/d7 nodo2 Ok
nodo1 Ok
/dev/did/rdsk/d8 nodo2 Ok
nodo1 Ok
/dev/did/rdsk/d9 nodo2 Ok
nodo1 Ok

nodo1 # didadm -L
1 nodo2:/dev/rdsk/c0t8d0 /dev/did/rdsk/d1
2 nodo2:/dev/rdsk/c0t9d0 /dev/did/rdsk/d2
3 nodo2:/dev/rdsk/c10t60060480000290101637533030353533d0 /dev/did/rdsk/d3
3 nodo1:/dev/rdsk/c2t60060480000290101637533030353533d0 /dev/did/rdsk/d3
4 nodo2:/dev/rdsk/c10t60060480000290101637533030344544d0 /dev/did/rdsk/d4
4 nodo1:/dev/rdsk/c2t60060480000290101637533030344544d0 /dev/did/rdsk/d4
5 nodo2:/dev/rdsk/c10t60060480000290101637533030344435d0 /dev/did/rdsk/d5
5 nodo1:/dev/rdsk/c2t60060480000290101637533030344435d0 /dev/did/rdsk/d5
6 nodo2:/dev/rdsk/c10t60060480000290101637533030344537d0 /dev/did/rdsk/d6
6 nodo1:/dev/rdsk/c2t60060480000290101637533030344537d0 /dev/did/rdsk/d6
7 nodo2:/dev/rdsk/c10t60060480000290101637533030344442d0 /dev/did/rdsk/d7
7 nodo1:/dev/rdsk/c2t60060480000290101637533030344442d0 /dev/did/rdsk/d7
8 nodo2:/dev/rdsk/c10t60060480000290101637533030344531d0 /dev/did/rdsk/d8
8 nodo1:/dev/rdsk/c2t60060480000290101637533030344531d0 /dev/did/rdsk/d8
9 nodo2:/dev/rdsk/c10t60060480000290101637533030353532d0 /dev/did/rdsk/d9
9 nodo1:/dev/rdsk/c2t60060480000290101637533030353532d0 /dev/did/rdsk/d9
10 nodo2:/dev/rdsk/c10t60060480000290101637533031393430d0 /dev/did/rdsk/d10
11 nodo2:/dev/rdsk/c10t60060480000290101637533031393246d0 /dev/did/rdsk/d11
11 nodo1:/dev/rdsk/c2t60060480000290101637533031393246d0 /dev/did/rdsk/d11
12 nodo2:/dev/rdsk/c8t5006048452A66157d0 /dev/did/rdsk/d12
12 nodo2:/dev/rdsk/c6t5006048452A66168d0 /dev/did/rdsk/d12
12 nodo1:/dev/rdsk/c4t5006048C52A66147d0 /dev/did/rdsk/d12
12 nodo1:/dev/rdsk/c6t5006048C52A66168d0 /dev/did/rdsk/d12
13 nodo2:/dev/rdsk/c10t60060480000290101637533031393335d0 /dev/did/rdsk/d13
13 nodo1:/dev/rdsk/c2t60060480000290101637533031393335d0 /dev/did/rdsk/d13
14 nodo2:/dev/rdsk/c0t10d0 /dev/did/rdsk/d14
15 nodo2:/dev/rdsk/c0t11d0 /dev/did/rdsk/d15
16 nodo1:/dev/rdsk/c0t8d0 /dev/did/rdsk/d16
17 nodo1:/dev/rdsk/c0t9d0 /dev/did/rdsk/d17
18 nodo1:/dev/rdsk/c0t10d0 /dev/did/rdsk/d18
19 nodo1:/dev/rdsk/c0t11d0 /dev/did/rdsk/d19
20 nodo1:/dev/rdsk/c2t60060480000290101637533031393342d0 /dev/did/rdsk/d20
8191 nodo2:/dev/rmt/0 /dev/did/rmt/1

nodo1 # cldev unmonitor d1

nodo1 # cldev unmonitor d2

nodo1 # cldev unmonitor d14

nodo1 # cldev unmonitor d15

nodo1 # cldev unmonitor d16

nodo1 # cldev unmonitor d17

nodo1 # cldev unmonitor d18

nodo1 # cldev unmonitor d19


Verificar que se dejo de monitorear los discos locales, ejecutar cldev show o scdpm-p
all:all
.




nodo1 # clnode show
Cluster Nodes ===
Node Name: nodo2
Node ID: 1
Enabled: yes
privatehostname: clusternode1-priv
reboot_on_path_failure: enabled
globalzoneshares: 1
defaultpsetmin: 1
quorum_vote: 1
quorum_defaultvote: 1
quorum_resv_key: 0x48221C3C00000001
Transport Adapter List: ce1, ce3

Node Name: nodo1
Node ID: 2
Enabled: yes
privatehostname: clusternode2-priv
reboot_on_path_failure: enabled
globalzoneshares: 1
defaultpsetmin: 1
quorum_vote: 1
quorum_defaultvote: 1
quorum_resv_key: 0x48221C3C00000002
Transport Adapter List: ce1, ce3

nodo1 # scdpam -p all:all
nodo2:reboot_on_path_failure enabled
nodo2:/dev/did/rdsk/d1 Unmonitored
nodo2:/dev/did/rdsk/d2 Unmonitored
nodo2:/dev/did/rdsk/d3 Ok
nodo2:/dev/did/rdsk/d4 Ok
nodo2:/dev/did/rdsk/d5 Ok
nodo2:/dev/did/rdsk/d6 Ok
nodo2:/dev/did/rdsk/d7 Ok
nodo2:/dev/did/rdsk/d8 Ok
nodo2:/dev/did/rdsk/d9 Ok
nodo2:/dev/did/rdsk/d10 Ok
nodo2:/dev/did/rdsk/d11 Ok
nodo2:/dev/did/rdsk/d12 Ok
nodo2:/dev/did/rdsk/d13 Ok
nodo2:/dev/did/rdsk/d14 Unmonitored
nodo2:/dev/did/rdsk/d15 Unmonitored
nodo1:reboot_on_path_failure enabled
nodo1:/dev/did/rdsk/d16 Unmonitored
nodo1:/dev/did/rdsk/d17 Unmonitored
nodo1:/dev/did/rdsk/d18 Unmonitored
nodo1:/dev/did/rdsk/d19 Unmonitored
nodo1:/dev/did/rdsk/d20 Ok
nodo1:/dev/did/rdsk/d3 Ok
nodo1:/dev/did/rdsk/d4 Ok
nodo1:/dev/did/rdsk/d5 Ok
nodo1:/dev/did/rdsk/d6 Ok
nodo1:/dev/did/rdsk/d7 Ok
nodo1:/dev/did/rdsk/d8 Ok
nodo1:/dev/did/rdsk/d9 Ok
nodo1:/dev/did/rdsk/d11 Ok
nodo1:/dev/did/rdsk/d12 Ok
nodo1:/dev/did/rdsk/d13 Ok


Para ejecutar solo en Solaris 10, si no esta instalado el paquete SUNWescom, siga estos pasos.



Deshabilitar el servicio scsymon.



nodo1 # svcadm -v disable \
system/var/system/var/cluster/scsymon-srv

svc:/system/cluster/scsymon-srv:default disabled.

Borrar la linea $SVCADM enable svc:/system/cluster/scsymon-srv:default en el archivo

/usr/cluster/lib/svc/method/svc_cl_enable.


Tambien borrar la linea svc:/system/cluster/scsymon-srv:default" en el archivo
/usr/cluster/lib/svc/method/svc_boot_check.


Hay unas comillas (") en el final de la linea svc:/system/cluster/scsymon-srv:default". Muevelas a la linea anterior.



nodo1 # cd /usr/cluster/lib/svc/method
nodo1 # vi svc_cl_svc_enable
"svc_cl_svc_enable" [Read only] 80 lines, 2154 characters
#!/sbin/sh
#
"svc_cl_svc_enable" [Read only] 80 lines, 2154 characters
nodo1 # vi svc_boot_check
"svc_boot_check" [Read only] 203 lines, 6284 characters
#!/bin/sh
#
svc:/system/cluster/sc_svtag:default
svc:/system/cluster/scsymon-srv:default"
:wq! "svc_boot_check" 203 lines, 6288 characters

nodo1 # scshutdown -y -g0


Si necesito modificar el archivo infrastructure a mano, entonces tengo que bootear por fuera del cluster con la opción -x y correr un ccradm y finalmente
rebootear.



{181} ok boot -x

root@nodo1 # /usr/cluster/lib/sc/ccradm -i \
/etc/cluster/ccr/infrastructure -o


nodo1 # init 6
nodo1 # clinterconnect status
Cluster Transport Paths ===
Endpoint1 Endpoint2 Status
--------- --------- ------
nodo2:ce3 nodo1:ce3 Path online
nodo2:ce1 nodo1:ce1 Path online

Pasos para mirrorear disco de booteo



Inicializar el disco de mirror:



vxdisksetup -i c0t11d0 format=sliced

Agregar el disco al diskgroup.




vxdg -g rootdg adddisk rootmirror=c0t11d0s2

Mirrorear el disco.



vxmirror -g rootdg rootdisk rootmirror

Crear un diskgroup local con sus respectivos volumenes.



vxdisksetup -i Disk_5
vxdg init localdg localdg01=Disk_5
vxassist -g localdg make vol01 2g localdg01
newfs /dev/vx/rdsk/localdg01/vol01

Pasos para configurar cluster con Oracle RAC


Oracle RAC solo esta soportado en zonas globales.



En caso de que la versión de Oracle sea la 10g, se debera
instalar primero el Oracle CRS.



Chequear que esten instaladas las licencias de CVM en el caso de tener VxVM.



vxlicrep y vxlicinst

Crear el grupo y usuario para Oracle.



groupadd -g 1000 dba
groupadd -g 1001 oinstall
useradd -u 1000 -g 1000 -G 1001 -c "oracle DBA" -m -d \
/export/home/oracle -s /usr/bin/ksh oracle
chown oracle:dba /export/home/oracle
passwd oracle

Instalar los servicios de RAC en ambos nodos. Es necesario tener instalado:




SUNWscucmd
SUNWudlm
SUNWudlmr

Para SVM se necesita SUNWscmd.


Para CVM se necesita SUNWcvm,
SUNWcvmr
.


Tambien el SUNscor es necesario para que el wizard de los data service funcione correctamente.



Instalar el paquete UDLM de Oracle.





pkgadd -d .ORCLudlm

Agregar en el /etc/system,
los parámetros recomendado para Oracle RAC.



set semsys:seminfo_semmni=100
set semsys:seminfo_semmns=1024
set semsys:seminfo_semmsl=256
set semsys:seminfo_semvmx=32767
set shmsys:shminfo_shmmax=4294967295
set shmsys:shminfo_shmmin=1
set shmsys:shminfo_shmmni=100
set shmsys:shminfo_shmseg=10

Luego reboot del equipo.



Cuidado: Cambiar el port 6000 que viene seteado por default en el /opt/SUNWudlm/etc/udlm.conf, porque puede traer conflictos con el port del sshd.


Una opción valida es el port 7000. Esto hacerlo cuando no este ejecutandose el dlm.


Crear RGM para el Oracle RAC DataService.




clrt register SUNW.rac_framework
cltr register SUNW.rac_udlm

clrg create -n nodo1,nodo2 -p maximum_primaries=2 -p desired_primaries=2 -p rg_mode=Scalable rac-framework-rg
clrs create -g rac-framework-rg -t SUNW.rac_framework-rg rac-framework-rs
clrs create -g rac-framework-rg -t SUNW.rac_udlm -p port=7000 -p resource_dependencies=rac-framework-rs rac-udlm-rs
clrs create -g rac-framework-rg -t SUNW.rac_svm -p resource_dependencies=rac-framework-rs rac-svm-rs

Poner el recurso online.


clrg online -emM rac-framework-rg


Pasos para Crear Raw Devices para Oracle RAC.



vxassist -g racdg -U gen make ocr1 1g
vxedit -g racdg set user=oracle group=dba ocr1

Crear el Resource Group Scalable.




clrg create -n nodo1,nodo2 -p Desired_primaries=2 -p Maximum_primaries=2 -p RG_affinities=++rac-framework-rg RG_mode=Scalable scal-racdg-rg

clrt register SUNW.ScalDeviceGroup
clrs create -g scal-racdg-rg -t SUNW.ScalDeviceGroup -p Resource_dependencies=rac-cvm-rs -p DiskGroupName=racdg scal-racdg-rs
clrg online -emM scal-racdg-rg

Crear el recurso CRS.



clrt register SUNW.crs_framework
clrs create -g rac-framework-rg -t SUNW.crs_framework -p Resource_dependencies=rac-framework-rs -p Resource_dependencies_offline_restart{local_node} crs_framework-rs

Resource_dependencies_offline_restart
es necesario, solo si esta creado un resource group Scalable.




Crear un Proxy resource group para el Oracle RAC.


Si no se usa un device group Scalable, hay que remover las dependencias a el.



clrg create -n nodo1,nodo2 -p Maximum_primaries=2 -p Desired_primaries=2 -p RG_mode=Scalable -p RG_affinities=++rac-framework-rg,++ scal-racdg-rg rac-proxy-rg

clrt register SUNW.scalable_rac_server_proxy

clrs create -g rac-proxy-rg -t SUNW.scalable_rac_server_proxy

clrs create -g rac-proxy-rg -t SUNW.scalable_rac_server_proxy -p ORACLE_HOME=/oracle/product/10.2.0.2/db -p CRS_HOME=/oracle/product/10.2.0.2/crs -p DB_NAME=SUNPR -p ORACLE_SID{nodo1}=SUNPR1 -p ORACLE_SID{nodo2}=SUNPR2 -p Resource_dependencies=rac-framework-rs -p Resource_dependencies_offline_restart=scal-rac-rs,crs_framework-rs rac-proxy-rs

clrg online -emM rac-proxy-rg


 




martedì 13 gennaio 2009

Oracle RAC: Checking RAC status with SQL/OS level statements

By Tarry Singh

Brief intro

Our last article was about monitoring RAC, which we will get back to in upcoming articles. Monitoring can be a daunting task for a DBA but fortunately, the EM console is a good place to start. There are vendors that deliver products to monitor RAC--we did a 3-part article reviewing the beta product from Quest software called SoRAC or Spotlight on RAC. They are good graphical tools but when it comes to recovering the scenarios like voting disks, crs files and other scenarios you need more than just that.

In this article, we will attempt to run typical scripts to check the status of our RAC nodes. We will also do a quick run on the liveliness of the cluster and then go on to run our typical scripts to see the status of our datafiles. Let us start by checking the status of our RAC on ESX 3.0.1 Server.

Doing quicks checks to check the livliness of the RAC

We have gone through this command several times. It resides under the 4ORACLE_HOME/CRS/bin directory and there are several commands to perform various tasks, such as displaying individual resource and starting and stopping those resources. Anyhow, do the crs --help to get a complete list of each command.

[oracle@vm02 bin]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.esxrac.db application ONLINE ONLINE vm02
ora....c1.inst application ONLINE ONLINE vm01
ora....c2.inst application ONLINE ONLINE vm02
ora....serv.cs application ONLINE ONLINE vm02
ora....ac1.srv application ONLINE ONLINE vm01
ora....ac2.srv application ONLINE ONLINE vm02
ora....SM1.asm application ONLINE ONLINE vm01
ora....01.lsnr application ONLINE ONLINE vm01
ora.vm01.gsd application ONLINE ONLINE vm01
ora.vm01.ons application ONLINE ONLINE vm01
ora.vm01.vip application ONLINE ONLINE vm01
ora....SM2.asm application ONLINE ONLINE vm02
ora....02.lsnr application ONLINE ONLINE vm02
ora.vm02.gsd application ONLINE ONLINE vm02
ora.vm02.ons application ONLINE ONLINE vm02
ora.vm02.vip application ONLINE ONLINE vm02

By checking the status of individual nodes and all the necessary applications, we can see that the VIP, GSD, Listener and the ONS daemons are alive.

[oracle@vm02 bin]$ srvctl status nodeapps -n vm01
VIP is running on node: vm01
GSD is running on node: vm01
Listener is running on node: vm01
ONS daemon is running on node: vm01
[oracle@vm02 bin]$ srvctl status nodeapps -n vm02
VIP is running on node: vm02
GSD is running on node: vm02
Listener is running on node: vm02
ONS daemon is running on node: vm02

Now checking the status of the ASM on both nodes...

[oracle@vm02 bin]$ srvctl status asm -n vm01
ASM instance +ASM1 is running on node vm01.
[oracle@vm02 bin]$ srvctl status asm -n vm02
ASM instance +ASM2 is running on node vm02.

What about the database status?

 [oracle@vm02 bin]$ srvctl status database -d esxrac
Instance esxrac1 is running on node vm01
Instance esxrac2 is running on node vm02

What would be the status of the service that we created at the end of the database installation?

[oracle@vm02 bin]$ srvctl status service -d esxrac
Service fokeserv is running on instance(s) esxrac2, esxrac1

Cluster Status

[oracle@vm02 bin]$ crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy
[oracle@vm02 bin]$ ssh vm01
The authenticity of host 'vm01 (172.22.107.25)' can't be established.
RSA key fingerprint is c0:0c:75:15:9a:e5:fc:69:5c:0c:e5:c8:94:00:52:c4.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'vm01,172.22.107.25' (RSA) to the list of known hosts.
Enter passphrase for key '/u01/app/oracle/.ssh/id_rsa':
Last login: Fri May 4 12:56:08 2007 from 172.22.206.62
[oracle@vm01 ~]$ crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy
[oracle@vm01 ~]$ exit
logout
Connection to vm01 closed.
[oracle@vm02 bin]$

Querying the RAC

SQL*Plus: Release 10.2.0.1.0 - Production on Fri May 25 10:15:27 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, Real Application Clusters, Oracle Label Security, OLAP and Data Mining Scoring Engine options

Here we quickly query the gv$instance cluster view to get the instances, hostname, and status of our node apps.

SQL> select instance_name, host_name, archiver, thread#, status
2 from gv$instance
3 /
INSTANCE_NAME HOST_NAME ARCHIVE THREAD# STATUS
-------------- --------------------- ------- -------- ------
esxrac1 vm01.wolga.nl STARTED 1 OPEN
esxrac2 vm02.wolga.nl STARTED 2 OPEN

Checking the SGA (System Global Area) on one of the nodes (Note: Both nodes have identical setup).

SQL> show sga
Total System Global Area 608174080 bytes
Fixed Size 1220820 bytes
Variable Size 142610220 bytes
Database Buffers 457179136 bytes
Redo Buffers 7163904 bytes

Getting a list of all our datafiles...

SQL> select file_name, bytes/1024/1024
2 from dba_data_files
3 /
FILE_NAME BYTES/1024/1024
----------------------------------------------- ---------------
+ORADATA/esxrac/datafile/system.259.620732719 500
+ORADATA/esxrac/datafile/undotbs1.260.620732753 200
+ORADATA/esxrac/datafile/sysaux.261.620732767 670
+ORADATA/esxrac/datafile/example.263.620732791 150
+ORADATA/esxrac/datafile/undotbs2.264.620732801 200
+ORADATA/esxrac/datafile/users.265.620732817 5
6 rows selected.

Getting the status of all the groups, type, membership (if any)...

SQL> select group#, type, member, is_recovery_dest_file
2 from v$logfile
3 order by group#
4 /
GROUP# TYPE MEMBER IS_
------ ------- --------------------------------------------------- ---
1 ONLINE +ORADATA/esxrac/onlinelog/group_1.257.620732695 NO
1 ONLINE +FLASH_RECO_AREA/esxrac/onlinelog/group_1.257.620732699 YES
2 ONLINE +ORADATA/esxrac/onlinelog/group_2.258.620732703 NO
2 ONLINE +FLASH_RECO_AREA/esxrac/onlinelog/group_2.258.620732707 YES
3 ONLINE +ORADATA/esxrac/onlinelog/group_3.266.620737527 NO
3 ONLINE +FLASH_RECO_AREA/esxrac/onlinelog/group_3.259.620737533 YES
4 ONLINE +ORADATA/esxrac/onlinelog/group_4.267.620737535 NO
4 ONLINE +FLASH_RECO_AREA/esxrac/onlinelog/group_4.260.620737539 YES

Querying the v$asm_diskgroup view...

select group_number, name,allocation_unit_size alloc_unit_size,state,type,total_mb,usable_file_mb
from v$asm_diskgroup;
GROUP_NUMBER NAME ALLOC_UNIT_SIZE STATE TYPE TOTAL_MB USABLE_FILE_MB
------------ ------------------------------ --------------- ----------- ------ ---------- --------------
1 FLASH_RECO_AREA 1048576 CONNECTED EXTERN 10236 2781
2 ORADATA 1048576 CONNECTED NORMAL 20472 8132

Querying v$asm_disk for our volumes (remember the ones we created first on OS level with the asmlib) :

select name, path, header_status, total_mb free_mb, trunc(bytes_read/1024/1024) read_mb, trunc(bytes_written/1024/1024) write_mb
from v$asm_disk;
NAME PATH HEADER_STATU FREE_MB READ_MB WRITE_MB
----- ---------- ------------ ---------- ---------- ----------
VOL1 ORCL:VOL1 MEMBER 10236 39617 15816
VOL2 ORCL:VOL2 MEMBER 10236 7424 15816
VOL3 ORCL:VOL3 MEMBER 10236 1123 13059

All datafiles in one go:

SQL> select name from v$datafile
2 union
3 select name from v$controlfile
4 union
5 select name from v$tempfile
6 union
7 select member from v$logfile
8 /
NAME
--------------------------------------------------------------------------------
+FLASH_RECO_AREA/esxrac/controlfile/current.256.620732691
+FLASH_RECO_AREA/esxrac/onlinelog/group_1.257.620732699
+FLASH_RECO_AREA/esxrac/onlinelog/group_2.258.620732707
+FLASH_RECO_AREA/esxrac/onlinelog/group_3.259.620737533
+FLASH_RECO_AREA/esxrac/onlinelog/group_4.260.620737539
+ORADATA/esxrac/controlfile/current.256.620732689
+ORADATA/esxrac/datafile/example.263.620732791
+ORADATA/esxrac/datafile/sysaux.261.620732767
+ORADATA/esxrac/datafile/system.259.620732719
+ORADATA/esxrac/datafile/undotbs1.260.620732753
+ORADATA/esxrac/datafile/undotbs2.264.620732801
+ORADATA/esxrac/datafile/users.265.620732817
+ORADATA/esxrac/onlinelog/group_1.257.620732695
+ORADATA/esxrac/onlinelog/group_2.258.620732703
+ORADATA/esxrac/onlinelog/group_3.266.620737527
+ORADATA/esxrac/onlinelog/group_4.267.620737535
+ORADATA/esxrac/tempfile/temp.262.620732779
17 rows selected.

Listing all the tablespaces...

SQL> select tablespace_name, file_name
2 from dba_data_files
3 union
4 select tablespace_name, file_name
5 from dba_temp_files
6 /
TABLESPACE_NAME FILE_NAME
------------------ --------------------------------------------------------------------------------
EXAMPLE +ORADATA/esxrac/datafile/example.263.620732791
SYSAUX +ORADATA/esxrac/datafile/sysaux.261.620732767
SYSTEM +ORADATA/esxrac/datafile/system.259.620732719
TEMP +ORADATA/esxrac/tempfile/temp.262.620732779
UNDOTBS1 ` +ORADATA/esxrac/datafile/undotbs1.260.620732753
UNDOTBS2 +ORADATA/esxrac/datafile/undotbs2.264.620732801
USERS +ORADATA/esxrac/datafile/users.265.620732817
7 rows selected.

This script will give you information of the +ASM1 instance files:

SQL> select group_number, file_number, bytes/1024/1024/1024 GB, type, striped, modification_date
2 from v$asm_file
3 where TYPE != 'ARCHIVELOG'
4 /
GRP_NUM FILE_NUM GB TYPE STRIPE MODIFICAT
------- -------- -------- --------------- ------ ---------
1 256 .01 CONTROLFILE FINE 04-MAY-07
1 257 .05 ONLINELOG FINE 25-MAY-07
1 258 .05 ONLINELOG FINE 24-MAY-07
1 259 .05 ONLINELOG FINE 24-MAY-07
1 260 .05 ONLINELOG FINE 25-MAY-07
1 261 .00 PARAMETERFILE COARSE 24-MAY-07
2 256 .01 CONTROLFILE FINE 04-MAY-07
2 257 .05 ONLINELOG FINE 25-MAY-07
2 258 .05 ONLINELOG FINE 24-MAY-07
2 259 .49 DATAFILE COARSE 04-MAY-07
2 260 .20 DATAFILE COARSE 04-MAY-07
2 261 .65 DATAFILE COARSE 23-MAY-07
2 262 .03 TEMPFILE COARSE 04-MAY-07
2 263 .15 DATAFILE COARSE 04-MAY-07
2 264 .20 DATAFILE COARSE 04-MAY-07
2 265 .00 DATAFILE COARSE 04-MAY-07
2 266 .05 ONLINELOG FINE 24-MAY-07
2 267 .05 ONLINELOG FINE 25-MAY-07
18 rows selected.

More detailed information:

SQL> select group_number, file_number, compound_index, incarnation, block_size, bytes/1024/1024/1024 GB, type, striped,
2 creation_date, modification_date
3 from v$asm_file
4 where TYPE != 'ARCHIVELOG'
5 /
GRP_NUM FILE_NUM COMPOUND_INDEX INCARNATION BLOCK_SIZE GB TYPE STRIPE CREATION_ MODIFICAT
------- -------- -------------- ----------- ---------- -------- --------------- ------ --------- ---------
1 256 16777472 620732691 16384 .01 CONTROLFILE FINE 24-APR-07 04-MAY-07
1 257 16777473 620732699 512 .05 ONLINELOG FINE 24-APR-07 25-MAY-07
1 258 16777474 620732707 512 .05 ONLINELOG FINE 24-APR-07 24-MAY-07
1 259 16777475 620737533 512 .05 ONLINELOG FINE 24-APR-07 24-MAY-07
1 260 16777476 620737539 512 .05 ONLINELOG FINE 24-APR-07 25-MAY-07
1 261 16777477 620737547 512 .00 PARAMETERFILE COARSE 24-APR-07 24-MAY-07
2 256 33554688 620732689 16384 .01 CONTROLFILE FINE 24-APR-07 04-MAY-07
2 257 33554689 620732695 512 .05 ONLINELOG FINE 24-APR-07 25-MAY-07
2 258 33554690 620732703 512 .05 ONLINELOG FINE 24-APR-07 24-MAY-07
2 259 33554691 620732719 8192 .49 DATAFILE COARSE 24-APR-07 04-MAY-07
2 260 33554692 620732753 8192 .20 DATAFILE COARSE 24-APR-07 04-MAY-07
2 261 33554693 620732767 8192 .65 DATAFILE COARSE 24-APR-07 23-MAY-07
2 262 33554694 620732779 8192 .03 TEMPFILE COARSE 24-APR-07 04-MAY-07
2 263 33554695 620732791 8192 .15 DATAFILE COARSE 24-APR-07 04-MAY-07
2 264 33554696 620732801 8192 .20 DATAFILE COARSE 24-APR-07 04-MAY-07
2 265 33554697 620732817 8192 .00 DATAFILE COARSE 24-APR-07 04-MAY-07
2 266 33554698 620737527 512 .05 ONLINELOG FINE 24-APR-07 24-MAY-07
2 267 33554699 620737535 512 .05 ONLINELOG FINE 24-APR-07 25-MAY-07
18 rows selected.

Conclusion

You need more than a bunch of scripts to monitor your RAC database. Normally in most shops managing and monitoring the RAC from the DB console or even a grid console makes the task much easier. However, you can become a RAC expert if you can practice and play with your RAC with various scenarios. We will start playing with our RAC and attempt to simulate all kinds of crash scenarios. In addition, with 11G coming up we will try to migrate our RAC to 11G (whenever it is publicly available