📄 316.html
字号:
<STYLE type=text/css>
<!--
body,td { font-size:9pt;}
hr { color: #000000; height: 1px}
-->
</STYLE>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD><TITLE>论坛精华 >> Oracle 专栏 >> Oracle DBA 常用SQL</title>
</head>
<body >
<p><IMG SRC="../image/jsp001_middle_logo.gif" WIDTH="180" HEIGHT="60" BORDER=0 ALT=""></p>
<table width=100% bgcolor="#cccccc" align=center cellpadding="2" cellspacing="0" border=1 bordercolorlight="#000000" bordercolordark="#FFFFFF">
<tr bgcolor="#EFF8FF"><td>
<a href=http://www.jsp001.com/list_thread.php?int_attribute=4>论坛精华</a>
>> <a href=http://www.jsp001.com/list_thread.php?forumid=20&int_attribute=4>Oracle 专栏</a>
>> Oracle DBA 常用SQL [<a href=http://www.jsp001.com/forum/showthread.php?goto=newpost&threadid=316>查看别人的评论</a>]<br>
<hr><p>由 macro 发布于: 2001-02-07 15:32</p><p><img src="images/icons/icon14.gif" alt="Thumbs up" border=0> </p><p>1、查看当前所有对象 <br><br>SQL> select * from tab; <br><br>2、建一个和a表结构一样的空表 <br><br>SQL> create table b as select * from a where 1=2; <br><br>SQL> create table b(b1,b2,b3) as select a1,a2,a3 from a where 1=2; <br><br>3、察看数据库的大小,和空间使用情况 <br><br>SQL> col tablespace format a20<br>SQL> select b.file_id 文件ID,<br> b.tablespace_name 表空间,<br> b.file_name 物理文件名,<br> b.bytes 总字节数,<br> (b.bytes-sum(nvl(a.bytes,0))) 已使用,<br> sum(nvl(a.bytes,0)) 剩余,<br> sum(nvl(a.bytes,0))/(b.bytes)*100 剩余百分比 <br> from dba_free_space a,dba_data_files b <br> where a.file_id=b.file_id <br> group by b.tablespace_name,b.file_name,b.file_id,b.bytes <br> order by b.tablespace_name<br> /<br> dba_free_space --表空间剩余空间状况<br> dba_data_files --数据文件空间占用情况<br><br><br>4、查看现有回滚段及其状态 <br><br>SQL> col segment format a30<br>SQL> SELECT SEGMENT_NAME,OWNER,TABLESPACE_NAME,SEGMENT_ID,FILE_ID,STATUS FROM DBA_ROLLBACK_SEGS; <br><br>5、查看数据文件放置的路径 <br><br>SQL> col file_name format a50<br>SQL> select tablespace_name,file_id,bytes/1024/1024,file_name from dba_data_files order by file_id; <br><br>6、显示当前连接用户 <br><br>SQL> show user <br><br>7、把SQL*Plus当计算器 <br><br>SQL> select 100*20 from dual; <br><br>8、连接字符串 <br><br>SQL> select 列1||列2 from 表1;<br>SQL> select concat(列1,列2) from 表1; <br><br>9、查询当前日期 <br><br>SQL> select to_char(sysdate,'yyyy-mm-dd,hh24:mi:ss') from dual; <br><br>10、用户间复制数据 <br><br>SQL> copy from user1 to user2 create table2 using select * from table1; <br><br>11、视图中不能使用order by,但可用group by代替来达到排序目的 <br><br>SQL> create view a as select b1,b2 from b group by b1,b2; <br><br>12、通过授权的方式来创建用户 <br><br>SQL> grant connect,resource to test identified by test; <br><br>SQL> conn test/test <br></p></td>
</tr>
</table>
<p>
<CENTER><a href="http://www.jsp001.com/forum/newreply.php?action=newreply&threadid=316">点这里对该文章发表评论</a></CENTER>
<p>该文章总得分是 <font color=red>0</font> 分,你认为它对你有帮助吗?
[<a href=javascript:void(0) onclick=window.open("http://www.jsp001.com/forum/codeVote.php?threadid=316&intVote=4","","menubar=no,toolbar=no,location=no,directories=no,status=no,resizable=no,scrollbars=no,width=70,height=40,top=0,left=0")>非常多</a>](<font color=red>0</font>)
[<a href=javascript:void(0) onclick=window.open("http://www.jsp001.com/forum/codeVote.php?threadid=316&intVote=2","","menubar=no,toolbar=no,location=no,directories=no,status=no,resizable=no,scrollbars=no,width=70,height=40,top=0,left=0")>有一些</a>](<font color=red>0</font>)
[<a href=javascript:void(0) onclick=window.open("http://www.jsp001.com/forum/codeVote.php?threadid=316&intVote=1","","menubar=no,toolbar=no,location=no,directories=no,status=no,resizable=no,scrollbars=no,width=70,height=40,top=0,left=0")>无帮助</a>](<font color=red>0</font>)
[<a href=javascript:void(0) onclick=window.open("http://www.jsp001.com/forum/codeVote.php?threadid=316&intVote=-1","","menubar=no,toolbar=no,location=no,directories=no,status=no,resizable=no,scrollbars=no,width=70,height=40,top=0,left=0")>是灌水</a>](<font color=red>0</font>) </p>
<script language="javascript" src="http://www.jsp001.com/include/read_thread_script.php?threadid=316"></script>
<p><CENTER>
Copyright © 2001 - 2009 JSP001.com . All Rights Reserved <P>
<IMG SRC="../image/jsp001_small_logo.gif" WIDTH="85" HEIGHT="30" BORDER=0 ALT="">
</CENTER></p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -