SQL> exit
从 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options 断
开
C:\>sqlplus sys/manager@55 as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on 星期五 5月 8 13:43:09 2015
Copyright (c) 1982, 2010, Oracle. All rights reserved.
ERROR:
ORA-01031: insufficient privileges
===================================================
SQL> grant sysdba to sys;
grant sysdba to sys
*
第 1 行出现错误:
ORA-01994: GRANT 失败: 口令文件缺失或已禁用
所以不得不重建口令文件:
Usage: orapwd file=
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.
[oracle@localhost ~]$ orapwd file=$ORACLE_HOME/dbs/orapw$orcl3939 entries=10 force=y;
Enter password for SYS:
[oracle@localhost ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on 星期五 5月 8 14:02:48 2015
Copyright (c) 1982, 2009, Oracle. All rights reserved.
连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select * from v$pwfile_users;
USERNAME SYSDB SYSOP SYSAS
------------------------------ ----- ----- -----
SYS TRUE TRUE FALSE
orapwd file=orapworcl password=oracle force=y
orapwd file=<密码文件的名字orapw
password=< sys用户的密码>
entries=<密码文件中的用户数目限制(二进制文件按矩阵计算可存多少数)>
force=
官网11gR2:
ORAPWD FILE=filename [ENTRIES=numusers] [FORCE={Y|N}] [IGNORECASE={Y|N}]
Command arguments are summarized in the following table.
| Argument | Description |
|---|---|
| FILE | Name to assign to the password file. You must supply a complete path. If you supply only a file name, the file is written to the current directory. |
| ENTRIES | (Optional) Maximum number of entries (user accounts) to permit in the file. |
| FORCE | (Optional) If y, permits overwriting an existing password file. |
| IGNORECASE | (Optional) If y, passwords are treated as case-insensitive. |
There are no spaces permitted around the equal-to (=) character.
The command prompts for the SYS password and stores the password in the created password file.
Example
The following command creates a password file named orapworcl that allows up to 30 privileged users with different passwords.
orapwd FILE=orapworcl ENTRIES=30
官网(12c):更为详细
orapwd FILE=filename [ENTRIES=numusers] [FORCE={y|n}] [ASM={y|n}] [DBUNIQUENAME=dbname] [FORMAT={12|legacy}] [SYSBACKUP={y|n}] [SYSDG={y|n}] [SYSKM={y|n}] [DELETE={y|n}] [INPUT_FILE=input-fname]orapwd DESCRIBE FILE=filenameCommand arguments are summarized in the following table.
| Argument | Description |
|---|---|
| FILE | If the DESCRIBE argument is not included, then specify the name to assign to the new password file. You must supply a complete path. If you supply only a file name, the file is written to the current directory. If the DESCRIBE argument is included, then specify the name of an existing password file. |
| PASSWORD | Password for SYS. You are prompted for the password if it is not specified. The password is stored in the created password file. |
| ENTRIES | (Optional) Maximum number |