May 15, 2015 at 6:11 am
I'm building a set of SQL Server views that use OPENQUERY to run queries against an Oracle server.
I want to see the metadata of the query from Oracle's perspective.
Is there an equivalent to SQL Server's sp_help for Oracle that I could use?
Gerald Britton, Pluralsight courses
May 15, 2015 at 6:51 am
you can use the two built in procedures which are used specifically for interrogating linked servers.
EXEC sp_tables_ex [OracleLinkedServerName] will get you started, but from there, you need to find a database/schema/table to really dig into:
EXECUTE sp_tables_ex
@table_server ='CPULinked',
@table_schema='BOOFILES',
@table_name = 'DOCTR'
EXECUTE sp_columns_ex
@table_server ='CPULinked',
@table_schema='BOOFILES',
@table_name = 'DOCTR',
@Column_Name ='DRTYPE'
Lowell
May 15, 2015 at 6:59 am
Thanks for the tip!
Unfortunately, these queries returned empty result sets for me, though the server, schema and tables/views most certainly exist (and I can query them using OPENQUERY)
Actually what I was looking for was an equivalent to sp_help that I can run on Oracle. So something like:
select * from openquery(oracle, 'exec sp_help ''schema.table''')
replacing 'exec sp_help ''schema.table''' with whatever the equivalent is on Oracle.
Gerald Britton, Pluralsight courses
May 15, 2015 at 8:12 am
ahh, sorry.
DESC or DESCRIBE TableName will get you some information, not sure how pretty it will be over a linked server, but that's what you want to try.
Lowell
May 15, 2015 at 8:47 am
Alas, I don't think you can run DESC over OPENQUERY, since it is not a SQL command. I think you can only do that with the SQLPLUS command.
Could be wrong though!
Gerald Britton, Pluralsight courses
May 20, 2015 at 4:29 pm
Doesn't Oracle have metadata views like ALL_TABLES, ALL_TAB_COLUMNS and ALL_USER_TABLES? Can you query those?
Joie Andrew
"Since 1982"
November 14, 2016 at 7:00 am
g.britton (5/15/2015)
Alas, I don't think you can run DESC over OPENQUERY, since it is not a SQL command. I think you can only do that with the SQLPLUS command.Could be wrong though!
You are right.....it is an internal command that only works with SQLPlus.....shame though....
May 11, 2018 at 2:58 pm
have you tried transparent gateway between oracle and sql server?
Cheers,
John Esraelo
June 8, 2019 at 12:25 pm
oracle has equivalent information_schema
Select * from all_tables
select * from all_views
Select * from all_tab_columns
***The first step is always the hardest *******
December 29, 2020 at 7:49 am
This reply has been reported for inappropriate content.
Desc Table1 in Oracle will do this..
Desc --->Describe
Desc:
Viewing 10 posts - 1 through 10 (of 10 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy