Oracle DBA课程系列笔记(16)

第十六章: 用户管理

  1、schema : user.object ,用户认证方式:os 认证,database 认证
  
  
  2、建立 database认证的用户:
  10:00:48 SQL> create user rose                                                                                                           
10:14:46   2    identified by oracle                                                                                                     
10:14:53   3     default tablespace users                                                                                                
10:14:58   4     temporary tablespace temp                                                                                               
10:15:08   5      quota 10m on users                                                                                                     
10:15:18   6    password expire;                                                                                                        

User created.

10:15:27 SQL> grant create session to rose;                                                                                             

Grant succeeded.

10:15:41 SQL> conn rose/oracle                                                                                                           
ERROR:
ORA-28001: the password has expired


Changing password for rose
New password:                                                                                                                            
Retype new password:                                                                                                                     
Password changed
Connected.
10:15:47 SQL>

3、建立OS认证(操作系统认证)用户(sys 用户属于os 认证)

10:19:00 SQL> show parameter auth                                                                                                       

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
os_authent_prefix                    string      ops$

10:19:00 SQL> show parameter auth                                                                                                       

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
os_authent_prefix                    string      ops$
remote_os_authent                    boolean     FALSE
10:19:01 SQL> create user "OPS$ORACLE"                                                                                                   
10:19:34   2    identified  externally                                                                                                   
10:19:42   3     profile default                                                                                                         
10:19:49   4      default tablespace users                                                                                               
10:19:53   5      temporary tablespace temp                                                                                              
10:19:59   6         quota 10m on users;                                                                                                

User created.

10:20:07 SQL>

10:20:07 SQL> select username ,account_status from dba_users;                                                                           

USERNAME                       ACCOUNT_STATUS
------------------------------ --------------------------------
MGMT_VIEW                      OPEN
SYS                            OPEN
SYSTEM                         OPEN
DBSNMP                         OPEN
SYSMAN                         OPEN
SCOTT                          OPEN
ROSE                           OPEN
OPS$ORACLE                     OPEN
TOM                            OPEN

10:20:55 SQL> select username ,password ,PROFILE,DEFAULT_TABLESPACe,TEMPORARY_TABLESPACE from dba_users;
USERNAME   PASSWORD                       PROFILE    DEFAULT_TABLESPACE             TEMPORARY_TABLESPACE
---------- ------------------------------ ---------- ------------------------------ ------------------------------
MGMT_VIEW  4F538DF5F344F348               DEFAULT    SYSTEM                         TEMP
SYS        8A8F025737A9097A               DEFAULT    SYSTEM                         TEMP
SYSTEM     2D594E86F93B17A1               DEFAULT    SYSTEM                         TEMP
DBSNMP     FFF45BB2C0C327EC               MONITORING SYSAUX                         TEMP
                                          _PROFILE

SYSMAN     2CA614501F09FCCC               DEFAULT    SYSAUX                         TEMP
SCOTT      F894844C34402B67               DEFAULT    USERS                          TEMP
ROSE       1166A1F535AF6EFB               DEFAULT    USERS                          TEMP
OPS$ORACLE EXTERNAL                       DEFAULT    USERS                          TEMP

10:23:05 SQL> grant create session to ops$oracle;                                                                                       

Grant succeeded.

10:23:14 SQL> exit                                                                                                                       
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
[oracle@work ~]$ id
uid=501(oracle) gid=501(oinstall) groups=501(oinstall),502(dba)

[oracle@work ~]$ sqlplus /   ----------登录不需要提供用户名和密码(oracle 必须属于os的dba组)

SQL*Plus: Release 10.2.0.1.0 - Production on Wed Aug 10 10:23:20 2011

Copyright (c) 1982, 2005, Oracle.  All rights reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

10:23:20 SQL> 
10:23:20 SQL> show user;                                                                                                                 
USER is "OPS$ORACLE"
10:23:22 SQL>

