Youry's Blog

Youry's Blog

Archive for the ‘Most’ Category

Oracle Scripts

leave a comment »

  • Cold Backup

I’ve use scripts from internet with my modifications for our local servers. It’s for myself and my colleagues only to help with day-to-day activity.

at the first I prefer to use a short path to the local folder which keeps necessary scripts. I use c:\scripts

good link is here: http://toolkit.rdbms-insight.com/cold_backup_scr.php

She has a copyright, but because she wrote:

“You will have to create two additional files, shutdown.sql and startup.sql — see comments in the second scipt. You will also need to precreate the backup log and, of course, customize the directories and SID for your system.”  “Note: Proofread any scripts before using. Always try scripts on a test instance first. I’m not responsible for any damage, even if you somehow manage to make my scripts corrupt every last byte of your data, set your server on fire and serve you personally with an eviction notice from your landlord!

I assume I have a right to correct her script for my configuration with appropriate credits for her work. If anybody has any problem with the updated script, please let me know. I’ll be happy to remove the updated script from this blog and to write my own. This is only to save my time, because I already wrote a lot of other scripts in the past, but I’ve lost many of them as well.

--------CUT-----------Updated by YK ------------------CUT---------------------

REM make_cold_backup.sql
REM copyright 2001-2004 N Roshak, updated by YK on Sun Vov 4, 2012
REM this is a sql script to generate a DOS backup script

