人人范文网 范文大全

常用sql语句

发布时间:2020-03-03 01:50:25 来源:范文大全 收藏本文 下载本文 手机版

1、查看表空间的名称及大小

select t.tablespace_name, round(sum(bytes/(1024*1024)),0) ts_size

from dba_tablespaces t, dba_data_files d

where t.tablespace_name = d.tablespace_name

group by t.tablespace_name;

2、删除表空间的数据文件:Alter tablespace tablespace_name

Drop datafile file_name;

3、删除表空间:Drop tablespace tablespace_name

[Including contents [And datafiles]]

4、删除表:Drop table table_name[cascade constraints][purge];

4、表空间物理文件的名称及大小

select tablespace_name, file_id, file_name,

round(bytes/(1024*1024),0) total_space

from dba_data_files

order by tablespace_name;

5、看控制文件

select name from v$controlfile;

6、看日志文件

select member from v$logfile;

7、查看数据库库对象

select owner, object_type, status, count(*) count#

from all_objects

group by owner, object_type, status;

8、找object为哪些进程所用

select

p.spid,

s.sid,

s.serial# serial_num,

s.username user_name,

a.typeobject_type,

s.osuser os_user_name,

a.owner,

a.object object_name,

decode(sign(48 - command),

9、object分类数量

select decode (o.type#,1,\'INDEX\' , 2,\'TABLE\' , 3 , \'CLUSTER\' , 4, \'VIEW\' , 5 ,\'SYNONYM\' , 6 , \'SEQUENCE\' , \'OTHER\' ) object_type , count(*) quantity fromsys.obj$ o where o.type# > 1 group by decode (o.type#,1,\'INDEX\' , 2,\'TABLE\' , 3

, \'CLUSTER\' , 4, \'VIEW\' , 5 , \'SYNONYM\' , 6 , \'SEQUENCE\' , \'OTHER\' ) union select\'COLUMN\' , count(*)

from sys.col$ union select \'DB LINK\' , count(*) from

10、哪些数据库实例在运行

select inst_name from v$active_instances;

SQL语句

SQL语句

SQL语句

sql语句

常用SQL语句

sql语句学习

SQL语句练习

SQL语句培训

sql常用语句

约束(sql 语句)

常用sql语句
《常用sql语句.doc》
将本文的Word文档下载到电脑,方便编辑。
推荐度:
点击下载文档
点击下载本文文档