select table_name,tablespace_name from user_tables;
回答者: 我是_王静 | 二级 | 2008-10-6 14:26
select * from dba_tables where tablespace_name='表空间名'
回答者: hotyxm | 九级 | 2008-10-6 14:37
9i
/
SQL> select * from v$logfile;(#日志文件路径)
///
查表空间定义:select dbms_metadata.get_ddl('TABLESPACE','&TABLESPACE') FROM DUAL;
查索引定义:select dbms_metadata.get_ddl('INDEX','&INDEX_NAME') FROM DUAL;
/
select *from all_tables where tablespace_name='USERS';
//查询该表空间下所有的表
//
select * from all_tables where table_name='TB_WZ_ALL_HELPER';
//查询表对应的表空间和所属用户
///
select default_tablespace from dba_users where username='SYSTEM';
查询用户默认表空间
//
select distinct(tablespace_name) from dba_tables;
select tablespace_name from user_tables;
///
select * from dba_data_files
查询表空间的信息(当前用户必须拥有DBA角色)。
select owner , object_name ,object_type from all_objects
查询某一用户下的所有表、过程、函数等信息。
///
select * from dba_tablespaces//怎么在sqlplus中查询表空间所有表信息
//
select table_name,tablespace_name from user_tables;
select table_name from user_tables;
/
select * from dba_data_files//产看表空间信息
select username,default_tablespace from dba_users;//查看用户默认的表空间
//
select * from dba_data_files
查询表空间的信息(当前用户必须拥有DBA角色)。
///
///
select * from USER_PART_TABLES
查看表的分区情况;
select OWNER, TABLE_NAME,PARTITION_NAME from dba_part_col_statistics
where TABLE_NAME='TB_WZ_ALL_HELPER';//查看表的分区情况;
select TABLE_OWNER,TABLE_NAME,PARTITION_NAME from dba_tab_partitions
where TABLE_NAME='TB_WZ_ALL_HELPER';//查看表的分区情况;
/
//
查看各个表空间占用磁盘情况.sql:
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
/
查询不区分大小写
你可以2边都用Upper或lower函数
select * from test_a
where upper(x)=upper('Abcdd);
//
查询所有表空间名
select tablespace_name from dba_tablespaces;
//
1、查询数据库中的表空间名称
1)查询所有表空间
select tablespace_name from dba_tablespaces;
select tablespace_name from user_tablespaces;
2)查询使用过的表空间
select distinct tablespace_name from dba_all_tables;
select distinct tablespace_name from user_all_tables;
2、查询表空间中所有表的名称
select table_name from dba_all_tables where tablespace_name = tablespacename
3、查询系统用户
select * from all_users
select * from dba_users
4、查看当前连接用户
select * from v$session
5、查看当前用户权限
select * from session_privs
6、查看所有的函数和存储过程
select * from user_source
其中TYPE包括:PROCEDURE、FUNCTION
7、查看表空间使用情况
select a.file_id "FileNo",
a.tablespace_name "表空间",
a.bytes "Bytes",
a.bytes - sum(nvl(b.bytes, 0)) "已用",
sum(nvl(b.bytes, 0)) "空闲",
sum(nvl(b.bytes, 0)) / a.bytes * 100 "空闲百分率"
from dba_data_files a, dba_free_space b
where a.file_id = b.file_id(+)
group by a.tablespace_name, a.file_id, a.bytes
order by a.tablespace_name;
http://www.cnblogs.com/ITGIS/articles/1763993.html //参考资料
查看当前用户每个表占用空间的大小:
Select Segment_Name,Sum(bytes)/1024/1024 From User_Extents Group By Segment_Name
查看每个表空间占用空间的大小:
Select Tablespace_Name,Sum(bytes)/1024/1024 From Dba_Segments Group By Tablespace_Name
/
查询表上面的索引:
select index_name,index_type,table_name from user_indexes where table_name='';
//
查询索引的列:
select * from user_ind_columns where index_name=upper('IX_TB_WZ_IP_IP');
查询USER_INDEXES各字段详细信息
select column_name,comments from dict_columns where table_name='USER_INDEXES';
///
查询表中的索引及对应的列:
select user_ind_columns.index_name,user_ind_columns.column_name,user_ind_columns.column_position,user_indexes.uniqueness
from user_ind_columns,user_indexes where user_ind_columns.index_name = user_indexes.index_name
and user_ind_columns.table_name ='TB_WZ_IP';
select t.*,i.index_type from user_ind_columns t,user_indexes i where t.index_name = i.index_name and t.table_name = i.table_name and t.table_name='TB_WZ_IP';
///
查表空间定义:select dbms_metadata.get_ddl('TABLESPACE','&TABLESPACE') FROM DUAL;
查索引定义:select dbms_metadata.get_ddl('INDEX','&INDEX_NAME') FROM DUAL;
//
如何将查询结果插入到另一张结构相同的表
1.SQL 语句
INSERT INTO table_a( link ,homePageURL ,title ,describe ,cataID ,encode)
SELECT link,homePageURL,title,describe,cataID,encode
FROM table_b;
//
Insert into USER_B (ad_user_id,Value,name,manager_id)
Select ad_user_id,Value,name,manager_id from USER_A Where( manager_id =100001);
//
用法如下:
1.对表的说明
comment on table table_name is 'comments_on_tab_information';
2.对表中列的说明
comment on column table.column_name is 'comments_on_col_information';
3.查看表的说明
SQL> select * from user_tab_comments where TABLE_NAME='EMPLOYEES';
4.查看表中列的说明
SQL> select * from user_col_comments where TABLE_NAME='EMPLOYEES';
///
查询表上有多少分区
SELECT * FROM useR_TAB_PARTITIONS WHERE TABLE_NAME='tableName'
查询索引信息
select object_name,object_type,tablespace_name,sum(value)
from v$segment_statistics
where statistic_name IN ('physical reads','physical write','logical reads')and object_type='INDEX'
group by object_name,object_type,tablespace_name
order by 4 desc
//
--显示当前用户所有分区表的信息:
select * from USER_PART_TABLES
//
--显示当前用户所有分区表的详细分区信息:
select * from USER_TAB_PARTITIONS
//
--删除一个表的数据是
truncate table table_name;
--删除分区表一个分区的数据是
alter table table_name truncate partition p5;
///
回答者: 我是_王静 | 二级 | 2008-10-6 14:26
select * from dba_tables where tablespace_name='表空间名'
回答者: hotyxm | 九级 | 2008-10-6 14:37
9i
/
SQL> select * from v$logfile;(#日志文件路径)
///
查表空间定义:select dbms_metadata.get_ddl('TABLESPACE','&TABLESPACE') FROM DUAL;
查索引定义:select dbms_metadata.get_ddl('INDEX','&INDEX_NAME') FROM DUAL;
/
select *from all_tables where tablespace_name='USERS';
//查询该表空间下所有的表
//
select * from all_tables where table_name='TB_WZ_ALL_HELPER';
//查询表对应的表空间和所属用户
///
select default_tablespace from dba_users where username='SYSTEM';
查询用户默认表空间
//
select distinct(tablespace_name) from dba_tables;
select tablespace_name from user_tables;
///
select * from dba_data_files
查询表空间的信息(当前用户必须拥有DBA角色)。
select owner , object_name ,object_type from all_objects
查询某一用户下的所有表、过程、函数等信息。
///
select * from dba_tablespaces//怎么在sqlplus中查询表空间所有表信息
//
select table_name,tablespace_name from user_tables;
select table_name from user_tables;
/
select * from dba_data_files//产看表空间信息
select username,default_tablespace from dba_users;//查看用户默认的表空间
//
select * from dba_data_files
查询表空间的信息(当前用户必须拥有DBA角色)。
///
///
select * from USER_PART_TABLES
查看表的分区情况;
select OWNER, TABLE_NAME,PARTITION_NAME from dba_part_col_statistics
where TABLE_NAME='TB_WZ_ALL_HELPER';//查看表的分区情况;
select TABLE_OWNER,TABLE_NAME,PARTITION_NAME from dba_tab_partitions
where TABLE_NAME='TB_WZ_ALL_HELPER';//查看表的分区情况;
/
//
查看各个表空间占用磁盘情况.sql:
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
/
查询不区分大小写
你可以2边都用Upper或lower函数
select * from test_a
where upper(x)=upper('Abcdd);
//
查询所有表空间名
select tablespace_name from dba_tablespaces;
//
1、查询数据库中的表空间名称
1)查询所有表空间
select tablespace_name from dba_tablespaces;
select tablespace_name from user_tablespaces;
2)查询使用过的表空间
select distinct tablespace_name from dba_all_tables;
select distinct tablespace_name from user_all_tables;
2、查询表空间中所有表的名称
select table_name from dba_all_tables where tablespace_name = tablespacename
3、查询系统用户
select * from all_users
select * from dba_users
4、查看当前连接用户
select * from v$session
5、查看当前用户权限
select * from session_privs
6、查看所有的函数和存储过程
select * from user_source
其中TYPE包括:PROCEDURE、FUNCTION
7、查看表空间使用情况
select a.file_id "FileNo",
a.tablespace_name "表空间",
a.bytes "Bytes",
a.bytes - sum(nvl(b.bytes, 0)) "已用",
sum(nvl(b.bytes, 0)) "空闲",
sum(nvl(b.bytes, 0)) / a.bytes * 100 "空闲百分率"
from dba_data_files a, dba_free_space b
where a.file_id = b.file_id(+)
group by a.tablespace_name, a.file_id, a.bytes
order by a.tablespace_name;
http://www.cnblogs.com/ITGIS/articles/1763993.html //参考资料
查看当前用户每个表占用空间的大小:
Select Segment_Name,Sum(bytes)/1024/1024 From User_Extents Group By Segment_Name
查看每个表空间占用空间的大小:
Select Tablespace_Name,Sum(bytes)/1024/1024 From Dba_Segments Group By Tablespace_Name
/
查询表上面的索引:
select index_name,index_type,table_name from user_indexes where table_name='';
//
查询索引的列:
select * from user_ind_columns where index_name=upper('IX_TB_WZ_IP_IP');
查询USER_INDEXES各字段详细信息
select column_name,comments from dict_columns where table_name='USER_INDEXES';
///
查询表中的索引及对应的列:
select user_ind_columns.index_name,user_ind_columns.column_name,user_ind_columns.column_position,user_indexes.uniqueness
from user_ind_columns,user_indexes where user_ind_columns.index_name = user_indexes.index_name
and user_ind_columns.table_name ='TB_WZ_IP';
select t.*,i.index_type from user_ind_columns t,user_indexes i where t.index_name = i.index_name and t.table_name = i.table_name and t.table_name='TB_WZ_IP';
///
查表空间定义:select dbms_metadata.get_ddl('TABLESPACE','&TABLESPACE') FROM DUAL;
查索引定义:select dbms_metadata.get_ddl('INDEX','&INDEX_NAME') FROM DUAL;
//
如何将查询结果插入到另一张结构相同的表
1.SQL 语句
INSERT INTO table_a( link ,homePageURL ,title ,describe ,cataID ,encode)
SELECT link,homePageURL,title,describe,cataID,encode
FROM table_b;
//
Insert into USER_B (ad_user_id,Value,name,manager_id)
Select ad_user_id,Value,name,manager_id from USER_A Where( manager_id =100001);
//
用法如下:
1.对表的说明
comment on table table_name is 'comments_on_tab_information';
2.对表中列的说明
comment on column table.column_name is 'comments_on_col_information';
3.查看表的说明
SQL> select * from user_tab_comments where TABLE_NAME='EMPLOYEES';
4.查看表中列的说明
SQL> select * from user_col_comments where TABLE_NAME='EMPLOYEES';
///
查询表上有多少分区
SELECT * FROM useR_TAB_PARTITIONS WHERE TABLE_NAME='tableName'
查询索引信息
select object_name,object_type,tablespace_name,sum(value)
from v$segment_statistics
where statistic_name IN ('physical reads','physical write','logical reads')and object_type='INDEX'
group by object_name,object_type,tablespace_name
order by 4 desc
//
--显示当前用户所有分区表的信息:
select * from USER_PART_TABLES
//
--显示当前用户所有分区表的详细分区信息:
select * from USER_TAB_PARTITIONS
//
--删除一个表的数据是
truncate table table_name;
--删除分区表一个分区的数据是
alter table table_name truncate partition p5;
///