Каталог статей
Меню сайта


Форма входа


Категории раздела
Oracle DB administering [46]
Oracle DB programming [15]
Oracle DB troubleshooting [11]


Поиск


Друзья сайта
  • Официальный блог
  • Сообщество uCoz
  • FAQ по системе
  • Инструкции для uCoz


  • Статистика

    Онлайн всего: 1
    Гостей: 1
    Пользователей: 0


    Приветствую Вас, Гость · RSS 20.05.2024, 07:01
    Главная » Статьи » Oracle DB » Oracle DB administering

    Monitoring tablespaces usage

          select distinct
            tablespace_name key_value,
            free_bytes_in_ts attribute1,
            total_bytes_in_ts attribute2,
            round( free_bytes_in_ts / total_bytes_in_ts * 100) attribute3,
            null attribute4,
            null attribute5
          from
          (
          select
            df.tablespace_name,
            df.file_name,  
            sum(NVL(fs.bytes, 0) ) free_bytes_in_file,
            df.bytes total_bytes_in_file,
            sum(sum(NVL(fs.bytes, 0) ) ) over (partition by df.tablespace_name) free_bytes_in_ts,
            sum(NVL(df.bytes, 0) ) over (partition by df.tablespace_name) total_bytes_in_ts--,
          from
            dba_free_space fs,
            dba_data_files df,
            dba_tablespaces ts
          where
            fs.file_id (+) = df.file_id  
            and fs.tablespace_name = ts.tablespace_name
            and ts.contents != 'UNDO'
          group by
            df.tablespace_name,
            df.file_name,
            df.bytes
          )
          union all
          select
            tablespace_name key_value,
            (free_bytes_in_ts + expired_bytes_in_ts) attribute1,
            total_bytes_in_ts attribute2,
            round( (free_bytes_in_ts + expired_bytes_in_ts) / total_bytes_in_ts * 100) attribute3,
            null attribute4,
            null attribute5
          from
            (
              select
                ts.tablespace_name,
                (select sum(bytes) from dba_free_space fs
                 where fs.tablespace_name = ts.tablespace_name)  free_bytes_in_ts,
                (select sum(bytes) from dba_undo_extents ue
                 where ue.tablespace_name = ts.tablespace_name
                   and status = 'EXPIRED') expired_bytes_in_ts,
                (select sum(bytes) from dba_data_files
                 where tablespace_name = ts.tablespace_name) total_bytes_in_ts
              from
                dba_tablespaces ts
              where
                ts.contents = 'UNDO'
            )
          order by
            key_value;

     

    Категория: Oracle DB administering | Добавил: basil (13.08.2015)
    Просмотров: 459 | Рейтинг: 0.0/0
    Всего комментариев: 0
    Имя *:
    Email *:
    Код *:
    Бесплатный конструктор сайтов - uCoz