Thứ Bảy, 23 tháng 4, 2016

[ORACLE RAC 11GR2] Playing Game with SRVCTL command.

Enable & Disable DATABASE on CRS

[oracle@oel01 ~]$ srvctl status database -d RAC
Instance RAC1 is running on node oel01
Instance RAC2 is running on node oel02
[oracle@oel01 ~]$ srvctl stop database -d RAC
[oracle@oel01 ~]$ srvctl status database -d RAC
Instance RAC1 is not running on node oel01
Instance RAC2 is not running on node oel02
[oracle@oel01 ~]$ srvctl disable database -d RAC
[oracle@oel01 ~]$ srvctl status database -d RAC
Instance RAC1 is not running on node oel01
Instance RAC2 is not running on node oel02
[oracle@oel01 ~]$ srvctl start database -d RAC
PRCR-1079 : Failed to start resource ora.rac.db
CRS-2501: Resource 'ora.rac.db' is disabled
[oracle@oel01 ~]$ srvctl enable database -d RAC
[oracle@oel01 ~]$ srvctl start database -d RAC
[oracle@oel01 ~]$ srvctl status database -d RAC
Instance RAC1 is running on node oel01
Instance RAC2 is running on node oel02

Remove Database from CRS

[oracle@oel01 ~]$ srvctl status database -d RAC
Instance RAC1 is running on node oel01
Instance RAC2 is running on node oel02
[oracle@oel01 ~]$ srvctl stop database -d RAC
[oracle@oel01 ~]$ srvctl remove database -d RAC
Remove the database RAC? (y/[n]) y
[oracle@oel01 ~]$ srvctl status database -d RAC
PRCD-1120 : The resource for database RAC could not be found.
PRCR-1001 : Resource ora.rac.db does not exist
[grid@oel01 ~]$ crs_stat -t -> Don't see ora.rac.db Resource

Can start instance on each node through sqlplus:

[oracle@oel01 ~]$ sqlplus / as sysdba -> can start on both of nodes.
SQL> startup
ORACLE instance started.

Total System Global Area  726540288 bytes
Fixed Size    2256792 bytes
Variable Size  511705192 bytes
Database Buffers  209715200 bytes
Redo Buffers    2863104 bytes
Database mounted.
Database opened.

Add Database & Intance to CRS

[oracle@oel01 ~]$ srvctl add database -d RAC -o /u01/app/oracle/product/11.2.0/dbhome_1 -p +DATA01/RAC/spfileRAC.ora -r PRIMARY -s open -t normal -n RAC -y AUTOMATIC -a "DATA01,DATA02"
[oracle@oel01 ~]$ srvctl status database -d RAC
Database is not running.
[oracle@oel01 ~]$ srvctl add instance -d RAC -i RAC1 -n oel01
[oracle@oel01 ~]$ srvctl add instance -d RAC -i RAC2 -n oel02
[oracle@oel01 ~]$ srvctl status database -d RAC
Instance RAC1 is not running on node oel01
Instance RAC2 is not running on node oel02

[grid@oel01 ~]$ crsctl status res -t -> The resources were added to CRS

ora.rac.db
      1        OFFLINE OFFLINE                                                   
      2        OFFLINE OFFLINE


[oracle@oel01 ~]$ srvctl start database -d RAC
[oracle@oel01 ~]$ srvctl status database -d RAC
Instance RAC1 is running on node oel01
Instance RAC2 is running on node oel02


Nodeapps on CRS (Network(VIP),GSD,ONS)


[oracle@oel01 ~]$ srvctl status nodeapps -n oel01
VIP oel01-vip is enabled
VIP oel01-vip is running on node: oel01
Network is enabled
Network is running on node: oel01
GSD is disabled
GSD is not running on node: oel01
ONS is enabled
ONS daemon is running on node: oel01
[oracle@oel01 ~]$ srvctl status nodeapps -n oel02
VIP oel02-vip is enabled
VIP oel02-vip is running on node: oel02
Network is enabled
Network is running on node: oel02
GSD is disabled
GSD is not running on node: oel02
ONS is enabled
ONS daemon is running on node: oel02

[oracle@oel01 ~]$ srvctl config nodeapps
Network exists: 1/172.16.111.0/255.255.255.0/eth0, type static
VIP exists: /oel01-vip/172.16.111.202/172.16.111.0/255.255.255.0/eth0, hosting node oel01
VIP exists: /oel02-vip/172.16.111.203/172.16.111.0/255.255.255.0/eth0, hosting node oel02
GSD exists
ONS exists: Local port 6100, remote port 6200, EM port 2016

[root@oel01 bin]# export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
[root@oel01 bin]# ./srvctl remove nodeapps

