How to use Oracle linked server shows all tables
By Tan Lee Published on May 15, 2024 465
To view all tables from an Oracle linked server in SQL Server, you need to ensure that you have already configured the Oracle linked server correctly.
Query to List All Tables
Once the linked server is set up, you can use the following query to retrieve all the tables from the Oracle database:
Open your sql management studio, then you can use the sql query below.
SELECT * FROM OPENQUERY(ORCL_LINK, 'SELECT table_name, owner FROM all_tables ORDER BY owner, table_name')
As a result you will see all schemas and all tables
Show Tables from a Specific Schema
If you want to filter tables by schema (for example, SCHEMA_NAME
), you can modify the query like so:
SELECT * FROM OPENQUERY([YourLinkedServerName], 'SELECT table_name FROM all_tables WHERE owner = ''SCHEMA_NAME''')
Replace SCHEMA_NAME
with the specific Oracle schema you're interested in.
Alternatively, if you know the schema you want, you can also query the Oracle tables directly from SQL Server by using:
SELECT * FROM [YourLinkedServerName]..SCHEMA_NAME.sys.tables;
- How to Download ODBC Driver for SQL Server
- How to Download SQL Server Management Studio (SSMS) Versions
- How to Query JSON in SQL Server
- How to modify JSON in SQL Server
- How to set time to 00:00:00 with GETDATE() in SQL
- How to find all the dependencies of a table in SQL Server
- How to Find Objects Referencing a Table in SQL Server
- Case sensitivity in SQL Server
Categories
Popular Posts
Portal HTML Bootstrap
Nov 13, 2024
Freedash bootstrap lite
Nov 13, 2024
Motiv MUI React Admin Dashboard Template
Nov 19, 2024
K-WD Tailwind CSS Admin Dashboard Template
Nov 17, 2024