recent

Titulo

NOHUP for DBA & Developer

NOHUP is a Linux Command to run a job in the background. Why is it important to DBA and developer? NOHUP stands for "No Hang Up" which will make sense when you are done reading this article.  Whenever, I push a change to production database, we do it during off hours when there are no or minimum traffics that is mostly at midnight, early morning or weekends depending on the nature of business. I hate to go to office during those off hours to implement db changes therefore, I work from home using my VPN connection.

What are the risks of running your script from home? Well, I can list over dozens but I am going to point out just the main one.  You may loose your VPN connection anytime! What do you think? What will happen to the script you are running on your SQL Developer or SQL*Plus when you loose connection? Limbo right? Well, one of two things will happen, either the script will continue to run or the change gets rollback. Do you really want this to happen when you are working on a strict maintenance window? Well, I am going to show you how you can run your script in the background and not worry about your loosing VPN connection on both Linux & Window's Server.

Linux Server: Linux command <nohup> runs your script in the background. You don't have to wait for your script to be done running it. Just run the script in the background and move on to your next project.  Next, we will do a demo on how <nohup> command is used while running Linux shell script and in SQL*Plus to run SQL query.

vi demoscript.ksh
#!/bin/ksh
echo " no hup demo exercise"
echo "back from 1 min sleep"
sleep 60
echo "back from 5 min sleep"
sleep 300
exit
## making script executable
chmod 775 demoscript.ksh
## Running script in background
nohup ./demoscript.ksh &
## viewing background jobs
jobs


Foreground to Background: There may be a time where your script runs longer than expected time and you may need to leave for the day. In such case you must switch your foreground jobs to background and then log out.

## executing demoscript.ksh
./demoscript.ksh
## suspending execution of demo script.ksh
"CTRL +Z"
## switching foreground jobs to background
bg
## viewing background jobs
jobs
## bring background job back to foreground
fg %1


Running SQL Query in the Background:
nohup sqlplus username/password@oracleserver @query_file.sql &

Windows: Linux Server has a cool <nohup> utilities that takes care of everything we are trying to accomplish? What does Microsoft offer for their windows user? Well, there is no equivalent that I am aware of but I would always RDP into the Window's host where my database sits and run the deployment script using SQL*Plus from the command. You may even use SQL Developer if that is installed. If anyone knows the better alternatives, please post a comment below. Since, the query is running on the host, you can logout of your pc and then monitor from home later.

Others: What options do you have beside <nohup> and RDP? There are two other options that I am aware of but they require additional work. You may schedule your script to run via Cron Schedular. Cron runs all the process in the background. The second options is to run Oracle Query using DBMS Scheduler which runs the job in the background like Cron. When Linux is not your OS these are the second best options to run your scripts.

Now, you know the risk of running SQL queries from SQL Developer and SQL*Plus especially when working from home.  If I am working on queries that is going to take a long time at 4:00 pm, I will run my sql using <nohup>, exit my laptop, go home and then start monitor from home. I hope you find this article helpful and  I encourage you make to use it if you are working from home/remotely or deploying the critical changes.


Interested in working with me? I can be reached at pbaniya04[at]gmail.com for any questions, consulting opportunities or you may drop a line to say HELLO. Thank your again for visiting my blog and looking forward to serving you more.

Have a Database-ious Day!

