oracle系列(二)用户管理
SQL> conn /as sysdba
Connected to Oracle Database 11g Express Edition Release 11.2.0.2.0
Connected as scott AS SYSDBA
1)创建用户
使用scott,dba 登录
SQL> create user ice identified by tiger;
User created
2)显示用户
select username from dba_users;
3)删除
SQL> drop user ice;
User dropped
4)修改用户密码
alter user ice identified by 123456;
创建的新用户是没有任何权限的,甚至登录数据库的权限都没有.
5)授权
SQL> grant connect to ice;
Grant succeeded
SQL> conn ice/123456
Connected to Oracle Database 11g Express Edition Release 11.2.0.2.0
Connected as ice
权限
系统权限:用户对数据库的相关权限.(create session)
对象权限:用户对其他用户的数据对象(表,触发器,视图...)操作的权限. [select,insert,update,delete,all,create index...]
角色:
预定义角色:connect dba resource
自定义角色:
1)权限不足
SQL> conn ice/123456
SQL> create table test(userId varchar2(30));
ORA-01031: 权限不足
2)表或视图不存在
切换sys登录: 表Owner =SYS
create table emp(userId varchar2(30));
再切换到ice
select * from emp;
ORA-00942: 表或视图不存在
3)grant resource后有建表的权限
dba登录:
SQL> grant resource to ice ;
Grant succeeded
SQL> conn ice/123456
Connected to Oracle Database 11g Express Edition Release 11.2.0.2.0
Connected as ice
SQL> create table test(userId varchar2(30));
Table created
SQL> select * from test;
USERID
------------------------------
SQL> desc test;
Name Type Nullable Default Comments
------ ------------ -------- ------- --------
USERID VARCHAR2(30) Y
4)ice访问scott创建的emp表
dba登录:
grant select on emp to ice;
SQL> select * from emp;
select * from emp
ORA-00942: 表或视图不存在
得使用:
select * from sys.emp;
同理:grant update on emp to ice;--增加修改权限.
grant all on emp to ice;
5)revoke收回权限
dba登录:
SQL> revoke select on emp from ice;
Revoke succeeded
ice登录:
SQL> select * from sys.emp;
select * from sys.emp
ORA-00942: 表或视图不存在
6)权限的传递:A用户让B用户能替自己(A)进行grant
对象权限:加入 with grant option
SQL> grant select on emp to ice with grant option;
Grant succeeded
系统权限:加入 with admin option
SQL> grant connect to ice with admin option;
Grant succeeded
sysdba给账户A权限grant option,A把权限给B (grant select on emp to B),当sysdba收回A的权限时,B的权限也没有(诛连)
--分割--
使用profile管理用户口令
1)账号锁定
设定尝试次数,和锁定时间.
步骤:创建profile文件
create profile {lock_account} limit failed_login_attempts {3} password_lock_time {2};
--5次 1天
SQL> create profile lock_account limit failed_login_attempts 5 password_lock_time 1;
Profile created
alter user ice profile {lock_account}
--应用lock_account规则于ice用户
SQL> alter user ice profile lock_account;
User altered
2)给账户解锁
alter user {ice} account unlock;
3)终止口令
让用户定期修改密码,使用终止口令的指令来完成.
要求ice这个用户每个10天要修改登录密码,宽限期为2天.
create profile {myprofile} limit password_life_time {10} password_grace_time {2};
--创建profile文件
SQL> create profile myprofile limit password_life_time 10 password_grace_time 2;
Profile created
--应用于ice用户
alter user ice profile myprofile;
SQL> alter user ice profile myprofile;
User altered
4)口令历史
指定口令可重用时间:10天后可重用
SQL> create profile myprofile2 limit password_life_time 10 password_grace_time 2 password_reuse_time 10;
Profile created
5)删除profile
drop profile {profileName}
SQL> drop profile myprofile;
drop profile myprofile
ORA-02382: 概要文件 MYPROFILE 指定了用户, 不能没有 CASCADE 而删除
SQL> drop profile myprofile cascade;
Profile dropped
删除后,该profile之前对账户的约束无效.
oracle系列(二)用户管理的更多相关文章
- 使用Jquery+EasyUI 进行框架项目开发案例解说之二---用户管理源代码分享
使用Jquery+EasyUI 进行框架项目开发案例解说之二 用户管理源代码分享 在上一篇文章<使用Jquery+EasyUI进行框架项目开发案例解说之中的一个---员工管理源代码分享> ...
- oracle数据库之用户管理
转载 Oracle创建用户.角色.授权.建表 一.oracle数据库的权限系统分为系统权限与对象权限: 系统权限( database system privilege )可以让用户执行特定的命令集 ...
- oracle 学习笔记--用户管理
oracle 用户管理 创建用户(需要具有dba权限的用户) create user 用户名 identified by 密码 defaule tablespace users //默认表空间 ...
- Oracle DB 执行用户管理的备份和恢复
• 说明用户管理的备份和恢复与服务器管理的备份和恢复 之间的差异 • 执行用户管理的数据库完全恢复 • 执行用户管理的数据库不完全恢复 备份和恢复的使用类型 数据库备份和恢复的类型包括: • 用户管理 ...
- oracle工具 sqlplus 用户管理
可以通过system用户对普通用户解锁.alter user scott account unlock; 工具:1/ sqlplusw sqlplus 自带.调用oracle安装目录下bin目录下的e ...
- oracle之二实例管理及数据库的启动/关闭
实例管理及数据库的启动/关闭 2.1 实例和参数文件 1.instance 功能:用于管理和访问database.instance在启动阶段读取初始化参数文件(init parameter fil ...
- Oracle笔记之用户管理
1. 创建用户 创建用户使用create user语句,需要DBA权限: CREATE USER tom IDENTIFIED BY mot; 2. 更改用户密码 修改别人的密码需要DBA权限,或者a ...
- Oracle基础和用户管理
1.数据库的使用: 项目的规模:负载量(用户)有多大? 成本: 安全性: (小型数据库)access.forbase 负载小 :100人以内,比如留言板,信息管理系统. 成本:千元以内. 安全性要 ...
- Atlas+Keepalived系列二:管理Atlas
1:登录代理端口1234 [root@localhost bin]# mysql -uroot -p -P1234 -h127.0.0.1 proxy-address项配置,例如proxy-addre ...
随机推荐
- flask-login2的简单使用
#coding:utf8 from flask import Flask, render_template, request, redirect, url_for, flash, abort from ...
- [小北De编程手记] : Lesson 02 - Selenium For C# 之 核心对象
从这一篇开始,开始正式的介绍Selenium 以及相关的组件,本文的将讨论如下问题: Selenium基本的概念以及在企业化测试框架中的位置 Selenium核心对象(浏览器驱动) Web Drive ...
- Python爬虫教程-12-爬虫使用cookie爬取登录后的页面(人人网)(上)
Python爬虫教程-12-爬虫使用cookie(上) 爬虫关于cookie和session,由于http协议无记忆性,比如说登录淘宝网站的浏览记录,下次打开是不能直接记忆下来的,后来就有了cooki ...
- 微信小程序开发2-第一个小程序开发准备
1.首先在官网上注册一个账号( https://mp.weixin.qq.com/ )申请一个AppID(类似于人的身份证,小程序也需要身份证) 注册过程不多说 2.安装开发工具( https://m ...
- 浮动属性(float)
(1.浮动是一种脱离标准文档流的形式. 作用:浮动就是用来制作多个盒子并排显示,也能设置宽高,负责网页排版 1 float:left; 左浮动 2 float:right; 右浮动 3 float: ...
- JavaScript Event 事件 事件流 事件对象 事件处理程序 回调函数 error和try...catch和throw
参考资料: 慕课网 DOM事件探秘 js事件对象 处理 事件驱动: JS是采用事件驱动的机制来响应用户操作的,也就是说当用户对某个html元素进行操作的时候,会产生一个事件,该事件会驱动某些函数 ...
- select下拉框默认不能选择第一个选项的问题
如题,现在有个js的功能:用户选择下拉框的同时,把选择的下拉框显示出来.同时选择的不能有重复的.刚开始 使用的是 select的onchange事件: $("#liveType") ...
- springmvc中配置RESTful风格控制器
一般的http请求中其实只需要get和post就可以满足项目需求了,而为什么还要使用restful可能就是为了使请求url看起来更加直观,好看吧.. restful常用的请求方式:get,post,p ...
- nginx 开启gzip压缩--字符串压缩比率很牛叉
刚刚给博客加了一个500px相册插件,lightbox引入了很多js文件和css文件,页面一下子看起来非常臃肿,所以还是把Gzip打开了. 环境:Debian 6 1.Vim打开Nginx配置文件 v ...
- ZT 设计模式六大原则(4):接口隔离原则
设计模式六大原则(4):接口隔离原则 分类: 设计模式 2012-02-27 08:32 17948人阅读 评论(21) 收藏 举报 设计模式classinterfacecstring框架 定义:客户 ...