Oracle new user and create table space

-View table space utilization

SELECT a.tablespace_name "tablespace name",

Round(total / 1024/1024 / 1024, 2) "table space size",

Round(free / 1024/1024 / 1024, 2) "Remaining table space size",

Round((total-free) / 1024/1024 / 1024, 2) "Table space usage size",

Round((total-free) / total, 4) * 100 "Utilization rate%"

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

order by 5 desc;

--Expand the system table space

alter database datafile '/oracle/app/oradata/mytablespace/my_01.dbf' resize 256M;

-Create a new table space

CREATE TABLESPACE TBS_XYZX DATAFILE '/data/oracle/oradata/dtc/xyzx01.dbf' SIZE 20480M;

-Expand the size of the table space

alter tablespace TBS_XYZX add datafile '/data/oracle/oradata/dtc/xyzx02.dbf' size 20480m;

--Create a new user

CREATE USER xyzx IDENTIFIED BY "pass$123" DEFAULT TABLESPACE TBS_XYZX;

--Authorization

GRANT CONNECT,RESOURCE TO xyzx;

grant select on xyzx.nce_gr_grjbxx_js to username;

Guess you like

Origin blog.csdn.net/Aaron_ch/article/details/113007309