The steps to recover an open database are
- To make sure you are pointing to the correct database ORCL, you need to set ORACLE_SID. Type
SET ORACLE_SID=ORCL
you should you use at the prompt. After you finish, press Enter.
- To access the Server Manager in the NT environment, type
SVRMGR30
at the prompt. After you finish, press Enter.
- Type
CONNECT INTERNAL
at the prompt to connect as sysdba. After you finish, press Enter.
- The password ORACLE is entered for you. Now you need to check whether the damaged datafile USR1ORCL.ORA is offline. Type
SELECT A.FILE#, A.NAME, A.STATUS, B.STATUS FROM V$DATAFILE A, V$DATAFILE_HEADER B WHERE A.FILE# = B.FILE#;
at the prompt. After you finish, press Enter.
- Since the damaged datafile USRORCL.ORA is still on line, you need to take it offline before you start recovery. Enter
ALTER DATABASE DATAFILE C:\ORANT\DATABASE\USR1ORCL.ORA OFFLINE;
at the prompt to to take this datafile offline. After you finish, press Enter.
- Now you are ready to restore the damaged datafile using the operating system command. To access the operating system, type
HOST
at the prompt. After you finish, press Enter.
- Suppose you have your backup at the path C:\ORANT\BACKUP and you original datafile path at C:\ORANT\DATABASE. Type
host copy C:\ORANT\BACKUP\USR1ORCL.ORA C:\ORANT\DATABASE\USR1ORCL.ORA
to restore the damaged datafile. After you finish, press Enter.
- Type
EXIT
to go back to the Server Manager. After you finish, press Enter.
- Type
RECOVER DATAFILE C:\ORANT\DATABASE\USR1ORCL.ORA;
to start to recover the datafile. After you finish, press Enter.
- Type
auto
to continue the recovery automatically. After you finish, press Enter.
- You finished the recovery successfully. Now you need to put the datafile online. Type
ALTER DATABASE DATAFILE 'C:\ORANT\DATABASE\USR1ORCL.ORA' ONLINE;
at the prompt. After you finish, press Enter.
- You have completed the whole process of recovery. This is the end of the Simulation.