Thursday, March 22, 2012

ORA-39000 ORA-31640 And ORA-27054 Erorrs On Invoking DataPump Import

When you use Data pump to import data in your database , you can see below error.

ORA-39001: invalid argument value
ORA-39000: bad dump file specification
ORA-31640: unable to open dump file "<Dump file path>" for read
ORA-27054: NFS file system where the file is created or resides is not mounted with correct options
Additional information: 3


Here is Solution

Here are the mount options that need to be used for NFS volumes on Linux are:
rsize=32k, wsize=32k, hard, actimeo=0

Along with the error there are warning messages printed in the alert log with the mount options to be used.Sometimes you may need to do the following to allow datapump to work with NFS mounted files:
Set the event in the init.ora, to disable the mount point parameter checking:

event="10298 trace name context forever, level 32"
          
Note that the event 10298 skips all mount checks.  Setting this event has to be done with care. Verify settings with your System Administrator to ensure no datafiles are corrupted

Tuesday, March 20, 2012

How to Install ASMLIB and Configure

First find out Kernal version
> uname -r

2.6.18-164.11.1.el5> cat /proc/version
Linux version
2.6.18-164.11.1.el5(brewbuilder@ls20-bc2-13.build.redhat.com) (gcc version 4.1.2 20071124 (Red Hat 4.1.2-41)) #1 SMP Tue Apr 29 13:16:15 EDT 2008

> rpm -q kernel
kernel-2.6.18-164.11.1.el5
 
Then you need download RPM packpage from oracle Website
http://www.oracle.com/technetwork/topics/linux/index-101839.html 
 

# rpm -Uvh oracleasm-support-2.1.7-1.el5.x86_64.rpm oracleasmlib-2.0.4-1.el5.x86_64.rpm
oracleasm-2.6.18-164.11.1.el5.x86_64.rpm
warning: oracleasm-support-2.1.7-1.el5.x86_64.rpm:

Header V3 DSA signature: NOKEY, key ID 4a7y5433
Preparing... ########################################### [100%]
1:oracleasm-support ########################################### [ 33%]
2:oracleasm-2.6.18-164.11.1.el5########################################### [ 67%]
3:oracleasmlib ########################################### [100%]
[root@]# /etc/init.d/oracleasm configure Configuring the Oracle ASM library driver.
This will configure the on-boot properties of the Oracle ASM library driver. The following questions will determine whether the driver is loaded on boot and what permissions it will have. The current values will be shown in brackets ('[]'). Hitting <ENTER> without typing an answer will keep that current value. Ctrl-C will abort.
Default user to own the driver interface []: oracle
oracle Default group to own the driver interface []: dba or oinstall
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver: [ OK ]
Scanning the system for Oracle ASMLib disks: [ OK ]
 
[root@etc/init.d]# ./oracleasm enable
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver: [ OK ]
Scanning the system for Oracle ASMLib disks: [ OK ]


How to findout ASMLIB available or not

[root@etc/init.d]# rpm -qa | grep oracleasm
oracleasm-support-2.1.7-1.el5
oracleasmlib-2.0.4-1.el5
oracleasm-2.6.18-164.11.1.el5
 
 
 
 
Make sure that Oracleasm configure command ran properly
 
Log on root
 
Execute the lsmod command (as root) to show the loaded oracleasm module.
The oracleasm module should be listed with a ‘Used by’ column setting of 1
[root@etc/init.d]# lsmod
Module Size Used by

oracleasm 84136 1
ipv6 420481 332
xfrm_nalgo 43845 1 ipv6
crypto_api 42177 1 xfrm_nalgo
autofs4 57289 0
hidp 83521 2
l2cap 89281 5 hidp

Execute the command cat /proc/filesystems and make sure that an entry named oracleasmfs exists in this filesystem listing
 
[root@etc/init.d]# cat /proc/filesystems
nodev sysfs
nodev rootfs
nodev bdev
nodev proc
nodev cpuset
nodev binfmt_misc
nodev debugfs
nodev securityfs
nodev sockfs
nodev usbfs
nodev pipefs
nodev futexfs
nodev tmpfs
nodev inotifyfs
nodev eventpollfs
nodev devpts
ext2
nodev ramfs
nodev hugetlbfs
iso9660
nodev mqueue
ext3
nodev rpc_pipefs
nodev nfs
nodev nfs4
nodev autofs
nodev asmdisk
nodev oracleasmfs

Execute the command df –ha. This should show you a that oracleasmfs is mounted on /dev/oracleasm
 
 
[root@etc/init.d]# df -ha
Filesystem Size Used Avail Use% Mounted on
/dev/sda7 5.9G 607M 5.0G 11% /
proc 0 0 0 - /proc
sysfs 0 0 0 - /sys
devpts 0 0 0 - /dev/pts
/dev/sda8 88G 18G 65G 22% /home
/dev/sda5 9.7G 217M 9.0G 3% /var
/dev/sda3 9.7G 152M 9.1G 2% /opt
/dev/sda2 9.7G 1.6G 7.7G 17% /usr
/dev/sda1 99M 12M 83M 12% /boot
tmpfs 16G 5.6G 11G 36% /dev/shm
none 0 0 0 - /proc/sys/fs/binfmt_misc
sunrpc 0 0 0 - /var/lib/nfs/rpc_pipefs
oracleasmfs 0 0 0 - /dev/oracleasm

