patternMinor
What is the name of the default schema in Oracle?
Viewed 0 times
thewhatdefaultnameoracleschema
Problem
When you create an object in Oracle, and do not specify a schema (object prefix), is there a name for that default schema? I see in Oracle SQL Developer, that a newly created object shows up in the root object nodes when no prefix is specified, rather than the schema object nodes.
Creating table under schema X:
X.table_1
Creating table under default schema:
table_1
Creating table under schema X:
X.table_1
Creating table under default schema:
table_1
Solution
By default, it is the user you used to log in, and you can query it as below:
You can change your current schema in your session however:
If you create a table after this, without specifying the schema, that table will be created in the USER2 schema regardless of what user you logged on with.
select sys_context('USERENV', 'CURRENT_SCHEMA') from dual;You can change your current schema in your session however:
alter session set current_schema=USER2;If you create a table after this, without specifying the schema, that table will be created in the USER2 schema regardless of what user you logged on with.
Code Snippets
select sys_context('USERENV', 'CURRENT_SCHEMA') from dual;alter session set current_schema=USER2;Context
StackExchange Database Administrators Q#131995, answer score: 8
Revisions (0)
No revisions yet.