Database Name: RAC
Instance Name : RAC1, RAC2
Service Name : RACSRV
TNSNAMES.ORA
racsrv =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST =srv-scan.example.com)(PORT = 1531))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = racsrv)
)
)
Add database service using command below:
[root@srv2 oracle]# srvctl add service -db rac -service racsrv -preferred rac1 -available rac2
PRCD-1288 : User is not authorized to create service racsrv for database rac
PRKH-1014 : Current user "root" is not the oracle owner user "oracle" of oracle home "/u01/app/oracle/product/12.1.0/dbhome_2"
(It will through error while using root user so use oracle user )
[root@srv2 oracle]# su oracle
[oracle@srv2 ~]$ ps -ef |grep pmon
grid 7738 1 0 Jun03 ? 00:00:11 asm_pmon_+ASM2
oracle 30158 30116 0 13:09 pts/1 00:00:00 grep pmon
oracle 32386 1 0 Jun04 ? 00:00:04 ora_pmon_rac2
[oracle@srv2 ~]$ . oraenv
ORACLE_SID = [+ASM2] ? rac2
The Oracle base has been changed from /u01/app/grid to /u01/app/oracle
[oracle@srv2 ~]$ srvctl add service -db rac -service racsrv -preferred rac1 -available rac2
[oracle@srv2 ~]$ srvctl start service -db rac -s racsrv
[oracle@srv2 ~]$ srvctl status service -db rac -s racsrv
Service racsrv is running on instance(s) rac1
[oracle@srv2 ~]$
#############################################################################
STEP 2 :
Add tns entry on oracle client or application tnsnames.ora
Add tns entry on oracle client or application tnsnames.ora
C:\Users\varunyadav>tnsping racsrv
TNS Ping Utility for 64-bit Windows: Version 12.1.0.2.0 - Production on 05-JUN-2019 13:21:08
Copyright (c) 1997, 2014, Oracle. All rights reserved.
Used parameter files:
C:\app\client\varunyadav\product\12.1.0\client_1\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST =srv-scan.example.com)(PORT = 1531)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = racsrv)))
OK (10 msec)
C:\Users\varunyadav>sqlplus sys/system123@racsrv as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Wed Jun 5 13:21:28 2019
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options
SQL> SELECT SYS_CONTEXT('USERENV','SERVICE_NAME') FROM DUAL;
SYS_CONTEXT('USERENV','SERVICE_NAME')
--------------------------------------------------------------------------------
racsrv
SQL> SELECT INSTANCE_NAME FROM V$INSTANCE;
INSTANCE_NAME
----------------
rac1
SQL>
[root@srv1 ~]# crsctl status resource -t
--------------------------------------------------------------------------------
Name Target State Server State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.BACKUP.ACFSBACKUP.advm
ONLINE ONLINE srv1 Volume device /dev/a
sm/acfsbackup-280 is
online,STABLE
ONLINE ONLINE srv2 Volume device /dev/a
sm/acfsbackup-280 is
online,STABLE
ora.BACKUP.dg
ONLINE ONLINE srv1 STABLE
ONLINE ONLINE srv2 STABLE
ora.CRS.dg
ONLINE ONLINE srv1 STABLE
ONLINE ONLINE srv2 STABLE
ora.DATA.dg
ONLINE ONLINE srv1 STABLE
ONLINE ONLINE srv2 STABLE
ora.FRA.dg
ONLINE ONLINE srv1 STABLE
ONLINE ONLINE srv2 STABLE
ora.LISTENER.lsnr
ONLINE ONLINE srv1 STABLE
ONLINE ONLINE srv2 STABLE
ora.asm
ONLINE ONLINE srv1 Started,STABLE
ONLINE ONLINE srv2 Started,STABLE
ora.backup.acfsbackup.acfs
ONLINE ONLINE srv1 mounted on /u01/ACFS
BACKUP,STABLE
ONLINE ONLINE srv2 mounted on /u01/ACFS
BACKUP,STABLE
ora.net1.network
ONLINE ONLINE srv1 STABLE
ONLINE ONLINE srv2 STABLE
ora.ons
ONLINE ONLINE srv1 STABLE
ONLINE ONLINE srv2 STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE srv1 STABLE
ora.LISTENER_SCAN2.lsnr
1 ONLINE ONLINE srv1 STABLE
ora.LISTENER_SCAN3.lsnr
1 ONLINE ONLINE srv1 STABLE
ora.MGMTLSNR
1 ONLINE ONLINE srv1 169.254.235.61 192.1
68.10.1,STABLE
ora.cvu
1 ONLINE ONLINE srv2 STABLE
ora.mgmtdb
1 ONLINE ONLINE srv1 Open,STABLE
ora.oc4j
1 ONLINE ONLINE srv2 STABLE
ora.rac.db
1 ONLINE ONLINE srv1 Open,STABLE
2 ONLINE ONLINE srv2 Open,STABLE
ora.rac.racsrv.svc
1 ONLINE ONLINE srv1 STABLE
ora.scan1.vip
1 ONLINE ONLINE srv1 STABLE
ora.scan2.vip
1 ONLINE ONLINE srv1 STABLE
ora.scan3.vip
1 ONLINE ONLINE srv1 STABLE
ora.srv1.vip
1 ONLINE ONLINE srv1 STABLE
ora.srv2.vip
1 ONLINE ONLINE srv2 STABLE
--------------------------------------------------------------------------------
[root@srv1 ~]#
###############################################################################
STEP 3 :
To check connection working or not .
KILL FORCEFULLY
[oracle@srv1 ~]$ ps -ef |grep pmon
grid 7785 1 0 Jun03 ? 00:00:10 asm_pmon_+ASM1
grid 8685 1 0 Jun03 ? 00:00:07 mdb_pmon_-MGMTDB
oracle 22222 22189 0 13:26 pts/1 00:00:00 grep pmon
oracle 29694 1 0 Jun04 ? 00:00:04 ora_pmon_rac1
[oracle@srv1 ~]$ pkill -9 -f ora_pmon_rac1
[oracle@srv1 ~]$ ps -ef |grep pmon
grid 7785 1 0 Jun03 ? 00:00:10 asm_pmon_+ASM1
grid 8685 1 0 Jun03 ? 00:00:07 mdb_pmon_-MGMTDB
oracle 22427 22189 0 13:26 pts/1 00:00:00 grep pmon
[oracle@srv1 ~]$
################################################################################
SQL> SELECT SYS_CONTEXT('USERENV','SERVICE_NAME') FROM DUAL;
SELECT SYS_CONTEXT('USERENV','SERVICE_NAME') FROM DUAL
*
ERROR at line 1:
ORA-03113: end-of-file on communication channel
Process ID: 20257
Session ID: 52 Serial number: 58807
SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options
C:\Users\varunyadav>sqlplus sys/system123@racsrv as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Wed Jun 5 13:27:16 2019
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options
SQL> SELECT SYS_CONTEXT('USERENV','SERVICE_NAME') FROM DUAL;
SYS_CONTEXT('USERENV','SERVICE_NAME')
--------------------------------------------------------------------------------
racsrv
SQL> SELECT INSTANCE_NAME FROM V$INSTANCE;
INSTANCE_NAME
----------------
rac2
SQL>
[root@srv1 ~]# crsctl status resource -t
--------------------------------------------------------------------------------
Name Target State Server State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.BACKUP.ACFSBACKUP.advm
ONLINE ONLINE srv1 Volume device /dev/a
sm/acfsbackup-280 is
online,STABLE
ONLINE ONLINE srv2 Volume device /dev/a
sm/acfsbackup-280 is
online,STABLE
ora.BACKUP.dg
ONLINE ONLINE srv1 STABLE
ONLINE ONLINE srv2 STABLE
ora.CRS.dg
ONLINE ONLINE srv1 STABLE
ONLINE ONLINE srv2 STABLE
ora.DATA.dg
ONLINE ONLINE srv1 STABLE
ONLINE ONLINE srv2 STABLE
ora.FRA.dg
ONLINE ONLINE srv1 STABLE
ONLINE ONLINE srv2 STABLE
ora.LISTENER.lsnr
ONLINE ONLINE srv1 STABLE
ONLINE ONLINE srv2 STABLE
ora.asm
ONLINE ONLINE srv1 Started,STABLE
ONLINE ONLINE srv2 Started,STABLE
ora.backup.acfsbackup.acfs
ONLINE ONLINE srv1 mounted on /u01/ACFS
BACKUP,STABLE
ONLINE ONLINE srv2 mounted on /u01/ACFS
BACKUP,STABLE
ora.net1.network
ONLINE ONLINE srv1 STABLE
ONLINE ONLINE srv2 STABLE
ora.ons
ONLINE ONLINE srv1 STABLE
ONLINE ONLINE srv2 STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE srv1 STABLE
ora.LISTENER_SCAN2.lsnr
1 ONLINE ONLINE srv1 STABLE
ora.LISTENER_SCAN3.lsnr
1 ONLINE ONLINE srv1 STABLE
ora.MGMTLSNR
1 ONLINE ONLINE srv1 169.254.235.61 192.1
68.10.1,STABLE
ora.cvu
1 ONLINE ONLINE srv2 STABLE
ora.mgmtdb
1 ONLINE ONLINE srv1 Open,STABLE
ora.oc4j
1 ONLINE ONLINE srv2 STABLE
ora.rac.db
1 ONLINE ONLINE srv1 Open,STABLE
2 ONLINE ONLINE srv2 Open,STABLE
ora.rac.racsrv.svc
1 ONLINE ONLINE srv2 STABLE
ora.scan1.vip
1 ONLINE ONLINE srv1 STABLE
ora.scan2.vip
1 ONLINE ONLINE srv1 STABLE
ora.scan3.vip
1 ONLINE ONLINE srv1 STABLE
ora.srv1.vip
1 ONLINE ONLINE srv1 STABLE
ora.srv2.vip
1 ONLINE ONLINE srv2 STABLE
--------------------------------------------------------------------------------
[root@srv1 ~]#
STEP 4:
Relocate Service to node1 at rac1 instance.
[oracle@srv1 ~]$ srvctl relocate service -db rac -service racsrv -oldinst rac2 -newinst rac1
[root@srv1 ~]# crsctl status resource -t
--------------------------------------------------------------------------------
Name Target State Server State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.BACKUP.ACFSBACKUP.advm
ONLINE ONLINE srv1 Volume device /dev/a
sm/acfsbackup-280 is
online,STABLE
ONLINE ONLINE srv2 Volume device /dev/a
sm/acfsbackup-280 is
online,STABLE
ora.BACKUP.dg
ONLINE ONLINE srv1 STABLE
ONLINE ONLINE srv2 STABLE
ora.CRS.dg
ONLINE ONLINE srv1 STABLE
ONLINE ONLINE srv2 STABLE
ora.DATA.dg
ONLINE ONLINE srv1 STABLE
ONLINE ONLINE srv2 STABLE
ora.FRA.dg
ONLINE ONLINE srv1 STABLE
ONLINE ONLINE srv2 STABLE
ora.LISTENER.lsnr
ONLINE ONLINE srv1 STABLE
ONLINE ONLINE srv2 STABLE
ora.asm
ONLINE ONLINE srv1 Started,STABLE
ONLINE ONLINE srv2 Started,STABLE
ora.backup.acfsbackup.acfs
ONLINE ONLINE srv1 mounted on /u01/ACFS
BACKUP,STABLE
ONLINE ONLINE srv2 mounted on /u01/ACFS
BACKUP,STABLE
ora.net1.network
ONLINE ONLINE srv1 STABLE
ONLINE ONLINE srv2 STABLE
ora.ons
ONLINE ONLINE srv1 STABLE
ONLINE ONLINE srv2 STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE srv1 STABLE
ora.LISTENER_SCAN2.lsnr
1 ONLINE ONLINE srv1 STABLE
ora.LISTENER_SCAN3.lsnr
1 ONLINE ONLINE srv1 STABLE
ora.MGMTLSNR
1 ONLINE ONLINE srv1 169.254.235.61 192.1
68.10.1,STABLE
ora.cvu
1 ONLINE ONLINE srv2 STABLE
ora.mgmtdb
1 ONLINE ONLINE srv1 Open,STABLE
ora.oc4j
1 ONLINE ONLINE srv2 STABLE
ora.rac.db
1 ONLINE ONLINE srv1 Open,STABLE
2 ONLINE ONLINE srv2 Open,STABLE
ora.rac.racsrv.svc
1 ONLINE ONLINE srv1 STABLE
ora.scan1.vip
1 ONLINE ONLINE srv1 STABLE
ora.scan2.vip
1 ONLINE ONLINE srv1 STABLE
ora.scan3.vip
1 ONLINE ONLINE srv1 STABLE
ora.srv1.vip
1 ONLINE ONLINE srv1 STABLE
ora.srv2.vip
1 ONLINE ONLINE srv2 STABLE
--------------------------------------------------------------------------------
[root@srv1 ~]#
[oracle@srv2 ~]$ srvctl remove service -database rac -service racsrv
[oracle@srv2 ~]$ srvctl status service -db rac -s racsrv
PRCR-1001 : Resource ora.rac.racsrv.svc does not exist
[oracle@srv2 ~]$
NOTE : Remember While creating service on RAC always create service from preferred node.
Eg ( I have created service from node 2 and make preffered service node1 instance RAC1, I have observed in case of failover service became offline rather than to move to another node automatically).
No comments:
Post a Comment