Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oradb-manage-db: Support for listener.ora, sqlnet.ora and tnsnames.ora with new inventory structure #101

Merged
merged 8 commits into from
Oct 13, 2018

Conversation

Rendanic
Copy link
Collaborator

@Rendanic Rendanic commented Sep 22, 2018

This PR includes all changes for creating tnsnames.ora and listener.ora with new inventory structure.
It is very flexible and a mandatory requiement for the future Data-Guard role.

It is possible to create a listener.ora with a lot of different options now.

- only supported with new home structure
- 'listener_installed' and  'oracle_listeners_config'  are needed
- multiple Hosts/Ports for each Listener
- Extproc support
- only Database in Filesystem without Restart/Grid Infrastructure is supported at the moment
- Definition of listener_installed disables old functionality
- listener_name in oracle_database for SID_LIST_ in listener.ora
When listener_name in oracle_database is defined a static  entry for the instance is added to SID_LIST_ in Listener.
- An Instance could only be part of 1 SID_LIST_ in the Listener
- Don't forget local_listener in init.ora!
- address in oracle_listeners_config need protocol for a host
- listener_port in oracle_database is ignored!

Important:
Support is only for Datebases without Oracle Restart or Grid Infrastructure
at the moment.
Please read more details about this change in oradb-manage-db/LISTENER.md.

Configuration example:

oracle_listeners_config:
    LISTENER:
        home: 18300-base
        address:
          - host: oradb03
            port: 1521
            protocol: TCP
    LISTENER1523:
        home: 18300-base
        address:
          - host: oradb03
            port: 1523
            protocol: TCP

listener_installed:
      - home: 18300-base
        listener_name: LISTENER
        state: present
      - home: 18300-base
        listener_name: LISTENER1523
        state: present

oracle_databases:
      - home: 18300-base
        oracle_db_name: cdb183
        listener_name: LISTENER
...
The tnsnames.ora could be configured in a similar way like
listener.ora.
This change is the next preparation for supporting Data-Guard
in ansible-oracle. The configuration with
oracle_tnsnames_config and tnsnames_installed is very flexible.

You could add more templates for defining custom tnsnames.ora entries.
An example has been added with: tnsnamesdgfailover2.ora.j2.

Example configuration:

oracle_tnsnames_config:
      cdb183:
        connect:
          service_name: cdb183
        address:
          - host: hwe2018
          - host: hwe2019

      cdb183_test:
        tnstemplate: dgfailover2 # Custom Template for Special Data-Guard configurations
        connect:
          service_name: test
        address:
          - host: hwe2018
            port: 1523
          - host: hwe2019
            port: 1523

tnsnames_installed:
      - home: 18300-base
        tnsname: cdb183
        state: present
      - home: 18300-base
        tnsname: cdb183_test
        state: present

cdb183 =
 (DESCRIPTION =
   (FAILOVER=yes)
   (CONNECT_TIMEOUT=5)
   (TRANSPORT_CONNECT_TIMEOUT=3)
   (RETRY_COUNT=3)
   (ADDRESS_LIST =
     (LOAD_BALANCE=on)
     (ADDRESS = (PROTOCOL = TCP)(Host = hwe2018)(Port = 1521))
     (ADDRESS = (PROTOCOL = TCP)(Host = hwe2019)(Port = 1521))
   )
   (CONNECT_DATA =
     (SERVICE_NAME = cdb183)
   )
 )

cdb183_test =
 (DESCRIPTION_LIST=
   (LOAD_BALANCE=off)
   (FAILOVER=yes)
   (DESCRIPTION=
   (CONNECT_TIMEOUT=5)
   (TRANSPORT_CONNECT_TIMEOUT=3)
   (RETRY_COUNT=3)
     (ADDRESS_LIST=
       (LOAD_BALANCE=on)
       (ADDRESS = (PROTOCOL = TCP)(Host = hwe2018)(Port = 1523))
     )
     (CONNECT_DATA =
       (SERVICE_NAME = test)
     )
   )
   (DESCRIPTION=
   (CONNECT_TIMEOUT=5)
   (TRANSPORT_CONNECT_TIMEOUT=3)
   (RETRY_COUNT=3)
     (ADDRESS_LIST=
       (LOAD_BALANCE=on)
       (ADDRESS = (PROTOCOL = TCP)(Host = hwe2019)(Port = 1523))
     )
     (CONNECT_DATA =
       (SERVICE_NAME = test)
     )
   )
 )
@Rendanic Rendanic changed the title oradb-manage-db: Support for listener.ora with new inventory structure oradb-manage-db: Support for listener.ora and tnsnames.ora with new inventory structure Sep 22, 2018
The state of create_listener will be ignored.
This change is needed for static setup of listener.ora when
oracle_db_unique_name or oracle_db_instance_name is used.

SERVER=DEDICATED is default for all entries in tnsnames.ora.
Added PATH during start/reload Listener, because some versions of
Ansible showwd strage problems while start/reload the listener...
The handling for tnsnames.ora has been changed.
ansible-oracle adds a tnsnames_ansible.ora file inside of
ORACLE_HOME/network/admin and added an IFILE= entry at the
beginnen of the tnsnames.ora in the same directory.

Please make sure to define unique entries for the tnsnames_ansible.ora
against the entries in tnsnames.ora
Custom configuration of sqlnet.ora with the same
logic as tnsnames.ora. An IFILE entry is added to
the sqlnet.ora and points to sqlnet_ansible.ora
with the following entries:

Only state present is supported at the moment.

sqlnet_installed:
      - home: 12102-latest
        sqlnet: sqlnetalias1
        state: present

sqlnet_config:
      sqlnetalias1:
        - {name: "ADR_BASE", value: "/u01/app/oracle/" }
        - {name: "SQLNET.ALLOWED_LOGON_VERSION_CLIENT", value: "12" }
@Rendanic Rendanic changed the title oradb-manage-db: Support for listener.ora and tnsnames.ora with new inventory structure oradb-manage-db: Support for listener.ora, sqlnet.ora and tnsnames.ora with new inventory structure Oct 6, 2018
@oravirt oravirt merged commit f570a31 into oravirt:master Oct 13, 2018
@Rendanic Rendanic deleted the prlistener2 branch October 13, 2018 13:59
Rendanic added a commit to Rendanic/ansible-oracle that referenced this pull request Jul 9, 2022
More fixes for Collection and less verbose with loop labels
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants