首页 > 代码库 > Oracle 操作

Oracle 操作

select tablespace_name,sum(bytes)/1024/1024 from dba_data_files group by tablespace_name;
select tablespace_name,sum(bytes)/1024/1024 from dba_free_space group by tablespace_name;
select df.tablespace_name,SUM(df.bytes)/1024/1024 total,SUM(fs.bytes)/1024/1024 free,SUM(df.bytes-fs.bytes)/1024/1024 used from dba_data_files df,dba_free_space fs
where df.tablespace_name = fs.tablespace_name
group by df.tablespace_name

select table_name,tablespace_name from user_tables where table_name=‘fwfinfo‘;
select username,default_tablespace from dba_users where username=‘FWSK‘;

select username,default_tablespace from dba_users;

select
b.file_id 文件ID号,
b.tablespace_name 表空间名,
b.bytes/1024/1024||‘M‘字节数,
(b.bytes-sum(nvl(a.bytes,0)))/1024/1024||‘M‘ 已使用,
sum(nvl(a.bytes,0))/1024/1024||‘M‘ 剩余空间,
100 - 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_id,b.bytes
order by b.file_id;

 

select tablespace_name,file_name,autoextensible from dba_data_files where autoextensible=‘YES‘;

SELECT FILE_NAME, TABLESPACE_NAME, AUTOEXTENSIBLE FROM DBA_DATA_FILES

select tablespace_name,
file_id,
file_name,
round(bytes / (1024 * 1024), 0) total_space
from sys.dba_data_files
order by tablespace_name


alter database datafile ‘D:\MYORACLE\ORACLE\ORADATA\ORCL\FWSKKZ_DATA.DBF‘ resize 4000m

Oracle 操作