Easy Connect with ORA-12504

Easy connect naming method will cause below error if you didn't specify user password:

1
2
3
4
5
6
7
8
[[email protected]:/home/oracle]$ sqlplus [email protected]:1522/linora

SQL*Plus: Release 12.2.0.1.0 Production on Tue Aug 6 08:48:46 2019

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

ERROR:
ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA

It's because Oracle will translate service_name as user password.
The solution is using double quote and escape character for connect strings:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[[email protected]:/home/oracle]$ sqlplus [email protected]\"192.168.56.101:1522/linora\" as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Tue Aug 6 10:53:57 2019

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

Enter password:

[[email protected]:/home/oracle]$ sqlplus /nolog

SQL*Plus: Release 12.2.0.1.0 Production on Tue Aug 6 10:55:53 2019

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

idle> conn [email protected]"192.168.56.101:1522/linora"
Enter password

EOF

Security Hardening of Oracle Database A brief introduction of MGMTDB