有时候给一些普通用户授予查询系统对象(例如dynamic performance views)权限时会遇到“ORA-02030: can only select from fixed tables/views”,如下所示:

SQL> grant select on v$session to test;

grant select on v$session to test

                *

ERROR at line 1:

ORA-02030: can only select from fixed tables/views

关于ORA-02030错误介绍如下,也是就是对于fixed tables 或fixed views只能进行SELECT查询,不能做SELECT之外的任何操作

[oracle@DB-Server ~]$ oerr ora 2030

02030, 00000, "can only select from fixed tables/views"

// *Cause:  An attempt is being made to perform an operation other than

//         a retrieval from a fixed table/view.

// *Action:  You may only select rows from fixed tables/views.

关于V$ Views的介绍如下:

V$ Views

The actual dynamic performance views are identified by the prefix V_$. Public synonyms for these views have the prefix V$. Database administrators and other users should access only the V$ objects, not the V_$ objects.

The dynamic performance views are used by Oracle Enterprise Manager, which is the primary interface for accessing information about system performance. After an instance is started, the V$ views that read from memory are accessible. Views that read data from disk require that the database be mounted, and some require that the database be open.

我们查询发现V$SESSION,V$DBLINK都是fixed views,而且v$这类我们经常查的视图都是v_$开头视图的同义词。

SQL> SELECT * FROM V$FIXED_TABLE WHERE NAME IN( 'V$SESSION','V$DBLINK');

 

NAME                            OBJECT_ID TYPE   TABLE_NUM

------------------------------ ---------- ----- ----------

V$SESSION                      4294950919 VIEW       65537

V$DBLINK                       4294951157 VIEW       65537

 

SQL> 

SQL> COL OWNER  FOR A12;

SQL> COL OBJECT_NAME FOR A32;

SQL> COL OBJECT_TYPE FOR A32;

SQL> SELECT OWNER, OBJECT_NAME ,OBJECT_TYPE

  2  FROM DBA_OBJECTS 

  3  WHERE OBJECT_NAME='V$SESSION';

 

OWNER        OBJECT_NAME                      OBJECT_TYPE

------------ -------------------------------- --------------------------------

PUBLIC       V$SESSION                        SYNONYM

 

SQL> 

SQL> COL TABLE_OWNER FOR A12;

SQL> COL SYNONYM_NAME FOR A20;

SQL> COL TABLE_NAME FOR A16;

SQL> COL DB_LINK FOR A8;

SQL> SELECT * FROM DBA_SYNONYMS WHERE SYNONYM_NAME='V$SESSION';

 

OWNER        SYNONYM_NAME         TABLE_OWNER  TABLE_NAME       DB_LINK

------------ -------------------- ------------ ---------------- --------

PUBLIC       V$SESSION            SYS          V_$SESSION

所以要授权就应该执行下面SQL语句

SQL>

SQL> GRANT SELECT ON V_$SESSION TO TEST;

 

Grant succeeded.

如果遇到这样的错误,直接找到对应同义词对应的视图或基表,然后进行授权,如下所示:

SQL> show user;

USER is "SYS"

SQL> grant select on v$dblink to test;

grant select on v$dblink to test

                *

ERROR at line 1:

ORA-02030: can only select from fixed tables/views

 

 

SQL> COL OWNER  FOR A12;

SQL> COL OBJECT_NAME FOR A32;

SQL> COL OBJECT_TYPE FOR A32;

SQL> SELECT OWNER, OBJECT_NAME ,OBJECT_TYPE

  2  FROM DBA_OBJECTS 

  3  WHERE OBJECT_NAME=UPPER('v$dblink');

 

OWNER        OBJECT_NAME                      OBJECT_TYPE

------------ -------------------------------- --------------------------------

PUBLIC       V$DBLINK                         SYNONYM

 

SQL> COL TABLE_OWNER FOR A12;

SQL> COL SYNONYM_NAME FOR A20;

SQL> COL TABLE_NAME FOR A16;

SQL> COL DB_LINK FOR A8;

SQL> SELECT * FROM DBA_SYNONYMS WHERE SYNONYM_NAME='V$DBLINK';

 

OWNER        SYNONYM_NAME         TABLE_OWNER  TABLE_NAME       DB_LINK

------------ -------------------- ------------ ---------------- --------

PUBLIC       V$DBLINK             SYS          V_$DBLINK

 

SQL> grant select on v_$dblink to test;

 

Grant succeeded.

 

SQL> 

