how to drop and recreate undo tablespace in oracle 11g
/dev/mapper/vg_root-lv_oracle 6.8G 6.3G 155M 98% /u01
[root@oracle-db-server11 XE]# pwd
/u01/app/oracle/oradata/XE
[root@oracle-db-server11 XE]# ls -ltrh
total 4.8G
-rw-r-----. 1 oracle dba 21M Sep 6 00:23 temp.dbf
-rw-r-----. 1 oracle dba 581M Sep 6 04:25 system.dbf
-rw-r-----. 1 oracle dba 101M Sep 6 04:25 users.dbf
-rw-r-----. 1 oracle dba 791M Sep 6 04:30 sysaux.dbf
-rw-r-----. 1 oracle dba 3.3G Sep 6 04:32 undotbs1.dbf
-rw-r-----. 1 oracle dba 9.4M Sep 6 04:33 control.dbf
SQL> drop tablespace UNDOTBS1 including contents and datafiles;
drop tablespace UNDOTBS1 including contents and datafiles
*
ERROR at line 1:
ORA-30013: undo tablespace 'UNDOTBS1' is currently in use
SQL> select tablespace_name,file_name from dba_data_files;
TABLESPACE_NAME
------------------------------
FILE_NAME
--------------------------------------------------------------------------------
USERS
/u01/app/oracle/oradata/XE/users.dbf
SYSAUX
/u01/app/oracle/oradata/XE/sysaux.dbf
UNDOTBS1
/u01/app/oracle/oradata/XE/undotbs1.dbf
SQL> alter tablespace undotbs1 offline;
alter tablespace undotbs1 offline
*
ERROR at line 1:
ORA-30042: Cannot offline the undo tablespace
SQL> create undo tablespace undotbs2 datafile '/u01/app/oracle/oradata/XE/undotbs2.dbf' size 100M;
Tablespace created.
SQL> alter system set undo_tablespace=undotbs2;
System altered.
SQL> alter system set undo_management=MANUAL scope=spfile;
System altered.
SQL> exit
Disconnected from Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
[root@oracle-db-server11 XE]# /etc/init.d/oracle-xe stop
Stopping oracle-xe (via systemctl): [ OK ]
[root@oracle-db-server11 XE]# /etc/init.d/oracle-xe start
Starting oracle-xe (via systemctl): [ OK ]
[root@oracle-db-server11 XE]# sqlplus system/oracle@xe;
SQL*Plus: Release 11.2.0.2.0 Production on Wed Sep 6 05:12:15 2017
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
SQL> show parameter undo_tablespace;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
undo_tablespace string UNDOTBS2
SQL> select owner, segment_name, tablespace_name, status from dba_rollback_segs order by 3;
OWNER SEGMENT_NAME TABLESPACE_NAME
------ ------------------------------ ------------------------------
STATUS
----------------
SYS SYSTEM SYSTEM
ONLINE
PUBLIC _SYSSMU10_2569484742$ UNDOTBS1
OFFLINE
PUBLIC _SYSSMU1_3789641169$ UNDOTBS1
OFFLINE
If any one the above segment is online then change it to offline
SQL>alter rollback segment "_SYSSMU10_2569484742$" offline;
Now Drop
SQL> drop tablespace UNDOTBS1 including contents and datafiles;
Tablespace dropped.
SQL> exit
/dev/mapper/vg_root-lv_oracle 6.8G 6.3G 155M 98% /u01
[root@oracle-db-server11 XE]# pwd
/u01/app/oracle/oradata/XE
[root@oracle-db-server11 XE]# ls -ltrh
total 4.8G
-rw-r-----. 1 oracle dba 21M Sep 6 00:23 temp.dbf
-rw-r-----. 1 oracle dba 581M Sep 6 04:25 system.dbf
-rw-r-----. 1 oracle dba 101M Sep 6 04:25 users.dbf
-rw-r-----. 1 oracle dba 791M Sep 6 04:30 sysaux.dbf
-rw-r-----. 1 oracle dba 3.3G Sep 6 04:32 undotbs1.dbf
-rw-r-----. 1 oracle dba 9.4M Sep 6 04:33 control.dbf
SQL> drop tablespace UNDOTBS1 including contents and datafiles;
drop tablespace UNDOTBS1 including contents and datafiles
*
ERROR at line 1:
ORA-30013: undo tablespace 'UNDOTBS1' is currently in use
SQL> select tablespace_name,file_name from dba_data_files;
TABLESPACE_NAME
------------------------------
FILE_NAME
--------------------------------------------------------------------------------
USERS
/u01/app/oracle/oradata/XE/users.dbf
SYSAUX
/u01/app/oracle/oradata/XE/sysaux.dbf
UNDOTBS1
/u01/app/oracle/oradata/XE/undotbs1.dbf
SQL> alter tablespace undotbs1 offline;
alter tablespace undotbs1 offline
*
ERROR at line 1:
ORA-30042: Cannot offline the undo tablespace
SQL> create undo tablespace undotbs2 datafile '/u01/app/oracle/oradata/XE/undotbs2.dbf' size 100M;
Tablespace created.
SQL> alter system set undo_tablespace=undotbs2;
System altered.
SQL> alter system set undo_management=MANUAL scope=spfile;
System altered.
SQL> exit
Disconnected from Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
[root@oracle-db-server11 XE]# /etc/init.d/oracle-xe stop
Stopping oracle-xe (via systemctl): [ OK ]
[root@oracle-db-server11 XE]# /etc/init.d/oracle-xe start
Starting oracle-xe (via systemctl): [ OK ]
[root@oracle-db-server11 XE]# sqlplus system/oracle@xe;
SQL*Plus: Release 11.2.0.2.0 Production on Wed Sep 6 05:12:15 2017
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
SQL> show parameter undo_tablespace;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
undo_tablespace string UNDOTBS2
SQL> select owner, segment_name, tablespace_name, status from dba_rollback_segs order by 3;
OWNER SEGMENT_NAME TABLESPACE_NAME
------ ------------------------------ ------------------------------
STATUS
----------------
SYS SYSTEM SYSTEM
ONLINE
PUBLIC _SYSSMU10_2569484742$ UNDOTBS1
OFFLINE
PUBLIC _SYSSMU1_3789641169$ UNDOTBS1
OFFLINE
If any one the above segment is online then change it to offline
SQL>alter rollback segment "_SYSSMU10_2569484742$" offline;
Now Drop
SQL> drop tablespace UNDOTBS1 including contents and datafiles;
Tablespace dropped.
SQL> exit
No comments:
Post a Comment