Tuesday, March 20, 2012

chown -R lesson learned the hard way

chown -R is a risky command to run. Especially if you are sitting in root. Make sure you are in the directory you want to recurse through…or you will be recursing yourself.


The following is more of a brain dump then a guide. Maybe you can glean some good stuff out of it.


I was able to Crtl+C out of it quick enough to prevent most of the damage, and fortunately I was sitting on a development server and not the production sever. One side effect is that all the Oracle Databases in a given Oracle Home stopped. When the permissions where changed on the oracle binary in the Home that caused a problem.


So find the oracle binary (you can use oraenv to set the home and then CD $ORACLE_HOME)…In Retrospect I am not sure that I needed to run this, but it is a good idea to check the permissions on the oracle binary. If your system is working fine do not change this!


ls -l oracle

might look something like this: 


-rwxr-xr-x 1 oracle oinstall 

You need to fix that with this command


chmod 6751 oracle

Resulting in this: 


-rwsr-s--x   1 oracle   dba        

Then you can try to open your database. If you are unfortunate like me then you will get the folllowing error:


ORA-27123:unable to attach to shared memory segment 
Linux error :22: Invalid argument 
Additional information:1 
Additional information:2457610

From here you need to use the sysresv tool along with the ipcs tool


  • run the . oraenv command and set it to the SID you want to work with

  • run the sysresv -i command

  • This tool will tell you if the oracle instance is still in memory. If you get a yes/no prompt that typically means the instance is shutdown and you need to enter yes to clear it from memory.

The output will look similar to this


 IPC Resources for ORACLE_SID "X816" :
Shared Memory:
ID KEY
16837 0xe4efa8dc
Semaphores:
ID KEY
12714018 0x09d48346
Oracle Instance not alive for sid "X816"

  • run the ipcrm -m command. You will use the ID from the sysresv command you executed above (16837) in our intance.

Then you can run a startup on your database. If you are unfortnate like me then you will receive the following error:  


ORA-00845: MEMORY TARGET not supported on this system.

This error was raised because /dev/shm (my tmpfs mount) was out of space. I noticed a lot of orphaned files (labled by SID) in this folder. So I moved them over to a temporary folder and bought enough room to start each one of my database instances.

0 comments:

Post a Comment