[root@oel01 bin]# ./srvctl add nodeapps -n oel01 -A 172.16.111.240/255.255.255.0/eth0
[root@oel01 bin]# ./srvctl add nodeapps -n oel02 -A 172.16.111.241/255.255.255.0/eth0
[root@oel01 bin]# ./srvctl config nodeapps
Network exists: 1/172.16.111.0/255.255.255.0/eth0, type static
VIP exists: /172.16.111.240/172.16.111.240/172.16.111.0/255.255.255.0/eth0, hosting node oel01
VIP exists: /172.16.111.241/172.16.111.241/172.16.111.0/255.255.255.0/eth0, hosting node oel02
GSD exists
ONS exists: Local port 6100, remote port 6200, EM port 2016

[oracle@oel01 ~]$ srvctl start nodeapps
[oracle@oel01 ~]$ srvctl status nodeapps
VIP 172.16.111.240 is enabled
VIP 172.16.111.240 is running on node: oel01
VIP 172.16.111.241 is enabled
VIP 172.16.111.241 is running on node: oel02
Network is enabled
Network is running on node: oel01
Network is running on node: oel02
GSD is disabled
GSD is not running on node: oel01
GSD is not running on node: oel02
ONS is enabled
ONS daemon is running on node: oel01
ONS daemon is running on node: oel02


[oracle@oel01 ~]$ ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00:0C:29:F8:86:6C  
          inet addr:172.16.111.200  Bcast:172.16.111.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fef8:866c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:9273 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8516 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1005371 (981.8 KiB)  TX bytes:1129551 (1.0 MiB)

eth0:1    Link encap:Ethernet  HWaddr 00:0C:29:F8:86:6C  
          inet addr:172.16.111.240  Bcast:172.16.111.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1


if the listeners are in INTERMEDIATE then do these steps to fix:

$crsctl stat res -t 

ora.LISTENER.lsnr

       ONLINE   ONLINE               racdb1 

       ONLINE   INTERMEDIATE         racdb2   Not All Endpoints Registered

ora.LISTENER_SCAN1.lsnr

   1   ONLINE   INTERMEDIATE         racdb2    Not All Endpoints Registered



$<RDBMS ORACLE_HOME>/bin/lsnrctl stop LISTENER
$<GRID_HOME>/bin/srvctl stop listener -n RAC1
$<GRID_HOME>/bin/srvctl stop scan_listener -i 1
$<GRID_HOME>/bin/srvctl start listener -n oel01
$<GRID_HOME>/bin/srvctl start scan_listener -i 1
- Modify /etc/hosts -> to new VIP ADDR
- Check local_listener on Database point to VIP LISTENER


Working with Service:

SQL> select service_id,name from v$services;

SERVICE_ID NAME
---------- ----------------------------------------------------------------
5 RACXDB
6 RAC
1 SYS$BACKGROUND
2 SYS$USERS

SQL> show parameter service;

NAME     TYPE VALUE
------------------------------------ ----------- ------------------------------
service_names     string RAC
SQL> show parameter unique;

NAME     TYPE VALUE
------------------------------------ ----------- ------------------------------
db_unique_name     string RAC


[oracle@oel01 ~]$ srvctl status service -d RAC -s GIRL
PRCR-1001 : Resource ora.rac.GIRL.svc does not exist
[oracle@oel01 ~]$  srvctl add service -d RAC -s GIRL -r RAC1,RAC2
[oracle@oel01 ~]$ srvctl status service -d RAC -s GIRL
Service GIRL is not running.
[oracle@oel01 ~]$ srvctl start service -d RAC -s GIRL
[oracle@oel01 ~]$ srvctl status service -d RAC -s GIRL
Service GIRL is running on instance(s) RAC1,RAC2


SQL> select service_id,name from v$services;

SERVICE_ID NAME
---------- ----------------------------------------------------------------
3 GIRL
5 RACXDB
6 RAC
1 SYS$BACKGROUND
2 SYS$USERS

SRVCTL with configuration Database



[oracle@oel01 ~]$ srvctl config database -d RAC
Database unique name: RAC
Database name: RAC
Oracle home: /u01/app/oracle/product/11.2.0/dbhome_1
Oracle user: oracle
Spfile: +DATA01/RAC/spfileRAC.ora
Domain:
Start options: open
Stop options: normal
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: RAC
Database instances: RAC1,RAC2
Disk Groups: DATA01,DATA02
Mount point paths:
Services: FLEXPROD
Type: RAC

Database is administrator managed


[oracle@oel01 ~]$ srvctl modify database -d RAC -h

Modifies the configuration for the database.
...
    -t <stop_options>        Stop options for the database. Examples of shutdown options are NORMAL, TRANSACTIONAL, IMMEDIATE, or ABORT.

[oracle@oel01 ~]$ srvctl modify database -d RAC -t IMMEDIATE
[oracle@oel01 ~]$ srvctl config database -d RAC
Database unique name: RAC
Database name: RAC
Oracle home: /u01/app/oracle/product/11.2.0/dbhome_1
Oracle user: oracle
Spfile: +DATA01/RAC/spfileRAC.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: RAC
Database instances: RAC1,RAC2
Disk Groups: DATA01,DATA02
Mount point paths:
Services: FLEXPROD
Type: RAC
Database is administrator managed

Không có nhận xét nào: