Copy permissions

Somethimes – especially on RACs – it is required to synchronize permissions on an ORACLE_HOMEĀ  running on one node with the permissions running on the other node.

 

Today i had the problem that after a patch all permissions were garbled. In order to restore service i had to fix them. The first idea here would be to copy the permissions from a working node and here is how you do it easy:

find /data/oragrid/product/11.2.0.3 -printf 'chown %U.%G %p\n' > /tmp/chown-home.sh
find /data/oragrid/product/11.2.0.3 -type d -printf "chmod %m %p \n" > /tmp/chmod-home.sh
find /data/oragrid/product/11.2.0.3 -type f -printf "chmod %m %p \n" > /tmp/chmod-home.sh

The scripts output for the file permissions looks like this:

chmod 775 /data/oragrid/product/11.2.0.3
chmod 755 /data/oragrid/product/11.2.0.3/patches
chmod 755 /data/oragrid/product/11.2.0.3/patches/p12989056
chmod 755 /data/oragrid/product/11.2.0.3/patches/p12989056/12989056
chmod 755 /data/oragrid/product/11.2.0.3/patches/p12989056/12989056/custom

and for the ownership:

chown 0.30275 /data/oragrid/product/11.2.0.3
chown 20341.30275 /data/oragrid/product/11.2.0.3/JRE
chown 20341.30275 /data/oragrid/product/11.2.0.3/patches
chown 20341.30275 /data/oragrid/product/11.2.0.3/patches/p12989056
chown 20341.30275 /data/oragrid/product/11.2.0.3/patches/p12989056/12989056

Just execute the scipts in any order and you are done.

Leave a Reply

Your email address will not be published.