暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

查看DM数据库系统信息

原创 Hua 2022-10-11
1232

1. 查看表空间物理文件的名称及大小

select tablespace_name,
       file_id,
       file_name,
       round(bytes / (1024 * 1024), 0) filesize
  from dba_data_files
 order by tablespace_name;

2. 查询表空间使用情况

select a.tablespace_name "表空间名称",

       100 - round((nvl(b.bytes_free, 0) / a.bytes_alloc) * 100, 2) "占用率(%)",

       round(a.bytes_alloc / 1024 / 1024, 2) "容量(M)",

       round(nvl(b.bytes_free, 0) / 1024 / 1024, 2) "空闲(M)",

       round((a.bytes_alloc - nvl(b.bytes_free, 0)) / 1024 / 1024, 2) "使用(M)",

       to_char(sysdate, 'yyyy-mm-dd hh24:mi:ss') "采样时间"

  from (select f.tablespace_name,

               sum(f.bytes) bytes_alloc,

               sum(decode(f.autoextensible, 'YES', f.maxbytes, 'NO', f.bytes)) maxbytes

          from dba_data_files f

         group by tablespace_name) a,

       (select f.tablespace_name, sum(f.bytes) bytes_free

          from dba_free_space f

         group by tablespace_name) b

 where a.tablespace_name = b.tablespace_name

 order by 2 desc;

3. 查看日志文件

select * from v$rlogfile;

4.  查看数据库对象

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

  from all_objects

 group by owner, object_type, status;

5.  查看数据库的版本

Select *  FROM v$version;

6. 查看字符集 

返回建库时,指定的字符集。返回值:0 表示 GB18030,1 表示 UTF-8。

SELECT SF_GET_UNICODE_FLAG ();

7. 在某个用户下找所有的索引 

select user_indexes.table_name,
       user_indexes.index_name,
       uniqueness,
       column_name
  from user_ind_columns, user_indexes
 where user_ind_columns.index_name = user_indexes.index_name
   and user_ind_columns.table_name = user_indexes.table_name
 order by user_indexes.table_type,
          user_indexes.table_name,
          user_indexes.index_name,
          column_position;

8. 查看数据库的创建日期和归档方式

select create_time,arch_mode from v$database;

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论