Wednesday, October 7, 2015

Create and drop tablespace on oracle database

Create tablespace name: TBSPACENAME

CREATE TABLESPACE TBSPACENAME DATAFILE
  'D:\ORADB\DBNAME\DATAFILE_01.DBF' SIZE 500K AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED,
  'D:\ORADB\DBNAME\DATAFILE_02.DBF' SIZE 500K AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED
LOGGING
ONLINE
EXTENT MANAGEMENT LOCAL AUTOALLOCATE
BLOCKSIZE 8K
SEGMENT SPACE MANAGEMENT MANUAL
FLASHBACK OFF;



Command drop tablespace

DROP TABLESPACE TBSPACENAME INCLUDING CONTENTS AND DATAFILES;

This code will delete all datafiles under tablespace 'TBSPACENAME'.
 
Note: Before drop tablespace, you must to drop username that map to this first.

No comments:

Post a Comment