A newby schema/user/table/tablespace question [message #181830] |
Tue, 11 July 2006 15:08  |
piojosnos
Messages: 1 Registered: July 2006
|
Junior Member |
|
|
This may be a very dummy question, but I'm new to Oracle (I'm used to MySQL / PostgreSQL, an others) but Oracle Users / Tablespaces are just driving me crazy.
I have two WEB applications written in Java (Using Hibernate). Both are made with the same framework, so they have some tables with the same names (t_adm_user, t_adm_crashreport, etc). I connect to an Oracle database (only one instance if I'm underestanding well the concepts) with two different users. I create the users and tablespaces for each application in the following way:
For the first app:
CREATE TABLESPACE CDI_TBL DATAFILE '/path/to/CDI_TBL' SIZE 1M AUTOEXTEND ON NEXT 50K;
CREATE USER CDI_USER IDENTIFIED BY sa003 DEFAULT TABLESPACE CDI_TBL;
GRANT RESOURCE, CONNECT, IMP_FULL_DATABASE TO CDI_USER;
For the second is the same procedure but replacing CDI_TBL for ONT_TBL and CDI_USER for ONT_USER.
When I run the first app (connecting as CDI_USER), the framework I use (Hibernate) creates the tables for the first app (Including the tables with common names) and then, when I run the second app (connecting as ONT_USER) the framework creates the tables for the second app but tells me that tables with common names are already created.
I would like to be able to have to two different "schemas or namespaces" (Here is where Oracle terminology gets me confused) for each app, so no matter if they have some tables with common names, they don't get shared. Is there any way?
|
|
|
Re: A newby schema/user/table/tablespace question [message #181853 is a reply to message #181830] |
Tue, 11 July 2006 23:16   |
gkrishn
Messages: 506 Registered: December 2005 Location: Putty a dark screen
|
Senior Member |
|
|
Users/Schemas can own objects,that will be created in the tablespace alloted to it.
CDI_USER objects will be created in TABLESPACE CDI_TBL
ONT_USER objects will be created in TABLESPACE ONT_TBL
Read more about Tablespace,datafile .
You can access CDI_USER objects as
CDI_USER.Table1
CDI_USER.Table2 and
ONT_USER objects as
ONT_USER.Table1
ONT_USER.Table2
Means you can have two tables with same name under different user/schema.
Schema is a kind of DBA terminology used for term 'users'.
|
|
|
|
Re: A newby schema/user/table/tablespace question [message #181928 is a reply to message #181885] |
Wed, 12 July 2006 04:39  |
orausern
Messages: 826 Registered: December 2005
|
Senior Member |
|
|
You might need to understand your application in more detail for this.
A schema is like a user ..and all the object that are owned by that user. so you can take
schema= user+all objects he owns.
so a table a can be in schema X and the same table a can be in schema y. and X.a is different from Y.a.
Now about common tables..you need to find out what the details are..what is the common table? who is the owner of that table etc..and post these details here.
|
|
|