Here, we have our applications developed both for oracle and SQL Server.
Devs are trying to fix their own way to be organized, using VW on views, PR on procedures and etc.
they told me that they're going to use something like DBO.REPORT_XXX to name tables, and I said "why don't you guys use Schemas"?
but, can I achieve something like sql server schemas on oracle?
I'm new with oracle and everything is different (like schema on oracle is the name of the database, that's a user)…
Best Answer
You can't map everything on a one to one relationship when comparing Oracle and SQL Server. There are some similarities between both products and then there are concepts that could pass as two concepts within the other product. Let's start out with the basic stuff (Columns, Tables, ...) and continue up until we reach the instance.
Reference: [Microsoft SQL Server 2008 - Practical SQL Server 2008 for Oracle Professionals][] ()
Database and Instances
An Oracle instance will normally contain one database.
The exception being when an Oracle instance has been configured to run a container database (CDB), which will contain multiple pluggable databases (PDBs).
Reference: 17 Introduction to the Multitenant Architecture (Oracle | Docs | Database Concepts)
A SQL Server instance normally contains multiple databases.
A newly created SQL Server instance will start off with the basic four system databases (master, model, msdb, tempdb).
Schemas
The database at the Oracle level is the container for multiple schemas. The same is valid for the SQL Server. However, there is a difference *) between the Oracle schema and the SQL Server schema.
... in SQL Server
In SQL Server you can create a schema like this:
Reference: CREATE SCHEMA (Transact-SQL) (Microsoft | Docs | SQL)
Any newly created object (table, view) can be linked to a specific schema, otherwise it is linked/stored inside the default schema
dbo
, unless the database user creating the new object has a differente default schema.In this case
dbo.
is the default schema for any object created in SQL Server. Thedbo
schema doesn't have to be explicitly created as it exists as soon as you create a database. You could create your own schemas and create tables within that schema. Here an example using the previously cratedDBT
schema:... in Oracle Database
In Oracle the schema is not a stand-alone concept/object. An Oracle schema is linked to an Oracle user. When you create an Oracle user a schema with the same name is created for that user. The
CREATE
statement for an Oracle user doesn't give a hint that the schema will be created:When you create objects (tables, views) you create them inside a specific schema. There is no default schema.
Summary
So in summary the Oracle user has a schema that has the same name as the user. The user is synonymous with the schema. Hence the *) pretty weird comparison in the table at the top.
dbo
. (e.g.dbo.UserTable
)ORACLEUSER.ORACLUESRTABLE
)Reference: Difference between database vs user vs schema (DBA Stack Exchange)
Answering Your Question
Yes, you can. You create an Oracle user with password and a schema is automatically created. And yes, you could create a
dbo
user/schema in Oracle.