1. view the default user account

  1. SQL> select username from dba_users;

2. lock all users and set their password to expired

  1. SQL> select alter user ‘|| username || password expire account lock;’ from dba_users;

3. A locked user can only be accessed by altering the user to an unlocked state

  1. SQL> alter user scott account unlock;

4. As a DBA, you can change the password for a user

  1. SQL> alter user <username> identified by <new password>;

5. Run this query to display users that have been created by another DBA versus those created by Oracle.For default users,there should be a record in the DEFAULT_PWD$ view.So,if a user doesn’t exist in DEFAULT_PWD$,then you can assume it’s not a default account.

  1. SQL> select distinct u.username
  2. ,case when d.user_name is null then DBA created account
  3. else Oracle created account
  4. from dba_users u
  5. ,default_pwd$ d
  6. where u.username=d.user_name(+);

6. You can check the DBA_USERS_WITH_DEFPWD view to see whether any Oracle-created user accounts are still to the default password

  1. SQL> select * from dba_users_with_defpwd;

7. Creating a User with Database Authentication

  1. SQL> create user user_name identified by password
  2. default tablespace users
  3. temporaty tablespace temp
  4. quote unlimited on users;
  5. SQL> grant create session to user_name; #to make the user useful
  6. SQL> grant create table to user_name; #to be able to create tables.
  7. SQL> grant create table,create session to user_name identified by password; #you can also use the GRANT . . . IDENTIFIED BY statement to create a user.

8.Creating a User with OS Authentication

Oracle strongly recommends that you set the OS_AUTHENT_PREFIX parameter to a null string

  1. SQL> alter system set os_authent_prefix=’’ scope=spfile;
  2. SQL> create user user_name identified externally;
  3. SQL> grant create session to user_name;
  4. $ sqlplus / #when user_name logs in to the database server,this user can connect to SQL*Plus.

9. You can alter your current user’s session to point at a different schema via ALTER SESSION statement

  1. SQL> alter session set current_schema = hr;

10. Assiging Default Permanent and Temporary Tablespaces

  1. SQL> alter user user_name default tablespace tb_name temporary tablespace temp_name;

11. Modifying Password

  1. SQL> alter user user_name identified by new_password;

12. SQL*PLUS password command

  1. SQL> passw user_name
  2. Changing password for user_name
  3. New password:

13. Modifying Users

  1. SQL> alter user user_name account lock;
  2. SQL> alter user user_name quota 500m on users;

14. Dropping Users. Before you drop a user,I recommend that you first lock the user.Locking the user prevents others from connecting to a locked database account.

  1. SQL> alter user user_name account lock;
  2. SQL> select username,lock_date from dba_users;
  3. SQL> alter user user_name account unlock;
  4. SQL> drop user user_name;
  5. SQL> drop user user_name cascade; #the prior commend won’t work if the user owns any database objects.Use the CASCADE clause to remove a user and have its objects dropped.

15. Password Strength. You can enforce a minimum standard of password complexity by assigning a password verification function to a user’s profile. Oracle supplies a default password verification function that you create by running the following script as the SYS schema

  1. SQL> @?/rdbms/admin/utlpwdmg
  2. SQL> alter profile default limit PASSWORD_VERIFY_FUNCTION ora12c_verify_function;
  3. SQL> alter profile default limit PASSWORD_VERIFY_FUNCTION null; #disable the password function.

16. Limiting Database Resource Usage

  1. SQL> alter system set resource_limit=true scope=both;

17. Assigning Database System Privileges

  1. SQL> select destinct privilege from dba_sys_privs;
  2. SQL> grant create session to user_name #minimally a user needs CREATE SESSION to be able to connect to the database.
  3. SQL> revoke cteate table from user_name; #to take away privileges.
  4. SQL> grant create table to user_name with admin option; #allows you to grant a system privilege to a user and also give that user the ability to administer a privilege.You can do this with the WITH ADMIN OPTION clause.

18. Assigning Database Object Privileges

  1. SQL> grant insert,update,delete,select on object_owner to user_name;
  2. SQL> grant insert(id,name,desc) on table_name to user_name #grants INSERT privileges to specific columns in the table.
  3. SQL> grant insert on object_owner to user_name with grant option; #if you want a user that is being granted object privileges to be able to subsequently grant those same object privileges to other users,then use the WITH GRANT OPTION clause.

19. Grouping and Assigning Privileges

  1. SQL> create role role_name;
  2. SQL> grant select any table to role_name;
  3. SQL> grant role_name to user_name;

