http://underdarkonsole.blogspot.com/2009/07/real-aplication-cluster-sekedar.html
http://underdarkonsole.blogspot.com/2009/07/install-database-for-cluster-aplication.html
dari artikel diatas sekarang adalah bagaimana cara mengetest bahwa rac telah berjalan dengan baik. Dan berikut sedikit commnad yang mungkin bisa kita pakai... :D
so... let's begin.......
--command--
Nb: dalam kasus ini database universal yang digunakan adalah " db"
Melihat status instance dan service di semua node
[oracle@rac1 ~]$ srvctl status database -d db
Instance db1 is running on node rac1
Instance db2 is running on node rac2
Instance db1 is running on node rac1
Instance db2 is running on node rac2
Jika hanya ingin mengecek di salah satu node saja
[oracle@rac1 ~]$ srvctl status instance -d db -i db1
Instance db1 is running on node rac1
Instance db1 is running on node rac1
untuk mematikan atau menyalakan instance tinggal ganti status dengan stop atau start
Untuk melihat aplikasi node yang berjalan
[oracle@rac1 ~]$ srvctl status nodeapps -n rac1
VIP is running on node: rac1
GSD is running on node: rac1
Listener is running on node: rac1
ONS daemon is running on node: rac1
VIP is running on node: rac1
GSD is running on node: rac1
Listener is running on node: rac1
ONS daemon is running on node: rac1
Melihat config database
[oracle@rac1 ~]$ srvctl config database -d db
rac1 db1 /u01/app/oracle/product/10.2.0/db_1
rac2 db2 /u01/app/oracle/product/10.2.0/db_1
[oracle@rac1 ~]$ srvctl config nodeapps -n rac1 -a -g -s -l
VIP exists.: /rac1-vip.localdomain/192.168.1.200/255.255.255.0/eth0
GSD exists.
ONS daemon exists.
Listener exists.
[oracle@rac1 ~]$ srvctl config nodeapps -n rac2 -a -g -s -l
VIP exists.: /rac2-vip.localdomain/192.168.1.204/255.255.255.0/eth0
GSD exists.
ONS daemon exists.
Listener exists.
rac1 db1 /u01/app/oracle/product/10.2.0/db_1
rac2 db2 /u01/app/oracle/product/10.2.0/db_1
[oracle@rac1 ~]$ srvctl config nodeapps -n rac1 -a -g -s -l
VIP exists.: /rac1-vip.localdomain/192.168.1.200/255.255.255.0/eth0
GSD exists.
ONS daemon exists.
Listener exists.
[oracle@rac1 ~]$ srvctl config nodeapps -n rac2 -a -g -s -l
VIP exists.: /rac2-vip.localdomain/192.168.1.204/255.255.255.0/eth0
GSD exists.
ONS daemon exists.
Listener exists.
Dan untuk menjalankan service Oracle Enterprise Manager dengan
$emctl start dbconsole
untuk menghentikan ganti opsi start dengan stop
--membuat service dengan srvctl--
[oracle@rac1 ~]$ srvctl add service -d db -s jajal -r db1 -a db2
[oracle@rac1 ~]$ srvctl config service -d db
db_service PREF: db1 AVAIL: db2
jajal PREF: db1 AVAIL: db2
[oracle@rac1 ~]$ srvctl config service -d db
db_service PREF: db1 AVAIL: db2
jajal PREF: db1 AVAIL: db2
Untuk men-start dan men-stop service
srvctl start service -d db -s jajal
srvctl stop service -d db -s jajal
Mungkin ini jarang di alami tapi pernah saya alamai. Masalahnya adalah IP untuk virual IP atau VIP bentrok dengan ip lain dan harus dirubah. itu dapat di atasi dengan menganti vip nya sebagai berikut
$ su -
# srvctl modify nodeapps -n rac2 -A rac2-vip.localdomain/192.168.1.204/255.255.255.0/eth0
# srvctl modify nodeapps -n rac2 -A rac2-vip.localdomain/192.168.1.204/255.255.255.0/eth0
--RAC TAF Failover--
Next kita ke bagian inti yaitu TAF. Untuk settingannya sangat sederhana. file configurasinya berada di $ORACLE_HOME/network/admin/tnsnames.ora
Untuk metode dan pilihan pen- setingan nya bisa dilihat di sini
Dan saya menggunakan metode sebagai berikut
DB2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip.localdomain)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = db.simplimobile.com)
(INSTANCE_NAME = db2)
(FAILOVER_MODE=
(BACKUP = DB1)
(TYPE=select)
(METHOD=preconnect)
)
)
)
DB1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip.localdomain)(PORT = 1521))
(FAILOVER = yes )
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = db.simplimobile.com)
(FAILOVER_MODE =
(TYPE = SELECT)
(BACKUP = DB2 )
(METHOD = preconnect)
(RETRIES = 180)
(DELAY = 5)
)
(INSTANCE_NAME = db1)
)
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip.localdomain)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = db.simplimobile.com)
(INSTANCE_NAME = db2)
(FAILOVER_MODE=
(BACKUP = DB1)
(TYPE=select)
(METHOD=preconnect)
)
)
)
DB1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip.localdomain)(PORT = 1521))
(FAILOVER = yes )
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = db.simplimobile.com)
(FAILOVER_MODE =
(TYPE = SELECT)
(BACKUP = DB2 )
(METHOD = preconnect)
(RETRIES = 180)
(DELAY = 5)
)
(INSTANCE_NAME = db1)
)
)
Nb: yang berwarna hijau adalah tambahan......
Dan pertanyaan nya adalah bagaimana kita tahu kalo ini telah berfungsi...?????
--Mari kita cari tau--
[oracle@rac1 ~]$ sqlplus scott/tiger@db1
check instance yang aktif
SQL> select inst_id, instance_name from gv$instance;
INST_ID INSTANCE_NAME
---------- ----------------
1 db1
2 db2
SQL> select instance_name from v$instance ;
INSTANCE_NAME
----------------
db1
INST_ID INSTANCE_NAME
---------- ----------------
1 db1
2 db2
SQL> select instance_name from v$instance ;
INSTANCE_NAME
----------------
db1
SQL> select machine, failover_type, failover_method, failed_over, count(*)
From v$session Group by machine, failover_type, failover_method, failed_over;
MACHINE FAILOVER_TYPE FAILOVER_M FAI COUNT(*)
-------------------- ------------- ---------- --- ----------
rac1.localdomain NONE NONE NO 24
rac1.localdomain SELECT PRECONNECT NO 1
Kemudian jalankan perintah ini tanpa keluar dari sqlplus dari terminal lain, lalu ulang query diatas
[oracle@rac2 ~]$ srvctl stop instance -d db -i db1
[oracle@rac2 ~]$ srvctl status database -d db
Instance db1 is not running on node rac1
Instance db2 is running on node rac2
SQL> select machine, failover_type, failover_method, failed_over, count(*)
From v$session Group by machine, failover_type, failover_method, failed_over;
MACHINE FAILOVER_TYPE FAILOVER_M FAI COUNT(*)
-------------------- ------------- ---------- --- ----------
rac2.localdomain NONE NONE NO 20
rac2.localdomain SELECT PRECONNECT YES 1
Kemudian untuk lebih jelasnya coba komputer rac1 di matikan dan perhatikan konfigurasi ip ( ifconfig ) RAC2 akan berubah.
NB: VIP RAC1 akan di pindah ke Virtual IP RAC 2 )
#sebelum komputer RAC1 dimatikan
[root@rac2 ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:7B:00:DC
inet addr:192.168.1.191 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe7b:dc/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:620286 errors:0 dropped:0 overruns:0 frame:0
TX packets:475415 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:62015968 (59.1 MiB) TX bytes:46630473 (44.4 MiB)
Interrupt:185 Base address:0x1080
eth0:1 Link encap:Ethernet HWaddr 00:0C:29:7B:00:DC
inet addr:192.168.1.204 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:185 Base address:0x1080
eth1 Link encap:Ethernet HWaddr 00:0C:29:7B:00:E6
inet addr:192.168.2.191 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe7b:e6/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:62834294 errors:3 dropped:11 overruns:0 frame:0
TX packets:30604774 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3673394008 (3.4 GiB) TX bytes:753379051 (718.4 MiB)
Interrupt:169 Base address:0x1400
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:881272 errors:0 dropped:0 overruns:0 frame:0
TX packets:881272 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:79229853 (75.5 MiB) TX bytes:79229853 (75.5 MiB)
[root@rac2 ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:7B:00:DC
inet addr:192.168.1.191 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe7b:dc/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:620286 errors:0 dropped:0 overruns:0 frame:0
TX packets:475415 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:62015968 (59.1 MiB) TX bytes:46630473 (44.4 MiB)
Interrupt:185 Base address:0x1080
eth0:1 Link encap:Ethernet HWaddr 00:0C:29:7B:00:DC
inet addr:192.168.1.204 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:185 Base address:0x1080
eth1 Link encap:Ethernet HWaddr 00:0C:29:7B:00:E6
inet addr:192.168.2.191 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe7b:e6/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:62834294 errors:3 dropped:11 overruns:0 frame:0
TX packets:30604774 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3673394008 (3.4 GiB) TX bytes:753379051 (718.4 MiB)
Interrupt:169 Base address:0x1400
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:881272 errors:0 dropped:0 overruns:0 frame:0
TX packets:881272 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:79229853 (75.5 MiB) TX bytes:79229853 (75.5 MiB)
Setelah komputer dimatikan, beberapa saat kemudian ip nya berubah menjadi
[root@rac2 ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:7B:00:DC
inet addr:192.168.1.191 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe7b:dc/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:621431 errors:0 dropped:0 overruns:0 frame:0
TX packets:480049 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:62168391 (59.2 MiB) TX bytes:47238196 (45.0 MiB)
Interrupt:185 Base address:0x1080
eth0:1 Link encap:Ethernet HWaddr 00:0C:29:7B:00:DC
inet addr:192.168.1.204 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:185 Base address:0x1080
eth0:2 Link encap:Ethernet HWaddr 00:0C:29:7B:00:DC
inet addr:192.168.1.200 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:185 Base address:0x1080
eth1 Link encap:Ethernet HWaddr 00:0C:29:7B:00:E6
inet addr:192.168.2.191 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe7b:e6/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:62865093 errors:3 dropped:11 overruns:0 frame:0
TX packets:30619912 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3714022080 (3.4 GiB) TX bytes:756831651 (721.7 MiB)
Interrupt:169 Base address:0x1400
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:881867 errors:0 dropped:0 overruns:0 frame:0
TX packets:881867 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:79248382 (75.5 MiB) TX bytes:79248382 (75.5 MiB)
eth0 Link encap:Ethernet HWaddr 00:0C:29:7B:00:DC
inet addr:192.168.1.191 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe7b:dc/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:621431 errors:0 dropped:0 overruns:0 frame:0
TX packets:480049 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:62168391 (59.2 MiB) TX bytes:47238196 (45.0 MiB)
Interrupt:185 Base address:0x1080
eth0:1 Link encap:Ethernet HWaddr 00:0C:29:7B:00:DC
inet addr:192.168.1.204 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:185 Base address:0x1080
eth0:2 Link encap:Ethernet HWaddr 00:0C:29:7B:00:DC
inet addr:192.168.1.200 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:185 Base address:0x1080
eth1 Link encap:Ethernet HWaddr 00:0C:29:7B:00:E6
inet addr:192.168.2.191 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe7b:e6/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:62865093 errors:3 dropped:11 overruns:0 frame:0
TX packets:30619912 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3714022080 (3.4 GiB) TX bytes:756831651 (721.7 MiB)
Interrupt:169 Base address:0x1400
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:881867 errors:0 dropped:0 overruns:0 frame:0
TX packets:881867 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:79248382 (75.5 MiB) TX bytes:79248382 (75.5 MiB)
NB: warna merah merupakan perubahan ip yang terjadi dan Virtual ip ini akan di kembalikan lagi ke RAC1 jika komputer RAC1 sudah ready kembali.
sekian
Terima kasih
Dan mohon maaf jika masih ada kekurangan.. maklum masih belajar.....
keep learn keep smart and never give up...
cayoooo
comment please ... ConversionConversion EmoticonEmoticon