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