Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Oracle user creation and permission setting

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Permissions:

Create session

Create table

Unlimited tablespace

Connect

Resource

Dba

Example:

# sqlplus / nolog

SQL > conn / as sysdba

SQL > create user username identified by password

SQL > grant dba to username

SQL > conn username/password

SQL > select * from user_sys_privs

We will start with the creation of the Oracle user rights table, and then explain general actions such as login, so that you have an in-depth understanding of the Oracle user rights table.

First, create

Sys; / / system administrator with the highest privileges

System; / / local administrator, second-highest privilege

Scott; / / ordinary user. The password defaults to tiger and is not unlocked by default.

II. Landing

Sqlplus / as sysdba; / / Log in to sys account

Sqlplus sys as sysdba; / / ditto

Sqlplus scott/tiger; / / Log in to ordinary user scott

III. Manage users

Create user zhangsan; / / under the administrator account, create the user zhangsan

Alert user scott identified by tiger; / / change password

IV. Grant authority

1. The default ordinary user scott is not unlocked by default and cannot be used. The newly created user does not have any permissions and must be granted permissions.

Grant create session to zhangsan; / / Grant zhangsan users the right to create session, that is, login permission

Grant unlimited tablespace to zhangsan; / / Grant zhangsan users permission to use tablespaces

Grant create table to zhangsan; / / Grant permission to create tables

Grante drop table to zhangsan; / / Grant permission to delete tables

Grant insert table to zhangsan; / / permissions to insert tables

Grant update table to zhangsan; / / permissions to modify tables

Grant all to public; / / this is more important, granting all permissions (all) to all users (public)

2. Oralce has strict rights management, and ordinary users cannot access each other by default, so they need to authorize each other.

Grant select on tablename to zhangsan; / / Grant the zhangsan user permission to view the specified table

Grant drop on tablename to zhangsan; / / Grant permission to delete tables

Grant insert on tablename to zhangsan; / / Grant insert permission

Grant update on tablename to zhangsan; / / Grant permission to modify the table

Grant insert (id) on tablename to zhangsan

Grant update (id) on tablename to zhangsan; / / grants insert and modify permissions to specific fields of the specified table. Note that it can only be insert and update

Grant alert all table to zhangsan; / / Grant zhangsan user permission to alert any table

V. revocation of authority

The basic syntax is the same as grant, and the keyword is revoke

VI. View permissions

Select * from user_sys_privs; / / View all permissions of the current user

Select * from user_tab_privs; / / View the user's permissions on the table

7. The table of the user who operates the table

Select * from zhangsan.tablename

VIII. Authority transfer

That is to say, user A can grant the permission of operation to C if user A grants the permission to Bmai B. the command is as follows:

Grant alert table on tablename to zhangsan with admin option; / / keyword with admin option

The effect of the grant alert table on tablename to zhangsan with grant option; / / keyword with grant option is similar to admin

IX. Role

A role is a collection of permissions that can be granted to a user.

Create role myrole; / / create roles

Grant create session to myrole; / / Grant the permission to create session to myrole

Grant myrole to zhangsan; / / Grant the role of myrole to zhangsan user

Drop role myrole; / / Delete roles

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report