First running out of space situation
1. Create a tablespace with few mega bytes and grant the user the quotas on it
create tablespace test datafile '+DATA(datafile)' SIZE 2m autoextend on next 1m maxsize 5m;2. Create a table in that tablespace
create table fult (a char(2000),b char(2000), c char(2000), d char(2000)) tablespace test;3. Run the following PL/SQL code. Above created tablespace ran out of space after inserting 248 rows. Inserting the 249th row raised an error
beginInserting the 249th
for i in 1 .. 248
loop
insert into fult values ('a'||i,'a'||i,'a'||i,'a'||i);
end loop;
end;
/
insert into fult values ('a','a','a','a')4. Add another datafile into the tablespace (assuming diskgroup is filled)
insert into fult values ('a','a','a','a')
*
ERROR at line 1:
ORA-01653: unable to extend table ASANGA.FULT by 128 in tablespace TEST
alter tablespace test add datafile '+flash(datafile)' SIZE 5m autoextend on next 1m maxsize 10m;After this step it will be possible to continue to add more rows.
Once new ASM disks are added move the newly created datafile from DATA ASM Disk group to FLASH Disk group.
5. List current datafiles in rman
RMAN> report schema;6. Take the datafile in FLASH diskgroup offline
using target database control file instead of recovery catalog
Report of database schema for database with db_unique_name RAC11G
List of Permanent Datafiles
===========================
File Size(MB) Tablespace RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1 730 SYSTEM *** +DATA/rac11g/datafile/system.256.720805879
2 980 SYSAUX *** +DATA/rac11g/datafile/sysaux.257.720805881
3 3365 UNDOTBS1 *** +DATA/rac11g/datafile/undotbs1.258.720805881
4 897 USERS *** +DATA/rac11g/datafile/users.259.720805881
5 100 REDUNTBS *** +DATA/rac11g/datafile/reduntbs.334.727582971
6 100 ASMBKP *** +DATA/rac11g/datafile/asmbkp.479.729141249
7 100 MSSM *** +DATA/rac11g/datafile/mssm.520.729490583
8 5 TEST *** +DATA/rac11g/datafile/test.618.741548757
9 7 TEST *** +FLASH/rac11g/datafile/test.266.741549549
SQL> alter database datafile '+FLASH/rac11g/datafile/test.266.741549549' offline;New rows cannot be inserted while the datafile is offline
Database altered.
SQL> insert into fult values ('a','a','a','a');7. Create a copy of the datafile
insert into fult values ('a','a','a','a')
*
ERROR at line 1:
ORA-00376: file 7 cannot be read at this time
ORA-01110: data file 9: +FLASH/rac11g/datafile/test.266.741549549'
RMAN> copy datafile '+FLASH/rac11g/datafile/test.266.741549549' to '+DATA';8. Rename the datafile to the newly created copy
Starting backup at 27-Jan-2011 18:02:55
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=138 instance=rac11g1 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00009 name=+FLASH/rac11g/datafile/test.266.741549549
output file name=+DATA/rac11g/datafile/test.609.741549777 tag=TAG20110127T180255 RECID=1 STAMP=741549777
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 27-Jan-2011 18:02:57
SQL> alter database rename file '+FLASH/rac11g/datafile/test.266.741549549' to '+DATA/rac11g/datafile/test.609.741549777';9. Switch to the copy and recover the datafile
Database altered.
RMAN> switch datafile '+DATA/rac11g/datafile/test.609.741549777' to copy;10. Bring the datafile online
datafile 9 switched to datafile copy "+DATA/rac11g/datafile/test.609.741549777"
RMAN> recover datafile 9;
SQL> alter database datafile '+DATA/rac11g/datafile/test.609.741549777' online;11. After this new rows could be inserted
Database altered.
SQL> insert into fult values ('a','a','a','a');12.The old datafile (one creatd in flash group is no longer part of the tablespace).
1 row created.
RMAN> report schema;Datafile in the flash diskgroup is automatically removed.
using target database control file instead of recovery catalog
Report of database schema for database with db_unique_name RAC11G
List of Permanent Datafiles
===========================
File Size(MB) Tablespace RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1 730 SYSTEM *** +DATA/rac11g/datafile/system.256.720805879
2 980 SYSAUX *** +DATA/rac11g/datafile/sysaux.257.720805881
3 3365 UNDOTBS1 *** +DATA/rac11g/datafile/undotbs1.258.720805881
4 897 USERS *** +DATA/rac11g/datafile/users.259.720805881
5 100 REDUNTBS *** +DATA/rac11g/datafile/reduntbs.334.727582971
6 100 ASMBKP *** +DATA/rac11g/datafile/asmbkp.479.729141249
7 100 MSSM *** +DATA/rac11g/datafile/mssm.520.729490583
8 5 TEST *** +DATA/rac11g/datafile/test.618.741548757
9 7 TEST *** +DATA/rac11g/datafile/test.609.741549777
SQL> select d.name dname,t.name tname from v$datafile d, v$tablespace t where d.ts#=t.ts#;
Datafile Name Tablespace
--------------------------------------------- -----------
+DATA/rac11g/datafile/system.256.720805879 SYSTEM
+DATA/rac11g/datafile/sysaux.257.720805881 SYSAUX
+DATA/rac11g/datafile/undotbs1.258.720805881 UNDOTBS1
+DATA/rac11g/datafile/users.259.720805881 USERS
+DATA/rac11g/datafile/reduntbs.334.727582971 REDUNTBS
+DATA/rac11g/datafile/asmbkp.479.729141249 ASMBKP
+DATA/rac11g/datafile/mssm.520.729490583 MSSM
+DATA/rac11g/datafile/test.618.741548757 TEST
+DATA/rac11g/datafile/test.609.741549777 TEST