Sunday, 14 October 2012

ORA-02437: cannot validate - primary key violated

SQL>ALTER TABLE ONLS.ONLS_BIL_FINTX ADD CONSTRAINT ONLS_BIL_FINTX_PK
 PRIMARY KEY  (TRANS_REF_NO, TRANS_SEQ_NO) ENABLE NOVALIDATE;

ORA-02437: cannot validate (ONLS.ONLS_BIL_FINTX_PK) - primary key violated



Solution
=============
------- First, create a NON-UNIQUE index on the same fields that you want to
--------include in the constraint.
alter table ONLS_BIL_FINTX drop constraint ONLS_BIL_FINTX_PK;

create index IND_ONLS_BIL_FINTX on ONLS_BIL_FINTX(TRANS_REF_NO, TRANS_SEQ_NO);

-------- Then add the unique or primary key constraint.

 ALTER TABLE ONLS.ONLS_BIL_FINTX ADD CONSTRAINT ONLS_BIL_FINTX_PK
 PRIMARY KEY  (TRANS_REF_NO, TRANS_SEQ_NO) ENABLE NOVALIDATE;

Sunday, 7 October 2012

Oracle apps 11i: After cloning, forms will not launch.



Performed the below Steps:
EXEC FND_CONC_CLONE.SETUP_CLEAN;
commit;
Run the cmclean.sql scripts
Run Autoconfig on all nodes.(DB+CM+WEB Nodes)


Below the cmclean file contents:

REM
REM FILENAME
REM cmclean.sql
REM DESCRIPTION
REM Clean out the concurrent manager tables
REM NOTES
REM Usage: sqlplus @cmclean
REM
REM
REM $Id: cmclean.sql,v 1.4 2001/04/07 15:55:07 pferguso Exp $
REM
REM
REM +======================================================================+


set verify off;
set head off;
set timing off
set pagesize 1000

column manager format a20 heading 'Manager short name'
column pid heading 'Process id'
column pscode format a12 heading 'Status code'
column ccode format a12 heading 'Control code'
column request heading 'Request ID'
column pcode format a6 heading 'Phase'
column scode format a6 heading 'Status'


WHENEVER SQLERROR EXIT ROLLBACK;

DOCUMENT

WARNING : Do not run this script without explicit instructions
from Oracle Support


*** Make sure that the managers are shut down ***
*** before running this script ***

*** If the concurrent managers are NOT shut down, ***
*** exit this script now !! ***

#

accept answer prompt 'If you wish to continue type the word ''dual'': '

set feed off
select null from &answer;
set feed on


REM Update process status codes to TERMINATED

prompt
prompt ------------------------------------------------------------------------

prompt -- Updating invalid process status codes in FND_CONCURRENT_PROCESSES
set feedback off
set head on
break on manager

SELECT concurrent_queue_name manager,
concurrent_process_id pid,
process_status_code pscode
FROM fnd_concurrent_queues fcq, fnd_concurrent_processes fcp
WHERE process_status_code not in ('K', 'S')
AND fcq.concurrent_queue_id = fcp.concurrent_queue_id
AND fcq.application_id = fcp.queue_application_id;

set head off
set feedback on
UPDATE fnd_concurrent_processes
SET process_status_code = 'K'
WHERE process_status_code not in ('K', 'S');



REM Set all managers to 0 processes

prompt
prompt ------------------------------------------------------------------------

prompt -- Updating running processes in FND_CONCURRENT_QUEUES
prompt -- Setting running_processes = 0 and max_processes = 0 for all managers

UPDATE fnd_concurrent_queues
SET running_processes = 0, max_processes = 0;




REM Reset control codes

prompt
prompt ------------------------------------------------------------------------

prompt -- Updating invalid control_codes in FND_CONCURRENT_QUEUES
set feedback off
set head on
SELECT concurrent_queue_name manager,
control_code ccode
FROM fnd_concurrent_queues
WHERE control_code not in ('E', 'R', 'X')
AND control_code IS NOT NULL;

