Oracle中利用Trigger进行工作
Oracle数据库中,有些情况下,对数据记录需要记录日志,或保存操作历史等情况.在此我们可以借助“数据库Trigger”进行。下面以一例进行说明:
CREATE OR REPLACE TRIGGER aits_auth_group_auth_trga_diu
AFTER update OR DELETE OR INSERT on aits_authority_group_auth
for each row
/*****************************************************************************************
*
* Trigger Name : aits_auth_group_auth_trga_diu
* Description : Log insert, Modify ,delete action to History table
* Version : 1.0
*****************************************************************************************/
declare
BEGIN
IF inserting THEN
INSERT INTO aits_auth_group_auth_history
(application_code, auth_id, ranage_code,
group_code, module_code, function_code,
creation_date, created_by, last_update_date,
last_updated_by, action_type)
VALUES
(:new.application_code, :new.auth_id, :new.ranage_code,
:new.group_code, :new.module_code, :new.function_code,
:new.creation_date, :new.created_by, :new.last_update_date,
:new.last_updated_by, aits_pak_common.InsertDesc);
ELSIF DELETING THEN
INSERT INTO aits_auth_group_auth_history
(application_co
相关文档:
跟其他语言的参数差不多,使用时要把把真实数据传过去替代
优点记得一些,如果在查询中使用直接量(常量),那么每个查询都将是一个全新的查询,必须对查询进行解析、限定(命名解析)、安全性检查、优化等即重新生成执行计划。而使用了以后就可以重复使用最先创建的执行计划。 ......
一、启动
1.#su - oracle 切换到oracle用户且切换到它的环境
2.$lsnrctl status 查看监听及数据库状态
3.$lsnrctl start &nb ......
原文地址:http://tech.e800.com.cn/articles/2009/710/1247207067745_1.html
处理方法一 :
检查哪个表被锁
select sess.sid,sess.serial#,
lo.oracle_username,lo.os_user_name,ao.object_name,lo.locked_mode
from
v$locked_object lo,dba_objects ao,v$session sess
where ao.object_id =
lo.object_id
......
update customers a
set city_name=(select b.city_name from tmp_cust_city b where b.customer_id=a.customer_id)
where exists (select 1
from tmp_cust_city b
where b.customer_id=a.customer_id
)
-- update 超过2个值
update customers a
set (city_name,customer_type)=(select b.city_name,b.customer_ ......
Oracle存储空间管理
1.查看每个数据文件的剩余表空间(一个表空间只对应N个数据文件,N一般等于1)
主要是利用表dba_free_space(表空间剩余空间状况)和dba_data_files(数据文件空间占用情况)
select b.file_id "文件ID",
b.tablespace_name "表空间名",
b.file_name " ......