1、system登录查看所有表空间
SELECT * FROM dba_tablespaces;
2、当前登录用户所属表空间
select username,default_tablespace from user_users;
3、表空间文件地址
SELECT tablespace_name, file_name
FROM dba_data_files;
4、查询每个表空间大小
SELECT tablespace_name, ROUND(SUM(bytes) / 1024 / 1024, 2) AS "Size (MB)"
FROM dba_data_files
GROUP BY tablespace_name;
5、创建表空间
CREATE TABLESPACE TS_IP_DATA
DATAFILE 'D:\TOOL\ORACLE\ORADATA\ORCL\TS_IP_DATA.DBF'
SIZE 100M;
6、创建用户,并赋值表空间
CREATE USER IP IDENTIFIED BY Temp2020$Ip
DEFAULT TABLESPACE TS_IP_DATA
QUOTA unlimited ON TS_IP_DATA;
GRANT connect, resource TO IP;