managing users & tables using oracle enterprise manage

14
OEM: Managing Users & Tables Vazi Okhandiar Page 1 by Vazi Okhandiar, PMP, MSCS, MCT NR Computer Learning Center 1835 W. Orangewood . Suite 200 Orange, CA 92868 www.nrclc.com

Upload: nr-computer-learning-center

Post on 12-Jun-2015

2.179 views

Category:

Technology


1 download

DESCRIPTION

nLearn to create users and manage them using Oracle Enterprise Manager

TRANSCRIPT

Page 1: Managing users & tables using Oracle Enterprise Manage

OEM: Managing Users & Tables

Vazi Okhandiar Page 1

by

Vazi Okhandiar, PMP, MSCS, MCT NR Computer Learning Center

1835 W. Orangewood . Suite 200 Orange, CA 92868

www.nrclc.com

Page 2: Managing users & tables using Oracle Enterprise Manage

OEM: Managing Users & Tables

Vazi Okhandiar Page 2

The article consists of using Oracle Enterprise Manager to perform following 5 tasks:

Create an account for user john with password smith

Create a table MyTable

Login as user john to add and manage data in the database

Remove table MyTable from the database

Remove the user John from the database.

Page 3: Managing users & tables using Oracle Enterprise Manage

OEM: Managing Users & Tables

Vazi Okhandiar Page 3

PART 1: Create A User Account

Log into OEM as sysdba

Open Firefox. Type in the following URL:

https://127.0.0.1:1158/em

Username: sys Password: manager Connect As: SYSDBA

Click on the Server Tab to open the server page.

Page 4: Managing users & tables using Oracle Enterprise Manage

OEM: Managing Users & Tables

Vazi Okhandiar Page 4

Select User in the Security Section on the Server page. This will open up the user page.

Click on Create button to create a user

Enter the user name, password, Default table and temporary table.

In the user name field enter john and in the password field enter smith.

Page 5: Managing users & tables using Oracle Enterprise Manage

OEM: Managing Users & Tables

Vazi Okhandiar Page 5

To select a default tablespace for the user, click on the find icon to view the list of

available tablespaces.

Select the USERS tablespace as the default tablespace and click on the Select button.

Similarly to assign a temporary tablespace for the user, click on the find icon to view

the list of available tablespaces.

Select the TEMP tablespace as the temporary tablespace and click on the Select button.

Page 6: Managing users & tables using Oracle Enterprise Manage

OEM: Managing Users & Tables

Vazi Okhandiar Page 6

The Create user screen should look similar to the one displayed below:

Make sure the Status is unlocked and click OK.

Next we will assign the user permission so that the user can create a table, insert data into the

table, select data from the table and drop the table. While you are in Create User Screen, click

on the System Privileges tab.

Page 7: Managing users & tables using Oracle Enterprise Manage

OEM: Managing Users & Tables

Vazi Okhandiar Page 7

In the Available System Privileges window, find “CREATE ANY TABLE” and click on Move button

to add it to the Selected System Privileges. Similarly, add “DROP ANY TABLE”, “SELECT ANY

TABLE” and “INSERT ANY TABLE” to the Selected System Privileges window.

Click on Apply button to apply the changes.

Next we will assign the unlimited quota for using the tablespace USERS to the user we creating,

in this case it is the user john. While you are in Create User screen, click on the Quotas tab.

Select Unlimited from the drop down for the quota and click OK.

Click OK again to create the user.

Page 8: Managing users & tables using Oracle Enterprise Manage

OEM: Managing Users & Tables

Vazi Okhandiar Page 8

PART II: Create A Table

To create a table, click on the Schema tab.

Click on the Table link in the Database objects.

Click on the Create button to open the window for creating a new table.

Page 9: Managing users & tables using Oracle Enterprise Manage

OEM: Managing Users & Tables

Vazi Okhandiar Page 9

Select Standard and click on Continue button

In the name field, enter MYTABLE, to create a new table called MYTABLE. In the Schema table, enter JOHN, to create the table as part of his database schema In the Tablespace, enter USERS, to use the USERS tablespace to store MYTABLE and associated data. In the Columns field, enter ID as integer with upto 3 digits and Firstname and Lastname of type VARCHAR2 with maximum capacity of 15 character. Click OK when done.

Page 10: Managing users & tables using Oracle Enterprise Manage

OEM: Managing Users & Tables

Vazi Okhandiar Page 10

Verify that when you search for John’s schema, MYTABLE get listed as the result set.

Page 11: Managing users & tables using Oracle Enterprise Manage

OEM: Managing Users & Tables

Vazi Okhandiar Page 11

PART III: Login as John and insert Data in MYTABLE

1. Login as john

>> sqlplus john/smith

2. Insert following records into a table.

SQL> INSERT INTO mytable (ID, FirstName, LastName) Values (1,‘John’, ‘Smith’);

SQL> INSERT INTO mytable (ID, FirstName, LastName) Values (2,‘Jane’, ‘Doe’);

SQL> INSERT INTO mytable (ID, FirstName, LastName) Values (3,‘Paul’, ‘Ryan’);

3. Use SELECT command to verify the data in the table

SQL> Select * from mytable;

ID FirstName LastName

1 John Smith 2 Jane Doe 3 Paul Ryan

4. Remove jane from the table

SQL > DELETE FROM mytable WHERE id=2;

5. Use SELECT command to verify the table is updated.

SQL> Select * from mytable;

ID FirstName LastName

1 John Smith 3 Paul Ryan

Page 12: Managing users & tables using Oracle Enterprise Manage

OEM: Managing Users & Tables

Vazi Okhandiar Page 12

PART IV: Dropping A Table

To remove a table from the database, click on Schema tab and select Tables in the Database Objects

section.

In the Schema field, enter John and click on Go button. This will list the object owned by John.

Select the object owned by John and click on Delete with Options button.

Page 13: Managing users & tables using Oracle Enterprise Manage

OEM: Managing Users & Tables

Vazi Okhandiar Page 13

PART V: Dropping the User To delete a user from the database, click on the server tab and then click on Users link under Security

section.

In the Users window, select the user John, and click on Delete button.

Page 14: Managing users & tables using Oracle Enterprise Manage

OEM: Managing Users & Tables

Vazi Okhandiar Page 14

Confirmation window will pop-up. Click on Yes button for confirm that you want to delete the

user John.

Once the User is deleted, the user will no longer have access to his/her account.