Sat, 29 Apr 2006

Fast CPAN mirrors

I wanted to build a local CPAN mirror using CPAN::Mini. Since it takes a little time to download all that data I wanted to choose a nice fast mirror. This little command was helpful:

$ netselect -vv `wget -O - | \
  perl -lne 'print $1 while m!>((ht|f)tp://[^<]+)!g'` | \
  sort -k 4 -n

It grabs the CPAN mirrors file, extracts the URLs and feeds them to netselect, which tests the mirrors and outputs its information. This is then sorted numerically on the fourth field, which is the number of hops.

The sorting is necessary because although netselect does tell you which mirror it thinks is the best, it doesn't really select very well. In fact, some of its output seems downright dodgy, so I selected a mirror which seemed plausibly fast, close and reliable. For me that was

For useful information on using CPAN::Mini, take a look at Mark Fowler's 2004 Perl Advent Calendar. You might need to get that from the Wayback Machine at (which is another URL kwiki has managed to mangle).

[/software/perl] permanent link

Tue, 04 Apr 2006

ORA 01081 "cannot start already-running ORACLE - shut it down first"

I was creating an Oracle database and got the error message:

ORA 01081 "cannot start already-running ORACLE - shut it down first"

however, I had already stopped everything, and ps showed there were no oracle processes running. It turns out that there were some IPC semaphores and shared memory identifiers which had to be killed before the database could be created.

In my case,

ipcs -a | grep dba

showed the resources that needed to be killed, and ipcrm with the appropriate options kills them. The ID of the resource to kill is in the second column.

ipcs -a | grep dba | perl -ane 'system "ipcrm -$F[0] $F[1]"'

[/software/oracle] permanent link

Mon, 03 Apr 2006

Making a Solaris UFS filesystem on a file

I wanted to set up a temporary database for testing purposes, and the scripts I needed to use to create an Oracle database wanted to use a couple of filesystems exclusively. Well, I didn't have a couple of spare filesystems lying around so I set about creating them on a couple of files. It turns out to be a fairly simple process. Here's how it worked for one of the filesystems.

# mkfile 2000m /myspace/fs1

# lofiadm -a /myspace/fs1

# newfs /dev/lofi/1
newfs: construct a new file system /dev/rlofi/1: (y/n)? y
/dev/rlofi/1:   4095600 sectors in 6826 cylinders of 1 tracks, 600 sectors
        1999.8MB in 214 cyl groups (32 c/g, 9.38MB/g, 2368 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
 32, 19232, 38432, 57632, 76832, 96032, 115232, 134432, 153632, 172832, 192032,
 [ ... ]
 3993632, 4012832, 4032032, 4051232, 4070432, 4089632,

# mount /dev/lofi/1 /dbTST/fs1

# df -k /dbTST/fs1
Filesystem            kbytes    used   avail capacity  Mounted on
/dev/lofi/1          1981012      11 1921571     1%    /dbTST/fs1

[/unix] permanent link

November 2022
Sun Mon Tue Wed Thu Fri Sat