The two highly lethal commands compiled today can instantly kill Oracle. Next I will give a simple comment and demonstrate its power.
$ Ps-ef | grep $ ORACLE_SID | grep-v grep | awk '{print $2}' | xargs kill-9
$ Ipcs-m | grep oracle | awk '{print $2}' | xargs ipcrm shm
The reason for these two commands:
Today, three Oracle databases cannot be logged on without reason. No matter what method you use, you cannot log on to Oracle SQL * PLus, let alone troubleshooting.
In this case, there are two options. The first option is to troubleshoot the fault for a long time. The other method is to start the database at any cost to restore production as soon as possible.
The first method can be used to test the experiment environment, and the experience accumulated in troubleshooting is intentional.
In a production environment, reducing the downtime is the most important principle, so we have to restore the database as soon as possible at all costs.
There are two methods to restore production as soon as possible.
The first method at any cost is to restart the server host, completely release all resources, and re-use it. This method is effective, but the downtime is still a little long, and the technical content is relatively low, therefore, this super "simple and rude" method is not recommended.
The second method is the one I will show you.
1. Step 1: Use the kill command of Linux to kill all oracle-related processes.
1) query oracle processes related to ORACLE_SID
$ Ps-ef | grep $ ORACLE_SID
Oracle 7776 1 0? 00:00:00 ora_pmon_ora10g
Oracle 7778 1 0? 00:00:00 ora_psp0_ora10g
Oracle 7780 1 0? 00:00:00 ora_mman_ora10g
Oracle 7782 1 0? 00:00:00 ora_dbw0_ora10g
Oracle 7784 1 0? 00:00:00 ora_dbw1_ora10g
Oracle 7786 1 0? 00:00:00 ora_lgwr_ora10g
Oracle 7788 1 0? 00:00:00 ora_ckpt_ora10g
Oracle 7790 1 0? 00:00:00 ora_smon_ora10g
Oracle 7792 1 0? 00:00:00 ora_reco_ora10g
Oracle 7794 1 0? 00:00:00 ora_cjq0_ora10g
Oracle 7796 1 0? 00:00:00 ora_mmon_ora10g
Oracle 7798 1 0? 00:00:00 ora_mmnl_ora10g
Oracle 7832 1 0? 00:00:00 ora_arc0_ora10g
Oracle 7834 1 0? 00:00:00 ora_arcw.ora10g
Oracle 7836 1 0? 00:00:00 ora_qmnc_ora10g
Oracle 7842 1 0? 00:00:00 ora_q000_ora10g
Oracle 7847 1 0? 00:00:00 ora_q0020.ora10g
Oracle 7951 7592 0 00:00:00 pts/2 grep ora10g
2) remove records containing the grep command itself
$ Ps-ef | grep $ ORACLE_SID | grep-v grep
Oracle 7776 1 0? 00:00:00 ora_pmon_ora10g
Oracle 7778 1 0? 00:00:00 ora_psp0_ora10g
Oracle 7780 1 0? 00:00:00 ora_mman_ora10g
Oracle 7782 1 0? 00:00:00 ora_dbw0_ora10g
Oracle 7784 1 0? 00:00:00 ora_dbw1_ora10g
Oracle 7786 1 0? 00:00:00 ora_lgwr_ora10g
Oracle 7788 1 0? 00:00:00 ora_ckpt_ora10g
Oracle 7790 1 0? 00:00:00 ora_smon_ora10g
Oracle 7792 1 0? 00:00:00 ora_reco_ora10g
Oracle 7794 1 0? 00:00:00 ora_cjq0_ora10g
Oracle 7796 1 0? 00:00:00 ora_mmon_ora10g
Oracle 7798 1 0? 00:00:00 ora_mmnl_ora10g
Oracle 7832 1 0? 00:00:00 ora_arc0_ora10g
Oracle 7834 1 0? 00:00:00 ora_arcw.ora10g
Oracle 7836 1 0? 00:00:00 ora_qmnc_ora10g
Oracle 7842 1 0? 00:00:00 ora_q000_ora10g
Oracle 7847 1 0? 00:00:00 ora_q0020.ora10g
3) use the awk command to get the process number that we care about.
$ Ps-ef | grep $ ORACLE_SID | grep-v grep | awk '{print $2 }'
7776
7778
7780
7782
7784
7786
7788
7790
7792
7794
7796
7798
7832
7834
7836
7842
7847
4) Everything is ready. We finally use the kill command to kill the oracle process, so we get the complete command below
$ Ps-ef | grep $ ORACLE_SID | grep-v grep | awk '{print $2}' | xargs kill-9
2. Step 2: Use the Linux ipcs and ipcsrm commands to release the shared memory occupied by oracle.
1) Use the ipcs command to view the shared memory usage in the system
$ Ipcs-m
------ Shared Memory Segments --------
Key shmid owner perms bytes nattch status
0x00000000 32768 root 644 72 2 dest
0x00000000 65537 root 644 16384 2 dest
0x00000000 98306 root 644 280 2 dest
0x00000000 131075 root 644 790528 2 dest
0x00000000 163844 root 644 790528 2 dest
0x00000000 196613 root 644 790528 2 dest
0x00000000 327689 oracle 644 790528 2 dest
0x00000000 360458 oracle 644 790528 2 dest
0x00000000 393227 oracle 644 790528 2 dest
0xecc5fba0 786447 oracle 640 5370806272 30
2) use the grep command to filter and obtain oracle-related content.
$ Ipcs-m | grep oracle
0x00000000 327689 oracle 644 790528 2 dest
0x00000000 360458 oracle 644 790528 2 dest
0x00000000 393227 oracle 644 790528 2 dest
0xecc5fba0 786447 oracle 640 5370806272 31
2) use the awk command to obtain the shmid field content we are concerned about above.
$ Ipcs-m | grep oracle | awk '{print $2 }'
327689
360458
393227
786447
3) use the ipcsrm command to release the shared memory.
$ Ipcs-m | grep oracle | awk '{print $2}' | xargs ipcrm shm
Resource (s) deleted
Check again that the shared memory has been released.
$ Ipcs-m | grep oracle
0x00000000 327689 oracle 644 790528 2 dest
0x00000000 360458 oracle 644 790528 2 dest
0x00000000 393227 oracle 644 790528 2 dest
0x00000000 786447 oracle 640 5370806272 31 dest
3. Now, we can log on to the database and start the database to restore production.
4. Summary
This method is relatively rough. However, it can be used in times of crisis.
Emphasis:
It is very dangerous to manually kill the oracle process and manually release the shared memory;
Here are two highly lethal commands I have provided. Please do not try them easily.
Good luck.
-- The End --