ORA-02030: can only select from fixed tables/views的更多相关文章

  1. Oracle:ORA-01219:database not open:queries allowed on fixed tables/views only

    Oracle:ORA-01219:database not open:queries allowed on fixed tables/views only 问: 解决 ORA-01219:databa ...

  2. [Illuminate\Database\QueryException] SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using pas sword: NO) (SQL: select * from information_schema.tables where table_schema = la

    [Illuminate\Database\QueryException] SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost ...

  3. laravel执行数据库迁移的过程中出现Illuminate\Database\QueryException : SQLSTATE[HY000] [2002] Operation timed out (SQL: select * from information_schema.tables where table_schema = shop and table_name = migrations

    向customers表添加字段phone php artisan make:migration add_phone_to_customers_table 问题: 解决方法: 将DB_HOST配置项修改 ...

  4. DB count check for TABLES VIEWS PROCEDURES TRIGGERS

    SELECT DISTINCT(TABLESPACE_NAME) FROM ALL_TABLES; SELECT COUNT(*) FROM ALL_TABLES where TABLESPACE_N ...

  5. PLSQL Developer软件使用大全

    PLSQL Developer软件使用大全 第一章 PLSQL Developer特性 PL/SQL Developer是一个集成开发环境,专门面向Oracle数据库存储程序单元的开发.如今,有越来越 ...

  6. [转]PLSQL Developer软件使用大全

    原文地址:https://www.cnblogs.com/lhrbest/p/6493218.html 第一章 PLSQL Developer特性 PL/SQL Developer是一个集成开发环境, ...

  7. 【Oracle】-【权限-ORA-04043】- ORA-04043: object "SYS"."V_$DATABASE" does not exist

    用非dba账号(但赋予了DBA角色)登录一个新的10g数据库想看下版本号, SQL> desc v$instance; ERROR: ORA-04043: object "SYS&qu ...

  8. 使用 PLSQL 提示动态执行表不可访问,本会话的自动统计被禁止

    使用PLSQL,第一次执行表的select操作的时候,提示"动态执行表不可访问,本会话的自动统计被禁止",如上图: 这种问题,一看就是当前连接用户没有对sys用户下的表v$sess ...

  9. v$、v_$、gv$之间的关系

    本次实验测试,oracle数据库视图中v$,v_$,gv$之间的关系 总结: v_$是动态性能视图,通过sql查询数据库基表返回记录.例如,v_$database对象是视图类型,可对其它用户授权访问: ...

随机推荐

  1. [Swift]LeetCode566. 重塑矩阵 | Reshape the Matrix

    In MATLAB, there is a very useful function called 'reshape', which can reshape a matrix into a new o ...

  2. [Swift]LeetCode875. 爱吃香蕉的珂珂 | Koko Eating Bananas

    Koko loves to eat bananas.  There are N piles of bananas, the i-th pile has piles[i]bananas.  The gu ...

  3. springmvc 请求参数解析细节

    springmvc 的请求流程,相信大家已经很熟悉了,不熟悉的同学可以参考下资料! 有了整体流程的概念,是否对其中的实现细节就很清楚呢?我觉得不一定,比如:单是参数解析这块,就是个大学问呢? 首先,我 ...

  4. 机器学习入门 - Google机器学习速成课程 - 笔记汇总

    机器学习入门 - Google机器学习速成课程 https://www.cnblogs.com/anliven/p/6107783.html MLCC简介 前提条件和准备工作 完成课程的下一步 机器学 ...

  5. Jquery 对DOM 的操作

     .focus 获取焦点  .blus离开焦点----------------------------------------------------------------------------- ...

  6. Nancy in .Net Core学习笔记 - 初识Nancy

    前言 去年11月份参加了青岛MVP线下活动,会上老MVP衣明志介绍了Nancy, 一直没有系统的学习一下,最近正好有空,就结合.NET Core学习总结了一下. 注: 本文中大部分内容都是对官网文档的 ...

  7. asp.net core 系列 2 启动Startup类介绍

    一.Startup类 ASP.NET Core 应用是一个控制台应用,它在其 Program.Main 方法中创建 Web 服务器.其中Main方法是应用的托管入口点,Main 方法调用 WebHos ...

  8. EF架构~让mysql支持DbFunctions扩展函数

    回到目录 对于在Linq To Entity里使用日期函数需要DbFunctions里的扩展方法,而不能使用.net里的日期函数,因为linq的代码会被翻译成SQL发到数据库端,如你的.net方法对于 ...

  9. spring框架应用系列二:component-scan自动扫描注册装配

    component-scan自动扫描注册装配 本文系作者原创,转载请注明出处:http://www.cnblogs.com/further-further-further/p/7717331.html ...

  10. 【ASP.NET Core快速入门】(五)命令行配置、Json文件配置、Bind读取配置到C#实例、在Core Mvc中使用Options

    命令行配置 我们通过vs2017创建一个控制台项目CommandLineSample 可以看到现在项目以来的是dotnet core framework 我们需要吧asp.net core引用进来,我 ...