The Network Adapter Could Not Establish Connection

Issue 1:
  Connecting to database with jdbc thin driver the following error is reported:
 
java.sql.SQLException: Io exception: The Network Adapter could not establish the connection at
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:111) at
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:145) at
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:254) at
oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:386) at
oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:413) at
oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:164)




The error can be caused by :
  • A firewall between client and database server
  • Database host does not exist in the etc/hosts file

Solution 1:  
   
  1. Ensure that the database server host name exists in the etc/hosts file
  2. Open the port used by java in the firewall
Issue 2:

      You implemented dataguard and your JDBC THIN client connections from your application server began failing shortly after. The class used to implement the JDBC driver is:
    oracle.jdbc.driver.OracleDriver
   Error message received:
java.sql.SQLException: Io exception: The Network Adapter could not establish the connection

As of JDBC 11g the oracle.jdbc.OracleConnection interface has been enhanced. For better visibility and clarity, all connection properties are defined as constants in this interface. The package oracle.jdbc.driver, which was deprecated in Oracle Database release 9.0.1, is desupported in this release. Code having references to this package will not compile and run. You can use package oracle.jdbc instead of this package.

Solution 2:

       To implement the solution, please execute the following steps:

      Change the JDBC connection driver class in your application server
     from:
          oracle.jdbc.driver.OracleDriver
    to
         oracle.jdbc.OracleDriver

Issue 3:

An application using the JDBC Thin Driver 10.2.0.1.0 cannot connect to the database server. At connection time, it fails with the following error:
java.sql.SQLException: Io exception: The Network Adapter could not establish the connection Error Code: 17002

If the NIC card of the server is configured to support IPv4 and IPv6, some services may start with IPv6. Any client application that tries to connect using IPv4 to the service that is running with IPv6 (or viceversa) will receive a connection refused error. If the java application is trying to connect to the database using JDBC then the client application may just hang or fail with an Io exception error.
The JDK used version is :  1.4.2.

Solution 3:

  
The java.net.preferIPv4Stack property allows Java applications to connect , and accept connections from, both IPv4 and IPv6 hosts. Setting this property to true indicates that JVM will use IPv4 sockets.
Here are two solutions :
  1. Indicate to the java machine to use ip protocol used is V4.
    For this, launch the java machine where the jdbc application is running with the following parameter -Djava.net.preferIPv4Stack=true
    As example :
          java -Djava.net.preferIPv4Stack=true jdbcTest
  2. Use the ORACLE OCI  JDBC driver.















 

Friday, March 9, 2012

ORA-12516 TNS:listener could not find available handler with matching protocol

When ORA-12516 raise , you can see  below error in you application log

Caused by: org.jboss.util.NestedSQLException: Could not create connection; -
nested throwable: (java.sql.SQLException: Listener refused the connection with
the following error:
ORA-12516, TNS:listener could not find available handler with matching protocol
stack
.......
......
       at
org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSour
ce.java:106)
        at
net.sf.hibernate.connection.DatasourceConnectionProvider.getConnection(Datasour
ceConnectionProvider.java:59)
        at
net.sf.hibernate.impl.BatcherImpl.openConnection(BatcherImpl.java:292)
        ... 78 more

Background of the error:


One of the most common reasons for the TNS-12516 and/or TNS-12519 errors being reported is the configured maximum number of PROCESSES and/or SESSIONS limitation being reached. When this occurs, the service handlers for the TNS listener become "Blocked" and no new connections can be made. Once the TNS Listener receives an update from the PMON process associated with the Database instance telling the TNS Listener the thresholds are below the configured limit, and the database is now accepting connections connectivity resumes.

By way of instance registration, PMON is responsible for updating the listener with information about a particular instance such as load and dispatcher information. Maximum load for dedicated connections is determined by the PROCESSES parameter. The frequency at which PMON provides SERVICE_UPDATE information varies according to the workload of the instance. The maximum interval between these service updates is 10 minutes.

The listener counts the number of connections it has established to the instance but does not immediately get information about connections that have terminated. Only when PMON updates the listener via SERVICE_UPDATE is the listener informed of current load. Since this can take as long as 10 minutes, there can be a difference between the current instance load according to the listener and the actual instance load.

When the listener believes the current number of connections has reached maximum load, it may set the state of the service handler for an instance to "blocked" and begin refusing incoming client connections with either of the following errors: ora-12519 or ora-12516

Solution

Increase the processes and sessions value to allow the listener to spawn more server process as required in your environment.

Monday, March 5, 2012

DBCA Creates a RAC Database But at the End Shows PRPP-1001 and CRS-0215

