views:

436

answers:

3

I am a SQL Server developer, with a task in Oracle. DBA set up a DBLink in Oracle that points at a SQL Server database. I am writing a view on the SQL Server data and then a view on the Oracle side to join it with additional Oracle data.

Problem: if I change the definition of the view on SQL Server, even "Select * From myview@dblink" errors with "Invalid column." Closing TOAD and reopening seems to correct the problem, but the real question is how to force Oracle to re-read the metadata without resetting the connection?

A: 

Maybe you can do?:

alter view <<view_name>> compile;

I haven't tested this because I have no db link from Oracle to MSSQL.

tuinstoel
I will try first thing on Monday.
Bill
+1  A: 

This sounds like an issue with TOAD, not oracle. What happens if you do it in SQL*Plus?

Matthew Watson
Same thing happens in SQL*Plus. If I exit and get back in, it works just fine. Must be caching metadata on the connection object.Next test, I queried the view in TOAD, changed it, queried it again. It failed. Then I opened a second connection. Query ran just fine. Must be on the connection object.
Bill
what happens if you do a commit/rollback in your session?
Matthew Watson
Nope. Nothing short of killing the connection forces the metadata refresh. Must be something in the Oracle client configuration - which is controlled by our Operations staff. I will discuss with them.Thanks Matthew and tuinstoel for the help.
Bill
A: 

This seems to be an issue with the Oracle 10g client. The current solution is to disconnect and reconnect. Given that I haven't been able to find anyone else with this problem, i will assume that it is a problem with my client config.

Bill