五、密码文件的建立:orapwd */
[Oracle@robinson ~]$ orapwd
Usage: orapwd file=<fname> password=<password> entries=<users> force=<y/n>
where
file - name of password file (mand), /*密码文件的名字orapw<sid>*/
password - password for SYS (mand), /*sys用户的密码*/
entries - maximum number of distinct DBA and /*可以有多少个sysdba,sysoper权限用户放到密码文件中去,去掉重复记录*/
/*注意entries中存放的个数但不是实际个数,这个是二进制数据*/
force - whether to overwrite existing file (opt), /*10g新增的参数,默认值为n ,y表示允许覆盖*/
OPERs (opt),
There are no spaces around the equal-to (=) character.
--修改密码:
[oracle@robinson ~]$ cd $ORACLE_HOME/dbs
[oracle@robinson dbs]$ ll orapworcl
-rw-r----- 1 oracle oinstall 1536 Apr 7 15:50 orapworcl
[oracle@robinson dbs]$ orapwd file=orapworcl password=oracle force=y
[oracle@robinson dbs]$ sqlplus sys/oracle@orcl as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Apr 9 11:34: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>
--将密码改回原来的密码
[oracle@robinson dbs]$ orapwd file=orapworcl password=RedHat
OPW-00005: File with same name exists - please delete or rename
[oracle@robinson dbs]$ orapwd file=orapworcl password=redhat force=y
[oracle@robinson dbs]$ rm orapworcl /*删除密码文件*/
[oracle@robinson dbs]$ orapwd file=orapworcl password=redhat /*重建密码文件*/
--演示将entries 改为,然后将多个用户设置为sysdba或sysoper
[oracle@robinson dbs]$ orapwd file=orapworcl password=redhat entries=1
[oracle@robinson dbs]$ strings orapworcl
]\[Z
ORACLE Remote Password file
INTERNAL
F7AC0C5E9C3C37AB
E100B964899CDDDF
--创建PL/SQL 增加个新用户
SQL> begin
2 for i in 1..20 loop
3 execute immediate 'create user u'||i||' identified by u'||i||'';
4 end loop;
5 end;
6 /
--将新用户赋予sysdba角色
PL/SQL procedure successfully completed.
SQL> begin
2 for i in 1..20 loop
3 execute immediate 'grant sysdba to u'||i||'';
4 end loop;
5 end;
6 /
begin /*得到和密码文件相关的错误提示*/
*
ERROR at line 1:
ORA-01996: GRANT failed: password file '' is full
ORA-06512: at line 3
--再次查看orapworcl发现多出了行,即当设置为的时候多出了个用户。原因是该密码文件是二进制文件,按矩阵计算可存放多少
[oracle@robinson dbs]$ strings orapworcl
]\[Z
ORACLE Remote Password file
INTERNAL
F7AC0C5E9C3C37AB
E100B964899CDDDF
3E81B724A296E296
668509DF9DD36B43
9CE6AF1E3F609FFC
7E19965085C9ED47
--注意不要轻易删掉密码文件,这样会将其他账户的信息也删除
/*
六、导致密码文件内容修改的几种方式:
1.使用orapwd建立,修改密码文件,不建议使用
2.使用alter user sys identified by <>
3.使用grant sysdba to <> 或grant sysoper to <> 或revoke sysdba |sysoper from <>