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;
Showing posts with label oracle. Show all posts
Showing posts with label oracle. Show all posts
Monday, September 22, 2008
Trigger to mimic MySQL "last modified" datatype in Oracle
Labels:
11g,
command line,
last modified,
mysql,
oracle,
sql,
sysadmin,
systems administration,
trigger
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:
11g,
command line,
oracle,
sql,
sysadmin,
systems administration
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
Exporting from oracle 9i on nt4 domain caveat number 2 (NTRights.exe)
In order to get an oracle export out of oracle 9i on an nt4 domain you need to create an oracle user that corresponds to a windows domain user who has administrative rights and also the right to "logon as a batch script" boy did this ever throw me for a loop. Fortunately after a few hours of google searches I came across the following documentation... looks like windows administration isn't all point and click! I imagine you need to do this on 2000/2003 still as this documentation is for those flavors. I can attest to the fact that it does work on nt4.(I pulled this from: http://www.ss64.com/nt/ntrights.html)
(Microsoft mentions it here http://support.microsoft.com/kb/315276)
NTRIGHTS.exe (Resource Kit, 2000/2003)
Edit user account Privileges.
Syntax
NTRIGHTS +r Right -u UserOrGroup [-m \\Computer] [-e Entry]
NTRIGHTS -r Right -u UserOrGroup [-m \\Computer] [-e Entry]
Key:
+/-r Right Grant or revoke one of the rights listed below.
-u UserOrGroup Who the rights are to be granted or revoked to.
-m \\Computer The computer (machine) on which to perform the operation.
The default is the local computer.
-e Entry Add a text string 'Entry' to the computer's event log.
Below are the Privileges that can be granted or revoked.
All are case-sensitive.
Privilege Meaning
SeAssignPrimaryTokenPrivilege Replace a process level token
SeAuditPrivilege Generate security audits
SeBackupPrivilege Back up files and directories
SeBatchLogonRight Log on as a batch job
...
Subscribe to:
Posts (Atom)
