# Metricbeat can't connect to Oracle 10g database

**URL:** <https://discuss.elastic.co/t/metricbeat-cant-connect-to-oracle-10g-database/352931>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [February 9, 2024, 12:37pm UTC](https://discuss.elastic.co/t/metricbeat-cant-connect-to-oracle-10g-database/352931 "2024-02-09T12:37:55Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![gurbelunder](https://avatars.discourse-cdn.com/v4/letter/g/77aa72/32.png) [@gurbelunder](https://discuss.elastic.co/u/gurbelunder)\
**Post date:** [February 9, 2024, 12:37pm UTC](https://discuss.elastic.co/t/metricbeat-cant-connect-to-oracle-10g-database/352931/1 "2024-02-09T12:37:55Z")

</div>

Hi community,

I'm trying to configure metricbeat on a Windows Server 2008 R2 server for 3 oracle 10.2.0.5 databases.  
I know both is not newest, but customer uses this still and of course these databases are important and not able to upgrade them 😃

Unfortunately metricbeat can't connect to my database. I've two different errors I want to show you.

In first case metricbeat can connect to database but it tries to login into database with wrong password. But password is correct. My oracle.yml in modules.d directory looks like this:

```auto
- module: oracle
  metricsets: ["tablespace", "performance"]
  enabled: true
  period: 10s
  hosts: ["HH-T-ORASRV-01:1521/ORACLEHH"]
  username: elastic
  password: password123

```

For this configuration I get these message in merticbeat logfile. Sorry for geman text, but the databases are running in german language.

```auto
2024-02-09T13:23:26.478+0100	ERROR	module/wrapper.go:266	Error fetching data for metricset oracle.performance: error creating connection to Oracle: error doing ping to database: params=oracle://HH-T-ORASRV-01%3A1521: ************?connectionClass=GODROR&enableEvents=0&heterogeneousPool=0&poolIncrement=1&poolMaxSessions=1000&poolMinSessions=1&poolSessionMaxLifetime=1h0m0s&poolSessionTimeout=5m0s&poolWaitTimeout=30s&prelim=0&standaloneConnection=0&sysasm=0&sysdba=0&sysoper=0&timezone= extAuth=0: ORA-01017: Benutzername/Kennwort ungültig; Anmeldung abgelehnt
type or paste code here

```

I just removed my passwords in this message for this forum so please not wonderung :D. But it's classical Oracle error ORA-01017 which mease "hey your login is not right. But it is 😉  
Password also have no special letters, only alphanumeric.

Then because I saw this [Metricbeat: Oracle module failing to connect while SQL module works · Issue #24118 · elastic/beats · GitHub](https://github.com/elastic/beats/issues/24118) I tried this configuration in oracle.yml in modules.d directory.

```auto
- module: oracle
  metricsets: ["tablespace", "performance"]
  enabled: true
  period: 10s
  hosts: ["oracle://HH-T-ORASRV-01:1521/ORACLEHH"]
  username: elastic
  password: password123

```

Now metricbeat can't connect to my service because it means the service can't be found.

```auto
2024-02-09T13:32:16.427+0100	ERROR	module/wrapper.go:266	Error fetching data for metricset oracle.performance: error creating connection to Oracle: error doing ping to database: params=oracle://elastic: ********* @HH-T-ORASRV-01:1521/ORACLEHH?connectionClass=GODROR&enableEvents=0&heterogeneousPool=0&poolIncrement=1&poolMaxSessions=1000&poolMinSessions=1&poolSessionMaxLifetime=1h0m0s&poolSessionTimeout=5m0s&poolWaitTimeout=30s&prelim=0&standaloneConnection=0&sysasm=0&sysdba=0&sysoper=0&timezone= extAuth=0: ORA-12154: TNS: Angegebener Connect Identifier konnte nicht aufgelöst werden

```

But normal sqlplus connect works fine in this style:

```auto
D:\oracle\product\10.2.0\db_1\BIN>sqlplus elastic/ ******** @//HH-T-ORASRV-01:1521/ORACLEHH

SQL*Plus: Release 10.2.0.5.0 - Production on Fri Feb 9 13:36:09 2024

Copyright (c) 1982, 2010, Oracle. All Rights Reserved.

Verbunden mit:
Oracle Database 10g Release 10.2.0.5.0 - 64bit Production

ELASTIC@//HH-T-ORASRV-01:1521/ORACLEHH>

```

So something in both configuration seems to be wrong.

All tests I'm trying direct on the database server.

Maybe somebody have good idea?

Thanks and regards,  
David

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [February 9, 2024, 2:46pm UTC](https://discuss.elastic.co/t/metricbeat-cant-connect-to-oracle-10g-database/352931/2 "2024-02-09T14:46:43Z")

</div>

What version of metricbeat?

---

<div class="post-metadata">

**Author:** ![Rios](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rios/32/95745_2.png) [@Rios](https://discuss.elastic.co/u/Rios)\
**Post date:** [February 9, 2024, 2:46pm UTC](https://discuss.elastic.co/t/metricbeat-cant-connect-to-oracle-10g-database/352931/3 "2024-02-09T14:46:52Z")

</div>

Check [the documentation](https://www.elastic.co/guide/en/beats/metricbeat/current/metricbeat-module-oracle.html#_example_configuration_48), params are wrong:

```auto
  period: 10s
  hosts: ['user="elastic" password="<pass>" connectString="HH-T-ORASRV-01:1521/ORACLEHH"']

```

---

<div class="post-metadata">

**Author:** ![gurbelunder](https://avatars.discourse-cdn.com/v4/letter/g/77aa72/32.png) [@gurbelunder](https://discuss.elastic.co/u/gurbelunder)\
**Post date:** [February 9, 2024, 2:52pm UTC](https://discuss.elastic.co/t/metricbeat-cant-connect-to-oracle-10g-database/352931/4 "2024-02-09T14:52:11Z")

</div>

Sorry i forgot the versions. Because of support for Windows Server 2008 R2 I'm using Metricbeat 7.17.17. See also the [support matrix](https://www.elastic.co/support/matrix) a bit more down this side (sorry I didn't found any anchor).

For this version documentation is here [documentation metricbeat 7.17](https://www.elastic.co/guide/en/beats/metricbeat/7.17/metricbeat-module-oracle.html) and from this documentation my configuration should be fine.

---

<div class="post-metadata">

**Author:** ![gurbelunder](https://avatars.discourse-cdn.com/v4/letter/g/77aa72/32.png) [@gurbelunder](https://discuss.elastic.co/u/gurbelunder)\
**Post date:** [February 9, 2024, 3:34pm UTC](https://discuss.elastic.co/t/metricbeat-cant-connect-to-oracle-10g-database/352931/5 "2024-02-09T15:34:40Z")

</div>

I also tried the parameter settings for the actual version of metricbeat. Just give it a try.

First I set this:

```auto
- module: oracle
  metricsets: ["tablespace", "performance"]
  enabled: true
  period: 10s
  hosts: ['user="elastic" password="mysecret" connectString="HH-T-ORASRV-01:1521/ORACLEHH"']

```

With that I get a

```auto
connectString=\"HH-T-ORASRV-01:1521/ORACLEHH\"": invalid character " " in host name; host parsing failed for oracle-performance: error parsing URL: parse "oracle://user=\"elastic\" password=\"mysecret\" connectString=\"HH-T-ORASRV-01:1521/ORACLEHH\"": invalid character " " in host name

```

in metricbeat logfile. So I tried it for connection string without the double quotes

```auto
- module: oracle
  metricsets: ["tablespace", "performance"]
  enabled: true
  period: 10s
  hosts: ["user='elastic' password='mysecret' connectString='HH-T-ORASRV-01:1521/ORACLEHH'"]

```

But also same error like first try. So I think this parameter format isn't included in this "older" version.

---

<div class="post-metadata">

**Author:** ![Rios](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rios/32/95745_2.png) [@Rios](https://discuss.elastic.co/u/Rios)\
**Post date:** [February 9, 2024, 3:43pm UTC](https://discuss.elastic.co/t/metricbeat-cant-connect-to-oracle-10g-database/352931/6 "2024-02-09T15:43:36Z")

</div>

Good point Stephen.  
The version [7.17 syntax](https://www.elastic.co/guide/en/beats/metricbeat/7.17/metricbeat-module-oracle.html#_example_configuration_48):  
` hosts: ["elastic:pass@HH-T-ORASRV-01:1521/ORACLEHH"]`

---

<div class="post-metadata">

**Author:** ![gurbelunder](https://avatars.discourse-cdn.com/v4/letter/g/77aa72/32.png) [@gurbelunder](https://discuss.elastic.co/u/gurbelunder)\
**Post date:** [February 9, 2024, 6:14pm UTC](https://discuss.elastic.co/t/metricbeat-cant-connect-to-oracle-10g-database/352931/7 "2024-02-09T18:14:22Z")

</div>

I also tried this syntax. Here complete

```auto
- module: oracle
  metricsets: ["tablespace", "performance"]
  enabled: true
  period: 10s
  hosts: ["elastic:mysecret@HH-T-ORASRV-01:1521/ORACLEHH"]

```

But again I'm getting ORA-01017 error, that my password is not correct.

```auto
2024-02-09T19:11:30.411+0100	ERROR	module/wrapper.go:266	Error fetching data for metricset oracle.tablespace: error creating connection to Oracle: error doing ping to database: params=oracle://elastic%3Amysecret%40HH-T-ORASRV-01%3A1521:SECRET-7YuAXBX6DXc=@?connectionClass=GODROR&enableEvents=0&heterogeneousPool=0&poolIncrement=1&poolMaxSessions=1000&poolMinSessions=1&poolSessionMaxLifetime=1h0m0s&poolSessionTimeout=5m0s&poolWaitTimeout=30s&prelim=0&standaloneConnection=0&sysasm=0&sysdba=0&sysoper=0&timezone= extAuth=0: ORA-01017: invalid username/password; logon denied

```

With that passwort I'm able to do a connection over sqlplus to the database.

```auto
D:\oracle\product\10.2.0\db_1\BIN>sqlplus elastic/mysecret@//HH-T-ORASRV-01:1521/ORACLEHH

SQL*Plus: Release 10.2.0.5.0 - Production on Fri Feb 9 19:13:38 2024

Copyright (c) 1982, 2010, Oracle. All Rights Reserved.

Verbunden mit:
Oracle Database 10g Release 10.2.0.5.0 - 64bit Production

GLOBAL_NAME
--------------------------------------------------
elastic@ORACLEHH 09.02.2024 19:13:39
Abgelaufen: 00:00:00.01

ELASTIC@//HH-T-ORASRV-01:1521/ORACLEHH> exit

```

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [February 9, 2024, 7:33pm UTC](https://discuss.elastic.co/t/metricbeat-cant-connect-to-oracle-10g-database/352931/8 "2024-02-09T19:33:11Z")

</div>

@gurbelunder Curious if you have a bunch of special characters in the password?

Any Chance you can test with a new version of metricbeat? Like 8.12.1 and / or with a simple password...some reason I remember a bug somewhere with `#` sign or something

I do know it should / does work, as I had a user using it ...

It uses the godor oracle driver under the covers...

> **[GitHub - godror/godror: GO DRiver for ORacle DB](https://github.com/godror/godror)**
>
> GO DRiver for ORacle DB. Contribute to godror/godror development by creating an account on GitHub.

Accordering to the code I see [here](https://github.com/elastic/beats/blob/v7.17.17/x-pack/metricbeat/module/oracle/connection.go#L10)

You should be able to use username and password separately.

```auto
	if params.Username == "" {
		params.Username = c.Username
	}

	if params.Password == "" {
		params.Password = c.Password
	}

```

The other thing I would suggest is try the raw SQL module

> **[SQL module | Metricbeat Reference \[7.17\] | Elastic](https://www.elastic.co/guide/en/beats/metricbeat/7.17/metricbeat-module-sql.html#_example_get_the_buffer_catch_hit_ratio_in_oracle)**

See if you can get that to work...

```auto
- module: sql
  metricsets:
    - query
  period: 10s
  hosts: ["oracle://sys:Oradoc_db1@172.17.0.3:1521/ORCLPDB1.localdomain?sysdba=1"]

  driver: "oracle"
  sql_query: 'SELECT name, physical_reads, db_block_gets, consistent_gets, 1 - (physical_reads / (db_block_gets + consistent_gets)) "Hit Ratio" FROM V$BUFFER_POOL_STATISTICS'
  sql_response_format: table

```

---

<div class="post-metadata">

**Author:** ![gurbelunder](https://avatars.discourse-cdn.com/v4/letter/g/77aa72/32.png) [@gurbelunder](https://discuss.elastic.co/u/gurbelunder)\
**Post date:** [February 10, 2024, 5:11pm UTC](https://discuss.elastic.co/t/metricbeat-cant-connect-to-oracle-10g-database/352931/9 "2024-02-10T17:11:55Z")

</div>

Actually I didn't try it with actual version of metricbeat because of Windows Server 2008 R2 is maximally supported by verison 7.17.x.

I also resetted passwort of the "elastic" database user as simple as I can and set it to "elastic". So I'm logging in with "elastic/elastic" and still get the ORA-01017 error.

I will look into the godror link to see if I can see something because as DBA I also know that password authentication was another in Oracle 10g databases and changed with Oracle 11g databases.

I also will try the sql module, let's see what I can get with these and I'll keep you informed.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 9, 2024, 7:12pm UTC](https://discuss.elastic.co/t/metricbeat-cant-connect-to-oracle-10g-database/352931/10 "2024-03-09T19:12:45Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
