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

<< lastnext >>

Snippet Name: TABLESPACE: Alter Permanent Tablespace

Description: Various examples of manipulating permanent tablespace settings.

Also see:
» TABLESPACE: Show contiguous space
» TABLESPACE: SYSAUX tablespace
» TABLESPACE: Tablespace management
» TABLESPACE: List tablespaces, files, ...
» TABLESPACE: Dropping Tablespaces
» 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

-- Add Datafile: 
ALTER TABLESPACE ADD DATAFILE <file_name>,
<integer><K | M | G | T>
[REUSE]
<autoextend> <ON | OFF>
NEXT <integer><K | M | G | T>
MAXSIZE <integer><K | M | G | T | UNLIMITED>
ALTER TABLESPACE tspace ADD DATAFILE
'/u02/oracle/oradata/sales_data.dbf' SIZE 25M
AUTOEXTEND OFF;
 
ALTER TABLESPACE tspace ADD ADD DATAFILE
'c:\oracle\product\oradata\testbed.dat' SIZE 10M
AUTOEXTEND ON;
 
 
-- take offline: 
ALTER TABLESPACE <tablespace_name> OFFLINE;
ALTER TABLESPACE tspace OFFLINE;
 
-- put on-line: 
ALTER TABLESPACE <tablespace_name> ONLINE;
ALTER TABLESPACE tspace ONLINE;
 
-- make tablespace read only: 
ALTER TABLESPACE <tablespace_name> READ ONLY;
ALTER TABLESPACE tspace READ ONLY;
 
SELECT tablespace_name, status
FROM dba_tablespaces;
 
-- Note that READ ONLY prevents DML but does not 
-- include DDL using DROP and TRUNCATE!
 
 
-- make a tablespace read/write: 
ALTER TABLESPACE <tablespace_name> READ WRITE;
ALTER TABLESPACE tspace READ WRITE;
 
SELECT tablespace_name, status
FROM dba_tablespaces;
 
 
-- prepare tablespace for backup:  
ALTER TABLESPACE <tablespace_name> BEGIN BACKUP;
ALTER TABLESPACE tspace BEGIN BACKUP;
END Tablespace Backup ALTER TABLESPACE <tablespace_name> END BACKUP;
ALTER TABLESPACE tspace END BACKUP;
 
-- rename tablespace: 
ALTER TABLESPACE <tablespace_name> RENAME TO <new_tablespace_name>;
SELECT tablespace_name
FROM dba_tablespaces;
 
SELECT table_name
FROM dba_tables
WHERE tablespace_name = 'SALES';
 
ALTER TABLESPACE sales RENAME TO sales_data;
 
SELECT tablespace_name
FROM dba_tablespaces;
 
SELECT table_name
FROM dba_tables
WHERE tablespace_name = 'SALES_DATA';
 


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 63 users online    © 2009 psoug.org

PSOUG LOGIN
Username: 
Password: 
Forgot your password?