Quick Search:
CODE
Oracle PL/SQL Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
 Oracle PL/SQL: TABLESPACE: Dropping Tablespaces Jump to:  
Category: >> Oracle PL/SQL >> TABLESPACE: Dropping Tablespaces Bookmark and Share

<< lastnext >>

Snippet Name: TABLESPACE: Dropping Tablespaces

Description: Example syntax and procedures for dropping tablespaces, including tablespaces where there are referential constraints in effect.

Also see:
» TABLESPACE: Show contiguous space
» TABLESPACE: SYSAUX tablespace
» TABLESPACE: Tablespace management
» TABLESPACE: List tablespaces, files, ...
» TABLESPACE: Alter Permanent Tablespace
» TABLESPACE: Transportable tablespaces
» TABLESPACE: Tempfile operations
» TABLESPACE: Create temp tablespace
» TABLESPACE: Change UNDO tablespace
» TABLESPACE: Undo Tablespace
» TABLESPACE: SYSAUX Tablespace
» TABLESPACE: Set default tablespace type
» TABLESPACE: Oracle Managed Auto-extend...
» TABLESPACE: Permanent Tablespace Using...
» TABLESPACE: Using Raw Devices
» TABLESPACE: permanent tablespace

Comment: (none)

Language: PL/SQL
Highlight Mode: PLSQL
Last Modified: March 12th, 2009

-- drop tablespace: 
DROP TABLESPACE <tablespace_name>;
DROP TABLESPACE tspace;
 
-- drop tablespace including contents: 
DROP TABLESPACE <tablespace_name>
INCLUDING CONTENTS;
DROP TABLESPACE tspace INCLUDING CONTENTS;
 
-- drop tablespace including contents & datafiles:      
DROP TABLESPACE <tablespace_name>
INCLUDING CONTENTS AND DATAFILES;
DROP TABLESPACE tspace INCLUDING CONTENTS AND DATAFILES;
 
-- drop tablespace including contents & datafiles 
-- where referential constraints exist:     
DROP TABLESPACE <tablespace_name> INCLUDING CONTENTS AND DATAFILES
CASCADE CONSTRAINTS;
DROP TABLESPACE tspace INCLUDING CONTENTS AND DATAFILES CASCADE CONSTRAINTS;
 
-- drop tablespace after datafile was accidentally dropped: 
conn / AS sysdba
 
CREATE TABLESPACE testbed
DATAFILE 'c:\temp\testbed.dbf' SIZE 10M
BLOCKSIZE 4096
EXTENT MANAGEMENT LOCAL UNIFORM SIZE 512K
SEGMENT SPACE MANAGEMENT AUTO
ONLINE;
 
SELECT tablespace_name
FROM dba_tablespaces;
 
SELECT file_name
FROM dba_data_files;
 
shutdown IMMEDIATE;
 
-- drop the file c:\temp\testbed.dbf
 
startup
 
-- record the error message
 
shutdown IMMEDIATE;
startup mount;
ALTER database datafile 'c:\temp\testbed.dbf' offline DROP;
ALTER database OPEN;
 
SELECT tablespace_name
FROM dba_tablespaces;
 
SELECT file_name
FROM dba_data_files;
 
DROP tablespace testbed including contents;
 
SELECT tablespace_name
FROM dba_tablespaces;
 
SELECT file_name
FROM dba_data_files;


Free
Oracle Magazine
Subscriptions
and Oracle White Papers


SQL University.net courses meet the most demanding needs of the business world for advanced education in a cost-effective manner. SQL University.net courses are available immediately for IT professionals and can be taken without disruption of your workplace schedule or processes.

Compared to traditional travel-based training, SQL University.net saves time and valuable corporate resources, allowing companies to do more with less. That's our mission, and that's what we deliver.

Click here to find out more
 
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 199 users online    © 2009 psoug.org

PSOUG LOGIN
Username: 
Password: 
Forgot your password?