oravirt / ansible-oracle

Oracle related stuff. Installs RAC/RAC One Node/Single Instance
MIT License
343 stars 249 forks source link

Oracle listener can’t start for 12.2.0.1 #187

Closed tanshaolong closed 2 years ago

tanshaolong commented 5 years ago

Hi,

I am installing oracle SI for 12.2.0.1, but it is failure at creating database. The reason is that not listner. Please see the error message.

TASK [ansible-oracle/roles/oradb-manage-db : manage-db | create/manage database] ****************************************************************************
fatal: [192.168.4.203]: FAILED! => {"changed": false, "msg": "Could not connect to database - ORA-12541: TNS:no listener, connect descriptor: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.4.203)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=CMP)))"}

Actually, I given the listner name and port at ansible host_vars, and ansible had created the listner. The below is ansible output with running

TASK [ansible-oracle/roles/oradb-manage-db : listener | Create listener with netca] *************************************************************************
changed: [192.168.4.203]

TASK [ansible-oracle/roles/oradb-manage-db : manage-db | Add change-pdb script] *****************************************************************************
changed: [192.168.4.203]

I go to target machine to check listner status. The listner is surely invalid. Please see the status.

[oracle@192 bin]$ ./lsnrctl 

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 05-AUG-2019 17:17:28

Copyright (c) 1991, 2016, Oracle.  All rights reserved.

Message 850 not found; No message file for product=network, facility=NL
LSNRCTL> status
Message 1053 not found; No message file for product=network, facility=TNSTNS-12541: Message 12541 not found; No message file for product=network, facility=TNS
 TNS-12560: Message 12560 not found; No message file for product=network, facility=TNS
  TNS-00511: Message 511 not found; No message file for product=network, facility=TNS
   Linux Error: 111: Connection refused

I export the ORCALE_HOME manuly. Check the status again, it will be successful. I don’t know the reason. Who can help? Thanks you.

Below is part of playbook vars for help point the issue.

    oracle_databases:
      - home: 12201-base
        oracle_version_db: 12.2.0.1
        oracle_db_name: orcl
        oracle_db_type: SI
        pdb_prefix: pdb
        num_pdbs: 0
        listener_name: LISTENER
        listener_port: 1521
        is_container: false
        storage_type: FS
        oracle_db_mem_totalmb: 1024
        oracle_database_type: MULTIPURPOSE
        redolog_size: 100M
        redolog_groups: 3
        datafile_dest: /u01/oradata/
        recoveryfile_dest: /u01/fra/
        archivelog: false
        flashback: false
        state: present

        init_parameters:
          - {name: db_create_file_dest, value: /u01/oradata, scope: both, state: present}

    host_fs_layout:
      - vgname: vgtest
        state: present
        filesystem:
          - {mntp: /u01, lvname: lvtest, lvsize: 100%FREE, fstype: ext4 }
        disk:
          - {device: /dev/sdb, pvname: /dev/sdb1 }

    apply_patches_db: False
    db_homes_config:
      12201-base:
        home: db1-base
        version: 12.2.0.1
        edition: EE
    db_homes_installed:
      - home: 12201-base
        state: present
        apply_patches: false
        oracle_version_db: 12.2.0.1
tanshaolong commented 5 years ago

Please help point out if any invalid vars is in my playbook. Thanks you. :)

tanshaolong commented 5 years ago

Also, I have two test enviroments, Redhat7.2 and Redhat7.5. The above issue only happen at Redhat7.5. Redhat7.2 is ok with same playbook.

Rendanic commented 2 years ago

Looks like an inventory problem for me. If the listener has been started with a listener.ora with host= not like hostname or FQDN of the host, the lisener will only listen to the configured host in listener.ora. lsnrctl statustry to connect to the listener on localhost. The current running listener is not listening on localhost and you'll get the ' connection refused'...

I plan to replace the current inventory with a more modern version which has an example for listener configured included as well.

You'll find a good inventory example in the following repository: https://github.com/opitzconsulting/ansible-oracle-inventory