Oracle Database Basic Operations

Source: Internet
Author: User
Tags dba

We mainly learn some basic operations of the database, such as how to create users in the database, authorization, delete users, reclaim permissions, lock or unlock users and other common operations.

First, we want to know how to write the user's statement in the database, see below:

1. Create a user

Create user Laowang identified by Laowang;

Create a user name of Laowang and set the user password Laowang for Laowang.

As shown, our old Li user is created and there are a few details to be said.

Create user is the keyword for creating users

Identified by is a keyword that sets the user's password

After the SQL statement is finished, press F8 to execute it. Don't forget.

However, after the creation, we use the Laolu account login is unsuccessful, because this account is not authorized,

Pop-up error message:

So we need to give laolu this user authorization to let him log in

The authorized statements are:

Grant Coonect, resource,dba to Laolu;

--connect is a link database permission that can be used for database

--resource Resource usage rights to create a table

--DBA is the database administrator right

Look at the complete running posture below. OK, create the user, we also give the user authorization, this time Laolu can log on the system? Don't worry, here also note that: Create users, delete users and other permissions only the database administrator Oh, the administrator of the database is the system, one is the DBA. This you need to remember Oh!

Enter Laolu username and password again, click OK

The discovery was successfully logged in.

Is there a little excitement?

2. Modify User Password

Okay, so let's go ahead and create a user, so how do I change the user's password? take a look at the performance posture below, and the SQL statement that modifies the password is:

alter user Laolu identified by laolu123; In fact, in the back of the Laolu add a 123 well is not very simple ah, you can log in after the change to try Oh, do not forget to press F8 to execute once.

3. Reclaim Permissions

When one day Laolu this user to leave from the company, how to do? Should we have to recycle his account, see the correct posture for recycling laolu user Rights, SQL statements are

Revoke Connect,resource from Laolu;

Revoke--Recycling

Connect,rescource--Create and query permissions

From – Where to recycle

We execute revoke connect,resource from Laolu; Then look at the Laolu this user is not again login?

4. Lock or unlock the user

Can we lock or unlock the Laolu user? When the heat is ready, please look down.

Locking: Alter user Laolu account lock;

Unlock: Alter user Laolu account unlock;

--alter user is a modified keyword

--account is a key to lock or unlock

--lock is to lock the user

--unlock is to unlock the user  

after locking, we look at the effect; execute the locked SQL statement first.

Look at the sign-in effect.

The same unlock is the same as the execution of the unlocked statement, and then you can log in correctly. I'm not going to give you a demonstration.

5. Delete a user

we'll then remove the Laolu user and see the correct running posture for SQL. when deleting, please guarantee the user and exit, otherwise cannot delete oh.

After exiting, we look at the effect at the time of deletion. SQL statement after system logon in execution of delete

In the use of Laolu account login, and error. Description we succeeded when we deleted it.

Well, about the database commonly used to create users, delete users, modify user passwords, lock, unlock, authorization, recycling authorization, we say here.

Oracle Database Basic Operations

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.