Saturday, March 26, 2011

RMAN-06563: control file or SPFILE must be restored using FROM AUTOBACKUP


DB-ID - 2390844960

Rman Restore control file

Issue:
RMAN-06563: control file or SPFILE must be restored using FROM AUTOBACKUP

Action :
Backup and Recovery best practices dictate that we must use a RMAN recovery catalog and also have the controlfile AUTOBACKUP enabled.

If we do not do either and we lose all the controlfiles, we cannot restore the controlfiles even if we have taken a backup to tape as shown in the case below.

We will encounter the RMAN-06563 error even if we set the DBID or explicitly alllocate a channel for a tape device.

set dbid=2390844960;

Find dbid of database: IF DB IS IN MOUNT MODE
Check dbid from v$database;

$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Sat Feb 19 16:12:32 2011

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: CRPDEV (DBID=2390844960)

RMAN>
 
$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Sat Feb 19 16:15:15 2011

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: CRPDEV (DBID=2390844960, not open)

RMAN>

db-id: -2390844960

RMAN-06172: no autobackup found or specified handle is not a valid copy or piece

restore control file:

if no location mentioned for controlfile autobackup It will be in $ORACLE_HOME/dbs

RMAN> show all;
will display all configuration paramters
Check controlfile autobackup is on or not.

mention full path as given below from the show all.

RMAN> run{
2> set controlfile autobackup format for device type disk to '/u02/rmanbackup/CRPDEV_controlfile_%F';
3> restore controlfile from autobackup;}

Rman> resore database;
RMAN> recover database;
RMAN> Alter database open.

Error while recovering db:

RMAN recover database;

RMAN> LIST BACKUP OF ARCHIVELOG ALL

Rman> recover database noredo; will work.

RMAN> Alter database open:

Crosschecks update outdated RMAN repository information about backups whose repository records do not match their physical status.
For example, if a user removes archived logs from disk with an operating system command, the repository still indicates that
the logs are on disk, when in fact they are not.
If the backup is on disk, then the CROSSCHECK command determines whether the header of the file is valid.
If the backup is on tape, then the command simply checks that the backup exists.
The possible status values for backups are AVAILABLE, UNAVAILABLE, and EXPIRED.


Sunday, March 20, 2011

AutoPatch error: - ORA-01502 ,ORA-06512 - adphistExecBulkActionPkg: Unexpected Database Error



AutoPatch error:

adphistExecBulkActionPkg: Unexpected Database Error

AutoPatch error:

ORA-01502: index 'APPLSYS.AD_PATCH_RUN_BUG_ACTIONS_U1' or partition of such index is in unusable state
ORA-06512: at "APPS.AD_FILE_UTIL", line 2254
ORA-06512: at line 3

Error calling adphistExecBulkActionPkg().

0 patches uploaded from the ADPSV format patch history files: Sun Mar 13 2011 12:00:12

SELECT * from USER_INDEXES WHERE STATUS = ‘INVALID’; SQL statement.

Solution to this error is simple. You can:

   1. Drop the specified index and/or recreate the index
   2. Rebuild the specified index
   3. Rebuild the unusable index partition

2nd one :

ORA-01502: index 'indexname' or partition of such index is in unusable state

The reason is that some indexes have been marked unusable by a direct load or by a DDL operation, or shrinking space etc. Here is simple solution.


   1. Drop the specified index and/or recreate the index
   2. Rebuild the specified index
   3. Rebuild the unusable index partition

Here we rebuilding UNUSABLE indexes online, quering to USER_INDEXES view.
$sqlplus /nolog

Sql> connect system/oracle
Sql> SELECT count(*),status FROM all_indexes GROUP BY status;
Sql>  select 'alter index '||owner||'.'||index_name||' rebuild online ;' from dba_indexes where status = 'UNUSABLE' ;

Finding Invalid Objects in database. Nice Command



SELECT 'ALTER '|| OBJECT_TYPE || ' '|| OBJECT_NAME || ' COMPILE;'

FROM ALL_OBJECTS WHERE OBJECT_NAME IN (

select d.name

from sys.obj$ d, sys.dependency$ dep, sys.obj$ p

where d.obj# = dep.d_obj# and p.obj# = dep.p_obj#

and d.status = 1

and bitand(dep.property, 1) = 1

and d.subname is null

and not(p.type# = 32 and d.type# = 1)

and not(p.type# = 29 and d.type# = 5)

and not(p.type# in(5, 13) and d.type# in (2, 55))

and (p.status not in (1, 2, 4) or p.stime != dep.p_timestamp));

HP Unix commands related to Memory,Swapspace etc



 Memory utilization on HP-UX

UNIX95= ps -e -o vsz,uid,pid,args |sort -rn |more  

swapinfo -tam

iostat

top

check physical memory of HP-Unix
dmesg -i | grep physical

Finding and Deleting Files in Unix older than the specified number of days



syntax : 

For finding the files older than 35 days

  find . -name "filename.ext" -mtime +no_of_days -exec ls -ltr {} \;
e.g
  find . -name "*req" -mtime +35 -exec ls -ltr {} \;

 Verify the timestamp of all the files.They must be older than 5 weeks

For Deleting files older that 35 days :

find . -name "*req" -mtime +35 -exec rm {} \;

Verify after execution of the above.

Execute:  find . -name "*req" -mtime +35 -exec ls -ltr {} \;