口令文件介绍

在ORALCE数据库系统中,用户如果要以特权用户身份(SYS/SYSDBA/SYSOPER)登录ORALCE数据库可以有两种身份验证的方法:即使用与操作系统集成的身份验证或使用ORALCE数据库的密码文件进行身份验证。因此,管理好密码文件,对于控制授权用户从服务器本机或远端登录Oracle数据库系统,执行数据库管理工作,具有重要的意义.

ORALCE口令文件用于存储拥有部分特权用户(sys等用户)的口令(注意:普通账号密码是不会存储在口令文件的)。允许用户通过口令文件验证,在数据库未启动之前登陆,从而启动数据库。如果没有口令文件,在数据库未启动之前就只能通过操作系统认证.口令文件存放在$ORACLE_HOME/dbs目录下(linux,window放在database),默认名称是orapw$ORACLE_SID。即密码文件位置:

Linux下的存放位置:$ORACLE_HOME/dbs/orapw<sid>.ora

Windows下的存放位置:$ORACLE_HOME/database/PW%ORACLE_SID%.ora

口令文件管理

1:口令文件成员查看

SQL> SELECT * FROM V$PWFILE_USERS;

 

USERNAME                       SYSDBA SYSOPER

------------------------------ ------ -------

SYS                            TRUE   TRUE

如果查询该视图没有的记录的话,那么这是什么情况呢?出现这种情况,一般是口令文件被删除或移走。 例如如下操作所示:

oracle@DB-Server ~]$ 

[oracle@DB-Server ~]$ cd $ORACLE_HOME/dbs

[oracle@DB-Server dbs]$ mv orapwgsp  /tmp

[oracle@DB-Server dbs]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.1.0 Production on Thu Aug 4 17:43:39 2016

 

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

 

 

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

 

SQL> SELECT * FROM V$PWFILE_USERS;

 

no rows selected

 

SQL> 

ORACLE使用操作系统集成的身份验证或使用密码验证,这个类似SQL SERVER中的Windows身份验证和SQL Server验证方式,那么使用哪种方式登录数据库是由两个参数控制的。

1:ORACLE提供的一个参数remote_login_passwordfile,remote_login_passwordfile有none,shared,exclusive3个值:

   none表示不使用口令文件;

   exclusive表示实例独占使用口令文件,也就是各自实例使用单独的口令文件,

   shared表示多个实例共享一个口令文件

2:sqlnet.ora里面的参数SQLNET.AUTHENTICATION_SERVICES

 

SQLNET.AUTHENTICATION_SERVICES = none | all | ntf(windows)

none : 表示关闭操作系统认证,只能密码认证

all : 用于linux或unix平台,关闭本机密码文件认证,采用操作系统认证,但远程<异机>可以使用密码文件认证

nts : 用于windows平台

2:使用操作系统集成的身份验证登录数据库

 

[oracle@DB-Server ~]$ 

[oracle@DB-Server ~]$ cd /u01/app/network/admin/

[oracle@DB-Server admin]$ more sqlnet.ora 

# sqlnet.ora Network Configuration File: /u01/app/network/admin/sqlnet.ora

# Generated by Oracle configuration tools.

 

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

 

ADR_BASE = /u01

[oracle@DB-Server admin]$ vi sqlnet.ora 

# sqlnet.ora Network Configuration File: /u01/app/network/admin/sqlnet.ora

# Generated by Oracle configuration tools.

 

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

 

ADR_BASE = /u01

SQLNET.AUTHENTICATION_SERVICES=all

其实默认情况,参数文件sqlnet.ora里面并没有配置SQLNET.AUTHENTICATION_SERVICES这个参数,默认表示操作系统认证,如果配置文件sqlnet.ora 里面有SQLNET.AUTHENTICATION_SERVICES=none, 那么设置为SQLNET.AUTHENTICATION_SERVICES=all 即可启用操作系统集成的身份验证登录数据库

[oracle@DB-Server admin]$ more sqlnet.ora 

# sqlnet.ora Network Configuration File: /u01/app/network/admin/sqlnet.ora

# Generated by Oracle configuration tools.

 

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

 

ADR_BASE = /u01

SQLNET.AUTHENTICATION_SERVICES=none

[oracle@DB-Server admin]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.1.0 Production on Sat Aug 6 21:30:23 2016

 

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

 

ERROR:

ORA-01031: insufficient privileges

 

 

Enter user-name: 

3:改变OS认证为口令认证

SQLNET.AUTHENTICATION_SERVICES = none | all | ntf(windows)

none : 表示关闭操作系统认证,只能密码认证

all : 用于linux或unix平台,关闭本机密码文件认证,采用操作系统认证,但远程<异机>可以使用密码文件认证

