Pages

Thursday, July 5, 2012

RMAN - Restoring SPFILE and Control File

Recovering a Lost Control File

If you are running NOARCHIVELOG mode

rman target /
startup nomount;
restore controlfile from autobackup;
alter database mount;
recover database noredo;
alter database open resetlogs;

If you are running ARCHIVELOG mode, recovery is only slightly different:

rman target /
startup nomount;
restore controlfile from autobackup;
alter database mount;
recover database;
alter database open resetlogs;

Restoring the server parameter file (SPFILE)

If you lose your server parameter file (SPFILE), RMAN can restore it to its default location or to a location of your choice.  Unlike the loss of the control file, the loss of your SPFILE does not cause your instance to immediately stop.  Your instance may continue operating, although you will have to shut it down and restart it after restoring the SPFILE.

1. If the database is up at the time of the loss of the SPFILE, connect to the target database.

rman target /


If the database it not up when the SPFILE is lost, and you are not using a recovery catalog, then you must set the DBID of the target database.

2. Shut down the instance and restart it without mounting. When the SPFILE is not available, RMAN starts the instance with a dummy parameter file.

startup force nomount;


3. Restore the server parameter file. If restoring to the default location, then run:

restore spfile from autobackup;


If restoring to a nondefault location, then you could run commands as in the following example;

restore spfile to '/home/oracle/spfileTEMP.ora' from autobackup;


4. Restart the instance with the restored file. If restarting with a server parameter file in a nondefault location, then create a new client-side initialization parameter file with the single line SPFILE=new_location, where new_location is the path name of the restored server parameter file. Then, restart the instance with the client-side initialization parameter file.

For example, create a file /tmp/init.ora which contains the single line:
SPFILE=/home/oracle/spfileTEMP.ora


Then use this RMAN command, to restart the instance based on the restored SPFILE:

startup force pfile=/tmp/init.ora;



Monday, July 2, 2012

OEM Deleting Alert Manually

Sometimes Oracle Enterprise Manager alert was triggered and will not go away.  You cannot even delete those alert from the OEM User Interface and wait for the alerts to go away automatically but it never goes away.




When this happen here is some option you can try to remove those alerts.

Loggon to OEM server and login as sysman.

select target_guid, metric_guid, key_value, message from mgmt_current_severity 
where message like 'User SYS logged on %';


TARGET_GUID                      METRIC_GUID
-------------------------------- --------------------------------
KEY_VALUE
-------------------------
MESSAGE
--------------------------------------------------------------------------------
BF0B06F8FE2A18DBD8CB3F89C6503995 D6438569B496BC9205481E8A70F92F1E
SYS_grape
User SYS logged on from grape.



exec EM_SEVERITY.delete_current_severity(TARGET_GUID,METRIC_GUID,KEY_VALUE);

 SQL> exec EM_SEVERITY.delete_current_severity('BF0B06F8FE2A18DBD8CB3F89C6503995'
,'D6438569B496BC9205481E8A70F92F1E','SYS_grape');
PL/SQL procedure successfully completed.

SQL> commit;

Commit complete.