SQL*Plus Error OID generation failed

I received this error on a MacBook, when trying to connect with SQL*Plus to my database:

SQL*Plus: Release 12.1.0.2.0 Production on Mon Nov 21 08:27:22 2016

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

ERROR:
ORA-21561: OID generation failed

The issue comes from not having the MacBook’s hostname associated with the home IP address. To fix this, simply find your hostname:

~$ hostname
MY_MACBOOK

Then edit your /etc/hosts file and add the home name to the home IP address:

127.0.0.1       localhost MY_MACBOOK

Also make sure that when you edit the hosts file, that you are not connected to a VPN. Some VPN clients may overwrite the hosts file.