When you try create database DBCA show up PRPP-1001 and CRS-0215

1) There are separate homes for the ASM instance and the database instances.
2) The Oracle NET listener runs from a separate home than the home used for the database.
3) Even though the TNS_ADMIN for the session that launched DBCA was set and pointed to
    the proper home and directory were the Oracle NET configuration files reside (e.g., tnsnames.ora, etc.),
    this was not passed to the srvctl commands kicked off by DBCA

You can fix issue  here

Update the TNS_ADMIN environment setting for each of these database and instance resources registered in the OCR, to point to the proper directory.
Example (do this only from one of the RAC nodes, any node),
1) If the node's Oracle NET listener runs from home '/home/oracle/oracle/product/11.1/asm_1', then
2) If DBCA is launched from home '/home/oracle/oracle/product/11.1/db_1' (which will be the home for the new database), then
3) From any node and as the Oracle software owner
srvctl setenv db -d <db_name> -t TNS_ADMIN=/home/oracle/oracle/product/11.1/asm_1/network/admin
srvctl setenv inst -d <db_name> -i <instance_name_1> -t TNS_ADMIN=/home/oracle/oracle/product/11.1/asm_1/network/admin
srvctl setenv inst -d <db_name> -i <instance_name_2> -t TNS_ADMIN=/home/oracle/oracle/product/11.1/asm_1/network/admin
4) Now, the RAC database and instance should not fail to startup via srvctl:
 srvctl start db -d <db_name>

Encountered file error when copying listeners from home

When try to create new databse using dbca, you can get below error
'Encountered file error when copying listeners from home=/u01/app/oracle/prodouct/

Problem1 :

The problem does not occur

If the $TNS_ADMIN is set.
If the ORACLE_HOME and the ASM_HOME are owned by the same user.

Issue:
In this case the ORACLE_HOME & ASM_HOME were owned by different users.
From the dbca log file residing in the $ORACLE_HOME/cfgtoollogs/dbca directory

file `/home/oracle/oracle/product/11.0/asm/network/admin/listener.ora': Permission denied 

Solution:

Ensure that you have write permission to the network/admin directory under the asm home.
chmod 775 /home/oracle/oracle/product/11.0/asm/network/admin/
Rerun dbca.


Problem 2:

Issue:

Database Configuration Assistant (DBCA) fails to create database at 0% of the "Copying database files" stage.

Pop-up shows:

Encountered file error when copying listeners from home=/home/oracle/oracle/product/11.1/asm_1
                                               [OK]
After clicking on the OK button, DBCA goes back to the last page before it attempted to create the database (Database Configuration Assistant, Step 16 of 16 : Creation Options).

11g by default creates DBCA trace. The DBCA trace file ought to be under the directory $ORACLE_BASE/cfgtoollogs/dbca/<database_name>.

[Thread-240] [17:51:28:709] [NativeSystem.rununixcmd:929] NativeSystem.rununixcmd: RetString 0|scp: /home/oracle/oracle/product/11.1/db_1/network/admin/listener.ora: No such file or directory :failed
[Thread-240] [17:51:28:709] [CopyCommand.execute:79] CopyCommand.execute: native copyFile returns `0|scp: /home/oracle/oracle/product/11.1/db_1/network/admin/listener.ora: No such file or directory :failed'
[Thread-240] [17:51:28:710] [NativeResult.<init>:88] NativeResult: The String obtained is0|scp: /home/oracle/oracle/product/11.1/db_1/network/admin/listener.ora: No such file or directory :failed
[Thread-240] [17:51:28:710] [NativeResult.<init>:96] The status string is: 0

Solution:

The problem was caused by a missing soft link used to link listener.ora in the $ORACLE_HOME/network/admin directory used by the DBCA session to the $ORACLE_HOME/network/admin/listener.ora used by the node's Oracle listener.

Example, On node1
(where DBCA was launched):

[oracle@test1] /home/oracle/oracle/product/11.1/db_1/network/admin> ls -ltr 
lrwxrwxrwx 1 root root 64 Jan 12 17:37 listener.ora -> /home/oracle/oracle/product/11.1/asm_1/network/admin/listener.ora 

Example, On node2 (same $ORACLE_HOME used by DBCA on node1 but that is on node2) :

[oracle@test2] /home/oracle/oracle/product/db_1/network/admin> ls -ltr 
<no listing for a soft link>

Do not use soft links to link Oracle NET configuration files (listener.ora, etc). Instead, configure TNS_ADMIN to point the DBCA session to the proper directory where these configuration files reside:

Example:

1) If your home where you will launch DBCA is '/home/oracle/oracle/product/11.1/db_1', then
2) If the server's listener run from home '/home/oracle/oracle/product/11.1/asm_1', then
3) From the session that will launch DBCA, set its TNS_ADMIN variable to point to the home where the listener runs of:
   $ export TNS_ADMIN=/home/oracle/oracle/product/11.1/asm_1/network/admin
4) Start up DBCA and database creation should now successfuly complete.