set feedback on
set head off
UPDATE fnd_concurrent_queues
SET control_code = NULL
WHERE control_code not in ('E', 'R', 'X')
AND control_code IS NOT NULL;

REM Also null out target_node for all managers
UPDATE fnd_concurrent_queues
SET target_node = null;


REM Set all 'Terminating' requests to Completed/Error
REM Also set Running requests to completed, since the managers are down

prompt
prompt ------------------------------------------------------------------------

prompt -- Updating any Running or Terminating requests to Completed/Error
set feedback off
set head on
SELECT request_id request,
phase_code pcode,
status_code scode
FROM fnd_concurrent_requests
WHERE status_code = 'T' OR phase_code = 'R'
ORDER BY request_id;

set feedback on
set head off
UPDATE fnd_concurrent_requests
SET phase_code = 'C', status_code = 'E'
WHERE status_code ='T' OR phase_code = 'R';





REM Set all Runalone flags to 'N'
REM This has to be done differently for Release 10

prompt
prompt ------------------------------------------------------------------------

prompt -- Updating any Runalone flags to 'N'
prompt
set serveroutput on
set feedback off
declare
c pls_integer := dbms_sql.open_cursor;
upd_rows pls_integer;
vers varchar2(50);
tbl varchar2(50);
col varchar2(50);
statement varchar2(255);
begin

select substr(release_name, 1, 2)
into vers
from fnd_product_groups;

if vers >= 11 then
tbl := 'fnd_conflicts_domain';
col := 'runalone_flag';
else
tbl := 'fnd_concurrent_conflict_sets';
col := 'run_alone_flag';
end if;


statement := 'update ' || tbl || ' set ' || col || '=''N'' where ' || col || ' = ''Y''';
dbms_sql.parse(c, statement, dbms_sql.native);
upd_rows := dbms_sql.execute(c);
dbms_sql.close_cursor(c);
dbms_output.put_line('Updated ' || upd_rows || ' rows of ' || col || ' in ' || tbl || ' to ''N''');
end;
/



prompt

prompt ------------------------------------------------------------------------

prompt Updates complete.
prompt Type commit now to commit these updates, or rollback to cancel.
prompt ------------------------------------------------------------------------

prompt

set feedback on

REM <= Last REM statment -----------------------------------------------------

Disclaimer
EXCEPT WHERE EXPRESSLY PROVIDED OTHERWISE, THE INFORMATION, SOFTWARE,
PROVIDED ON AN "AS IS" AND "AS AVAILABLE" BASIS. ORACLE EXPRESSLY DISCLAIMS
ALL WARRANTIES OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NON-INFRINGEMENT. ORACLE MAKES NO WARRANTY THAT: (A) THE RESULTS
THAT MAY BE OBTAINED FROM THE USE OF THE SOFTWARE WILL BE ACCURATE OR
RELIABLE; OR (B) THE INFORMATION, OR OTHER MATERIAL OBTAINED WILL MEET YOUR
EXPECTATIONS. ANY CONTENT, MATERIALS, INFORMATION OR SOFTWARE DOWNLOADED OR
OTHERWISE OBTAINED IS DONE AT YOUR OWN DISCRETION AND RISK. ORACLE SHALL HAVE
NO RESPONSIBILITY FOR ANY DAMAGE TO YOUR COMPUTER SYSTEM OR LOSS OF DATA THAT
RESULTS FROM THE DOWNLOAD OF ANY CONTENT, MATERIALS, INFORMATION OR SOFTWARE.

