增加ORACLE表空间操作

2019-11-19  本文已影响0人  Kicky_1c69
SELECT
    username,
    default_tablespace,
    temporary_tablespace
FROM
    dba_users;
SELECT
    tablespace_name,
    file_id,
    file_name,
    ROUND (bytes /(1024 * 1024), 0) total_space
FROM
    dba_data_files
ORDER BY
    tablespace_name;
SELECT
    A .tablespace_name "表空间名",
    total "表空间大小",
    free "表空间剩余大小",
    (total - free) "表空间使用大小",
    total / (1024 * 1024 * 1024) "表空间大小(G)",
    free / (1024 * 1024 * 1024) "表空间剩余大小(G)",
    (total - free) / (1024 * 1024 * 1024) "表空间使用大小(G)",
    ROUND ((total - free) / total, 4) * 100 "使用率 %"
FROM
    (
        SELECT
            tablespace_name,
            SUM (bytes) free
        FROM
            dba_free_space
        GROUP BY
            tablespace_name
    ) A,
    (
        SELECT
            tablespace_name,
            SUM (bytes) total
        FROM
            dba_data_files
        GROUP BY
            tablespace_name
    ) b
WHERE
    A .tablespace_name = b.tablespace_name;
ALTER DATABASE DATAFILE '/home/oracle/app/oracle/oradata/ORA11G/system01.dbf' RESIZE 3000m;
上一篇下一篇

猜你喜欢

热点阅读