oracle 11g RAC : mengubah menjadi mode archive log September 23, 2008
Posted by setijoagus in Oracle Administration, oracle.Tags: archive log, oracle 11g, RAC
add a comment
oracle 11g RAC : mengubah menjadi mode archive log
a. apakah database Instance masih hidup ?
[oracle@node1 ~]$ srvctl status database -d node
Instance node1 is running on node node1
Instance node2 is running on node node2
b. matikan database Instance
[oracle@node1 ~]$ srvctl stop database -d node
c. Menyiapkan salah satu database instance agar diset menjadi mode archive log, dengan mengirimkan perintah instance mount
[oracle@node1 ~]$ srvctl start instance -d node -i node1 -o mount
[oracle@node1 ~]$ srvctl status database -d node
Instance node1 is running on node node1
Instance node2 is not running on node node2
[oracle@node1 ~]$ sqlplus / as sysdba
SQL> alter database archivelog;
Database altered.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination +DATA1
Oldest online log sequence 3
Current log sequence 4
SQL> exit
d. restart database instance
[oracle@node1 ~]$ srvctl stop instance -d node -i node1
[oracle@node1 ~]$ srvctl start database -d node
[oracle@node1 ~]$ srvctl status database -d node
Instance node1 is running on node node1
Instance node2 is running on node node2
oracle 11g RAC : Archivelog save in OCFS2 (version 2) September 23, 2008
Posted by setijoagus in Oracle Install, oracle.Tags: archive log, ocfs2, oracle 11g, RAC
1 comment so far
oracle 11g RAC : Archivelog save in OCFS2 (version 2)
Oracle merelease file system ocfs2 yang dapat digunakan untuk keperluan cluster file system, jenis file system ini selain untuk keperluan grid computing (10g, 11g) juga dapat digunakan untuk keperluan saya, yaitu mengumpulkan archive file.
Saya kutip dari http://en.wikipedia.org/wiki/OCFS2
“OCFS (Oracle Cluster File System) It is a shared storage file system developed by Oracle Corporation and released under the GNU General Public License.
OCFS2 (version 2) was integrated into the version 2.6.16 of Linux kernel. Initially, it was marked as “experimental” (Alpha-test) code. This restriction was removed in Linux version 2.6.19.
OCFS2 uses a distributed lock manager which resembles the OpenVMS DLM but is much simpler.”
1. menyiapkan harddisk untuk archive (saya simpan di Storage Area Network / vmware disk share)
[root@node1 ~]# fdisk -l /dev/sdf
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-49278, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-49278, default 49278):
Command (m for help): w
2. format ocfs2 (hanya di lakukan di salah satu node)
[root@node1 ~]# mkfs.ocfs2 -F -b 4K -C 32K -N 4 -L oradatafiles /dev/sdf1
3. mountpoint otomatis, tambahkan di /etc/fstab, di semua node
[root@node1 ~]# vi /etc/fstab
/dev/sdf1 /u03 ocfs2 _netdev,datavolume 0 0
[root@node2 ~]# vi /etc/fstab
/dev/sdf1 /u03 ocfs2 _netdev,datavolume 0 0
4. konfigurasi agar ocfs run pada saat booting, di semua node
[root@node1 ~]# /etc/init.d/o2cb configure
Configuring the O2CB driver.
This will configure the on-boot properties of the O2CB driver.
The following questions will determine whether the driver is loaded on
boot. The current values will be shown in brackets (‘[]‘). Hitting
<ENTER> without typing an answer will keep that current value. Ctrl-C
will abort.
Load O2CB driver on boot (y/n) [n]: y
Cluster to start on boot (Enter “none” to clear) [ocfs2]:
Writing O2CB configuration: OK
Cluster ocfs2 already online
[root@node2 ~]# /etc/init.d/o2cb configure
Configuring the O2CB driver.
This will configure the on-boot properties of the O2CB driver.
The following questions will determine whether the driver is loaded on
boot. The current values will be shown in brackets (‘[]‘). Hitting
<ENTER> without typing an answer will keep that current value. Ctrl-C
will abort.
Load O2CB driver on boot (y/n) [n]: y
Cluster to start on boot (Enter “none” to clear) [ocfs2]:
Writing O2CB configuration: OK
Cluster ocfs2 already online
5. hak & security
[root@node1 ~]# mkdir /u03
[root@node1 ~]# mount /dev/sdf1 /u03 -t ocfs2
[root@node1 ~]# chown oracle.oinstall /u03
[root@node1 ~]# chmod 775 /u03
[root@node1 ~]# ls -ld /u03
[root@node2 ~]# mkdir /u03
[root@node2 ~]# mount /dev/sdf1 /u03 -t ocfs2
[root@node2 ~]# chown oracle.oinstall /u03
[root@node2 ~]# chmod 775 /u03
[root@node2 ~]# ls -ld /u03
6. Mengubah mode archive log pada Oracle 11g RAC
a. apakah database Instance masih hidup ?
[oracle@node1 ~]$ srvctl status database -d node
Instance node1 is running on node node1
Instance node2 is running on node node2
b. matikan database Instance
[oracle@node1 ~]$ srvctl stop database -d node
c. Menyiapkan salah satu database instance agar diset menjadi mode archive log, dengan mengirimkan perintah instance mount
[oracle@node1 ~]$ srvctl start instance -d node -i node1 -o mount
[oracle@node1 ~]$ srvctl status database -d node
Instance node1 is running on node node1
Instance node2 is not running on node node2
[oracle@node1 ~]$ sqlplus / as sysdba
SQL> alter database archivelog;
Database altered.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination +DATA1
Oldest online log sequence 3
Current log sequence 4
SQL> exit
d. restart database instance
[oracle@node1 ~]$ srvctl stop instance -d node -i node1
[oracle@node1 ~]$ srvctl start database -d node
[oracle@node1 ~]$ srvctl status database -d node
Instance node1 is running on node node1
Instance node2 is running on node node2
7. Mengarahkan archive log pada Oracle 11g RAC ke folder tertentu
SQL> alter system set log_archive_dest_1=’location=/u03/archive01′;
System altered.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /u03/archive01
Oldest online log sequence 42
Next log sequence to archive 43
Current log sequence 43
SQL> exit;
oracle 11g RAC : Transparent Application Failover (TAF) September 23, 2008
Posted by setijoagus in Oracle Administration, oracle.Tags: failover, oracle 11g, TAF
add a comment
oracle 11g RAC : Transparent Application Failover (TAF)
TAF, secara singkat jika client connect instance di RAC, dan mendapatkan instance node1 kemudian node1 down, maka client akan dilayani oleh node yang masih hidup instancenya dalam contoh ini node2
lengkapnya saya cuplik dari : http://wiki.oracle.com/page/Transparent+Application+Failover+(TAF)?t=anon
A runtime failover for high-availability environments, such as Oracle9i Real Application Clusters and Oracle Fail Safe, that refers to the failover and re-establishment of application-to-service connections. It enables client applications to automatically reconnect to the database if the connection fails, and, optionally, resume a SELECT statement that was in progress. This reconnect happens automatically from within the Oracle Call Interface (OCI) library.
1. setup tnsnames.ora di semua node
[oracle@node1 ~]$ vi $ORACLE_HOME/network/admin/tnsnames.ora
NODE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = node1-vip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = node2-vip)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = node)
(FAILOVER_MODE =
(TYPE = SELECT)
(METHOD = BASIC)
(RETRIES = 180)
(DELAY = 5)
)
)
)
[oracle@node2 ~]$ vi $ORACLE_HOME/network/admin/tnsnames.ora
NODE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = node1-vip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = node2-vip)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = node)
(FAILOVER_MODE =
(TYPE = SELECT)
(METHOD = BASIC)
(RETRIES = 180)
(DELAY = 5)
)
)
)
2. test koneksi
a. scott login di oracle 11g RAC (sqlplus no 1)
[oracle@node1 ~]$ sqlplus scott/tiger@node
SQL> select * from dept;
DEPTNO DNAME LOC
———- ————– ————-
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
b. scott dapat instance berapa di oracle 11g RAC ? (sqlplus no 2)
[oracle@node1 ~]$ sqlplus system/oracle0@node
SQL> column instance_name format a10
SQL> column host_name format a10
SQL> select instance_name, host_name,
2 NULL AS failover_type,
3 NULL AS failover_method,
4 NULL AS failed_over
5 FROM v$instance
6 UNION
7 SELECT NULL, NULL, failover_type, failover_method, failed_over
8 FROM v$session
9 WHERE username = ‘SCOTT’;
INSTANCE_N HOST_NAME FAILOVER_TYPE FAILOVER_M FAI
———- ———- ————- ———- —
node2 node2
SELECT BASIC NO
c. instance node 2 shutdown
[oracle@node1 ~]$ srvctl status database -d node
Instance node1 is running on node node1
Instance node2 is running on node node2
[oracle@node1 ~]$ srvctl stop instance -d node -i node2
[oracle@node1 ~]$ srvctl status database -d node
Instance node1 is running on node node1
Instance node2 is not running on node node2
d. apakah session scott di node2 juga down ?, ternyata tidak (sqlplus no 1)
SQL> /
DEPTNO DNAME LOC
———- ————– ————-
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
e. lha ?, kalau begitu sekarang scott di layani oleh instance berapa ? (sqlplus no 2)
SQL> /
INSTANCE_N HOST_NAME FAILOVER_TYPE FAILOVER_M FAI
———- ———- ————- ———- —
node1 node1
SELECT BASIC YES
oracle 11g RAC : Starting and Stopping Instances and RAC databases with srvctl and sql September 23, 2008
Posted by setijoagus in Oracle Administration, oracle.Tags: oracle 11g, RAC, srvctl, startup shutdown
add a comment
oracle 11g RAC : Starting and Stopping Instances and RAC databases with srvctl and sql
==================
A. srvctl
==================
1. status database with srvctl
[oracle@node1 ~]$ srvctl status database -d node
Instance node1 is running on node node1
Instance node2 is running on node node2
2. Stopping Instances and RAC databases with srvctl
[oracle@node1 ~]$ srvctl stop database -d node
3. status database with srvctl
[oracle@node1 ~]$ srvctl status database -d node
Instance node1 is not running on node node1
Instance node2 is not running on node node2
4. Starting Instances and RAC databases with srvctl
[oracle@node1 ~]$ srvctl start database -d node
5. status database with srvctl
[oracle@node1 ~]$ srvctl status database -d node
Instance node1 is running on node node1
Instance node2 is running on node node2
6. Stopping Instances and RAC databases with srvctl (not all instance)
[oracle@node1 ~]$ srvctl stop instance -d node -i node2
7. status database with srvctl
[oracle@node1 ~]$ srvctl status database -d node
Instance node1 is running on node node1
Instance node2 is not running on node node2
8. Starting Instances and RAC databases with srvctl (not all instance)
[oracle@node1 ~]$ srvctl start instance -d node -i node2
9. status database with srvctl
[oracle@node1 ~]$ srvctl status database -d node
Instance node1 is running on node node1
Instance node2 is running on node node2
==================
B. sql command
==================
10. status database with sql
[oracle@node1 ~]$ sqlplus system/oracle0@node1
sql> column instance_name format a10
sql> column host_name format a10
sql> column archiver format a10
sql> column status format a10
sql> select instance_name, host_name, archiver, thread#, status from gv$instance;
INSTANCE_N HOST_NAME ARCHIVER THREAD# STATUS
———- ———- ———- ———- ———-
node1 node1 STARTED 1 OPEN
node2 node2 STARTED 2 OPEN
sql> exit;
11. Stopping Instances and RAC databases with sql (not all instance, in ex : node1)
[oracle@node1 ~]$ sqlplus sys/oracle0@node1 as sysdba
sql> shutdown;
sql> exit;
[oracle@node1 ~]$
12. status database with srvctl
[oracle@node1 ~]$ sqlplus system/oracle0@node2
sql> column instance_name format a10
sql> column host_name format a10
sql> column archiver format a10
sql> column status format a10
sql> select instance_name, host_name, archiver, thread#, status from gv$instance;
INSTANCE_N HOST_NAME ARCHIVER THREAD# STATUS
———- ———- ———- ———- ———-
node2 node2 STARTED 2 OPEN
sql> exit;
[oracle@node1 ~]$
13. Starting Instances and RAC databases with sql (not all instance, in ex : node1)
[oracle@node1 ~]$ sqlplus sys/oracle0@node1 as sysdba
SQL*Plus: Release 11.1.0.6.0 – Production on Tue Sep 23 13:46:08 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.
ERROR:
ORA-12521: TNS:listener does not currently know of instance requested in
connect descriptor
Enter user-name: / as sysdba
Connected to an idle instance.
SQL> startup;
ORACLE instance started.
Total System Global Area 853716992 bytes
Fixed Size 1303244 bytes
Variable Size 557845812 bytes
Database Buffers 289406976 bytes
Redo Buffers 5160960 bytes
Database mounted.
Database opened.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 – Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
[oracle@node1 ~]$
=========================================
Note use command : sqlplus / as sysdba
=========================================
ERROR:
ORA-12521: TNS:listener does not currently know of instance requested in
connect descriptor
14. status database with sql
[oracle@node1 ~]$ sqlplus system/oracle0@node2
sql> column instance_name format a10
sql> column host_name format a10
sql> column archiver format a10
sql> column status format a10
sql> select instance_name, host_name, archiver, thread#, status from gv$instance;
INSTANCE_N HOST_NAME ARCHIVER THREAD# STATUS
———- ———- ———- ———- ———-
node2 node2 STARTED 2 OPEN
node1 node1 STARTED 1 OPEN