ORACLE RESERVES THE RIGHT TO MAKE CHANGES OR UPDATES TO THE SOFTWARE AT ANY
TIME WITHOUT NOTICE.
Limitation of Liability
IN NO EVENT SHALL ORACLE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL OR CONSEQUENTIAL DAMAGES, OR DAMAGES FOR LOSS OF PROFITS, REVENUE,
DATA OR USE, INCURRED BY YOU OR ANY THIRD PARTY, WHETHER IN AN ACTION IN
CONTRACT OR TORT, ARISING FROM YOUR ACCESS TO, OR USE OF, THE SOFTWARE.

SOME JURISDICTIONS DO NOT ALLOW THE LIMITATION OR EXCLUSION OF LIABILITY.
ACCORDINGLY, SOME OF THE ABOVE LIMITATIONS MAY NOT APPLY TO YOU.

CRS-4535 Cannot communicate with Cluster Ready Services

In Cluster environment, when you check the status of the CRS (Cluster Ready Service) you may find the error as CRS-4535 Cannot communicate with Cluster Ready Services as shown below.
[root@rac1 bin]# ./crsctl check crs
CRS-4638: Oracle High Availability Services is online
CRS-4535: Cannot communicate with Cluster Ready Services
CRS-4530: Communications failure contacting Cluster Synchronization Services daemon
CRS-4534: Cannot communicate with Event Manager
This mainly occurs for two reasons:
1. Check if the nodes are able to ping each other in terms  of respective IPs (Public, Private and Virtual IP).
2. Check if the Grid owner has the permission on the ASM disks on the node where you faced the error.
In my case, GRID owner was user Oracle. The connectivity between the nodes using their Public, Private and Virtual IPs were perfect and was able to ping each other using the above said IPs.
So, the issue laid with the permission of the ASM disks for the Grid Owner (username Oracle)
This is what I found with the permissions for the ASM disks. The disks were owned by ROOT and ORACLE had no permissions on it.
[root@rac1 bin]# cd /dev/oracleasm/disks
[root@rac1 disks]# ls -lrt
total 0
brw——- 1 root root 8, 17 May  6 10:16 DISK1
brw——- 1 root root 8, 33 May  6 10:16 DISK2
brw——- 1 root root 8, 49 May  6 10:16 DISK3
brw——- 1 root root 8, 65 May  6 10:16 DISK4
brw——- 1 root root 8, 81 May  6 10:16 DISK5
[root@rac1 bin]# ps -ef  | grep css
root      3784     1  0 10:17 ?        00:00:01 /u01/app/grid/11.2.0/bin/cssdmonitor
root      3801     1  0 10:17 ?        00:00:01 /u01/app/grid/11.2.0/bin/cssdagent
root      4189  4107  0 10:26 pts/1    00:00:00 grep css
Now, change the owner of these disks to ORACLE as shown below and also provide appropriate permission for the ORACLE user to read/write these disks.
[root@rac1 disks]# chown -R oracle:dba /dev/oracleasm/disks
[root@rac1 disks]# chmod -R 777 /dev/oracleasm/disks
[root@rac1 disks]# ls -lrt
total 0
brwxrwxrwx 1 oracle dba 8, 17 May  6 10:16 DISK1
brwxrwxrwx 1 oracle dba 8, 33 May  6 10:16 DISK2
brwxrwxrwx 1 oracle dba 8, 49 May  6 10:16 DISK3
brwxrwxrwx 1 oracle dba 8, 65 May  6 10:16 DISK4
brwxrwxrwx 1 oracle dba 8, 81 May  6 10:16 DISK5
Once you have assigned the permission, start the cluster services as the ROOT user.
Change to your $GRID_HOME/bin directory (in my case, $GRID_HOME was /u01/app/oracle/product/11.2.0/grid) and start the cluster services using the CRSCTL utility as shown below.
[root@rac1 bin]# ./crsctl start cluster
CRS-2672: Attempting to start ‘ora.cssd’ on ‘rac1′
CRS-2676: Start of ‘ora.cssd’ on ‘rac1′ succeeded
CRS-2672: Attempting to start ‘ora.ctssd’ on ‘rac1′
CRS-2676: Start of ‘ora.ctssd’ on ‘rac1′ succeeded
CRS-2679: Attempting to clean ‘ora.asm’ on ‘rac1′
CRS-2681: Clean of ‘ora.asm’ on ‘rac1′ succeeded
CRS-2672: Attempting to start ‘ora.asm’ on ‘rac1′
CRS-2676: Start of ‘ora.asm’ on ‘rac1′ succeeded
CRS-2672: Attempting to start ‘ora.crsd’ on ‘rac1′
CRS-2676: Start of ‘ora.crsd’ on ‘rac1′ succeeded
Check the CSS service status:
[root@rac1 bin]# ps -ef | grep css
root      3784     1  0 10:17 ?        00:00:01 /u01/app/grid/11.2.0/bin/cssdmonitor
root      4372     1  0 10:30 ?        00:00:01 /u01/app/grid/11.2.0/bin/cssdagent
oracle    4387     1  1 10:30 ?        00:00:02 /u01/app/grid/11.2.0/bin/ocssd.bin
root      5347  4107  0 10:33 pts/1    00:00:00 grep css
Now check if CRS (Cluster Ready Service) is online or not:
[root@rac1 bin]# ./crsctl check crs
CRS-4638: Oracle High Availability Services is online
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
[root@rac1 bin]#

