0% found this document useful (0 votes)
13 views

SQL NOTE

Query sql

Uploaded by

aribrabbani2
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

SQL NOTE

Query sql

Uploaded by

aribrabbani2
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

SELECT

tablespace_name,
ROUND((bytes_used / bytes_total) * 100, 2) AS "Utilization (%)",
ROUND(bytes_used / 1024 / 1024, 2) AS "Used (MB)",
ROUND(bytes_total / 1024 / 1024, 2) AS "Total (MB)"
FROM (
SELECT
tablespace_name,
SUM(bytes_used) AS bytes_used,
SUM(bytes_total) AS bytes_total
FROM (
SELECT
tablespace_name,
DECODE(autoextensible, 'YES', bytes_max, bytes) AS bytes_total,
bytes_used
FROM (
SELECT
tablespace_name,
bytes,
CASE WHEN autoextensible = 'YES' THEN maxbytes ELSE bytes END AS
bytes_max,
SUM(bytes_cached) AS bytes_used
FROM
v$tempseg_usage
GROUP BY
tablespace_name, bytes, maxbytes, autoextensible
)
)
GROUP BY
tablespace_name
);

SQL> grant CONNECT to ;

Grant succeeded.

SQL> grant RESOURCE to ;

Grant succeeded.

SQL> grant QUERY REWRITE to ;

Grant succeeded.

SQL> grant CREATE SEQUENCE to ;

Grant succeeded.

SQL> grant SELECT ANY to ;

Grant succeeded.

SQL> grant UNLIMITED TABLESPACE to ;

Grant succeeded.

SQL> grant CREATE VIEW to ;

Grant succeeded.

You might also like