oracle 如何更改 sql developer 中的默认架构?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17407950/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I change the default schema in sql developer?
提问by bernie2436
I don't see any tables in the tables section of a database that I've linked to w/ SQL developer. The DB admin says I need to change the default schema in SQL developer. How do I do that?
我在与 SQL 开发人员链接的数据库的表部分中没有看到任何表。数据库管理员说我需要更改 SQL 开发人员中的默认架构。我怎么做?
回答by Ram
alter session set current_schema = otheruser;
should do the trick.
应该做的伎俩。
回答by Carlos Negron
Just right clic on the created connection and select "Schema browser", then use the filter to display the desired one.
只需右键单击创建的连接并选择“架构浏览器”,然后使用过滤器显示所需的连接。
Cheers.
干杯。
回答by Brian Ogden
This will not change the default schema in Oracle Sql Developer but I wanted to point out that it is easy to quickly view another user schema, right click the Database Connection:
这不会改变 Oracle Sql Developer 中的默认架构,但我想指出快速查看另一个用户架构很容易,右键单击数据库连接:
Select the user to see the schema for that user
选择用户以查看该用户的架构
回答by Nick.McDermaid
I know this is old but...
我知道这是旧的,但...
I found this:
我找到了这个:
http://javaforge.com/project/schemasel
http://javaforge.com/project/schemasel
From the description, after you install the plugin it appears that if you follow the logical connection name with a schema in square brackets, it should connect to the schema by default.
从描述中可以看出,在安装插件后,如果您在逻辑连接名称后面加上方括号中的架构,则默认情况下它应该连接到架构。
It does but the object browser does not.
它有,但对象浏览器没有。
Oh well.
那好吧。
回答by shekhar
回答by Ranald McKillop
If you log in as scott, but wish to see the tables for the HR schema, then you need to alter your session "alter session set current_schema=HR;"
如果您以 scott 身份登录,但希望查看 HR 模式的表,那么您需要更改会话“alter session set current_schema=HR;”
If you do this all time, then you can create a startup script called login.sql with the above command in it, then tell SQL Developer to run this at startup via Tool/Preferences/Database
如果你一直这样做,那么你可以创建一个名为 login.sql 的启动脚本,其中包含上面的命令,然后告诉 SQL Developer 在启动时通过 Tool/Preferences/Database 运行它
回答by Mikhael Loo
When a new user is created in ORACLE, an empty work area for tables and views is also automatically created. That work area is called a 'Schema'. Because of the tightly coupled relationship between users and schemas, the terms are often used synonymously. SQL Developer will, by default, show the empty schema that belongs to the user you connected with if it is indeed empty.
在 ORACLE 中创建新用户时,还会自动创建一个用于表和视图的空白工作区。该工作区称为“架构”。由于用户和模式之间的紧密耦合关系,这些术语通常作为同义词使用。默认情况下,SQL Developer 将显示属于您连接的用户的空架构(如果它确实是空的)。
However, if you click to expand the part of the tree titled 'Other Users', you'll see other users/schemas that your user has access to. In there, you may find the tables and views you are seeking if you select the correct user/schema.
但是,如果您单击以展开标题为“其他用户”的树部分,您将看到您的用户有权访问的其他用户/模式。如果您选择了正确的用户/模式,您可能会在其中找到您正在寻找的表和视图。
Still, it would be nice if the application allowed us to pick our desired schema closer to the root of the tree instead of forcing us to go searching for it. Other answers have offered workarounds such as:
尽管如此,如果应用程序允许我们选择更接近树根的模式,而不是强迫我们去搜索它,那就太好了。其他答案提供了解决方法,例如:
- Logging in as the desired user/schema to begin with.
- Using a different Tool.
- Ignoring the tree and just executing: alter session set current_schema = otheruser;
- Creating a startup script to set the schema every time the application loads.
- 以所需的用户/模式登录开始。
- 使用不同的工具。
- 忽略树并执行:alter session set current_schema = otheruser;
- 创建启动脚本以在每次应用程序加载时设置架构。
In the end, I searched and found another free tool that seems to solve this particular usability issue called DBeaver.
最后,我搜索并找到了另一个免费工具,它似乎可以解决这个名为DBeaver 的特殊可用性问题。
It's all a bit confusing because the word schema is overloaded. Schema could also be used to describe the database of your application. To get more clarity, read more about the term schema as it is used in the ORACLE context.
这有点令人困惑,因为模式这个词超载了。Schema 也可用于描述应用程序的数据库。为了更清晰,请阅读更多有关 ORACLE 上下文中使用的术语模式的信息。
回答by wolφi
Just create a new connection (hit the green plus sign) and enter the schema name and password of the new default schema your DBA suggested. You can switch between your old schema and the new schema with the pull down menu at the top right end of your window.
只需创建一个新连接(点击绿色加号)并输入您的 DBA 建议的新默认架构的架构名称和密码。您可以使用窗口右上角的下拉菜单在旧模式和新模式之间切换。
回答by Andres Diaz De Valdes
After you granted the permissions to the specified user you have to do this at filtering:
在向指定用户授予权限后,您必须在过滤时执行此操作:
First step:
第一步:
Second step:
第二步:
Now you will be able to display the tables after you changed the default load Alter session to the desire schema (using a Trigger after LOG ON).
现在,您将能够在将默认负载更改会话更改为所需模式后显示表(在登录后使用触发器)。