Skip to main content

Posts

Showing posts with the label Solaris

How to generate a MD5 hash

On Microsoft SQL Server SQL> SELECT HASHBYTES('MD5', source).... Source: varchar, nvarchar, ou varbinary, 8000 chars max. On Oracle PL/SQL> myhash := dbms_crypto.hash( source, dbms_crypto.HASH_MD5 ); SQL> select dbms_crypto.hash(utl_raw.cast_to_raw(source),2) ... Source: RAW, BLOB, et CLOB. With implicite conversion, you can also use CHAR, VARCHAR2, NCHAR, NVARCHAR2 et LONG. On Sybase sybase> SELECT HASHBYTES('MD5', source).... On MySQL mysql> SELECT MD5(source) ....

Loading solaris sar data to MySQL

Sar (System Activity Report) is the performance data collector on all unix systems. If it works pretty well to collect data, displaying the result lets a bitter taste; forget any colorfull graphs, its output is only tabs of pure ascii text. However, sar's weakness is also his strength; text is easy to parse and Unix have plenty of powerfull tools to do so. My aim today is to parse the output of sar and to load it into MySQL. Why MySQL? Simply because it's a powerfull free database, and querying MySQL with Excel is easy. The idea is simple: sar > XML > LOAD XML command > MySQL database Step 1 - choosing the output of sar On Solaris, sar -A provides all the results; actually, it is equivalent to successively issue these commands: sar -u (CPU utilization) sar -d (activity for each block device) sar -q (average queue length while occupied) sar -b (buffer activities) sar -w (system swapping and switching activity) sar -c (system calls) sar -a (file access system ro...

CGI & HTTP 500

I'am currently writing a small app in C that should display a timetable, on a Solaris 10/Apache Sun server. The app should open a HTML skeleton, syntaxicaly replace a couple of placeholders and display the content. If the skeleton could not be found, an HTML error message is sent back to the user. I compile, and test it: runs #1. I move my executable in the cgi-bin folder and invoke it with my browser and .. bang!: HTTP 500. The error_log shows: malformed header from script. Bad header=<HTML>: /apache/web/cgi-bin/timesheet.cgi The HTTP-500 arises mostly when Content-type:... is missing, or if there's not empty line before the text. However, in my case, when I invoked it manually: /apache/web/cgi-bin/timesheet.cgi .. it worked perfectly, displaying it could find its skeleton: Content-type: text/html <html> [... Error message ...] </html> So what was going on? I replaced the binary by a small script displaying the error message, hit it with my brower ... and it...

Solaris: metastat "need maintenance" state on a SAN

After a scheduled downtime, one of our Oracle server (SunFire V240) was started slightly before the SAN (Sun StorEdge D280) was fully operational. It resulted in I/O errors and a metastat in "need maintenance" state. (Please notice I've truncated the output for an easier reading). # metastat d200 d200: Mirror Submirror 0: d201 State: Needs maintenance Pass: 1 Read option: roundrobin (default) Write option: parallel (default) Size: 566198272 blocks (269 GB) d201: Submirror of d200 State: Needs maintenance Invoke: after replacing "Maintenance" components: metareplace d200 /dev/dsk/c3t600A...d0s0 Size: 566198272 blocks (269 GB) Stripe 0: Device Start Block Dbase State Reloc Hot Spare /dev/dsk/c3t600B...d0s0 0 No Last Erred Yes Stripe 1: Device Start Block Dbase State Reloc Hot Spare /dev/dsk/c3t600C...d0...

Solaris: metainit: No such file or directory

# metainit -f d200 -m d100 metainit: srmtl104: d200: No such file or directory The explanation is in kernel parameters: # grep nmd /kernel/drv/md.conf name="md" parent="pseudo" nmd=128 md_nsets=4; nmd limits pseudo-device names to 128. You may change this, wich implies a boot -r, or limit yourself to pseudo-device names within the range. # metainit -f d127 -m d100 d127: Mirror is setup #