
一、作用:主要进行DBA权限的身份认证
DBA用户:具有sysdba,sysoper权限的用户被称为dba用户。默认情况下sysdba角色中存在sys用户,sysoper角色中存在system用户
二、Oracle的两种认证方式
1.使用与操作系统集成的身份验证
2.使用Oracle数据库的密码文件进行身份认证
三、密码文件的位置
$ORACLE_HOME/dbs/orapw$ORACLE_SID

参数决定认证方式:
$ORACLE_HOME/dbs/spfile$ORACLE_SID.ora 参数文件中
remote_login_passwordfile = none | exclusive |shared
none : 不使用密码文件认证
exclusive :要密码文件认证,自己独占使用(默认值)
shared :要密码文件认证,不同实例dba用户可以共享密码文件

$ 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.

$ orapwd file=$ORACLE_HOME/dbs/orapworcl password=oracle force=y
删除密码文件
$ rm orapworcl
重建密码文件
$ orapwd file=orapworcl password=oracle
TIPS:注意不要轻易删掉密码文件,这样会将其他账户的信息也删除

1. 使用orapwd建立,修改密码文件(不建议使用)
2. 使用alter user sys identified by < >
3. 使用grant sysdba to < >
或
grant sysoper to < >
或
revoke sysdba |sysoper from < >

$ strings orapworcl
]\[Z
ORACLE Remote Password file
INTERNAL
AB27B53EDC5FEF41
8A8F025737A9097A
TIPS:当sys密码不记得可以使用OS系统身份认证登陆到sqlplus,再使用alter user修改密码
SQL> alteruser sys identified by oracle;
User altered

SQL> select* from system_privilege_mapwhere name like '%SYS%';
PRIVILEGE NAME PROPERTY
---------- --------------- ----------
-3 ALTER SYSTEM 0
-4 AUDIT SYSTEM 0
-83 SYSDBA 0
-84 SYSOPER 0
两者的schema不同
SQL> show user
USER is "SYS"
SQL> conn as sysoper
Connected.
SQL> show user
USER is "PUBLIC"
查看密码文件视图,可以得到哪些用户为sysdba,哪些用户为sysoper
SQL> select* from v$pwfile_users;
USERNAME SYSDB SYSOP
----------- ----- -----
SYS TRUE TRUE
SCOTT TRUE FALSE
USER1 FALSE TRUE





