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

后端 未结 5 829
不思量自难忘°
不思量自难忘° 2020-12-18 00:09

I\'m trying to connect my local Oracle 11g database using server explorer in Visual Studio 2010. I tried to setup everything as per instruction, but I\'m still getting an OR

相关标签:
5条回答
  • 2020-12-18 00:19

    In the "Connection Properties" -> "Advanced" set in the "Data Source" field the information in format HOST:PORT/SERVICE_NAME. E.g. 10.xxx.xxx.xxx:1521/SIDNAME

    0 讨论(0)
  • 2020-12-18 00:23

    Without having much knowledge in connecting ODP.NET with an Oracle DB, I suggest you start using SERVICE_NAME (e.g: VENUS) in your connection parameters.

    Oracle states that:

    From 11g onwards, the feature of using the hostname provided in the /etc/hosts file, as the alias / service name has been changed. As a result, the user will have to provide the service name while connecting OR configure the target listener with a default service name.

    One way to bypass the SERVICE_NAME client side requirement is to force the Listener always sending you on the same SERVICE by telling it to do so in the tnsnames.ora

    DEFAULT_SERVICE_LISTENER =  VENUS
    

    But I do not suggest you do that as it's quite restricting.

    0 讨论(0)
  • 2020-12-18 00:27

    Try this, in Visual Studio's Server Explorer Data Connection panel:

    Data source name: SPRPRG020/VENUS

    i.e. the Data source name format is SERVER_NAME_OR_IP/DATABASE_NAME

    0 讨论(0)
  • 2020-12-18 00:37

    I have experienced the same problem when I was trying to create LinkedServer with Oracle 11g. My oracle instance name was: PC-2.my.xgen and my listener name was "NB". The last parameter of first statement is actually the concatenation of Oracle server instance and listener name.

    So I have write down the following statements in SQL server.

    --add a linked server into SQL server
    --last parameter contains OracleInstance / Listener Name of desired database
    EXEC sp_addlinkedserver   'OracleLinkedServer4', 'Oracle',   'MSDAORA', 'PC-2.my.xgen/nb'
    
    --add login information into linked server
    EXEC sp_addlinkedsrvlogin 'OracleLinkedServer4', false,  Null, 'system',  '123456'
    

    In Oracle database "NB" I have a table named : CRD_CIL_NOTIFICATION_TYPE. So I have written down the following statement to get the records.

    select * from OracleLinkedServer4..SYSTEM.CRD_CIL_NOTIFICATION_TYPE
    
    0 讨论(0)
  • 2020-12-18 00:40

    In the "Connection Properties" -> "Advanced" set in the "Data Source" field the information in format HOST/SERVICE_NAME. E.g. 127.0.0.1/TEST

    0 讨论(0)
提交回复
热议问题