我最近在使用mysql几年后开始使用oracle。 我立刻被详细的oracle与mysql的比较感到震惊。 四字查询(如SHOW INDEX IN < table> )在oracle中成为四行查询。
我的问题是: 真正的 oracle DBA如何有效地与oracle交互。 必须有一些方法来为常用命令添加别名(就像在unix shell中一样)。 我发现很难相信他们会输入类似的东西
select index_name, column_name, column_position from user_ind_columns where table_name='MYTABLENAME' order by index_name, column_position每次他们想要做一些简单的事情就像列出表的索引一样。 否则他们怎么能完成任何工作?
I've recently started using oracle after a few years of using mysql. I was immediately struck by how verbose oracle is compared to mysql. Four-word queries (like SHOW INDEX IN < table> ) become four-line queries in oracle.
My question is: how do real oracle DBAs interact with oracle efficiently. There must be some way to alias commonly used commands (like you do in the unix shell). I find it hard to believe that they would type something like
select index_name, column_name, column_position from user_ind_columns where table_name='MYTABLENAME' order by index_name, column_positionevery time they wanted to do something as simple as list the indexes of a table. Otherwise how can they get any work done?
最满意答案
您可以使用像SQL Developer或Toad这样的IDE; 它们具有用于浏览表,索引和其他对象的UI,而无需键入任何命令。
或者在SQL Plus中,您可以简单地将常用查询保存为文件中的脚本,例如,名为show_index的脚本可以包含:
select index_name, column_name, column_position from user_ind_columns where table_name=upper('&TABLENAME.') order by index_name, column_position;你可以在SQL Plus中运行它,如下所示:
SQL> @show_index Enter value for tablename: mytableYou can use an IDE like SQL Developer or Toad; these have a UI to browse tables, indexes and other objects without typing any commands.
Or in SQL Plus you can simply save commonly used queries as scripts in files, for example a script called show_index could contain:
select index_name, column_name, column_position from user_ind_columns where table_name=upper('&TABLENAME.') order by index_name, column_position;You would run this in SQL Plus like this:
SQL> @show_index Enter value for tablename: mytable更多推荐
发布评论