Solaris
Archived posts from this Category
Archived posts from this Category
Posted by admin on 21 Oct 2008 | Tagged as: Databases, IT Stuff, Photography, Renewable Energy, Solaris, snmp
Postgres triggers are created in 2 stages, firstly you create the trigger function then you link the function to the trigger event. In this sample code a function that fires during before an INSERT event updates a column in the table where the data is being inserted. The function uses an internal (SQL92 compliant) string manipulation function to create the additional data that is required to complete the insert. The column has been defined as char (8), the data being manipulated is a postgres date type and must be cast to a text type. Note also that text types are indexed starting at a base of 1 (not 0 as with ‘C’ character arrays).
CREATE OR REPLACE FUNCTION set_initial_pass() RETURNS trigger AS $set_initial_pass$
DECLARE
yyyy char(4);
mm char(2);
dd char(2);
BEGIN
yyyy := substring(cast(NEW.dob as text) from 1 for 4);
mm := substring(cast(NEW.dob as text) from 6 for 2);
dd := substring(cast(NEW.dob as text) from 9 for 2);
NEW.initial_code := dd||mm||yyyy;
RETURN NEW;
END;
$set_initial_pass$
LANGUAGE 'plpgsql' VOLATILE COST 100;
ALTER FUNCTION set_initial_pass() OWNER TO script;
Now create the trigger and attach the function above.
CREATE TRIGGER set_initial_pass
BEFORE INSERT
ON person
FOR EACH ROW
EXECUTE PROCEDURE set_initial_pass();
This example was created using pgadmin III.
Posted by admin on 08 Jun 2008 | Tagged as: IT Stuff, Solaris
To apply Sun packages manually use the pkgadd command
pkgadd -d full-path-to-package package-name
eg.
pkgadd -d /cdrom/Sol10/pkg SUNWlucfg
Posted by admin on 08 Jun 2008 | Tagged as: IT Stuff, Solaris
The Sun Update Manger usually downloads patches to ⁄var⁄sadm⁄spool as .jar files but cannot always apply the patches from the GUI. In this case you may need to open a terminal window and use:
patchadd [-n] [-B full-path-to-backout-directory -M full-path-patch-directory patch-file-name
where:
-n … do not check the patch signing
-B … backout directory. This can be omitted if you don’t ever want to back out of a patch!!
-M … path to location of patch. ⁄var⁄sadm⁄spool is the default location so can be omitted if that is where the patch file is located.eg.
patchadd -n -B ⁄var⁄sadm⁄backout -M ⁄var⁄sadm⁄spool 128307-04.jar
“man patchadd” is your friend.