In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
When doing oracle database management, users often encounter errors that exceed the maximum number of processes, showing that new connections cannot log in to the database. Consistent prompt exceeds the maximum number of process. In fact, this problem, if the user is a test environment, can be solved. Shut down the database directly or kill all the "LOCAL=NO" processes directly.
But in many cases, users cannot accept downtime, or kill loses all remote connections. Based on the above, the following script is written
#! / usr/bin/perl#write by wulei#get the first parameter$arg1= ""; chomp ($arg1); while ($arg1 eq "") {print "please input your first parameter:"; $arg1=; chomp ($arg1); if ($arg1 ne "") {@ temp1= `ps-eo lstart,pid,args | grep'$arg1' | grep-v grep`; $process_count= `ps-eo lstart,pid,args | grep'$arg1' | grep-v grep | wc-l`; chomp ($process_count) If ($process_count eq "0") {$arg1= "; print" we got 0 processes,please retry!\ n "; next;} print" We will kill $process_count (count) processes\ n "; print" All the processes list below!\ n " Print "# #\ n"; print @ temp1;} chomp ($arg1);} # get the second parameter$arg2= ""; chomp ($arg2); while ($arg2 eq "") {print "\ n"; print "\ n" Print "#\ n"; print "# [null] kill all the process we had got #\ n"; print "# [num] kill the process start at before sysdate-number #\ n" Print "if you want exit,enter 'ctrl+c' #\ n"; print "#\ n"; print "please input your second parameter:"; $arg2=;chomp ($arg2) If ($arg2 eq ") {print" Are you sure,to kill all the process above: [yPay] "; $confirm=; chomp ($confirm); if ($confirm eq" Y "or $confirm eq" y ") {# kill all the process, we got it @ result= `ps-eo pid,args | grep'$arg1' | grep-v grep` Print "Kill List!\ n" Print "#\ n"; foreach $result (@ result) {@ result1=split (/\ scharger); chomp ($result1 [0]) If ($result1 [0] ne ") {# `kill-9'$result1 [0]'`; print $result1 [0]." .$ result1 [1]. ".$ result1 [2]."\ n "; push (@ kill_Queue,$result1 [0]);}} $killQueueLen=@kill_Queue Print "#\ n"; print "We will kill'$killQueueLen' processes!\ n"; print "Are you sure about kill the processes above? [YBO]"; $yesorno=; chomp ($yesorno) If ($yesorno eq "Y" or $yesorno eq "y") {print "#\ n"; foreach $kill_Queue (@ kill_Queue) {print $kill_Queue Chomp ($kill_Queue); if ($kill_Queue ne ") {`kill-9'$kill_Queue' `;} elsif ($yesorno eq" N "or $yesorno eq" n ") {@ kill_Queue= (); $arg2="; next } else {print "#\ n"; print "JUEST Y or Neighbourhood"!\ n " Print "#\ n"; next;} print "OK\ n"; exit;} elsif ($confirm eq "N" or $confirm eq "n") {exit 0 } else {print "Please input [yporpora]:"; next;}} else {if ($arg2 = ~ / ^ [+ -]?\ dMacau /) {@ result= `ps-eo lstart,pid,args | grep $arg1 | grep-v grep`; my @ kill_Queue= "; print" killed list\ n " Print "#\ n"; foreach $result (@ result) {if ($result ne "") {@ result1 = split $time_start=$result1 [1]. ". $result1 [2].". $result1 [3]. ". $result1 [4]; $format_time= `date-d'$time_start''+% Y/%m/%d% T'`; chomp ($format_time); $pro_st_time= `date +% s-d'$format_time' `; $A1 = `date`; chomp ($A1); chomp ($pro_st_time); chomp ($kill_time) $cur_time= `date +% s-d'$a1``; $kill_time=$cur_time-$arg2; if ($pro_st_time > $kill_time) {print $result1 [5]. ". $result1 [6].". $result1 [7]. "\ n"; push (@ kill_Queue,$result1 [5]);}} else {next;}} $killQueueLen=@kill_Queue-1 Print "#\ n"; print "We will kill'$killQueueLen' processes!\ n"; print "Are you sure about kill the processes above? [YBO]"; $yesorno=; chomp ($yesorno) If ($yesorno eq "Y" or $yesorno eq "y") {foreach $kill_Queue (@ kill_Queue) {chomp ($kill_Queue); if ($kill_Queue ne ") {`kill-9'$kill_Queue' `;} elsif ($yesorno eq" N "or $yesorno eq" n ") {$arg2=" Next;}} print "retry";} print "End of the script\ n"; print "= =\ n"
The basic function of the script is to data on the processes to be filtered, such as "LOCAL=NO", and then get the start time and content of all matching processes. Then, the process that needs the data to kill is a process that starts several seconds before the current point in time. If you enter null. Is that kill drops all matching processes. If you enter 1000, kill drops all processes marked "LOCAL=NO" that have started in the past 1000 seconds.
After performing the process, you should be able to connect to the database. Adjust the process parameters. Ensure that the system is running properly, and then query the cause of this error.
In this way, we can minimize the impact on the system as much as possible.
Current scripting knowledge has been tested on linux, not on other unix-like systems.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.