nts : 用于windows平台

在sqlnet.ora文件里面,增加SQLNET.AUTHENTICATION_SERVICES= (none)

[oracle@DB-Server admin]$ vi sqlnet.ora 

 

# sqlnet.ora Network Configuration File: /database/product/dbhome_1/network/admin/sqlnet.ora

# Generated by Oracle configuration tools.

 

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

SQLNET.AUTHENTICATION_SERVICES= none

参数remote_login_passwordfile仅仅表示远程登录数据库时,是否使用密码验证。当remote_login_passwordfile=none并且SQLNET.AUTHENTICATION_SERVICES= (none)时,远程和本机都无法登录数据库。

SQL> alter system set remote_login_passwordfile=none scope=spfile;

 

System altered.

 

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startup

ORACLE instance started.

 

Total System Global Area 1090519040 bytes

Fixed Size                  1218920 bytes

Variable Size             234882712 bytes

Database Buffers          838860800 bytes

Redo Buffers               15556608 bytes

Database mounted.

Database opened.

SQL> 

此时从远程客户端登录:此处实际上是无法通过口令文件验证

C:\Users\kerry>sqlplus "sys/kkk123456@mydb as sysdba"

 

SQL*Plus: Release 11.2.0.1.0 Production on 星期五 1月 11 15:37:45 2013

 

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

 

ERROR:

ORA-01017: invalid username/password; logon denied

 

 

SQL> alter system set remote_login_passwordfile=exclusive scope=spfile;                                

 

System altered.

 

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

 

SQL> startup

ORACLE instance started.

 

Total System Global Area 1090519040 bytes

Fixed Size                  1218920 bytes

Variable Size             234882712 bytes

Database Buffers          838860800 bytes

Redo Buffers               15556608 bytes

Database mounted.

Database opened.

SQL> show parameter remote_login_password

 

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

remote_login_passwordfile            string      EXCLUSIVE

SQL> 

远程客户端以SYSDBA登录数据库时,此时远程登录OK了

4:查看口令文件内容