104 comments

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. This comment has been removed by a blog administrator.

    ReplyDelete
  3. This comment has been removed by a blog administrator.

    ReplyDelete
  4. This comment has been removed by a blog administrator.

    ReplyDelete
  5. This comment has been removed by a blog administrator.

    ReplyDelete
  6. This comment has been removed by a blog administrator.

    ReplyDelete
  7. This comment has been removed by a blog administrator.

    ReplyDelete
  8. This comment has been removed by a blog administrator.

    ReplyDelete
  9. This comment has been removed by a blog administrator.

    ReplyDelete
  10. This comment has been removed by a blog administrator.

    ReplyDelete
  11. This comment has been removed by a blog administrator.

    ReplyDelete
  12. This comment has been removed by a blog administrator.

    ReplyDelete
  13. very useful really good information thanks for posting such a good information it will hepls the people a lot keep it up.. Best MATLAB Training Center In Chennai|

    ReplyDelete
  14. Wow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.and once again thanks for sharing.….. Best PMI Certification In Chennai|

    ReplyDelete
  15. Thanks for sharing this informative blog. I have read your blog and I gathered some valuable information from this blog. Keep posting. Best ISTQB BCS Certification In Chennai|

    ReplyDelete
  16. very nice post what a fantastic information you sharing. Keep sharing your post regularly.. Best CISM Certification in Chennai |

    ReplyDelete
  17. This post was quite awesome and interesting to read. Congrats for your work. Thanks a lot for providing this with us. Keep on updating this with us regularly: Best CISA Certification in Chennai |

    ReplyDelete
  18. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge. Best CCNA Training Center in Chennai |

    ReplyDelete
  19. Your blog was so informative, Really I thanks a lot for sharing such a awesome blog., Best RHCSA Training Institute In Chennai |

    ReplyDelete
  20. Excellant post!!!. The strategy you have posted on this technology helped me to get into the next level and had lot of information in it. Best Tally Training Center in chennai |

    ReplyDelete
  21. Really an amazing post..! By reading your blog post i gained more information. Best Microsoft Advanced Excel Training Center in chennai |

    ReplyDelete
  22. Thanks for sharing this valuable information to our vision. You have posted a trust worthy blog keep sharing. Best CCNA Training institute in chennai |

    ReplyDelete
  23. Really it was an awesome article...very interesting to read..You have provided an nice article....Thanks for sharing.. Best Software Testing Training Center in chennai
    |

    ReplyDelete
  24. this blog is really useful and it is very interesting thanks for sharing , it is really good and exclusive. Best Prince 2 Exam center in chennai|

    ReplyDelete
  25. Great and useful post.Thanks for taking time to share this post. Best Machine Learning Training in chennai|

    ReplyDelete
  26. Great tips and its so easy to understand. really You explain everything in detailed manner and it was very interesting to read. Thank you. Best Data Science Training in chennai|

    ReplyDelete
  27. Thanks for another great post. The place else may anyone get that type of information in such a perfect way of writing? I’ve a presentation next week, and I’m at the look for such information. Best CCNA Training Institute in Chennai

    ReplyDelete
  28. Wow, interesting and informative topic. Helps to gain a lot of knowledge . Thanks for posting such an informative post in this blog. Best Tally Training Institute in Chennai

    ReplyDelete
  29. This is excellent information. It is amazing and wonderful to visit your site.Thanks for sharing this information and it is very useful to me... RHCSA Training Center in Chennai|

    ReplyDelete
  30. Great the given information and after refer that post,i get new energy because of all given information very excellent and real words to implemented for you.Thank you so much shared that valuable information. PCB Design Training Center in Chennai ! velachery|

    ReplyDelete

  31. These provided information was really so nice,thanks for giving that post and the more skills to develop after refer that post. Your articles really impressed for me,because of all information so nice. JAVA Training Center in Chennai |

    ReplyDelete
  32. Thank you so much for sharing such an amazing post with useful information with us. Keep updating such a wonderful blog…. Photoshop Training institute in Chennai |

    ReplyDelete
  33. Very nice blogs!!! I have to learning for lot of information for this sites...Sharing for wonderful information. Thanks for sharing this valuable information to our vision. You have posted a trust worthy blog keep sharing.… Tally Training Center in Chennai |

    ReplyDelete
  34. Very happy to see this blog. Gives a wonderful information with coded explanaion. Thank you for this blog. very useful to me. Prince2 Certification Center in Chennai |

    ReplyDelete
  35. Thanks for your informative Information.Your post helped me to understand the future and career prospects. Keep on updating your blog with such awesome article. Agile Scrum Master Certification Center in Chennai |

    ReplyDelete
  36. Thanks for sharing this informative blog. I have read your blog and I gathered some valuable information from this blog. Keep posting. BBA Project center in chennai and velachery |

    ReplyDelete
  37. Awesome post. Really you have shared a very informative concept... Thank you for sharing. Keep on updating... EEE Project center in chennai and velachery |

    ReplyDelete
  38. Well Said, you have furnished the right information that will be useful to anyone at all time. Thanks for sharing your Ideas. UFT Training center in chennai |

    ReplyDelete
  39. Hi, you have given really informative post. Thanks for sharing this post to our vision. MCSE Training institute in chennai |

    ReplyDelete
  40. It is really a great and useful piece of information. I am glad that you shared this helpful info with us. Please keep us up to date like this. Thank you for sharing. Azure Training institute in Chennai and Velachery |

    ReplyDelete
  41. Amazing write up. You have delivered useful information. Thanks for posting and keep blogging. PCB Design Training Center in Chenna |

    ReplyDelete
  42. Excellent blog with useful concept. Really I feel very happy to see this informative blog, Thanks for sharing such a nice blog.. Tally Training Institute in Chennai|

    ReplyDelete
  43. Very nice post here and thanks for it .I always like and such a super blog of these post.Excellent and very cool idea and great blog of different kinds of the valuable information's. Python Training Institute in Chennai |

    ReplyDelete
  44. awesome way to get exert tips from everyone,not only i like that post all peoples like that post,because of all given information was wonderful and it's very helpful for me. CCNA Exam Center in Chennai |

    ReplyDelete
  45. In the beginning, I would like to thank you much about this great post.I like your writing style and I hope you will keep doing this good working AWS Exam Center in Chennai |

    ReplyDelete
  46. Wow...Excellent informative blog, really helpful. Thank you. Final Year Projects For Phd in Chennai |

    ReplyDelete
  47. It is really a great work and the way in which u r sharing the knowledge is excellent.Thanks for helping me to understand basic concepts. Final year projects For Engineering Students in Chennai |

    ReplyDelete
  48. Thank you for sharing the information here. Its much informative and really i got some valid information. You had posted the amazing article. Final year projects For CSE Students in Chennai |

    ReplyDelete
  49. Excellant post!!!. The strategy you have posted on this technology helped me to get into the next level and had lot of information in it. Final year projects For CS in Chennai |

    ReplyDelete
  50. I am joyful to read this post, its an attractive one. Thanks for this amazing post.. Final year projects For IT in Chennai |

    ReplyDelete
  51. I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing.. Final year projects For EEE in Chennai |

    ReplyDelete
  52. This is excellent information. It is amazing and wonderful to visit your site.Thanks for
    sharing this information, this is useful to me. Photoshop Training institute in Chennai |

    ReplyDelete
  53. Really an awesome post. I wondered by reading this blog post. Thanks a lot for posting this unique post which you have shared with us. Keep on posting like this exclusive post with us. Photoshop Training institute in Chennai |

    ReplyDelete
  54. I really enjoy simply reading all of your weblogs. Simply wanted to inform you that you have people like me who appreciate your work. Hardware and Networking Training institute in Chennai |

    ReplyDelete
  55. This is excellent information. It is amazing and wonderful to visit your site.Thanks for sharing this information and it is very useful to me... Microsoft Azure Certification Center in Chennai |

    ReplyDelete
  56. Really very great information to be provided and the All points discussed were worth reading and i’ll surely work with them all one by one. TOGAF Certification Center in Chennai |

    ReplyDelete
  57. Wonderful blog.. Thanks for sharing informative blog.. its very useful to me.. Selenium Training Center in Chennai |

    ReplyDelete
  58. Your blog was so informative, Really I thanks a lot for sharing such a awesome blog. Tally Erp9 Training Center in Chennai |

    ReplyDelete
  59. I am reading your post from the beginning, it was so interesting to read & I feel thanks to you for posting such a good blog, keep updates regularly. Graphic Designing Training Center in Chennai |

    ReplyDelete
  60. Nice Post! It is really interesting to read from the beginning & I would like to share your blog to my circles, keep your blog as updated. JAVA Training Institute In Chennai |

    ReplyDelete
  61. very nice blogs!!! i have to learning for lot of information for this sites...Sharing for wonderful information. Thanks for sharing this valuable information to our vision. You have posted a trust worthy blog keep sharing. Final year projects For EEE in Chennai |

    ReplyDelete
  62. Impressive blog with lovely information. really very useful article for us thanks for sharing such a wonderful blog... Final year projects For BCA in Chennai |

    ReplyDelete
  63. Your blog is awesome..You have clearly explained about it ...Its very useful for me to know about new things..Keep on blogging.. Final year projects For MCA in Chennai |

    ReplyDelete
  64. Python is a dynamic and object-oriented programming language, widely used for web application development. 90% of people prefer Python over other technology because of its simplicity, reliability and easy interfacing. unindent does not match any outer indentation level python

    ReplyDelete
  65. I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! keep up the good work... online marketing outsourcing services

    ReplyDelete
  66. That appears to be without doubt terrific. A good number of teeny facts are meant experiencing great deal of background abilities. I will be interested the thing a large amount. Smart contract software development chennai

    ReplyDelete
  67. This is a great inspiring article.I am pretty much pleased with your good work.You put really very helpful information. Keep it up. Keep blogging. Looking to reading your next post
    Custom MLM Software jaipur

    ReplyDelete
  68. I Read your artical.your post is very is very useful.so thankyou so much for sharing...Smart contract development company mirzapur

    ReplyDelete
  69. Great Post…This Article is very unique. Thanks for sharing and very informative!!!MLM Software Development Company Mumbai

    ReplyDelete
  70. Thanks for writing such a good article.I stumbled into your especially.Really ts inconceivable article keep it up!!!crypto exchange software development mumbai


    ReplyDelete
  71. Amazing article I like to read your blog very useful keep it up thanks for share.
    ERC20 Token Developer in Mumbai

    ReplyDelete
  72. Great Post…This Article is very unique. Thanks for sharing and very informative!!gupt rog in Allahabad

    ReplyDelete
  73. fantastic artical.thanks for a sharing and i read this blog..gupt rog doctors in allahabad

    ReplyDelete
  74. I found your this post while searching for some related information on blog search...Its a good post..keep posting and update the information. palm hills alexandria

    ReplyDelete
  75. Wonderful beat ! I wish to apprentice while you amend
    your web site, how can i subscribe for a blog site? The account helped me a acceptable deal.
    I had been a little bit acquainted of this your broadcast
    provided bright clear idea.대구오피

    부산오피

    ReplyDelete
  76. i really try these steps its very helpful to me , thanks for this amazing blog ..Sexologist in Allahabad

    ReplyDelete
  77. Excellent post. I certainly appreciate this website. Keep writing!top 10 sexologist doctors in allahabad

    ReplyDelete
  78. very informative blogs posting thanks you so much sharing me information.
    German Language Course In Gurgaon

    ReplyDelete
  79. This is just the information I am finding everywhere. Thanks for your blog, I just subscribe your blog. This is a nice blog.
    Zirconia Crown Manufacturer In India

    ReplyDelete
  80. Thank you so much for such a well-written article. It’s full of insightful information.
    bestzirconia crowns in india

    ReplyDelete
  81. Your Blog is very nice.
    Wish to see much more like this. Thanks for sharing your information
    Buy Peripherals Online at Best Prices | MyBogo | Free Shipping

    ReplyDelete
  82. i really try these steps its very helpful to me , thanks for this amazing blog . Best Sexologist in Prayagraj

    ReplyDelete
  83. thanks for sharing valid information and a blog post.

    Study In Germany

    ReplyDelete
  84. I really appreciate the kind of topics you post here, a great information that is actually helpful for us and you can also visit our link for best zirconia crowns in india

    ReplyDelete
  85. Mega Downloader crack offers user measured scrambled cloud stowing planetary and dialogue as of side to adjacent regular network browsers. Mega Downloader Pc

    ReplyDelete


  86. I always felt uplifted after reading this blog's posts.
    K7 Total Security

    ReplyDelete
  87. thanks for sharing a valid information and a blog post .

    German Language Institute In Chandigarh

    ReplyDelete

Powered by Blogger.