Sunday, 30 September 2012

How To Configure SSH for a RAC Installation [ID 300548.1]


Applies to:

Oracle Server - Enterprise Edition - Version: 10.1.0.2 to 11.2.0.1.0 - Release: 10.1 to 11.2
Oracle Server - Enterprise Edition - Version: 10.1.0.2 to 11.2.0.1.0   [Release: 10.1 to 11.2]
Information in this document applies to any platform.
Reviewed 22-Oct-2008

Goal

This document will explain how to configure SSH, which is required to run a RAC installation. Following the instructions in the installation guide are also correct, but sometimes this will not work, although the reason for that isn't clear. Therefore after some investigation it seems to be that the steps below will work too.
Starting with 11gR2 the Oracle Universal Installer the ssh setup can be done by using the  'SSH Connectivity' button.

Solution

To configure SSH you need to perform the following steps on each node in the cluster.
$ cd $HOME
$ mkdir .ssh
$ chmod 700 .ssh
$ cd .ssh
$ ssh-keygen -t rsa
Now accept the default location for the key file
Enter and confirm a passphrase. (you can also press enter twice).
$ ssh-keygen -t dsa
Now accept the default location for the key file
Enter and confirm a passphrase. (you can also press enter twice).
$ cat *.pub >> authorized_keys. (nodeX could be the nodename to differentiate files later)
Now do the same steps on the other nodes in the cluster.
When all those steps are done on the other nodes, start to copy the authorized_keys. to all the nodes into $HOME/.ssh/
For example if you have 4 nodes you will have after the copy in the .ssh 4 files with the name authorized_keys.

Then on EACH node continue the configuration of SSH by doing the following:
$ cd $HOME/.ssh
$ cat *.node* >> authorized_keys
$ chmod 600 authorized_keys
NOTE: ALL public keys must appear in ALL authorized_keys files, INCLUDING the LOCAL public key for each node.
To test that everything is working correct now execute the commands
$ ssh date
So on example in a 4 node environment:
$ ssh node1 date
$ ssh node2 date
$ ssh node3 date
$ ssh node4 date
Repeat this 4 times on each node, including ssh back to the node itself. The nodeX is the hostname of the node.
The first time you will be asked to add the node to a file called 'known_hosts' this is correct and answer the question with 'yes'. After that when correctly configured you must be able to get the date returned and you will not be prompted for a password.
Note: the above will work if during RSA and DSA configuration no password was provided. If you provide a password then you need to do 2 addition steps.
$ exec /usr/bin/ssh-agent $SHELL
$ /usr/bin/ssh-add
These statements will inform the ssh agent to add the keys to the shell used. So when a new shell is started you need to repeat the last to statements to make sure ssh is working properly.
ssh will not allow passwordless access if permissions on the home directory of the account you are using  allow write access for everyone.
You will also see permission denied error when the permissions on $HOME are 777 or 775.
Disable banner (/etc/banner) on all cluster nodes when you
  • run clusterverify (cluvfy, runcluvfy)
  • install software
  • patch the system

