Wednesday, 10 June 2009

restoring a file with networker

in this example, I restore an oracle cron file, and then later on show how to restore an earlier oracle cron file
so - first thing I did was invoke the recover command, specifying the networker server (cluster) and client;

eudt0201:root /tmp/cronoratab > /opt/networker/bin/recover -s ukprbknws001 -c eudt0201-bk

/tmp/cronoratab/ not in index

will exit.

and then entered the directory I needed to recover the file from;

Enter directory to browse: /var/spool/cron/crontabs/

recover: Current working directory is /var/spool/cron/crontabs/

help is our friend!

recover> help

Available commands are:

add [-q] [filename] - add `filename' to list of files to be recovered

cd [dir] - change directory to dir

changetime [date] - change the time that you are browsing

debug

delete [filename] - delete `filename' from the recover list

destination - print destination location for recovered files

dir [/w] [filename...] - list filename

exit - immediately exit program

force - overwrite existing files

help or `?' - print this list

lf [-aAcCdfFgilLqrRsStu1] [filename...] - list filename type

list [-c | -l] - list the files marked for recover

ll [-aAcCdfFgilLqrRsStu1] [filename...] - long list filename

ls [-aAcCdfFgilLqrRsStu1] [filename...] - list filename

noforce - do not overwrite existing files

pwd - print current directory

quit - immediately exit program

recover - recover requested files

relocate [dir] - specify new location for recovered files

verbose - toggle verbose mode; feedback about what is going on

versions [filename] - report on each version of file `filename

volumes [filename] - report volumes needed to recover marked files

`filename' can be either a file or a directory

I used 'destination' to check where the file was going to be recovered to;

recover> destination

recover files into their original location

and then changed the destination using relocate;

recover> relocate

will recover files into their original location

New destination directory: /tmp/cronoratab

and confirmed that with the destination command;

recover> destination

recover files into /tmp/cronoratab

listed the files in the direcotry I want to restore from

recover> ls

adm oracle root sys

recover> ls -lrt

total 32

-r-------- root 61 Jun 07 2007 sys

-r-------- root 771 Apr 30 2008 adm

-r-------- root 1157 Jul 04 2008 root

-r-------- root 1 May 21 09:27 oracle

and then added the file I want to recover with the add command

recover> add oracle

1 file(s) marked for recovery

and then recovered it with the recover command

recover> recover

recover: Total estimated disk space needed for recover is 8 KB.

Recovering 1 file from /var/spool/cron/crontabs/ into /tmp/cronoratab

Volumes needed (all on-line):

AD0085 at ACSLS01_D

Requesting 1 file(s), this may take a while...

./oracle

Received 1 file(s) from NSR server `ukprbknws001'

Recover completion time: Wed Jun 10 11:00:28 2009

recover> quit

eudt0201:root /tmp/cronoratab > ls

oracle

and then there is this other example where I needed an earlier file;

recover> ls -lrt

total 32

-r-------- root 61 Jun 07 2007 sys

-r-------- root 771 Apr 30 2008 adm

-r-------- root 1157 Jul 04 2008 root

-r-------- root 1 May 21 09:27 oracle

by using the changetime command and specifying a date in May

recover> changetime May 19

time changed to Tue May 19 23:59:59 2009

recover> ls

adm oracle root sys

recover> ls -lrt

total 32

-r-------- root 61 Jun 07 2007 sys

-r-------- root 771 Apr 30 2008 adm

-r-------- root 1157 Jul 04 2008 root

-r-------- root 3377 Mar 31 07:45 oracle

recover> add oracle

1 file(s) marked for recovery

recover> destination

recover files into /tmp/cronoratab

recover> recover

recover: Total estimated disk space needed for recover is 8 KB.

Recovering 1 file from /var/spool/cron/crontabs/ into /tmp/cronoratab

Volumes needed (all on-line):

AD0630 at ACSLS01_D

Requesting 1 file(s), this may take a while...

