Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
13 views

Oracle SQL Assignments

This document provides steps to create new users and grant privileges in an Oracle database. It explains how to create two users with usernames and passwords, grant all privileges to the users, login as each user and create a table, and try accessing tables created by the other user.

Uploaded by

vinoth kumar
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Oracle SQL Assignments

This document provides steps to create new users and grant privileges in an Oracle database. It explains how to create two users with usernames and passwords, grant all privileges to the users, login as each user and create a table, and try accessing tables created by the other user.

Uploaded by

vinoth kumar
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

How to create new user in oracle ?

Note : Currently we are using default user name SYS and password(password will be at the time
of oracle database installation will be provided).
We can create our own user’s name and password in oracle database to login to work with oracle
database.
Here are the steps given blow to follow and how to create your new user’s name and password in
oracle database. From next time you use this user name and password to login into oracle
database.

Step 1: (To this you have to first login with sys user name and password. Once new user is
created then you can login with new user from next time)
1.ALTER SESSION SET "_ORACLE_SCRIPT" = true;

2.CREATE USER Veeramani IDENTIFIED BY oracle123;


Note : Here Veeramai is user name and oracle123 is the password. Accordingly create user that
you wanted.

After executing the above 1 and 2 statement successfully the new user name and password
created.
Note: User is created but this user is a dummy user because this user is not having permission to
connect to database and create new tables in the database. So, permissions must be given to the
user (veeramani) by using the “grant” command by dba(system). Every user in the oracle server
is called “schema”.

3. GRANT ALL PRIVILEGES TO veeramani;


Note : grant ALL means new user veeramni have all the access to workwith oracle
database..like create new table, create new user, drop table, insert record , select etc..
Navigation: Right Click on you database connection name (XE is my database connection.
Remember your database connection name will be something else.) then select properties

Assignment :

1.Create any two new user name and password.


2. Grant all access to those two users.
3. Login with first use name and create table
CREATE TABLE dept_firstuser (
deptno NUMBER(2),
dname VARCHAR2(14),
loc VARCHAR2(13)
);
insert into dept_firstuser (DEPTNO, DNAME, LOC)
values(10, 'ACCOUNTING', 'NEW YORK');

insert into dept_firstuser


values(20, 'RESEARCH', 'DALLAS');

insert into dept_firstuser


values(30, 'SALES', 'CHICAGO');

insert into dept_firstuser


values(40, 'OPERATIONS', 'BOSTON');

4.Login with second user name and create table


CREATE TABLE dept_seconduser (
deptno NUMBER(2),
dname VARCHAR2(14),
loc VARCHAR2(13)
);

insert into dept_firstuser (DEPTNO, DNAME, LOC)


values(100, 'ACCOUNTING-100', 'NEW YORK-1');

insert into dept_firstuser


values(200, 'RESEARCH-200', 'DALLAS-2');

insert into dept_firstuser


values(300, 'SALES-300', 'CHICAGO-3');
5.Login with first user name and write a select statement to access ana second user table.
6.Login with second user name and write a select statement to access first user table.

You might also like