I have a task to migrate a SQL Server database to Oracle.
There are several different SCHEMAs in our SQL Server database and I have to create something similar in Oracle. In SQL Server SCHEMA is like a namespace in C#. But as far as could understand from the Oracle docs, Schema in Oracle has quite a different meaning from that in SQL Server.
To be more specific, I have the following SQL statement in SQL Server:
CREATE SCHEMA Accounting
CREATE TABLE [Accounting].[Payments]
(
ID BIGINT,
Amount MONEY
)
So what is the equivalent of this script in Oracle?
The Oracle concept of a schema maps to the SQL Server concept of a database and one of its schemas. For example, Oracle might have a schema named HR. An instance of SQL Server might have a database named HR, and within that database are schemas. One schema is the dbo (or database owner) schema.
By default, the Oracle schema HR will be mapped to the SQL Server database and schema HR.dbo. SSMA refers to the SQL Server combination of database and schema as a schema. You can modify the mapping between Oracle and SQL Server schemas.
An instance of SQL Server contains multiple databases, each of which can have multiple schemas. The Oracle concept of a schema maps to the SQL Server concept of a database and one of its schemas. For example, Oracle might have a schema named HR. An instance of SQL Server might have a database named HR, and within that database are schemas.
By default, SSMA migrates all objects in an Oracle schema to a SQL Server database named for the schema. However, you can customize the mapping between Oracle schemas and SQL Server databases. An Oracle database contains schemas. An instance of SQL Server contains multiple databases, each of which can have multiple schemas.
The Oracle equivalent of a SQL Server schema is, well, a schema. An Oracle server talks to a single database and that is the "real" difference between the two: A SQL Server instance can connect to multiple databases whereas an Oracle instance connects directly to only one. Because of this, SQL Server uses a three-part naming convention within a server and Oracle only has a two-part naming convention.
In both, schema objects are generally speaking the unit of security -- they are convenient for assigning permissions to groups of objects. The two databases differ on some very important points. In Oracle, a schema is essentially synonymous with a user. SQL Server was once organized this way, but now a schema is separate from users (allowing objects to be moved between schemas for instance).
In SQL Server, permissions do not have to be at the schema level, although that is often convenient for organizational purposes. For instance, you might have underlying tables that users have no direct access to in one schema. You can have another schema with views and the schema has permissions to access the tables. Then, a new view added to the schema automatically has the "right" permissions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With