Easy Connect with ORA-12504

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
[oracle@db2srv:/home/oracle]$ sqlplus system@192.168.56.101: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
[oracle@db2srv:/home/oracle]$ sqlplus system@\"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:

[oracle@db2srv:/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 system@"192.168.56.101:1522/linora"
Enter password
posted @ 2021-11-19 04:43  耀阳居士  阅读(0)  评论(0)    收藏  举报