Missing datafile while clone

*** This is unsupported scenraio**********Please use it at your own risk****May work only if INDEX datafile is missing while clone.

If you clone from a hot/cold backup and by mistake you miss a datafile and you have already done 'alter database open resetlogs' , Then in order to bring the missing datafile you need to copy all data files again.

What you can do it you can list the objects in the datafile and then recreate the objects.

** This is UNsupported scneraion*** but a possible scenario****

Suppose datafile is missing from WIPX tablespace.
check for the missing datafile.

SQL> select file_name from dba_data_files where tablespace_name='WIPX';

FILE_NAME
--------------------------------------------------------------------------------
/dbdata/data2/wipx05.dbf
/dbdata/data2/wipx03.dbf
/dbdata/data2/wipx01.dbf
/dbdata/data2/wipx04.dbf
/dbdata/data1/wipx07.dbf
/dbdata/data1/wipx02.dbf
/oracle/10.2.0/dbs/MISSING00894

7 rows selected.

**Find out list of objects in the datafile. I was lucky and had only one INDEX in the datafile.

SQL> select o.name from obj$ o, ind$ i, x$kccfn x
where o.obj# = i.obj#
and i.file# = x.fnfno
and x.fnnam = '/oracle/10.2.0/dbs/MISSING00894'
and o.type# = 1
order by o.name ;
2 3 4 5 6
NAME
------------------------------
WIP_DISCRETE_JOBS_N10

SQL>
SQL> select owner from dba_objects where object_name='WIP_DISCRETE_JOBS_N10';

OWNER
------------------------------
WIP

SQL> conn wip/wip
Connected.
SQL> drop index WIP_DISCRETE_JOBS_N10;

Index dropped.

Take index definition from any other instance and recreate it.

SQL> CREATE INDEX WIP.WIP_DISCRETE_JOBS_N10 ON WIP.WIP_DISCRETE_JOBS
2 (PARENT_WIP_ENTITY_ID, MANUAL_REBUILD_FLAG)
LOGGING
3 4 TABLESPACE WIPX
5 PCTFREE 10
6 INITRANS 11
7 MAXTRANS 255
8 STORAGE (
9 INITIAL 16K
10 NEXT 4M
11 MINEXTENTS 1
12 MAXEXTENTS 2147483645
13 PCTINCREASE 0
14 FREELISTS 4
15 FREELIST GROUPS 4
16 BUFFER_POOL DEFAULT
)
17 18 NOPARALLEL;

Index created.

No comments:

Post a Comment