rem YK's correction
connect / as sysdba
set heading off
set pagesize 0
set echo off
set feedback off
set verify off
set linesize 500
col mything for a500
spool C:\scripts\cold_backup.bat
prompt REM Script to take full cold database backup
prompt REM generated by make_cold_backup_scr.sql
prompt REM does not back up tempfiles
prompt REM
REM updated by YK
prompt set oracle_home=C:\ORACLE\PRODUCT\10.2.0
prompt set backup_dir=Y:\klo-sciora-1_backup\coldSCI254Backup
REM corrected by YK on Nov. 4th, 2012
select distinct 'copy ' || leaf
|| ' %backup_dir%' || substr(leaf,instr(leaf,'\',-1,1), length(leaf))
as  cmdstr
from
(select name as LEAF from v$datafile
union
select name from v$controlfile
union
select member from v$logfile)
/
prompt REM Copy init.ora and pwd files
prompt copy %oracle_home%\db_1\database\SPFILESCI254.ORA %backup_dir%\SPFILESCI254.ORA
prompt copy %oracle_home%\db_1\database\PWDsci254.ora %backup_dir%\PWDsci254.ora
spool off
exit

--------CUT-----------------------------CUT---------------------

REM backup.bat
REM this is a DOS batch script
REM to take a full cold backup
REM copyright 2002-2004 N Roshak, updated by YK on Nov 4th, 2012

REM requires two sql scripts in addition to the above sql script:
REM shutdown.sql (connect / as sysdba, shutdown immediate, exit)
REM startup.sql (connect / as sysdba, startup open, exit)

set oracle_home=C:\ORACLE\PRODUCT\10.2.0\db_1
set script_dir=c:\scripts
set shutdown=%script_dir%\shutdown.sql
set startup=%script_dir%\startup.sql
set scriptgen=%script_dir%\sci254ColdBackup.sql
set log=%script_dir%\backup.log

echo >> %log%
echo ----------BEGIN FULL COLD BACKUP OF DB---------- >> %log%
date /T >> %log%
time /T >> %log%
echo Generating cold backup script... >> %log%
%oracle_home%\bin\sqlplus /nolog @%scriptgen%

date /T >> %log%
time /T >> %log%
echo Shutting down... >> %log%

%oracle_home%\bin\sqlplus /nolog @%shutdown%

echo Backing up... >> %log%
call %SCRIPT_DIR%\cold_Backup.bat >> %log% 2>&1

echo Starting up... >> %log%
%oracle_home%\bin\sqlplus /nolog @%startup%

date /T >> %log%
time /T >> %log%
echo Succesfully completed. >> %log%
echo -----------END FULL COLD BACKUP OF DB----------- >> %log%

--------CUT-----------------------------CUT---------------------

Written by youryblog

November 4, 2012 at 5:49 PM

Horror Stories

leave a comment »

I’m starting new blog about “horror stories” in SW Engineering and industry. I think it’s good to know what we could have from some “businessman”.

  1. This box cost Enumclaw fire district $309,794 http://www.pressdisplay.com/pressdisplay/viewer.aspx?newspaper=the+seattle+times+sunday&issue=10632012102800000000001001
    It’s a very good story, when somebody plans to do something fast and cheap, as in this story to get a cheap and old movable home for $85,000 and move it to a very close location, but real price for the relocation can be in two times more expensive than the home. But they did mistake – they bought the home from the wife of an elected official who oversees the district …  The new one would cost $225,000.
  2. I like this paper: Why Projects Fail (Facts and Figures): http://calleam.com/WTPF/?page_id=1445
    Source : IBM
    Type of survey : Survey of 1,500 change management executives
    Date : Oct 2008

    IBM survey in the success / failure rates of “change” projects finds;

    Only 40% of projects met schedule, budget and quality goals
    Best organizations are 10 times more successful than worst organizations
    Biggest barriers to success listed as people factors: Changing mindsets and attitudes – 58%. Corporate culture – 49%.  Lack of senior management support – 32%.
    Underestimation of complexity listed as a factor in 35% of projects

Written by youryblog

November 3, 2012 at 2:37 PM

Posted in Business, Most

IT jobs market (some info)

leave a comment »

  1. The Unemployable Programmer: “When companies find out I don’t have a degree that’s usually the end of the road. “
  2. T Job Market Recovering Faster Than After Dot-Com Bubble Burst InfoWorld (01/14/13) Ted Samson  (from the January 16, 2013 edition of ACM TechNews http://technews.acm.org/)”More new technology jobs have been created since the end of the past recession than during the same recovery period following the burst of the dot-com bubble and the early 1990s recession, according to a recent Dice.com report. In the 42 months since the most recent recession officially ended in June 2009, 180,600 tech jobs have been created. By contrast, in the 42 months following the end of the recession in March 1991, the total number of U.S. tech jobs dropped by 48,500. In addition, between November 2001 and April 2005, 415,600 tech jobs were lost. Although the past recessions were damaging to the tech industry, today tech jobs are steadily returning and the unemployment rate among tech professionals is much lower than the overall national average. At the end of 2012, the tech unemployment rate was 4.1 percent, while the national average was 8.7 percent. The unemployment rate for database administrators is 1.5 percent, the lowest among all tech-related categories. The second lowest rate is among network architects at 1.9 percent, while the rate for software developers is 2.9 percent, followed by computer systems analysts at 3.3 percent and Web developers at 3.5 percent. ” full paper is here http://www.nytimes.com/2013/01/15/technology/california-to-give-web-courses-a-big-trial.html
  3. Jon Swartz, USA TODAYShareSecond of five reports this week on the job outlook in key industries.full paper: http://www.usatoday.com/story/money/business/2012/10/01/hot-tech-jobs-demand/1593105/“Data analysts are as important as the best engineers and designers. Job recruiters would say they’re more important.A recent McKinsey Global Institute study called data analytics “the next frontier for innovation, competition and productivity.”

    “It’s never been a better time to be a data scientist,” known in the industry as quantitative jocks,says John Manoogian III, co-founder and chief technology officer at 140 Proof. “Companies want to turn this data into insights about what people like and what might be relevant to them, but they need very specialized analytical talent to do this.”

    And the job pays well — whether in San Francisco (an average annual salary of $104,000), New York ($102,000) or Chicago ($86,000), according to Indeed.com. The average salary is $74,000, says site Simply Hired.

  4. IT Jobs Light Up Top 100 Careers for 2013 by InfoWorld, December 20, 2013 http://www.acm.org/membership/careernews/archives/acm-careernews-for-tuesday-january-8-2013/
    “According to a recent U.S. News and World Report ranking of the 100 best jobs for 2013, systems analyst, database administrator, software developer, and Web developer are among the top 10 overall careers of the year. In addition, three other IT jobs — computer programmer, IT manager, and systems administrator — made the top 25. U.S. News and World Report based its rankings on several key factors: salary, job prospects, employment rate, and growth potential. Computer systems analyst was ranked fourth on the top 100 list with an overall score of 8.2 out of 10.
    According to the report, the median salary for systems analysts in 2011 was $78,770; the highest-paid 10% of systems analysts earned $120,060 and the lowest-paid took home $49,370. With a score of 8.0, database administrator was ranked the sixth best career for 2013. The median salary for DBAs was around $75,190 in 2011, with the top 10% netting $116,870 and the bottom 10% bringing home $42,360. Number seven on the list of top 100 jobs with an overall score of 7.9: software developer, a position earning a median salary of $89,280 in 2011.”
  5. The Secret to Getting Your New Job in the New Year LinkedIn Today, December 28. 2013 from http://www.acm.org/membership/careernews/archives/acm-careernews-for-tuesday-january-8-2013/ “While resumes are still essential in helping candidates get the initial interview, it’s the ability to tell a compelling story that often gets you to the next round and, eventually, a new position. According to experienced executive recruiters, the lack of a purposeful and compelling story is the number one reason why candidates fail to win over prospective employers in job interviews. This is especially true at the highest executive levels, where the ability to tell a purposeful story helps to convince hiring managers they can lead organizations, persuade customers, manage employees and sell products.”

Written by youryblog

October 3, 2012 at 1:38 PM

Tools for SW Engineering

leave a comment »

Written by youryblog

October 2, 2012 at 12:26 PM

Some Fedora problems and some solutions/ tricks

leave a comment »

Fresh installation

  1. Synergy autostart from http://forums.fedoraforum.org/showthread.php?t=147162
    Synergy client autostart in FC6
    The sequence I used for synergy on FC6:Edit /etc/gdm/Init/Default and add just before exit 0:
    /usr/bin/killall synergyc
    sleep 1
    /usr/bin/synergyc <serverip>

    Copy /etc/gdm/PostLogin/Default.sample to /etc/gdm/PostLogin/Default
    Edit /etc/gdm/PostLogin/Default and add to the end:
    /usr/bin/killall synergyc
    sleep 1

    Edit /etc/gdm/PreSession/Default and add just before exit 0:
    /usr/bin/killall synergyc
    sleep 1
    /usr/bin/synergyc <serverip>

  2. GNOME Shell Frippery for grumpy old stick-in-the-muds (Fedora 19 – suspend, hibernate, etc).
  3. Re: No Fedora 19 kernel installed after Fedup upgrade (from http://forums.fedoraforum.org/showthread.php?p=1661255)
    “I came across this problem as well. Had all the F19 rpms but had a grub menu only showing F18 entries.
    The solution for me was as root to:

    1.   Rerun fedup-cli –network 19. This only runs until it sets up repos and the boot image and then tells you that you have F19 installed. .
    2. Run grub2-install /dev/sda if your boot sector is on sda.
    3. Run grub2-mkconfig -o /boot/grub2/grub.cfg.
      After this I had the fedup option in grub. Somewhere along the line first time around the boot into F19 had been missed.
      Right, This still didn’t work as the fedup option fails missing some files. Something that is inherently disastrous is required. DO THIS WITHOUT ANY GUARANTEES! It worked for me.
    4.   Run yumdownloader kernel-3.9.9-302.fc19.x86_64 kernel-headers-3.9.9-302.fc19.x86_64 kernel-devel-3.9.9-302.fc19.x86_64.
    5. Run rpm –Uvh kernel-3.9.9-302.fc19.x86_64.rpm kernel-devel-3.9.9-302.fc19.x86_64.rpm kernel-headers-3.9.9-302.fc19.x86_64.rpm –nodeps –force.
    6. Don’t panic when the output shows dracut activity. This is the creation of the vmlinuz, initramfs, system map and config sections in the boot file.
    7. Remove the file vmlinuz-fedup from the /boot/ directory. I copied it elsewhere in the filesystem in case needed later.
    8. Run steps 2) & 3) again and reboot.

    Last edited by whodareswins; 24th July 2013 at 11:20 PM. Reason: more steps needed”

  4. F16 cups-pdf http://forums.fedoraforum.org/showthread.php?t=274219
  5. Fedora 17: post installation tasks http://www.if-not-true-then-false.com/2011/nautilus-open-in-terminal-on-fedora-centos-red-hat-rhel/
  6. Nautilus “Open in Terminal” on Fedora/CentOS/Red Hat (RHEL) http://www.if-not-true-then-false.com/2011/nautilus-open-in-terminal-on-fedora-centos-red-hat-rhel/
  7. Kannst du das spüren? Disable auto mount of encrypted LUKS (CRYPTO_LUKS) partition on openSuSE 11.2 while booting http://tropenhitze.wordpress.com/2010/01/21/disable-auto-mount-of-encrypted-luks-crypto_luks-partition-on-opensuse-11-2-while-booting/
    • To add luks information to crypttab you nee to use “cryptsetup luksUUID <device>" http://is.gd/VuUy5P
  8.  Add the mapping information to /etc/crypttab http://docs.fedoraproject.org/en-US/Fedora/17/html/Installation_Guide/apcs04s06.html
  9. https://access.redhat.com/knowledge/docs/en-US/Red_Hat_Enterprise_Linux/5/html/Installation_Guide/ch29s04s04.html Create a mapping to allow access to the device’s decrypted contents
  10. http://bodhizazen.net/Tutorials/Ecryptfs/
  11. very sad news. I found deja-dup doesn’t work to restore the whole system. As it was posted in many posts, the best way to install Fedora from live-cd and then restore only /home. Very stupid idea. I’ve spend about 10-15 hours trying to recover everything from the deja-dup backup. No luck. Installed everything from scratch:
    • sudo yum install libreoffice language-support-en
    • Skype: download skype from the skype website and install
      sudo yum skype-xxxx
    • Synergy: download synergy from the synergy web-site and install
      sudo yum synergy-xxx
  12. Some useful advises for Fedora 16: http://smashingweb.info/fedora-16-post-installation-guide-for-perfect-desktop/
  13. Enable Desktop Icons and Right Click ~ Gnome 3 (Gnome Shell) Ubuntu 11.04 http://joesteiger.com/2011/07/02/enable-desktop-icons-and-right-click-gnome-3-gnome-shell-ubuntu-11-04/
  14. Creating Application Launcher in GNOME3 Desktop http://community.linuxmint.com/tutorial/view/791
  15. Fedora GNOME 3 show desktop keyboard shortcut. http://blog.ergatides.com/2011/06/26/fedora-gnome-3-show-desktop-keyboard-shortcut/
  16. sudo yum install -y dconf-editor
  17. Re: How do I disable auto maximizing windows

    Since, after installing dconf-editor, I could not find either org.gnome.mutter edge-tiling or org.gnome.shell.overrides, I installed ccsm to see if disabling Grid as mentioned might work, and it did, no more auto-maximize. I’m very grateful for the helpful information in disabling this feature. http://ubuntuforums.org/showthread.php?t=1970815&page=2
  18. http://smashingweb.info/fedora-17-post-installation-guide-things-to-do-after-installing-fedora-17/
  19. Howto Show Date in Gnome 3: http://forums.fedoraforum.org/showthread.php?t=261961
    gsettings set org.gnome.shell.clock show-date true
  20. How to show minimize tab in the windows http://motorscript.com/customizing-gnome-shell/ : install gnome-tweak-tool and chose in the shell show all.
  21. Very good paper about Howto Play .wmv Files on Fedora 16 / 15 / 14
  22. If you have a problem with a USB printer, it’s better to change SeLinux to permissive mode and sometimes is better to reinstall cups.
  23. Skype can cause sometimes problems and needs to be reinstalled. see http://www.go2linux.org/skype-for-fedora-using-yum
  24. Backups (I used deju-dup, but can’t restore full system now):
  • dpkg –get-selections > installed-software

All you need to do is to create a file named skype.repo and lacated in: /etc/yum.repos.d/
And this file should have this content.
[skype]
name=Skype Repository
baseurl=http://download.skype.com/linux/repos/fedora/updates/i586/
gpgkey=http://www.skype.com/products/skype/linux/rpm-public-key.asc

yum install skype

if the following problem: Package skype-2.1.0.81-fc.i586.rpm is not signed
$ yum –nogpgcheck install skype

3. Vmware boot to fast: see http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1004129
Resolution
To make it easier to access the BIOS setup screen, edit the virtual machine’s configuration (.vmx ) and append one of these options:

*
bios.forceSetupOnce = “TRUE”

This forces entry to the BIOS setup at startup.

*
bios.bootDelay = “xxxx”

This adds a delay to the initial POST screen, showing it for longer and giving you more time to access the BIOS setup, where xxxx is the number of milliseconds to show the POST screen. (There are 1000 milliseconds in a second.)

4. Problems with Grub2 boot in Fedora 16.

I’ve spent about 10 hours to resolve problems with grub2 on raid1 and with bugs, related to use an old HDD from Raid1. After many attempts and posts reading I found couple excellent papers:

If I such papers 10 hours early, I would not spend so much time for a such small problems. If you have any problem with Grub2, please read 2 mentioned above papers.

Raid Problems: http://www.sonoracomm.com/internet/18-support/42-linux-sw-raid

repair failed blocks in Raid1

Disk Repair

This command will scan your disk and, optionally, mark off the bad blocks on it.

badblocks -vf /dev/hdX     # test only
badblocks -wvf /dev/hdX    # write test and remap bad blocks

adding new HDD and copy partitions:

How to copy the partition layout of a whole disk using standard tools

sfdisk -d /dev/sda > part_table
sfdisk /dev/sda < part_table

Then use the sgdisk command like so

sgdisk -R=/dev/sdb /dev/sda
sgdisk -G /dev/sdb

The first command copies the partition table of sda to sdb (be careful not to mix these up). The second command randomizes the GUID on the disk and all the partitions. This is only necessary if the disks are to be used in the same machine, otherwise it’s unnecessary.

another good paper about dd command: Raid Administration
dd if=/dev/sda of=/dev/sdc bs=512 count=1  
and check it by
sfdisk --dump /dev/sda
sfdisk --dump /dev/sdc

1. http://amandine.aupetit.info/42/raid1-to-raid5/ – how to upgrade Raid 1 to Raid 2 with volume groups.

For the old HDD from the previous Raid you should format HDD on another computer with MBR update.

5. I use Raid 1 and Raid 5 on many my desktops and servers and found many times I need to remember some Raid administration commands and even tricks. Just couple days ago my Raid 5 md2 failed and I found a new name for the Raid md126. I found in Internet, that many people have such problems.

My solution is following:

  • stop raid by > mdadm –stop /dev/md126
  • check the raid disks by > cat /proc/mdstat
  • and then check the HDDs by >mdadm –examine /dev/sda3
    and other disks in the same way
  • and then assemble new raid back by >mdadm -A /dev/md2 /dev/sd[abc]3
  • check the raid arrays by > mdadm –detail –scan
    and if it is necessary update the configuration file by the
  • mdadm –detail –scan >> /etc/mdadm/mdadm.conf

6. Interesting topic about how to increase Raid 1 size. I did it in the past, but not remember now. This is a reason why I started this blog. I did a lot of different things, but don’t remember many of them and now I want to keep them in one place.

I already increased size for the partitions of the Raid 1 from 35GB to 75Gb, but still have the same size for the Volume Group, which is the problem.

Some links, which I use now:

Written by youryblog

December 5, 2010 at 2:09 PM

Posted in IT, Most, UNIX/Linux tricks