简体   繁体   English

如何更改特定用户的表? [SQL Oracle]

[英]How to alter table for a particular user? [SQL Oracle]

In SQL Developer, under one connection, we can have many users. 在SQL Developer中,通过一种连接,我们可以有许多用户。 Right now, I am trying to alter a table for a particular user but I have been failing to do so. 现在,我正在尝试为特定用户更改表,但是我一直没有这样做。

Here is my code: 这是我的代码:

ALTER TABLE USER_NAME.VIEW_NAME
ADD new_view_column VARCHAR(250),
ADD CONSTRAINT FOREIGN KEY(new_view_column) REFERENCES USER_NAME.REFERENCE_TABLE_NAME(reference_column);

If there is already similar question asked, can you help give me the link? 如果已经有类似的问题要问,您能帮我给我链接吗? Sincerely, I have been searching high and low but haven't got anywhere. 真诚的,我一直在搜寻高空,但是却一无所获。

Otherwise, please advice me on this matter. 否则,请就此事向我提出建议。 Thank you. 谢谢。

SQL Developer will let you see any objects you have select privileges on; SQL Developer将让您看到您具有选择特权的任何对象; that does not mean you can modify the objects, and maybe not mean you can modify the data they contain. 这并不意味着您可以修改对象,也并不意味着您可以修改它们包含的数据。

To alter another user's table you need to have been granted the alter any table privilege , either directly to your user or via a role. 要更改另一个用户的表,您需要直接或通过角色被授予alter any table特权

The "any" privileges are powerful though and should only be granted if really needed - which is true of any privilege of course, but particularly of those that might let a user cause problems outside their own schema. 不过,“任何”特权都具有强大的功能,只有在确实需要时才应授予 -当然, 对于任何特权都是如此 ,尤其是那些可能使用户在其自身架构之外引起问题的特权

Unless it is really necessary for your user, in a DBA-type role, to make changes elsewhere then the owner of the object should make any changes to it themselves. 除非确实有您的用户以DBA类角色在其他地方进行更改,否则对象的所有者应自行对其进行任何更改。 If you have the credentials for that schema you can just create a new connection with those, and will then be able to make changes directly as that user. 如果您具有该架构的凭据,则可以使用这些凭据创建一个新的连接,然后就可以以该用户的身份直接进行更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM