If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Oracle > Creating User & Database Confusion

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-18-12, 10:11
CarlosinFL CarlosinFL is offline
Registered User
 
Join Date: Oct 2010
Location: Orlando, FL
Posts: 223
Question Creating User & Database Confusion

I've successfully installed Oracle 11g R2 database Enterprise Edition on Oracle Linux 6.2 last week. I've been reading the manuals and this. I'm confused about two things:

1. When I create a new user as shown below in SQL*Plus, I'm not sure what to assign / grant for each user so they can login and begin using the system...

Code:
CREATE USER carlos IDENTIFIED BY some_pass
DEFAULT TABLESPACE users
TEMPORARY TABLESPACE temp
;
So the above creates the user 'carlos' fine however I'm looking for at minimum what Oracle 11g requires each user to have to start using the system. I was told I had to grant 'connect' & some other permissions as well.

2. Understanding how databases are created / owned:

The last part I'm confused about is maybe due to my misunderstanding of the word 'database' and how Oracle manages work areas. In MySQL & PostgreSQL, you create a database with the 'CREATE DATABASE' command. Then you assign the database an owner and that user then connects to the newly created database. In Oracle, I'm using an 11g system with a SID of test. I'm not 100% clear on if the SID name is a 'database' name or just a system I.D. but I'm guessing since Oracle can only have one unique SID, it's just an identifier and under this system, I can create many different schemas which are treated like databases in PostgreSQL, no? After I create the role / user above and give him whatever grants / permissions one needs to interact w/ 11g, how can I create a database for 'carlos' to start working? I'm trying to create a database for carlos called 'fcs' and I need carlos to be able to connect to this 'fcs' database or schema and create relational-oriented tables for my project.

Thanks for any clarification!
Reply With Quote
  #2 (permalink)  
Old 06-18-12, 10:27
anacedent anacedent is offline
Registered User
 
Join Date: Aug 2003
Location: Where the Surf Meets the Turf @Del Mar, CA
Posts: 7,083
when all else fails Read The Fine Manual (RTFM)

Contents

In Oracle a schema (user) is equivalent to database in MYSQL or PostgreSQL.
I recommend that you avoid case where "CARLOS" need to operate against "FCS" schema.
If you insist then again RTFM via URL below
http://www.oracle.com/pls/db112/sear...y+user&partno=
__________________
You can lead some folks to knowledge, but you can not make them think.
The average person thinks he's above average!
For most folks, they don't know, what they don't know.
Reply With Quote
  #3 (permalink)  
Old 06-18-12, 10:35
CarlosinFL CarlosinFL is offline
Registered User
 
Join Date: Oct 2010
Location: Orlando, FL
Posts: 223
Quote:
Originally Posted by anacedent View Post
In Oracle a schema (user) is equivalent to database in MYSQL or PostgreSQL.
I recommend that you avoid case where "CARLOS" need to operate against "FCS" schema.
Quote:
One characteristic of an RDBMS is the independence of physical data storage from logical data structures. In Oracle Database, a database schema is a collection of logical data structures, or schema objects. A database schema is owned by a database user and has the same name as the user name.
So from what I understand above, every user created gets his/her own schema (which is like a database in PostgreSQL) to work with and start creating tables into, correct? Just want to make sure I understand this correctly.
Reply With Quote
  #4 (permalink)  
Old 06-18-12, 10:53
anacedent anacedent is offline
Registered User
 
Join Date: Aug 2003
Location: Where the Surf Meets the Turf @Del Mar, CA
Posts: 7,083
> every user created gets his/her own schema (which is like a database in PostgreSQL) to work with and start creating tables into
CORRECT!
__________________
You can lead some folks to knowledge, but you can not make them think.
The average person thinks he's above average!
For most folks, they don't know, what they don't know.
Reply With Quote
  #5 (permalink)  
Old 06-18-12, 10:56
shammat shammat is offline
Registered User
 
Join Date: Nov 2003
Posts: 2,675
Quote:
Originally Posted by CarlosinFL View Post
So from what I understand above, every user created gets his/her own schema
Yes, correct.
Reply With Quote
  #6 (permalink)  
Old 06-18-12, 11:14
CarlosinFL CarlosinFL is offline
Registered User
 
Join Date: Oct 2010
Location: Orlando, FL
Posts: 223
Thanks all and just to be clear after reading the fine manual, at minimum for a new user to connect to his/her schema and begin working in 11g, they require ONLY create session & connect, correct?

Code:
SQL> CONNECT / as sysdba
Connected.

SQL> CREATE USER carlos IDENTIFIED BY letmein;

User created.

SQL> GRANT CONNECT, CREATE SESSION TO carlos;

Grant succeeded.
According to this quote in the manual:

Quote:
Prerequisites

To log on to Oracle Database, a user must have the CREATE SESSION system privilege. Therefore, after creating a user, you should grant the user at least the CREATE SESSION system privilege. Refer to GRANT for more information.
I'm not sure why the omitted CONNECT but is what I did right or should they not need the CONNECT privilege?
Reply With Quote
  #7 (permalink)  
Old 06-18-12, 11:37
anacedent anacedent is offline
Registered User
 
Join Date: Aug 2003
Location: Where the Surf Meets the Turf @Del Mar, CA
Posts: 7,083
>I'm not sure why the omitted CONNECT but is what I did right or should they not need the CONNECT privilege?

CONNECT is a ROLE; not a privilege.
the actual privileges assigned to CONNECT vary by Oracle version.
Oracle wants/plans to deprecate CONNECT role.
__________________
You can lead some folks to knowledge, but you can not make them think.
The average person thinks he's above average!
For most folks, they don't know, what they don't know.
Reply With Quote
  #8 (permalink)  
Old 06-18-12, 12:19
shammat shammat is offline
Registered User
 
Join Date: Nov 2003
Posts: 2,675
Quote:
Originally Posted by CarlosinFL View Post
I'm not sure why the omitted CONNECT but is what I did right or should they not need the CONNECT privilege?
Connect is a role and contains the privilege "create session". As anacedent has pointed out the usage of the roles "CONNECT" and "RESOURCE" are deprecated because the grant too much privileges (and are therefor a possible security issue).

After creating a user grant those privileges that will be needed. Usually those are:

CREATE SESSION
CREATE TABLE
CREATE VIEW
CREATE INDEX
CREATE SEQUENCE

And possibly:

CREATE SYNONYM
CREATE TRIGGER
CREATE PROCEDURE
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On