{DB作成}tnsnames.oraの作成

https://docs.oracle.com/cd/F19136_01/netag/configuring-naming-methods.html#GUID-D62B85C0-D3C1-4C5C-A9DF-C12DFB21C533
https://docs.oracle.com/cd/F19136_01/netag/configuring-and-administering-oracle-net-listener.html#GUID-0E7C39E3-4627-403A-AE69-E9AA2C7E4C57


lsnrctl start LISTENER_orcl
lsnrctl start LISTENER_PROD1
lsnrctl start LISTENER_PROD2

lsnrctl status LISTENER_orcl
lsnrctl status LISTENER_PROD1
lsnrctl status LISTENER_PROD2


create user test identified by test;
grant dba to test;

 

cdh
cd network/admin

vim tnsnames.ora


orcl=
 (DESCRIPTION=
  (ADDRESS=(PROTOCOL=tcp)(HOST=mmm111.example.com)(PORT=1521))
  (CONNECT_DATA=
     (SERVICE_NAME=orcl.example.com)))


listener_PROD1=
 (DESCRIPTION=
   (ADDRESS=(PROTOCOL=tcp)(HOST=mmm111.example.com)(PORT=1522)))


listener_PROD2=
 (DESCRIPTION=
   (ADDRESS=(PROTOCOL=tcp)(HOST=mmm111.example.com)(PORT=1523)))

 

PROD1=
 (DESCRIPTION=
  (ADDRESS=(PROTOCOL=tcp)(HOST=mmm111.example.com)(PORT=1522))
  (CONNECT_DATA=
     (SERVICE_NAME=PROD1.example.com)))

PROD2=
 (DESCRIPTION=
  (ADDRESS=(PROTOCOL=tcp)(HOST=mmm111.example.com)(PORT=1523))
  (CONNECT_DATA=
     (SERVICE_NAME=PROD2.example.com)))

 

alter system set local_listener=listener_PROD1;
alter system set local_listener=listener_PROD2;

 

sqlplus test/test@orcl
sqlplus test/test@PROD1
sqlplus test/test@PROD2


lsnrctl status LISTENER_orcl
lsnrctl status LISTENER_PROD1
lsnrctl status LISTENER_PROD2