Oracle权限分类 1、 系统权限:对于数据库操作的权限,包括但不限于: CREATE TABLE CREATE VIEW CREATE SESSION CREATE SEQUE
Oracle权限分类
1、 系统权限:对于数据库操作的权限,包括但不限于:
CREATE TABLE
CREATE VIEW
CREATE SESSION
CREATE SEQUENCE
CREATE PROCEDURE
……
2、 对象权限:对于用户创建的表、视图的访问、修改能操作权限,包括但不限于:
SELECT
UPDATE
INSERT
DELETE
……
权限分配与回收
1、 权限分配:
GRANT 权限 TO 用户/角色
例1:将对hr用户下employee表的访问权限赋给用户SCOTT
GRANT SELECT ON hr.employee TO scott;
例2:将角色CONNECT分配给用户SCOTT
GRANT CONNECT TO scott
2、 权限回收:
REVOKE 权限 FROM 用户/角色
例1:收回用户scott对于hr用户employee表的访问权限
REVOKE hr.employee FROM scott;
例2:收回用户scott的CONNECT角色
REVOKE CONNECT FROM scott;
权限继承与回收
1、情景模拟:Oracle总部拥有对于Oracle产品的管理权限,Oracle总部赋予Oracle中国管理中国境内的经营事宜,如果Oracle中国需要二次分配这种权限,可以在总部赋予权限的时候,使用WITH ADMIN OPTION(系统权限继承)/WITH GRANT OPTION(对象权限继承)
例:SYS 赋予用户scott创建表的权限,然后scott可以赋予其他用户创建表的权限
SOL>CONN SYS
GRANT CREATE TABLE TO scott WITHADMIN OPTION;
说明:
CREATE TABLE属于系统权限,使用关键字WITH ADMIN OPTION赋予权限继承;
此时,SCOTT用户可以对于其他任意用户赋予创建表的权限
SQL>CONN SCOTT
GRANT CREATE TABLE TOtest;
如果是对象权限的继承则需要使用WITHGRANT OPTION
例:将对hr用户下employee表的访问权限赋给用户SCOTT,SCOTT用户可以继承
SQL>CONN hr
GRANT SELECT ON hr.employee TO scott WITH GRANT OPTION;
CONN scott
GRANT SELECT ONhr.employee TO test; --scott用户将权限二次分配给test用户;
2、继承权限回收
回收权限时,,对于系统权限而言,不会回收WITH ADMIN OPTION分配的子权限;
对象权限则会级联回收,比如用户scott用户对hr用户下employe表的访问权限,scott用户又将访问权限二次分配给了新用户test,则回收scott访问权限的同时,系统会自动回收由scott二次分配的访问权限;
常见角色权限与分配原则
1、常见角色
DBA:拥有全部特权,是系统最高权限,只有DBA才可以创建数据库结构。
RESOURCE:只可以创建实体,不可以创建数据库结构。
CONNECT:只可以登录Oracle,不可以创建实体,不可以创建数据库结构。
2、角色权限分配原则:
对于普通用户:授予connect, resource权限。
对于DBA管理用户:授予connect,resource, dba权限。
常用的权限查询视图
--1、显示角色拥有的系统权限
SELECT * FROMROLE_SYS_PRIVS;
--2、角色对于表列拥有的权限
SELECT * FROMROLE_TAB_PRIVS;
--3、查询用户所属角色
SELECT * FROMUSER_ROLE_PRIVS;
--4、显示已授予给其他用户的对象权限,用户是当前登录用户
SELECT * FROMUSER_TAB_PRIVS_MADE
--5、显示已授予给其他用户的对象权限,用户是被授予者
SELECT * FROMUSER_TAB_PRIVS_RECD
--6、显示列上已授予的权限,用户是当前登录用户
SELECT * FROMUSER_COL_PRIVS_MADE
--7、显示列上已授予的权限,用户是被授予者
SELECT * FROMUSER_COL_PRIVS_RECD
--8、显示当前登录用户所拥有的系统权限
SELECT * FROMUSER_SYS_PRIVS
用户管理
1、 创建用户test,密码test
CREATE USER test IDENTIFIED BY test;
2、 修改用户test密码为123456
ALTER USER test IDENTIFIED BY 123456;
3、 解锁用户SCOTT
ALTER USER scott ACCOUNT UNLOCK;
创建数据库连接
CREATE [PUBLIC] DATABASE LINK 连接名称
CONNECT 用户名 IDENTIFIED BY 登录密码
USING 数据库实例名
Oracle 单实例 从32位 迁移到 64位 方法
在CentOS 6.4下安装Oracle 11gR2(x64)
Oracle 11gR2 在VMWare虚拟机中安装步骤
Debian 下 安装 Oracle 11g XE R2
本文永久更新链接地址:

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

Article discusses strategies for handling large datasets in MySQL, including partitioning, sharding, indexing, and query optimization.

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

The article discusses dropping tables in MySQL using the DROP TABLE statement, emphasizing precautions and risks. It highlights that the action is irreversible without backups, detailing recovery methods and potential production environment hazards.

Article discusses using foreign keys to represent relationships in databases, focusing on best practices, data integrity, and common pitfalls to avoid.

The article discusses creating indexes on JSON columns in various databases like PostgreSQL, MySQL, and MongoDB to enhance query performance. It explains the syntax and benefits of indexing specific JSON paths, and lists supported database systems.

Article discusses securing MySQL against SQL injection and brute-force attacks using prepared statements, input validation, and strong password policies.(159 characters)


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

WebStorm Mac version
Useful JavaScript development tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

SublimeText3 Linux new version
SublimeText3 Linux latest version

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.
