Defining a service

[oracle@rac1 ~]$ srvctl add service -db CLOUD1 -service HRAPPL -preferred CLOUD11,CLOUD12 -pdb ORCL 
[oracle@rac1 ~]$ srvctl start service -db CLOUD1 -service HRAPPL
[oracle@rac1 ~]$ srvctl status service -db CLOUD1
Service HRAPPL is running on instance(s) CLOUD11,CLOUD12
[oracle@rac1 ~]$ tnsping rac-scan.example.com/HRAPPL

TNS Ping Utility for Linux: Version 12.1.0.2.0 - Production on 13-SEP-2016 13:27:35

Copyright (c) 1997, 2014, Oracle.  All rights reserved.

Used parameter files:

Used HOSTNAME adapter to resolve the alias
Attempting to contact (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=HRAPPL))
(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.56.10)(PORT=1521))
(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.56.12)(PORT=1521))
(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.56.11)(PORT=1521)))
OK (20 msec)

From this I define my rac-scan connect identifier >>> 

[oracle@rac1 admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /products/oracle/12.1.0.2/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

CLOUD1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac-scan.example.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = CLOUD1.example.com)
    )
  )

hrappl.example.com = (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=HRAPPL.example.com))
(ADDRESS=(PROTOCOL=TCP)(HOST=rac-scan.example.com)(PORT=1521)))


[oracle@rac1 admin]$ srvctl status service -db CLOUD1
Service HRAPPL is running on instance(s) CLOUD11,CLOUD12
[oracle@rac1 admin]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Tue Sep 13 13:36:17 2016

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> alter session set container=orcl ;

Session altered.

SQL> create user peto identified by peto ;

User created.

SQL> grant connect to peto ;

Grant succeeded.

[oracle@rac1 admin]$ lsnrctl service | grep hra
Service "hrappl.example.com" has 1 instance(s).

[oracle@rac1 admin]$ sqlplus peto/peto@hrappl.example.com

SQL*Plus: Release 12.1.0.2.0 Production on Tue Sep 13 13:40:06 2016

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

Last Successful login time: Tue Sep 13 2016 13:39:48 +02:00

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 sysdate from dual ;

SYSDATE
---------
13-SEP-16
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s