Wednesday 17 September 2014

ERROR: NMO not setuid-root (Unix-only)

Thus error came up while I was specifying a host credentials on EM 12c.

 After some research I found that I had not run root.sh on the agent home.

Solution:

# cd $AGENT_HOME
# ./root.sh
Finished product-specific root actions.
/etc exist
Finished product-specific root actions.
#

This solved my problem!


Wednesday 10 September 2014

Setup of RMAN Catalog

The benefits of running RMAN backup and recovery with a catalog cannot not be overstated. A simple internet search will reveal several reasons why a serious DBA handling several databases should consider setting up a recovery catalog.

The steps involved are pretty straight forward.

1. Creation of the catalog database using DBCA or scripts.



2. Creation of catalog owner and granting necessary roles and privileges.

SQL> create user mycat identified by mycat;

- Grant necessary roles, priviledges to user

SQL> grant recovery_catalog_owner to mycat;
SQL> grant connect, resource to mycat;

3. Creation of the recovery catalog

$ rman catalog mycat/mycat
RMAN> create catalog;

4. Registering the databases which will use this database as recovery catalog



run these commands from each of the concerned databases.


$ rman target / catalog mycat/mycat@CATDB
RMAN> register database;

- Verify that the registration was successful by running REPORT SCHEMA

RMAN> report schema;

To unregister a database TESTDB from RMAN catalog, there are two ways.



1. Unregistering from the target database.


Connect to the target and catalog

rman target / catalog=mycat/mycat@catdb

perform clean -up by deleting existing backups

RMAN> LIST BACKUP SUMMARY;
RMAN> DELETE BACKUP DEVICE TYPE SBT;
RMAN> DELETE BACKUP DEVICE TYPE DISK;

Unregister database

RMAN> UNREGISTER DATABASE;

OR

RMAN> UNREGISTER DATABASE NOPROMPT;

2. Unregistering when there is no access to the target database.

Start RMAN, connect only to the catalog.

$ rman catalog=mycat/mycat@catdb

Unregister the database by name.

RMAN> UNREGISTER DATABASE TESTDB NOPROMPT;

In a case where there is more than one database in the catalog with the same name, you will need to use the DBID to identify the database to unregister. You can find this using the LIST INCARNATION command.

RMAN> LIST INCARNATION OF DATABASE TESTDB;

Once you have the DBID, you can unregister the database using the following script.

    RUN
    { 
      SET DBID 1111111111;
      UNREGISTER DATABASE TESTDB NOPROMPT;
    }









ORA-12514: TNS listener cannot resolve service name error

This came up after I created a test RMAN catalog database on one of my test serves that had three other databases running on it. These databases are actually ones that I restored while testing my full database backups, therefore I never really bothered about the networking aspect of them as I never connect to them from outside the server.

I had to setup the tnsnames.ora and listener configuartion to enable connections to and from the RMAN catalog database. This was a pretty straight forward thing but I unfortunately skipped a key configuration which caused the error ORA-12514 every time I tried to connect to the Catalog DB from any of the others.

Note that #tnsping CATDB was successful, which got me more confused and at the same time convinced that all was well with the SERVICE_NAME definition.

I also ran #lsnrctl service and I could see the CATDB service running.

However, the problem was the SERVICE_NAME I defined for the Catalog DB. 

Original configuration in tnsnames.ora

CATDB=
        (DESCRIPTION=
                (ADDRESS=(PROTOCOL = TCP)(HOST =
1.1.1.1)(PORT = 1521))
                (CONNECT_DATA = (SERVICE_NAME = CATDB))


Correct configuration

CATDB=
        (DESCRIPTION=
                (ADDRESS=(PROTOCOL = TCP)(HOST = 1.1.1.1)(PORT = 1521))
                (CONNECT_DATA = (SERVICE_NAME = CATDB.xxxxxx.local))


I did not fully specify the service name!

This resolved my problem and I was able to connect to the Catalog DB.



Tuesday 9 September 2014

ORA-01180: can not create datafile 1 ORA-01110: data file 1: '/dir/system01.dbf' during RMAN restore.

I got this error while trying do a full database restore to another host. I have always done same without issues.

Changes:
The source database is now the primary in a ADG set up.
Source database now has FRA confirgured.
Source database opened with reset logs during a migration to a new host as the original host had to be maintained.

Road to resolution:

At first I checked the directory on the new host to confirm that oracle user has appropriate permission to write to the directory.

I also checked to ensure that the backup sets are fully cataloged and that the restored control file is the most recent.

I tried the process one more time and still got the same error.

I went on MOS and found two notes ID 1265151.1 & ID 392237.1.
 
RMAN restore fails with ORA-01180: can not create datafile 1 (Doc ID 1265151.1)


RMAN restore of database fails with ORA-01180: Cannot create datafile 1 (Doc ID 392237.1)

"The current incarnation only contains incremental level 1 backups of the database.
There are NO level 0 backups in this incarnation.
As the physical datafiles do not exist RMAN attempts to create the physical files but this is NOT allowed if the file belongs to the SYSTEM tablespace."

solution: Reset the database to the previous incarnation and run the restore and recovery again:
 select count(*) from v$database_incarnation;

  COUNT(*)
----------
         4
SQL> select INCARNATION#, RESETLOGS_TIME from  v$database_incarnation order by RESETLOGS_TIME desc;

INCARNATION# RESETLOGS_TIME
------------ --------------------
           4 02:28:32 19:aug:2014
           2 04:23:11 08:aug:2014
           3 10:03:41 25:jul:2014
           1 07:01:36 09:dec:2011

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

>rman target /

Recovery Manager: Release 11.2.0.2.0 - Production on Tue Sep 9 13:04:29 2014

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

connected to target database: XXXXXX (DBID=111111111, not open)

RMAN> reset database to incarnation 2;

RMAN>restore database;


Walla!!! it was successful.