Check the table space path and size:
select tablespace_name,file_id,bytes/1024/1024 兆,file_name from dba_data_files order by file_id;
Create tablespace:
create tablespace spacename datafile '/opt/oracle/app/oradata/orcl/spacename .dbf'size 200m autoextend on next 32m maxsize 2048m;
Create user:
create user username identified by userpassword default tablespace spacename ;
Authorized User:
grant connect,resource,dba to username ;
Drop the tablespace and delete the datafiles at the same time:
drop tablespace test_data ;
Deleting data files including contents and datafiles should be used with caution.
Move the table to another tablespace:
select 'alter table '||tname||' move tablespace hebeihotel;' from tab ;
Moving the table to another tablespace will make the index unavailable:
Find the index under the user:
select * from user_indexes ui where ui.table_owner='username';
index rebuild
Rebuild with index status as unusable:
select 'alter index HEBEIHOTEL.'||index_name||' rebuild' abc from user_indexes where status='UNUSABLE'
turn the search results into rows,
select replace(wm_concat(t.abc),',',';') from
(
select 'alter index HEBEIHOTEL.'||index_name||' rebuild' abc from user_indexes where status='UNUSABLE'
)t;
Then copy it into editplus and replace all ; with regular expressions with ;\n
It is convenient to run all directly in oracle.
Find the tablespace name, size, free space, and file path.
select b.file_id file ID number,
b.tablespace_name tablespace name,
b.bytes / 1024 / 1024 || 'M' number of bytes,
(b.bytes - sum(nvl(a.bytes, 0))) / 1024 / 1024 || 'M' used,
sum(nvl(a.bytes, 0)) / 1024 / 1024 || 'M' free space,
100 - sum(nvl(a.bytes, 0)) / (b. bytes) * 100 occupancy percentage,
b.file_name file path
from dba_free_space a, dba_data_files b
where a.file_id = b.file_id
group by b.tablespace_name, b.file_id, b.bytes,b.file_name
order by b.file_id;