4、quota 管理:(对象的最大存储空间,用户在表空间上建立对象,必须在相应的tablespace 上获得quota)

10:27:09 SQL> select TABLESPACE_NAME,USERNAME,bytes/1024,max_bytes/1024/1024 from dba_ts_quotas                                          
10:27:11   2   where username='ROSE';                                                                                                   

TABLESPACE_NAME                USERNAME                       BYTES/1024 MAX_BYTES/1024/1024
------------------------------ ------------------------------ ---------- -------------------
USERS                          ROSE                                    0                  10

------BYTES 已经使用过的配额,max_bytes 所分配的配额

10:28:18 SQL> grant create table to rose;                                                                                               

Grant succeeded.

10:28:23 SQL> grant select on scott.emp to rose;                                                                                        

Grant succeeded.

10:28:26 SQL> conn rose/rose                                                                                                             
Connected.
10:28:29 SQL> 
10:28:29 SQL> create table emp1 as select * from scott.emp;                                                                             

Table created.

10:28:41 SQL> conn /as sysdba                                                                                                            
Connected.
10:28:47 SQL> 
10:28:47 SQL> select TABLESPACE_NAME,USERNAME,bytes/1024,max_bytes/1024/1024 from dba_ts_quotas                                          
10:28:50   2  where username='ROSE';                                                                                                    

TABLESPACE_NAME                USERNAME                       BYTES/1024 MAX_BYTES/1024/1024
------------------------------ ------------------------------ ---------- -------------------
USERS                          ROSE                                   64                  10

10:28:53 SQL>

-------回收quota

10:29:26 SQL> alter user rose quota 0 on users;                                                                                         

User altered.
10:30:01 SQL> select TABLESPACE_NAME,USERNAME,bytes/1024,max_bytes/1024/1024 from dba_ts_quotas                                          
10:30:04   2   where username='ROSE';                                                                                                   

no rows selected
10:29:30 SQL> conn rose/rose                                                                                                             
Connected.
10:29:37 SQL> 
10:29:37 SQL> insert into emp1 select * from emp1;                                                                                      

14 rows created.

10:29:51 SQL> /                                                                                                                         

28 rows created.

10:30:20 SQL> conn rose/rose                                                                                                             
Connected.
10:31:51 SQL> 
10:31:51 SQL> insert into emp1 select * from emp1;                                                                                      

56 rows created.

10:31:54 SQL> /                                                                                                                         

112 rows created.

10:31:56 SQL> /                                                                                                                         

224 rows created.

10:31:57 SQL> /                                                                                                                          
insert into emp1 select * from emp1
*
ERROR at line 1:
ORA-01536: space quota exceeded for tablespace 'USERS'


10:31:58 SQL> analyze table emp1 compute statistics;                                                                                    

Table analyzed.

10:32:16 SQL> select table_name,num_rows ,blocks,empty_blocks from user_tables;                                                         

TABLE_NAME                       NUM_ROWS     BLOCKS EMPTY_BLOCKS
------------------------------ ---------- ---------- ------------
EMP1                                  448          8            0

10:32:36 SQL>


5、删除用户:


10:33:56 SQL> select username,sid,serial# from v$session                                                                                 
10:34:08   2   where username is not null;                                                                                              

USERNAME                              SID    SERIAL#
------------------------------ ---------- ----------
SYS                                   153        219
ROSE                                  159         55

10:34:15 SQL> 
10:33:40 SQL> 
10:33:40 SQL> drop user rose;                                                                                                            
drop user rose
*
ERROR at line 1:
ORA-01940: cannot drop a user that is currently connected

------强制关闭用户会话
10:34:15 SQL> alter system kill session '159,55';                                                                                       

System altered.

10:32:36 SQL> select * from emp1;                                                                                                        
select * from emp1
*
ERROR at line 1:
ORA-00028: your session has been killed


10:35:23 SQL> drop user rose cascade;                                                                                                   

User dropped.

10:36:18 SQL>










本文转自 客居天涯 51CTO博客,原文链接:http://blog.51cto.com/tiany/791805,如需转载请自行联系原作者

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/454082.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

python序列是几维_从一个1维的位数组获得一个特定的2维的1序列数组[Python] - python...

我正在使用Python,我需要找到执行以下任务的最有效方法。任务:给定零和一的任何一维数组v,用k> 0表示v的所有一维的子序列数。我需要从v获得一个二维数组w,使得:1)shape(w)(k,len(v)),2)对于…

深度学习之卷积神经网络(Convolutional Neural Networks, CNN)(二)

前面我们说了CNN的一般层次结构, 每个层的作用及其参数的优缺点等内容.深度学习之卷积神经网络(Convolutional Neural Networks, CNN)_fenglepeng的博客-CSDN博客 一 CNN参数初始化及参数学习方法 和机器学习很多算法一样, CNN在进行训练之前也要进行参数的初始化操作. 我们…

GCC Inline ASM GCC内联汇编

GCC 支持在C/C代码中嵌入汇编代码,这些汇编代码被称作GCC Inline ASM——GCC内联汇编。这是一个非常有用的功能,有利于我们将一些C/C语法无法表达的指令直接潜入C/C代码中,另外也允许我们直接写 C/C代码中使用汇编编写简洁高效的代码。1.基本…

Hadoop1.x版本升级Hadoop2.x

引言 随着企业数据化和Hadoop的应用越加广泛,hadoop1.x的框架设计越来越无法满足人们对需求,Apache一直在对Hadoop1.x进行修改,最后推出了新一代的Hadoop2.x。从业界使用分布式系统的变化趋势和 hadoop 框架的长远发展来看,MapRed…

本页由试用版打印控件lodop6.2.6输出_Visual Basic 6.0 Sirk 迷你版

Visual Basic 6.0 Sirk 迷你版 VB6 Sirk Mini 2019更新1、支持主流操作系统,避免原版安装失败的问题:支持Windows XP、Vista、Win7、Win8、Win10(32位、64位)。2、保留大部分常用功能,避免精简版过度精简:包含原版完整控件&#x…

深度学习之卷积神经网络 LeNet

卷积神经网络典型CNN LeNet:最早用于数字识别的CNNLeNet5:现在常说的一般就是LeNet5AlexNet:2012ILSVRC冠军,远超第二名的CNN,比LeNet更深,用多层小卷积叠加来替换单个的大卷积ZF Net:2013ILSV…

python爬虫常见反爬措施_爬虫常见的反爬措施有哪些

爬虫常见的反爬措施有三种:1、header头部信息解决方法:加User-Agent值:如果不加header头,部分网站服务器判断不到用户的访问来源,所以会返回一个404错误来告知你是一个爬虫,拒绝访问,解决办法如…

dom4j的读写xml文件,读写xml字符串

百度了一些博客,大同小异,在选取jar包工具的时候大概看了下,大抵是jdom原始,dom4j优秀。于是做了些练习。 参考:http://www.cnblogs.com/mengdd/archive/2013/06/05/3119927.html 1 package com.test.xml;2 3 import j…

深度学习之数据增强方案和TensorFlow操作

一、数据增强的方法介绍 增加训练数据, 则能够提升算法的准确率, 因为这样可以避免过拟合, 而避免了过拟合你就可以增大你的网络结构了。 当训练数据有限的时候, 可以通过一些变换来从已有的训练数据集中生成一些新的数据&#x…

移动前端头部标签(HTML5 head meta)

<!DOCTYPE html> <!-- 使用 HTML5 doctype&#xff0c;不区分大小写 --> <html lang"zh-cmn-Hans"> <!-- 更加标准的 lang 属性写法 http://zhi.hu/XyIa --> <head><!-- 声明文档使用的字符编码 --><meta charsetutf-8>&l…

python新建文件夹口令_python编程快速上手—口令保管箱