Oracle Study Note : Users and Basic Security的更多相关文章

  1. Oracle Study Note : Tablespace and Data Files

    1.how to create a tablespace that employs the most common features create tablespace tb_name #create ...

  2. Oracle Study之--Oracle 11gR2通过RMAN克隆数据库

    Oracle Study之--Oracle 11gR2通过RMAN克隆数据库 Purpose of Database Duplication A duplicate database is usefu ...

  3. Oracle Study之--Oracle 单实例11.2.0.1.0升级到11.2.0.3.0

    Oracle Study之--Oracle 单实例11.2.0.1.0升级到11.2.0.3.0 系统环境: 操作系统:RedHat EL6(64位) Oracle:    Oracle 11gR2 ...

  4. Oracle Study之-AIX6.1构建Oracle 10gR2 RAC(3)

    Oracle Study之-AIX6.1构建Oracle 10gR2 RAC(3) 一.配置共享存储 [oracle@aix203 ~]$lsdev -c disk hdisk0 Available ...

  5. Oracle Study之-AIX6.1构建Oracle 10gR2 RAC(4)

    Oracle Study之-AIX6.1构建Oracle 10gR2 RAC(4) 一.安装CRS补丁 在安装CRS之前,须要安装补丁p6718715_10203_AIX64-5L,否则在安装时会出现 ...

  6. Beginning Scala study note(5) Pattern Matching

    The basic functional cornerstones of Scala: immutable data types, passing of functions as parameters ...

  7. Beginning Scala study note(2) Basics of Scala

    1. Variables (1) Three ways to define variables: 1) val refers to define an immutable variable; scal ...

  8. 理解RHEL上安装oracle的配置参数 :/etc/security/limits.conf, /etc/profile, /etc/pam.d/login

    无论安装什么版本的Oracle,在安装之前,都需要配置 /etc/pam.d/login   /etc/profile   /etc/security/limits.conf这三个文件 那这三个文件究 ...

  9. Java Basic&Security Tools

    JDK Tools and Utilities Basic Tools These tools are the foundation of the JDK. They are the tools yo ...

随机推荐

  1. c-windows-1

    < Back 我使用的是<windows程序设计>和VS 首先看到的第一个代码是: /*----------------------------------------------- ...

  2. EndNote文献管理

    一直想写个博客,但是一直没有好好坐下来对自己工作进行一个梳理.从今天开始吧,争取多写一点. 今天,先介绍一下科技论文写作中经常使用的一款软件EndNote,这个软件,掌握它的使用方法后会觉得很方便:但 ...

  3. Virtualenv介绍

    [翻译]http://virtualenv.readthedocs.org/en/latest/index.html virtualenv是创建独立python环境的一种工具. 环境搭建的过程中,有一 ...

  4. c#中using System.Runtime.Serialization.Json;不能引用

    原因:生成项目对于的.net版本是2.0的.需要手动切换成4.0 操作步骤:右键项目,属性页面,下拉框选择最高版本.net 截图:

  5. 解决visual studio已安装的问题

    使用Windows Install Clean Up(用管理员身份打开),找到相应的软件

  6. 简单JS实现对表的行的增删

    这段代码非常的简单,仅仅作为自己的一个小小的记录! ok,先上一个简单的图例,效果如下(注意:这只是一个简单的例子,不过可以根据这个简单的例子,变化出更为复杂的效果)! 代码也非常的简单,如下所示(注 ...

  7. 动态链接库(dll) __declspec(dllimport) __declspec(dllexport)

    一. __declspec(dllexport) Microsoft 在 Visual C++ 的 16 位编译器版本中引入了 __export,使编译器得以自动生成导出名并将它们放到一个 .lib ...

  8. Java基础学习(学习IT企业必读的324个JAVA面试题.pdf 整理)

    一.Java程序基础 javac 文件名.java    编译程序 java 类名               运行java程序 代码规范中,一下几点要注意: 包名:包名是全小写的名词,中间可以由点分 ...

  9. haproxy配置文件简单管理

    版本:python3功能:对haproxy配置文件进行简单的查询.添加以及删除功能操作流程:1.根据提示选择相应的选项2.进入所选项后,根据提示写入相应的参数3.查询功能会返回查询结果,添加.删除以及 ...

  10. Java中可变长参数的使用及注意事项

    在Java5 中提供了变长参数(varargs),也就是在方法定义中可以使用个数不确定的参数,对于同一方法可以使用不同个数的参数调用,例如print("hello");print( ...