ORACLE常用Script(轉)
ORACLE常用Script(轉)[@more@]1、檢視當前所有物件SQL> select * from tab;2、建一個和a表結構一樣的空表SQL> create table b as select * from a where 1=2;SQL> create table b(b1,b2,b3) as select a1,a2,a3 from a where 1=2;3、察看資料庫的大小,和空間使用情況SQL> col tablespace format a20SQL> select b.file_id 檔案ID, b.tablespace_name 表空間, b.file_name 物理檔名, b.bytes 總位元組數, (b.bytes-sum(nvl(a.bytes,0))) 已使用, sum(nvl(a.bytes,0)) 剩餘, sum(nvl(a.bytes,0))/(b.bytes)*100 剩餘百分比 from dba_free_space a,dba_data_files b where a.file_id=b.file_id group by b.tablespace_name,b.file_name,b.file_id,b.bytes order by b.tablespace_name / dba_free_space --表空間剩餘空間狀況 dba_data_files --資料檔案空間佔用情況4、檢視現有回滾段及其狀態SQL> col segment format a30SQL> SELECT SEGMENT_NAME,OWNER,TABLESPACE_NAME,SEGMENT_ID,FILE_ID,STATUS FROM DBA_ROLLBACK_SEGS;5、檢視資料檔案放置的路徑SQL> col file_name format a50SQL> select tablespace_name,file_id,bytes/1024/1024,file_name from dba_data_files order by file_id;6、顯示當前連線使用者SQL> show user7、把SQL*Plus當計算器SQL> select 100*20 from dual;8、連線字串SQL> select 列1||列2 from 表1;SQL> select concat(列1,列2) from 表1;9、查詢當前日期SQL> select to_char(sysdate,'yyyy-mm-dd,hh24:mi:ss') from dual;10、使用者間複製資料SQL> copy from user1 to user2 create table2 using select * from table1;11、檢視中不能使用order by,但可用group by代替來達到排序目的SQL> create view a as select b1,b2 from b group by b1,b2;12、透過授權的方式來建立使用者SQL> grant connect,resource to test identified by test;SQL> conn test/tes
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8225414/viewspace-940549/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- ORACLE常用Script (轉)Oracle
- 【SCRIPT】Oracle表管理段管理常用語句Oracle
- oracle scriptOracle
- [Oracle Script] LockOracle
- Oracle Database ScriptOracleDatabase
- Shell Script(轉)
- [Oracle Script] Top sqlOracleSQL
- [Oracle Script] check userOracle
- [Oracle Script] check latchOracle
- Oracle kill session scriptOracleSession
- IPTables配置Script(轉)
- 轉:Oracle常用dump命令Oracle
- Oracle 常用dump命令 - 轉Oracle
- Oracle常用dump命令(轉)Oracle
- [Oracle Script] check active sessionOracleSession
- [Oracle Script] Log switch statusOracle
- [Oracle Script] check lock infoOracle
- [Oracle Script] latch holderOracle
- [Oracle Script] Temporary Sort UsageOracle
- [Oracle Script] Rollback Segment UsageOracle
- [Oracle Script] check Literal SQLOracleSQL
- Oracle常用調優手段[轉]Oracle
- Oracle常用監控SQL(轉)OracleSQL
- [Oracle Script] check tablespace usage infoOracle
- [Oracle Script] select db parameterOracle
- [Oracle Script] check temp tablespace usageOracle
- [Oracle Script] ASM Disks Performance metricOracleASMORM
- [Oracle Script] Undo Usage Per statusOracle
- [Oracle Script] Undo Usage Per sessionOracleSession
- [Oracle Script] Buffer Cache Hit RatioOracle
- [Oracle Script] check object count by userOracleObject
- [Oracle Script] check File I/OOracle
- perl script for scan TCP ports .(轉)TCP
- NAT iptables防火牆(script)(轉)防火牆
- 轉載-Oracle 常用的dump命令Oracle
- (轉)Oracle常用dump命令介紹Oracle
- Oracle 常用 Dump 命令收集(轉帖)Oracle
- oracle裡常用命令(轉)Oracle