Home » SQL & PL/SQL » SQL & PL/SQL » Getting Hostname,systimestamp over db link
Getting Hostname,systimestamp over db link [message #599601] |
Sat, 26 October 2013 13:39  |
sekharsomu
Messages: 72 Registered: December 2008
|
Member |
|
|
Hi,
Ihave a staging which connects to RAC clusters via dblink
I have a scenario to collect the hostname,systimestamp whenever i do a query from this rac clusters
So in general below would be cool
select UTL_INADDR.GET_HOST_NAME,sysdate,x,y,z from gv$symmetric would work perfect
But on dblink..
select UTL_INADDR.GET_HOST_NAME,sysdate,x,y,z from gv$symmetric@dblink
is returning local timestamp and hostname which is not intended
So i even tried subquery..
select (select host_name,systimestamp from v$instance),t UTL_INADDR.GET_HOST_NAME,sysdate,x,y,z from gv$symmetric@dblink
this would work in certain case
But it certain cases it would throw an error saying mutiple rows from asubquery .
All ineed is to get hostname,systimestamp append to all sql i fetch from any this rac clusters through this dblinks
Please guide me through on this
Thanks,
Somu
Note: x,y,z are dummy columns for representation
[Updated on: Sat, 26 October 2013 13:42] Report message to a moderator
|
|
|
|
|
Re: Getting Hostname,systimestamp over db link [message #599606 is a reply to message #599602] |
Sat, 26 October 2013 14:04   |
sekharsomu
Messages: 72 Registered: December 2008
|
Member |
|
|
no my issue is like this is in need to insert into tables at staging
where columns would be like hostname,systime,and other colums that are expected
for any sql query i get i need to append systimestamp and time stamp
for example :
select UTL_INADDR.GET_HOST_NAME, systimestamp, metric_name, value, metric_unit from gv$sysmetric where metric_name like'%CPU%' and group_id=2;
would work perfectly for me
in dblink on rac say 4node
select UTL_INADDR.GET_HOST_NAME, systimestamp, metric_name, value, metric_unit from gv$sysmetric@dblink where metric_name like'%CPU%' and group_id=2;
this would output only local hostname,local time stamp instead of remote .
Making it difficult for me to know on which host this value came from.
But,thanks for the blazing fast reply.@blackswan
Thanks,
Somu
[Updated on: Sat, 26 October 2013 14:10] Report message to a moderator
|
|
|
|
|
|
|
|
Goto Forum:
Current Time: Mon Apr 28 03:14:25 CDT 2025
|