Thursday, February 23, 2006

How to drop a deleted datafile from Oracle

The symptom error is :
ERROR at line 1:
ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
ORA-01110: data file 1: 'E:\ORACLE\ORADATA\CESCATI\SYSTEM01.DBF'

a. Execute "connect internal". If it complains about the ORACLE_SID not being set, then check to make sure that the ORACLE_SID environment variable is properly set. With the default setup, you could issue a command like "setenv ORACLE_SID eqs" from the csh prompt. On Windows 2000 use the environment variable modification tool under Control Panel -> System. If you have this problem on , Win2000 you should probably redo the entire Oracle installation. On UNIX you will have to run as the account that own oracle.

b. Execute "shutdown abort" to make sure the database is shutdown.

c. Execute "startup nomount". (This is the most primitive way of starting the database.)

d. Execute "alter database mount" (This should mount the database, and server manager should reply with the string "Statement Processed")

e. Execute "alter database datafile offline drop" where is the name of the operating system file that you have deleted or otherwise butchered. It should be surrounded by single quotes ( ' ).

f. If the last statement executed, you should be in the clear. Execute "shutdown immediate" to shutdown the database.

g. Exit server manager.

NOTE: To find out the datafile name , use the v$datafile view (Name column)

No comments: