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
相关文档:
public ActionForward backUpAction(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
&n ......
将一个数据库的某用户的所有表导到另外数据库的一个用户下面的例子
exp userid=system/manager owner=username1 file=expfile.dmp
imp userid=system/manager fromuser=username1 touser=username2 ignore=y file=expfile.dmp
ORACLE数据库有两类备份方法。第一类为物理备份,该方法实现数据库的完整恢复,但数据 ......
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 " ......