Oracle 创建视图问题

Oracle Create View issue(Oracle 创建视图问题)
本文介绍了Oracle 创建视图问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我以 dba 帐户登录,我想在 User1 的架构中创建一个视图,但从 User2 的架构中选择数据.

I am logged in as the dba account and I want to create a view in User1's schema, but selecting data from User2's.

我使用了以下查询:

CREATE OR REPLACE VIEW User1.NewView (Column1) AS
SELECT DISTINCT Column1 FROM User2.Table

我收到以下错误:

SQL Error: ORA-00942: table or view does not exist
00942. 00000 -  "table or view does not exist"
*Cause:    
*Action:

为了解决这个问题,我必须在 User2.Table 上授予对 User1 的选择访问权限.因为我已经以 dba 身份登录,所以有没有一种无需授予访问权限的方法?

To resolve this I had to grant select access to User1 on User2.Table. Is there a way to do this without having to grant access, since I am already logged in as the dba?

推荐答案

是的,您必须(并且始终应该)明确授予对另一个架构中的对象的访问权限.

Yes, you have (and always should) to explicitly grant access to objects in another schema.

GRANT SELECT ON user2.table TO user1

尽管您以dba 帐户"(我假设是 SYS)身份登录,但 CREATE 语句专门针对 user1 架构.

Though you're logged in as "the dba account" (SYS, I'm assuming), the CREATE statement is for the user1 schema specifically.

这篇关于Oracle 创建视图问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

Sending parameters to stored procedures vb.net(将参数发送到存储过程 vb.net)
Insert multiple rows, count based on another table columns(插入多行,根据另一个表列计数)
How to hold the location of an image in a SQL Server database?(如何在 SQL Server 数据库中保存图像的位置?)
How to send to email (outlook) the selected items in SQL Server database using vb.net(如何使用 vb.net 将 SQL Server 数据库中的选定项目发送到电子邮件(Outlook))
datagrid checkbox writes Null instead of 0 (false) into database(datagrid 复选框将 Null 而不是 0 (false) 写入数据库)
DBCC CheckDb-any ways to detect errors vb.net?(DBCC CheckDb-vb.net 有什么检测错误的方法吗?)