Oracle 常用命令
--连接数据库:
sqlplus / as sysdba
sqlplus 用户名/密码@数据库名 as sysdba
--连远程主机的数据库:
sqlplus 用户名/密码@IP地址/数据库名称 as sysdba
--改行宽度
set linesize 2000;
--改行数
set pagesize 1000;
--1、查看表空间的名称及大小
SELECT t.tablespace_name, round(SUM(bytes / (1024 * 1024)), 0) ts_size
FROM dba_tablespaces t, dba_data_files d
WHERE t.tablespace_name = d.tablespace_name
GROUP BY t.tablespace_name;
--6、查看表空间的使用情况
SELECT SUM(bytes) / (1024 * 1024) AS free_space, tablespace_name
FROM dba_free_space
GROUP BY tablespace_name;
SELECT a.tablespace_name,
a.bytes total,
b.bytes used,
c.bytes free,
(b.bytes * 100) / a.bytes "% USED ",
(c.bytes * 100) / a.bytes "% FREE "
FROM sys.sm$ts_avail a, sys.sm$ts_used b, sys.sm$ts_free c
WHERE a.tablespace_name = b.tablespace_name
AND a.tablespace_name = c.tablespace_name;
来源:https://www.cnblogs.com/flash100/p/12400919.html