Creating Managing Droping Oracle Database Tablespaces

Опубликовано: 18 Январь 2025
на канале: Abbasi Asif
27,065
142

Creating Managing Droping Oracle Database Tablespaces

select tablespace_name,block_size,status,contents,logging from dba_tablespaces;
create tablespace mytbs datafile 'd:\oradata\dbrdbms\mytbs01.dbf' size 10m;
alter tablespace mytbs add datafile 'd:\oradata\dbrdbms\mytbs02.dbf' size 10m;
alter tablespace mytbs drop datafile 'd:\oradata\dbrdbms\mytbs02.dbf';

desc v$datafile;
desc ts#,name from v$datafile;
select ts#,name from v$tablespace;
select v$datafile.ts#,v$datafile.name,v$tablespace.name from v$datafile,v$tablespace where v$datafile.ts#=v$tablespace.ts#
and v$tablespace.name='MYTBS';
alter database datafile 'd:\oradata\dbrdbms\mytbs01.dbf' resize 20m;
ALTER DATABASE DEFAULT TABLESPACE mytbs;

select ts#,name from v$tablespace;
select ts#,name from v$datafile;
select ts#,name from v$tablespace;

drop tablespace mytbs;
drop tablespace mytbs ialtncluding contents and datafiles;
drop tablespace mytbs including contents and datafiles cascade;

alter tablespace mytbs read only;
alter tablespace mytbs read write;

alter tablespace mytbs force logging;
alter tablespace mytbs nologging;

alter tablespace mytbs flashback on;
alter tablespace mytbs flashback off;

purge tablespace mytbs user myuser;