Monday, September 22, 2008

Trigger to mimic MySQL "last modified" datatype in Oracle

ALTER TABLE YOUR_TABLE ADD (LAST_MODIFIED DATE);

CREATE OR REPLACE
TRIGGER YOUR_TABLE_BEFORE_INS_UPD BEFORE INSERT OR UPDATE
ON YOUR_TABLE
FOR EACH ROW
DECLARE CURRENT_TIME DATE;
BEGIN
CURRENT_TIME := SYSDATE;
:new.last_modified := CURRENT_TIME;
END;



Labels: , , , , , , , ,

To start up everything Oracle

$ . oraenv

$ sqlplus “/ as sysdba”
SQL> startup
SQL> exit

$ lsnrctl
LSNRCTL> start
LSNRCTL> exit

$ cd $ORACLE_HOME/bin
./emctl start dbconsole


Labels: , , , , ,

Shut down everything Oracle:

$ . oraenv

$ sqlplus “/ as sysdba”
SQL> shutdown immediate
SQL> exit

$ lsnrctl
LSNRCTL> stop
LSNRCTL> exit

$ cd $ORACLE_HOME/bin
./emctl stop dbconsole


Labels: , , , ,