开发者

oracle in the real world

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_in开发者_C百科d_columns
where table_name='MYTABLENAME' order by index_name, column_position

every time they wanted to do something as simple as list the indexes of a table. Otherwise how can they get any work done?


You 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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