oracle常用語句

2021-06-18 00:41:48 字數 1573 閱讀 8798

drop tablespace crm_online_space including contents and datafiles  --刪除表空間

drop user wuliu01 cascade; --刪除使用者

exp **/**@orcl file=d:/**.dmp  --匯出資料庫

imp **/**@orcl file=e:/alen/work/****.dmp ignore=y full=y  --匯入資料庫

expdp userid='**/**@orcl11 as sysdba' schemas=** directory=data_pump_dir dumpfile=gytms20130603for10g.dmp logfile=20130603.log version=10.2.0.1.0  --11g導成10g

impdp userid='**/**@orcl11 as sysdba' schemas=gytms directory=data_pump_dir dumpfile=gytms20130603for10g.dmp logfile=aa.log version=10.2.0.1.0  --10g匯入

--根據約束條件找到指定的表及所對應的列資訊

select a.constraint_name ,

a.constraint_type,

a.table_name,

b.column_name,

a.search_condition

from user_constraints a,user_cons_columns b

where a.constraint_name=b.constraint_name  and a.constraint_name like '%fk3f53657728a16d5a%'

檢視執行過的語句

select * from v$sqltext a

select * from v$sqlarea

檢視當前使用者下表的占用空間

select segment_name, sum(bytes)/1024/1024 from user_extents group by segment_name

查詢所有物件占用空間

select owner, segment_name,sum(bytes/1024/1024)   from   dba_segments   

group by owner,segment_name

查詢資料庫中各物件占用空間大小

select segment_name,b.object_type, sum(bytes)/1024/1024 from user_extents a,user_objects b

where a.segment_name=b.object_name group by segment_name,b.object_type order by object_type, segment_name

oracle中去除欄位中的回車符

update ywj_yxglobj set table_name = replace(table_name,chr(10),'')

where table_name like 'acct_info%'

oracle 常用語句

oracle 產看表空間 select total.name tablespace name free space,total space free space used space,total space from select tablespace name,sum bytes 1024 102...

oracle 常用語句

oracle 常用語句 查詢表的大小 select t.owner,t.segment name,sum t.blocks 8 1024 m as s,t.segment type from dba segments t where t.owner user name group by t.owne...

oracle常用語句

查詢鎖定表 select l.session id sid,s.serial l.locked mode,l.oracle username,l.os user name,s.machine,s.terminal,o.object name,s.logon time from v locked ob...