当前位置: 首页> 游戏> 单机 > singleton 配置

singleton 配置

时间:2025/7/14 7:27:34来源:https://blog.csdn.net/jnrjian/article/details/140642964 浏览次数:0次

​​​​​​​Is there a way to connect to a specific instance of Oracle server?icon-default.png?t=N7T8https://stackoverflow.com/questions/70617760/is-there-a-way-to-connect-to-a-specific-instance-of-oracle-server

1.。。。。。。。。。。。RAC下 通过instance name 控制,instance没起来就失败。。。

I am not sure if I am using the right terminology, but I noticed while logged into OEM that my Oracle database server is set up with three instances and it seems to randomly pick one when I log in. Is there a way to update tnsnames to connect to a specific instance or do it in the New Connection window in Toad? I'm hoping I can kill a particular session that way. 

Normally, yes you can. If you know on which server the instance is located, you could specify that host with the oracle service name that is running there. Using select instance_name, host_name, logins, status from v$instance; you can find out on which instance on which machine your current session is located.

You can find the other instances by querying gv$instance.

If you have no privileges on [g]v$instance you might want to try select sys_context('USERENV','INSTANCE_NAME') from dual; but this only works for the current instance.

 

user123664

  • That last select query was very handy! I couldn't figure out which instance I was in and then realized after running that a few times, that Toad was adding the number in brackets next to the database name. I then learned how to update the tnsnames file for an instance_name and got conntected! 

    – Kelly

     CommentedJan 7, 2022 at 14:48

Add a comment

1

Answering my own question- in the TNSNames file, you can add an INSTANCE_NAME part like this. I did not figure out how to do it without a TNSNames file.

database =(DESCRIPTION =(SDU=32767)(ADDRESS = (PROTOCOL = TCP)(HOST = server.name)(PORT = 1521)(SEND_BUF_SIZE = 98304)(RECV_BUF_SIZE = 98304))(CONNECT_DATA =(SERVER = DEDICATED)(INSTANCE_NAME = instance_name)(SERVICE_NAME = service_name)))

As @ik_zelf posted, you can query for which instance you're on using this:

select sys_context('USERENV','INSTANCE_NAME') from dual;
关键字:singleton 配置

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: