oracle表空间的事情状况要经常查看,一般空闲比例过低的时候就应该考虑增大表看空间了。查看方法如下SQL:
方法一:
select dbftablespace_name,
dbftotalspace "总量(M)",
dbftotalblocks as 总块数,
dfsfreespace "剩余总量(M)",
dfsfreeblocks "剩余块数",
(dfsfreespace / dbftotalspace) 100 "空闲比例"
from (select ttablespace_name,
sum(tbytes) / 1024 / 1024 totalspace,
sum(tblocks) totalblocks
from dba_data_files t
group by ttablespace_name) dbf,
(select tttablespace_name,
sum(ttbytes) / 1024 / 1024 freespace,
sum(ttblocks) freeblocks
from dba_free_space tt
group by tttablespace_name) dfs
where trim(dbftablespace_name) = trim(dfstablespace_name)
方法二:
SELECT Totalname "Tablespace Name",
Free_space, (total_space-Free_space) Used_space, total_space
FROM
(select tablespace_name, sum(bytes/1024/1024) Free_Space
from sysdba_free_space
group by tablespace_name
) Free,
(select bname, sum(bytes/1024/1024) TOTAL_SPACE
from sysv_$datafile a, sysv_$tablespace B
where ats# = bts#
group by bname
) Total
WHERE FreeTablespace_name = Totalname
当发现有的表空间不够的错误时,处理如下:
1:找出该表空间对应的数据文件及路径
select from dba_data_files t
where ttablespace_name = 'ARD'
2:增大数据文件
alter database datafile '全路径的数据文件名称' resize M
3:增加数据文件
alter tablespace 表空间名称
add datafile '全路径的数据文件名称' M
注解:表空间尽量让free百分比保持在10%以上,如果低于10%就增加datafile或者resizedatafile,一般数据文件不要超过2G
select from all_tab_comments
-- 查询所有用户的表,视图等
select from user_tab_comments
-- 查询本用户的表,视图等
select from all_col_comments
--查询所有用户的表的列名和注释
select from user_col_comments
-- 查询本用户的表的列名和注释
select from all_tab_columns
--查询所有用户的表的列名等信息(详细但是没有备注)
select from user_tab_columns
--查询本用户的表的列名等信息(详细但是没有备注)
--一般使用1:
select ttable_name,tcomments from user_tab_comments t
--一般使用2:
select r1, r2, r3, r5
from (select atable_name r1, acolumn_name r2, acomments r3
from user_col_comments a),
(select ttable_name r4, tcomments r5 from user_tab_comments t)
where r4 = r1
方法和详细的 *** 作步骤如下:
1、第一步,
MySQL数据库使用特定字段查询所有表名,代码见下图,转到下面的步骤。
2、第二步,执行完上面的 *** 作之后,Oracle数据库使用特定字段查询所有表名,代码见下图,转到下面的步骤。
3、第三步,执行完上面的 *** 作之后,SQLServer数据库使用特定字段查询所有表名,代码见下图,转到下面的步骤。
4、第四步,执行完上面的 *** 作之后, *** 作完成,见下图。这样,就解决了这个问题了。
select from user_tables --查询当前用户所拥有的表
select from all_tables --查询当前用户能访问的表
select from dba_tables --拥有DBA权限用户能查询所有的表
以上就是关于如何查看oracle数据库中的表空间全部的内容,包括:如何查看oracle数据库中的表空间、如何查看oracle数据库所有表、oracle里查出某个数据库里的所有表名等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)