---
title: "Oracle 查看用户是否具有sysdba或者sysoper权限"
author: "itspace"
date: "2009-12-24T16:28:45Z"
tags: []
categories: ["数据库"]
slug: "oracle-sysdba-sysoper"
draft: false
lastmod: "2009-12-24T16:31:15Z"
id: 555898
url: "https://dbzone.iteye.com/blog/555898"
---

查看用户是否具有sysdba或者sysoper权限，有2种方法
1、Oracle提供一视图查看用户是否具有sysdba或者sysoper权限，分别用TRUE和FALSE来表示


> SQL> select * from V$PWFILE_USERS;
> 
> USERNAME                       SYSDB SYSOP
> ------------------------------ ----- -----
> SYS                            TRUE  TRUE
> WZDBRA                         TRUE  FALSE
> TEST                           FALSE TRUE


2、用操作系统命令strings查看密码文件，可以看到WZDBRA，TEST具有sysdba或者sysoper权限。
$ strings  orapwdrb
]\

当然Oracle密码文件可以用命令orapwd重建，但只能重建sys用户的密码，其他用户授予sysdba、sysoper权限，需要在数据库中显式赋权。显式赋权之后，Oracle将更新密码文件。需要注意的一点就是<span style="color:red">在RAC情况下，Oracle只更改当前节点的密码文件。</span>以下是orapwd语法的说明

> [ora10g@hzmc dbs]$ orapwd
> Usage: orapwd file=<fname> password=<password> entries=<users> force=<y/n> nosysdba=<y/n>
> 
>   where
>     file - name of password file (mand),
>     [b]password - password for SYS (mand),[/b]
>     [b]entries - maximum number of distinct DBA,[/b]
>     force - whether to overwrite existing file (opt),
>     nosysdba - whether to shut out the SYSDBA logon (opt for Database Vault only).
>   There are no spaces around the equal-to (=) character.