之前小编为大家整理了如何成为一个优秀的程序员应该具备的品质&#xff0c;接下来为大家展示一个简单有趣的python小项目&#xff0c;从中体会编程的乐趣。小编了解这个小项目之后&#xff0c;很是惊奇&#xff0c;觉得python竟然还可以做这样的事情。为什么要建立口令保管箱&a…

django+nginx+uwsgi部署web站点

环境&#xff1a; django&#xff1a;1.8.16 python&#xff1a;2.7.13 pip&#xff1a;2.7 uwsgi&#xff1a;2.0.15 project路径&#xff1a; /opt/cmdb/ Uwsgi的安装配置 1、安装python2.7 &#xff08;省略安装过程&#xff09; 2、安装pip2.7 &#xff08;省略安装过程&…

GCC源代码阅读

获取GCC源代码 阅读源代码的第一步是获取源代码&#xff0c;巧妇难为无米之炊嘛&#xff01; 使用以下任意方法均可获得gcc源代码&#xff1a; svn checkout svn://gcc.gnu.org/svn/gcc/trunk SomeLocalDir &#xff08;摘自http://gcc.gnu.org/svn.html&#xff09;git clone …

Nginx 动静分离

页面动静分离 后端 调用tomcat 集群 示例&#xff1a; server { listen 80; server_name www.www2.com ; root /web/www2/htmlloation /img/ {alias /web/www2/html/img/;}location ~ (\.jsp)|(\.do)$ {proxy_pass http:## //serverip:port;proxy_redirect off;// 重定向 指…

Linux 状态命令之内存状态 vmstat

语法 vmstat 常见命令格式如下&#xff1a; vmstat [-a] [-n] [-S unit] [delay [ count]] vmstat [-s] [-n] [-S unit] vmstat [-m] [-n] [delay [ count]] vmstat [-d] [-n] [delay [ count]] vmstat [-p disk partition] [-n] [delay [ count]] vmstat [-f] vmstat [-V]命…

使用OpenSSL实现CA证书的搭建过程

个人博客地址&#xff1a;http://www.pojun.tech/ 欢迎访问 什么是CA CA,Catificate Authority,通俗的理解就是一种认证机制。它的作用就是提供证书&#xff08;也就是服务端证书&#xff0c;由域名&#xff0c;公司信息&#xff0c;序列号&#xff0c;签名信息等等组成&#…

最近公共祖先 python_求二叉搜索树的最近公共祖先

给定一个二叉搜索树, 找到该树中两个指定节点的最近公共祖先。百度百科中最近公共祖先的定义为&#xff1a;“对于有根树 T 的两个结点 p、q&#xff0c;最近公共祖先表示为一个结点 x&#xff0c;满足 x 是 p、q 的祖先且 x 的深度尽可能大(一个节点也可以是它自己的祖先)。”…

gdb使用实例

第一篇 概论我们将学习使用gdb来调试通过一个通过串行线同PC相连的嵌入式系统。Gdb可以调试各种程序&#xff0c;包括C、C、JAVA、PASCAL、FORAN和一些其它的语言。包括GNU所支持的所有微处理器的汇编语言。在gdb的所有可圈可点的特性中&#xff0c;有一点值得注意&#xff0c;…

Linux 监控命令之 netstat

netstat命令用于显示与IP、TCP、UDP和ICMP协议相关的统计数据&#xff0c;一般用于检验本机各端口的网络连接情况。netstat是在内核中访问网络及相关信息的程序&#xff0c;它能提供TCP连接&#xff0c;TCP和UDP监听&#xff0c;进程内存管理的相关报告。 语法 netstat [-acC…

C#递归搜索指定目录下的文件或目录

来源&#xff1a;https://www.cnblogs.com/huhangfei/p/5012978.html诚然可以使用现成的Directory类下的GetFiles、GetDirectories、GetFileSystemEntries这几个方法实现同样的功能&#xff0c;但请相信我不是蛋疼&#xff0c;原因是这几个方法在遇上【System Volume Informati…