Comparison – Understanding Tables Between Oracle and SQL Server

Oracle and SQL Server tables share familiar ideas, but their names do not always describe the same behavior. After my earlier discussion of instances, friends from the Oracle community asked for more comparisons. Tables are a useful place to start.

Gouache painting of two differently arranged database shelves connected by a bridge

This comparison needs more than a list of matching names. Some concepts are close, some only overlap, and others solve different problems. The table below corrects several overly simple matches in the original post.

Compare the purpose, then the behavior

PurposeOracleSQL ServerImportant difference
Ordinary row storageHeap-organized tableHeap, or rowstore clustered indexA SQL Server heap has no clustered index. Similar storage goals do not make every access path identical.
Rows organized by a keyIndex-organized table (IOT)Rowstore clustered indexAn Oracle IOT uses its primary key. A SQL Server clustered index need not be the primary key.
Related rows stored togetherTable clusterNo direct table-cluster equivalentAn Oracle cluster can place rows from multiple tables in shared blocks. A SQL Server indexed view stores a query result, not those base tables together.
PartitioningPartitioned tablePartitioned tableBoth divide a table into partitions. Supported methods, index rules and maintenance operations differ.
Temporary dataGlobal or private temporary tableLocal #table or global ##tableOracle global temporary table data is private to a transaction or session. SQL Server global temporary tables are shared across sessions.
Data outside the databaseExternal tableExternal table where supportedA linked server is a connectivity object, not a table type. Check the supported external source and product version.
Object-based rowsObject tableNo direct table-type equivalentOracle rows can be instances of an object type. A SQL Server user-defined table type defines a tabular shape for variables and parameters.
Column-oriented storageHybrid Columnar CompressionColumnstore indexThese are different storage technologies. Compare platform support, updates and query behavior, not just compression labels.
Memory-focused processingDatabase In-Memory column storeMemory-optimized tables (In-Memory OLTP)Oracle can add a columnar copy alongside row-format data. SQL Server memory-optimized tables use a different OLTP storage and concurrency design.

Three names that deserve extra care

Clustered does not mean the same thing everywhere. An Oracle table cluster is different from a SQL Server clustered index. An indexed view is different again. For an Oracle IOT, a SQL Server rowstore clustered index is a useful comparison, but primary-key requirements and implementation details still differ.

Global temporary tables have different visibility. Do not translate an Oracle global temporary table to a SQL Server ## table based on the word global. Decide who should see the rows, when they should disappear and how the application creates and reuses the object.

In-memory is not one feature. Oracle Database In-Memory and SQL Server In-Memory OLTP are not interchangeable names. SQL Server also has columnstore indexes. Choose the technology for the workload, and verify the version, edition and licensing requirements separately.

Inspect the tables you actually have

In SQL Server, this read-only query lists visible user tables in the current database and their base storage index. It is a starting inventory, not a complete description of partitioning or every secondary index.

SELECT s.name AS schema_name,
       t.name AS table_name,
       i.type_desc AS base_storage,
       t.is_memory_optimized
FROM sys.tables AS t
JOIN sys.schemas AS s ON s.schema_id = t.schema_id
LEFT JOIN sys.indexes AS i
  ON i.object_id = t.object_id AND i.index_id IN (0, 1)
ORDER BY s.name, t.name;

In Oracle, the following catalog query describes relational tables owned by the current user. A NULL IOT_TYPE normally means the table is not an index-organized table. TEMPORARY and PARTITIONED show their respective flags; CLUSTER_NAME identifies a table cluster when present.

SELECT table_name,
       temporary,
       partitioned,
       iot_type,
       cluster_name
FROM user_tables
ORDER BY table_name;

Run each query in its own database product. Catalog visibility and table ownership affect what you see. The Oracle query is based on the documented catalog columns; it has not been executed in an Oracle instance for this refresh.

Use the comparison when planning a change

For a migration, start with the reason the original object exists. Check its constraints, indexes, transaction behavior, row visibility and maintenance needs. Then test the target design with representative data and queries. A matching term alone cannot establish equivalent behavior or performance.

Have you worked with a table design that was easy to misunderstand when moving between these products? Share the specific behavior in the comments.

A cross-platform comparison is not a name translation, it is a check of storage and behavior.

Published by Pinal Dave on SQLAuthority. More of my work at pinaldave.com.


Discover more from SQL Authority with Pinal Dave

Subscribe to get the latest posts sent to your email.

Oracle, SQL Server
Previous Post
SQL SERVER – The NOLOCK Question – Notes from the Field #117
Next Post
SQL SERVER – Installation Error – File Format is Not Valid

Related Posts

12 Comments. Leave new

  • Derek Bodendorfer
    March 11, 2016 8:25 am

    These traslations between oracle and sql terminology are helpful. When I was first introduced to an Oracle environment, coming from Sql Server, the two biggest things that caught me off guard were

    1. How all the objects in oracle were organized under the user/schema. I was using DBeaver as my gui at the time and it took me a minute to figure out how to navigate through the objects, whereas in sql sever I historically would simply click on the Tables folder in SSMS for example.

    2. The other thing that tripped me up was the importance of the TNSNAMES.ORA configuration file! I’m a dev/analyst and never had to manually mess with a sql server config file directly to ensure my connection bits where in place and proper.

    Once I had those 2 pieces down it was easy breezy to make the switch to Oracle. However, now I am back with Sql Server, but I appreciated the opportunity to get some Oracle experience

    Reply
  • I would add here also Oracle’s Nested table ~ XML datatype in MSSQL.

    Reply
  • Pinal, Oracle have InMemory option too.

    Reply
  • I don’t think Oracle’s External Table is equivalent or similar to SQL Server’s Linked Server. We do have External Tables introduced in SQL Server 2016 and as I understood from a recent conversation with experts, the new External Tables are one Polybase way of dealing with Big Data.

    Reply
  • Houri Mohamed
    May 22, 2016 1:02 pm

    There is no such Oracle Hybrid columnar compressed table. An Oracle table can be either BASICALLY(free of licence) compressed or OLTP (need a licence) compressed. The HCC is a compression technic which, if my memory serves me well, initially implemented in the Oracle Exadata machine. Columnstore Clustered Indexes are something completely different and could not be compared with HHC.

    I don’t know exactly what SQL server Indexed views are but It is fairly likely something which is different from an Oracle Cluster table.

    And finally one of the readers wrote that Oracle Nested table are XML datatype. This is probably not correct as an Oracle Nested table has nothing to do with an XML datatype.

    Best regards
    Mohamed
    [url removed]

    Reply
  • Andrea Caldarone
    June 21, 2016 9:27 pm

    Oracle equivalent of SQL Server Indexed viiew is “materialized view”

    Reply
  • Andrea Caldarone
    June 21, 2016 9:33 pm

    Hello Emito,
    same name but very different feature:
    Oracle “in-memory” is essentially a non clustered column store index that the db engine build and maintain on the fly backing normal row-store data.
    SQL Server “in-memory” OLTP is a lock and latch free data structure that exist only in memory to improve OLTP performances.
    Oracle advantage is that you have not to modify your code to benefit of the improevement.
    SQL Server advantage is that you can exploit both columar data store and lock latch free structure but at one cost: you have to re-design your db (for column store index) or both the db and the application (for in-memory OLTP)

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.