Basic Oracle Concepts and Programming Question:
Download Job Interview Questions and Answers PDF
How To Rename a Tablespace in Oracle?
Answer:
You can easily rename a tablespace by using the ALTER TABLESPACE ... RENAME TO statement as shown in the example below:
SQL> CREATE TABLESPACE my_space
2 DATAFILE '/temp/my_space.dbf' SIZE 10M;
Tablespace created.
SQL> ALTER TABLESPACE my_space RENAME TO your_space;
Tablespace created.
SQL> SELECT TABLESPACE_NAME, STATUS, CONTENTS
2 FROM USER_TABLESPACES;
<pre>NAME STATUS CONTENTS
---------------- --------------- ---------
SYSTEM ONLINE PERMANENT
UNDO ONLINE UNDO
SYSAUX ONLINE PERMANENT
TEMP ONLINE TEMPORARY
USERS ONLINE PERMANENT
YOUR_SPACE ONLINE PERMANENT</pre>
SQL> CREATE TABLESPACE my_space
2 DATAFILE '/temp/my_space.dbf' SIZE 10M;
Tablespace created.
SQL> ALTER TABLESPACE my_space RENAME TO your_space;
Tablespace created.
SQL> SELECT TABLESPACE_NAME, STATUS, CONTENTS
2 FROM USER_TABLESPACES;
<pre>NAME STATUS CONTENTS
---------------- --------------- ---------
SYSTEM ONLINE PERMANENT
UNDO ONLINE UNDO
SYSAUX ONLINE PERMANENT
TEMP ONLINE TEMPORARY
USERS ONLINE PERMANENT
YOUR_SPACE ONLINE PERMANENT</pre>
Download Oracle Database Interview Questions And Answers
PDF
Previous Question | Next Question |
How To Create a New Tablespace in Oracle? | How To Drop a Tablespace? |