[oracle@DB-Server dbs]$ strings orapwgsp

]\[Z

ORACLE Remote Password file

INTERNAL

6813407607142FD5

2F2B362C23566AE4

E20879077A63EBEE

如果你用more命令查看,就会发现查看不到具体内容,如下所示:

[oracle@DB-Server dbs]$ more orapwgsp

ORACLE Remote Password file

口令文件创建

 

现在人为删除口令文件后,从远程客户端以SYSDBA登录数据库

C:\Users\kerry>sqlplus "sys/kkk123456@mydb as sysdba"

 

SQL*Plus: Release 11.2.0.1.0 Production on 星期五 1月 11 15:53:06 2013

 

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

 

ERROR:

ORA-01031: insufficient privileges

ORACLE 10g 下orapwd命令

[oracle@wgods dbs]$ orapwd

Usage: orapwd file=<fname> password=<password> entries=<users> force=<y/n> 

 

  where

    file - name of password file (mand),

    password - password for SYS (mand),

    entries - maximum number of distinct DBA and     force - whether to overwrite existing file (opt),

OPERs (opt), 

  There are no spaces around the equal-to (=) character.

ORACLE 11g 下orapwd命令

[oracle@DB-Server ~]$ orapwd

Usage: orapwd file=<fname> entries=<users> force=<y/n> ignorecase=<y/n> nosysdba=<y/n>

 

  where

    file - name of password file (required),

    password - password for SYS will be prompted if not specified at command line,

    entries - maximum number of distinct DBA (optional),

    force - whether to overwrite existing file (optional),

    ignorecase - passwords are case-insensitive (optional),

    nosysdba - whether to shut out the SYSDBA logon (optional Database Vault only).

    

  There must be no spaces around the equal-to (=) character.

参数描述

file : 创建的密码文件

password : 创建的口令(sys用户)

entries=MAX_USER : 口令文件中可以存放的最大用户数。即拥有sysdba和sysoper身份登陆的用户数

force=(Y/N) : 强制覆盖已存在的密码文件

ignorecase : 密码大小写敏感

nosysdba=<y/n> : sysdba用户不可以登陆

密码文件的创建:

 

1:确定实例的名称、密码文件的路径和名称。

2:停止数据库,删除老的密码文件

3: 用orapwd工具创建

[oracle@DB-Server ~]$ cd /u01/app/dbs/

 

[oracle@DB-Server dbs]$ orapwd file=orapwgsp password=kkk123456 force=y

 

[oracle@DB-Server dbs]$ ls orapwgsp 

 

orapwgsp

 

[oracle@DB-Server dbs]$

ORACLE口令管理的更多相关文章

  1. oracle口令管理之允许某个用户最多尝试三次登录

    如果一个用户连续三次登录失败,则锁定该用户两天,两天之后该用户才能重新登录. 创建profile文件: 更新账户: 三次登录失败后用户就会被锁定: 用户锁住之后要怎么给他解锁: 解锁之后就可以正常登录 ...

  2. Oracle数据库安全(二)资源限制于口令管理

    一.资源限制与口令管理概述 1.概要文件介绍: 在Oracle数据库中,用户对数据库和系统资源使用的限制以及对用户口令的管理的是建立概要文件实现的.它是Oracle数据库安全策略的重要组成不封.每个数 ...

  3. Oracle 用户管理与权限控制

    Oracle 用户管理与权限控制 oracle数据库的权限系统分为系统权限与对象权限.系统权限( database system privilege )可以让用户执行特定的命令集.例如,create ...

  4. Oracle权限管理详解

    Oracle权限管理详解 转载--CzmMiao的博客生活 Oracle 权限 权限允许用户访问属于其它用户的对象或执行程序,ORACLE系统提供三种权限:Object 对象级.System 系统级. ...

  5. Oracle的学习一:安装与卸载、sql *plus常用命令、Oracle用户管理

    1.为什么学习oracle? 性能优越: 小型数据库 中型数据库 大型数据库 acess.foxbase mysql.sql server.informix sybase.oracle.db2 复杂量 ...

  6. Oracle—用户管理的备份(一)

    用户管理的备份(一) 一.首先要知道数据库中表空间和文件的信息,有几个性能视图,v$datafile,v$tablespace,v$tempfile,v$logfile,v$controlfile,d ...

  7. 四、oracle 用户管理(Profile)

    oracle 用户管理 :profile + tablespace + role + user  一.使用profile管理用户口令概述:profile是口令限制,资源限制的命令集合,当建立数据库时, ...

  8. Oracle用户管理和角色管理

    原博:http://liwx.iteye.com/blog/1182251 一.创建用户的Profile文件 SQL> create profile student limit // stude ...

  9. oracle权限管理学习

      Oracle 权限 权限允许用户访问属于其它用户的对象或执行程序,ORACLE系统提供三种权限:Object 对象级.System 系统级.Role 角色级.这些权限可以授予给用户.特殊用户pub ...

随机推荐

  1. 百度云推送-服务端 C# SDK

    思路: 1.公司有项目需要做android和ios手机端推送消息的功能: 2.没有接触过这方面的知识,一头雾水,开始在网上一顿搜,网上倒是有不少解决方案,首先搜的是android的解决方案,因为ios ...

  2. jsp错误路径跳转设置

    <error-page><error-code>400</error-code><location>/king.html</location> ...

  3. 第 21 章 CSS3 文本效果

    学习要点: 1.文本阴影 2.文本裁剪 3.文本描边 4.文本填充 主讲教师:李炎恢 本章主要探讨 HTML5 中 CSS3 中文本效果,其中也包含一些之前讲过的 CSS3 文本属性. 一.文本阴影 ...

  4. 常见的http响应状态码

    http状态返回代码 1xx(临时响应)表示临时响应并需要请求者继续执行操作的状态代码. http状态返回代码 代码   说明100   (继续) 请求者应当继续提出请求. 服务器返回此代码表示已收到 ...

  5. 【FOL】第二周

    一直在忙其他事情,停了好久了.终于又可以开始做点东西了. 这周主要工作: 1.整理客户端代码,加入网络模块:fol.client.net. 2.写了个简单的版本服务端程序. 3.初步完成了自动更新功能 ...

  6. python 实现登陆接口

    要求: 1.输入用户名密码 2.认证成功后显示欢迎信息 3.输入三次后,锁定账户 流程图: 代码实现: #!/usr/bin/env python #!-*- coding:utf-8 -*- #!- ...

  7. CentOS添加路由表

    CentOS下静态路由修改命令方法一:添加路由route add -net 192.168.0.0/24 gw 192.168.0.1route add -host 192.168.1.1 dev 1 ...

  8. java内存模型-锁

    锁的释放-获取建立的 happens before 关系 锁是 java 并发编程中最重要的同步机制.锁除了让临界区互斥执行外,还可以让释放锁的线程向获取同一个锁的线程发送消息.下面是锁释放-获取的示 ...

  9. SharePoint 2013 BCS

    http://liandove.blog.51cto.com/176335/1247410 http://liandove.blog.51cto.com/176335/1249339 http://l ...

  10. Android Contextual Menus之一:floating context menu

    Android Contextual Menus之一:floating context menu 上下文菜单 上下文相关的菜单(contextual menu)用来提供影响UI中特定item或者con ...