./oracle

./oracle file exists, overwrite (n, y, N, Y) or rename (r, R) [n]? y

overwriting ./oracle

Received 1 file(s) from NSR server `ukprbknws001'

Recover completion time: Wed Jun 10 11:17:46 2009

recover> quit

Hope this helps!

Darren

Monday, 8 June 2009

Quick example of resizing a fs with vxvm

NOTE - this is on a HPUX server

Before

eupr0201:root /root > bdf |grep -i pwdcli01
/dev/vx/dsk/dgpwdcli01/oracledev01
6291456 3398357 2719643 56% /opt/oracle/PWDCLI01
/dev/vx/dsk/dgpwdcli01/oradatadev01
35651584 34456224 1186032 97% /oradata/PWDCLI01
/dev/vx/dsk/dgpwdcli01/archivedev01
12582912 4325 11792561 0% /archive/PWDCLI01

check what you can increase it to;

eupr0201:root /root > vxdg -g dgpwdcli01 free

DISK DEVICE TAG OFFSET LENGTH FLAGS

dgpwdcl02 c14t11d3 c14t11d3 18835744 16854464 -


after addition of 10Gb on oradata filesystem for pwdcli01 on the eupr0201/eupr0202

eupr0201:root /root > /etc/vx/bin/vxresize -F vxfs -g dgpwdcli01 oradatadev01 +10485760

eupr0201:root /root > bdf |grep -i pwdcli01
/dev/vx/dsk/dgpwdcli01/oracledev01
6291456 3398358 2719642 56% /opt/oracle/PWDCLI01
/dev/vx/dsk/dgpwdcli01/oradatadev01
46137344 34456544 11589552 75% /oradata/PWDCLI01
/dev/vx/dsk/dgpwdcli01/archivedev01
12582912 4325 11792561 0% /archive/PWDCLI01

Saturday, 6 June 2009

hp ilo trouble shooting

can you ping its ip address
can someone physically attach to it locally
is the cable attached? is it a good cable?
are the network settings correct?
is the activity light on (the blue light)
does a reboot shift the issue
does a cold reset shift the issue

Shutting down the linux system

Shutting Down the Linux System

If you look at the scripts in runlevel 0, you'll find a number of services being shut down, followed by the killing of all active processes, and finally, the halt script in /etc/rc.d/init.d directory executing the shutdown.

The halt script is used to either halt or reboot your system, depending on how it is called. What happens during a shutdown? If you're familiar with other operating systems (such as DOS), you remember that all you had to do was close any active application and then turn off the computer. Although Linux is easy to use, shutting down your computer is not as simple as turning it off. (You can try this, but you do so at your own risk.) A number of processes must take place before you or Linux turns off your computer. The following sections take a look at some of the commands involved.

shutdown
Although many people use Linux as single users on a single computer, many of us use computers on either a distributed or shared network. If you've ever been working under a tight deadline in a networked environment, you know the dreadful experience of seeing a System is going down in 5 minutes! message from the system administrator. You might also know the frustration of working on a system on which the system administrator is trying to perform maintenance, suffering seemingly random downtimes or frozen tasks.

Luckily for most users, maintenance jobs are performed during off hours, when most people are home with their loved ones or fast asleep in bed. Unluckily for sysadmins, this is the perfect time for system administration or backups, and one of the top reasons for the alt.sysadmin.recovery newsgroup.

The primary command to stop Linux is the shutdown command. Like most UNIX commands, shutdown has a number of options. A man page for the shutdown command is included with Red Hat Linux, but you can quickly read its command-line syntax if you use an illegal option, such as -z. Thanks to the programmer, here it is:

Usage: shutdown [-akrhfnc] [-t secs] time [warning message]
-a: use /etc/shutdown.allow
-k: don't really shutdown, only warn.
-r: reboot after shutdown.
-h: halt after shutdown.
-f: do a 'fast'reboot (skip fsck).
-F: Force fsck on reboot.
-n: do not go through "init" but go down real fast.
-c: cancel a running shutdown.
-t secs: delay between warning and kill signal.
** the "time" argument is mandatory! (try "now") **
To properly shut down your system immediately, use the -h option, followed by the word now or the numeral 0:


# shutdown -h now

or


# shutdown -h 0

If you want to wait for a while, use the -t option, followed by a number (in seconds) before shutdown or reboot. If you want to restart your computer, use the -r option, along with the word now or the numeral 0:


# shutdown -r now

or


# shutdown -r 0

NOTE

You'll find two curious text strings embedded in the shutdown program:

"You don't exist. Go away."
"Oh hello Mr. Tyler - going DOWN?"
Both are found by executing this:


# strings /sbin/shutdown


To find out about "You don't exist. Go away", see Robert Kiesling's Linux Frequently Asked Questions with Answers. You should be able to find a copy at http://www.linuxdoc.org/FAQ.

You can also use linuxconf to shut down your computer. If you're logged in as the root operator, enter the following from the command line of your console or an X11 terminal window:


# linuxconf --shutdown

linuxconf presents a shutdown dialog box, as shown in Figure 9.4. To restart your system, press the Tab key until you highlight the Accept button, and then press the Enter key. You can also enter a time delay or halt your system immediately, and specify a message to broadcast to all your users when you execute the shutdown.


Figure 9.4 The linuxconf command will perform a system reboot or shutdown.

halt and reboot
Two other commands also stop or restart your system: halt and reboot. reboot is a symbolic link to halt, which notifies the kernel of a shutdown or reboot. Although you should always use shutdown to restart your system, you can use the "Vulcan neck pinch": Ctrl+Alt+Del.

If you use the keyboard form of this command, you'll find that Linux uses the following command:


# shutdown -t3 -r now

NOTE

This command is defined in your system's initialization table, /etc/inittab.

Restarting your computer with the shutdown command calls the sync command, which updates the inodes (structure representations)of each of your files. If you exit Linux without updating this information, Linux could lose track of your files on disk, and that spells disaster!

NOTE

The only time you'll want to risk shutting down Linux through a hard reset or the power-off switch on your computer is if you can't quickly kill a destructive process, such as an accidental rm -fr /*. Yet another reason to never run Linux as the root operator all the time!

By now you should know that exiting Linux properly can help you avoid problems with your system. What happens if something goes wrong? In the next section you learn preventive measures, how to maintain your filesystem, and how to recover and overcome problems.

Thursday, 4 June 2009

cancelling an at job

In Unix, how do I cancel a batch job?

In Unix, if you scheduled a job with at or batch, you can cancel it at the Unix prompt by entering:

at -r
Replace with the number of the job that at or batch reported when you submitted the job. On some systems, you may use atrm instead of at -r .

If you don't remember the job number, you can get a listing of your jobs by entering:

at -l
Each job will be listed with its job number queue and the time it was originally scheduled to execute.

On some systems, the atq command is available to list all the jobs on the system. To use this command, at the Unix prompt, enter:

atq
If your job is already running, you will need to find the process ID and kill it. On System V implementations (including all UITS central systems at Indiana University), list all running processes by entering:

ps -fu username
Replace username with your username. The equivalent BSD command is:

ps x
Once you have the process ID, enter:

kill
Replace with the process ID. If it still will not terminate, try entering:

kill -9

how to run an at job

state the at command with the time and press return
test0029:root /opt/sysadmin/ttt > at 10:00am tomorrow

then specify the command to execute at that time

cp -p /opt/sysadmin/bcv/PWDSLI02BCVbackup.ksh.amended.jun042009 PWDSLI02BCVbackup.ksh

then CTRL-D to finish

warning: commands will be executed using /usr/bin/sh
job 1244192400.a at Fri Jun 5 10:00:00 2009

listing available disks on a linux rhel system

dmesg | grep disk
fdisk -l