Friday, December 30, 2011

Could not validate ASMSNMP password due to following error- "ORA-01031: insufficient privileges"


Platform: Oracle 11g R2 grid

At Fist Node's $ prompt execute


$ orapwd file= $GRID_HOME /dbs/orapw+ASM1 entries=5 password=your-password


At Fist Node's $ prompt execute


$ orapwd file=$GRID_HOME/dbs/orapw+ASM2 entries=5 password=your-password


From any of the node as 11g Grid Infrastructure owner execute:


export ORACLE_SID=+ASM1

export ORACLE_HOME=/u01/app/11.2.0/grid


[grid@node1 bin]$ sqlplus / as sysasm


SQL>create user asmsnmp identified by your-password;


SQL> grant sysdba to asmsnmp;


DBCA hangs, does not respond after clicking finish using Xmin

When I tried to create/configure database using DBCA at 11g release 2, DBCA hung or did not respond after 
clicking finish button and 

Cause:
             X Client I was using was XMING, which had a kind of bug.
Solution:
             After installing Xming complete font package, I could create database using DBCA, this problem exist with Xming at Linux or Unix enviromnets in my case it was AIX 7.

Oracle Support Note: 727290.1.

Wednesday, December 21, 2011

Transfer Datafile from ASM to File System

This article is about transferring database files from ASM to O/S File System, two methods are used here are:

1. DBMS_FILE_TRANSFER.copy_file.
2. 'ASMCMD cp' Command.

DBMS_FILE_TRANSFER
                            There are three procedures within the dbms_file_transfer package:
  • COPY_FILE: This is useful for copying files locally on the database server.
     
  • GET_FILE: This is useful when a file on a remote database is to be transferred to a local file system through the local database connection.
     
  • PUT_FILE: Reads a local file and contacts a remote database to create a copy of the file in the remote file system

       Can move files to and fro between ASM and OS File System, valid from 10gR2. Here COPY_FILE procedure will be used to transfer the datafile name EXAMPLE.dbf, the complete path and name of datafile at ASM is 
        +DATA/orcl/datafile/example.267.758826135

Source directory is at ASM (+DATA/orcl/datafile)
And Destination Directory is at O/S File System (/u01/app/oracle/dbhome_1)


Log in as user with DBA role and execute the following statements:

SQL> create directory source as '+DATA/orcl/datafile/';

SQL> create directory dest as '/u01/app/oracle/dbhome_1'

SQL> grant read on directory source to dba;

SQL> grant write on directory dest to dba;


and finally run 

SQL> begin 
                  dbms_file_transfer.copy_file('source','example.267.758826135','dest','EXAMPLE.dbf'); 
          end;


          After successful run of above procedure, file existence at O/S FS can be verified using 'ls'


 

ASMCMD 'cp'

                This is the simplest way to move database file either way between ASM and File System, introduces at 11g.

Again 
Source directory is at ASM (+DATA/orcl/datafile)
And Destination Directory is at O/S File System (/u01/app/oracle/dbhome_1)

at asmcmd prompt simply run the below line and you will be done.

ASMCMD> cp +DATA/appdbtst/datafile/example.267.758826135 /u01/app/oracle/dbhome_1/example.dbf


The remaining procedures (GET_FILE and PUT_FILE) are similar in the way source and destination are specified but enable further transfer to a remote DB specified by dblink. Both source and target databases should have directories defined. Restrictions related to dbms_file_transfer package are:
  • Files are supposed to be multiple of 512 bytes
  • Files should be less than 2TB
  • There is no character set conversion
  • Oracle should have permissions to the file and after copy file are owned by oracle user.
  • File transfer operation can be monitored from v$session_longops




Wednesday, December 7, 2011

Environment variable ORACLE_UNQNAME not defined

After successful installation of 11g release 2 grid infrastructure, when tries to start enterprise manager control, it raised error mentioned below:
                 Environment variable ORACLE_UNQNAME not defined, pleased set ORACLE_UNQNAME to database unique name.

        I simply executed following line at my linux command line with grid ouwner user i.e. oracle:

             export ORACLE_UNQNAM={DATABASE NAME}

        where DATABASE_NAME can be found via following command.

           select name from v$database;

       It simply solved my problem, and hope will help you as well.

Farrukh Salman.