Please work with your System Administrator or contact your Operating System support in case you still have problems setting up ssh.

Saturday, 29 September 2012

Linux Add a Swap File / space

You need to use the dd command to create swap file. The mkswap command is used to set up a Linux swap area on a device or in a file.

Step #1: Login as the Root User

Open a terminal window (select Applications > Accessories > Terminal) or login to remote server using the ssh client. Switch to the root user by typing su - and entering the root password, when prompted

Step #2: Create Storage File

Type the following command to create 512MB swap file (1024 * 512MB = 524288 block size):
# dd if=/dev/zero of=/swapfile1 bs=1024 count=524288
Where,
  1. if=/dev/zero : Read from /dev/zero file. /dev/zero is a special file in that provides as many null characters to build storage file called /swapfile1.
  2. of=/swapfile1 : Read from /dev/zero write stoage file to /swapfile1.
  3. bs=1024 : Read and write 1024 BYTES bytes at a time.
  4. count=524288 : Copy only 523288 BLOCKS input blocks.

Step #3: Set Up a Linux Swap Area

Type the following command to set up a Linux swap area in a file:
# mkswap /swapfile1
Setup correct file permission for security reasons, enter:
# chown root:root /swapfile1
# chmod 0600 /swapfile1

A world-readable swap file is a huge local vulnerability. The above command make sure only root user can read/write to the file. Finally, activate /swapfile1 swap space immediately, enter:
# swapon /swapfile1
To activate /swapfile1 after Linux system reboot, add entry to /etc/fstab file. Open this file using a text editor such as vi:
# vi /etc/fstab
Append the following line:
/swapfile1 swap swap defaults 0 0
Save and close the file. Next time Linux comes up after reboot, it enables the new swap file for you automatically.

taken from http://www.cyberciti.biz/faq/linux-add-a-swap-file-howto/

Wednesday, 26 September 2012

Disable / Enable USB ports on Windows XP, 7 or Vista PC via Registry


With this trick, you can disable access to your USB(Universal Serial Bus) ports in your Windows based PC to prevent people from taking out data from your personal computer without permission or spreading viruses through the use of USB(pen and flash) drives.

To use this trick to disable USB ports, follow the steps given below:-

  1. Click on Start.
  2. Click on Run.
  3. Type "regedit" without quotes. This will launch the Registry Editor.
  4. Navigate to  HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\usbstor.
  5. In the work area, double click on Start.
  6. In the Value Data box, enter 4.
  7. Click on OK.
  8. Close Registry Editor and refresh your desktop.
  9. To re-enable access to your USB ports, enter 3 in the Value Data box in Step 6.

Sunday, 23 September 2012

Oracle Database: Find Free and Used space

SELECT Total.name "Tablespace Name",
       round(nvl(Free_space, 0)/1024) "Free Size(GB)",
       round(nvl(total_space-Free_space, 0)/1024) "Used Size(GB)",
       round(total_space/1024) "Total Size(GB)"
FROM
  (select tablespace_name, sum(bytes/1024/1024) free_space
     from sys.dba_free_space
    group by tablespace_name
  ) Free,
  (select b.name,  sum(bytes/1024/1024) total_space
     from sys.v_$datafile a, sys.v_$tablespace B
    where a.ts# = b.ts#
    group by b.name
  ) Total
WHERE Free.Tablespace_name(+) = Total.name
ORDER BY Total.name;

Number of Visitors