Chinaunix首页 | 论坛 | 博客
  • 博客访问: 660277
  • 博文数量: 109
  • 博客积分: 6081
  • 博客等级: 准将
  • 技术积分: 1318
  • 用 户 组: 普通用户
  • 注册时间: 2009-10-24 10:28
文章分类
文章存档

2011年(8)

2010年(39)

2009年(62)

分类: Oracle

2010-02-06 17:40:46

oracle 口令文件设置:
$orapwd
Usage: orapwd file= password= entries= force=
  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.
$orapwd file=orapwstudy password=study entries=2
 
创建完后,数据库需要重启动,新的口令文件才能生效。
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area  167772160 bytes
Fixed Size                  1218316 bytes
Variable Size              83888372 bytes
Database Buffers           79691776 bytes
Redo Buffers                2973696 bytes
Database mounted.
Database opened.
 
这个口令文件对于非操作系统认证例如网络连接的方式才有用
对于在本机登录,因为采用了操作系统认证,不管用什么口令都可以登录,实际上口令没起任何作用。如果在本机登陆不采用操作系统认证,把ora92/network/admin下的sqlnet.ora中的
SQLNET.AUTHENTICATION_SERVICES= (NTS)
改为
SQLNET.AUTHENTICATION_SERVICES= (NONE)

如果在 orapwSID 没生效之前,设置该参数那么本地登陆将失败
  / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Jan 29 09:49:33 2010
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
ERROR:
ORA-01031: insufficient privileges
Enter user-name:
 
 
测试开始:
$ sqlplus as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Jan 29 09:57:09 2010
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
SQL> show user
USER is "SYS"
SQL> select * from v$pwfile_users;
USERNAME                       SYSDB SYSOP
------------------------------ ----- -----
SYS                            TRUE  TRUE
SQL> grant sysoper to jon identified by jon;
Grant succeeded.
SQL> grant sysdba to test identified by test;
Grant succeeded.
SQL> select * from v$pwfile_users;
USERNAME                       SYSDB SYSOP
------------------------------ ----- -----
SYS                            TRUE  TRUE
JON                            FALSE TRUE
TEST                           TRUE  FALSE
----------------------------------------------------------------------
$sqlplus as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Jan 29 10:02:36 2010
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
SQL> show user
USER is "SYS"
--------------------------------------------------------------------
$sqlplus as sysoper
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Jan 29 10:03:11 2010
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
SQL> show user
USER is "PUBLIC"
 
-----------------------------
发现问题:
在上面,由于在建 orapw 口令文件时,设定的 entries 值为2 ,故口令文件只能存放两条的记录,最后一条会被覆盖。
test 为最后面添加的,所以口令时存在的。
$strings orapwstudy
]\[Z
ORACLE Remote Password file
INTERNAL
D0EECC16A54101ED
B898A7F877F295DD
B0BE7F5D1FD7439A
TEST
7A0F2B316C212D67
F15C7D7DFC8C7D52
阅读(3181) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~