创建时间戳表
CONNECT snow/snow
DROP TABLE date_log;
CREATE TABLE date_log (
create_time DATE CONSTRAINT create_date_pk PRIMARY KEY USING INDEX TABLESPACE INDX,
name varchar2(10)
);
col segment_name for a15
col TABLESPACE_NAME for a15
select segment_name,tablespace_name from user_segments;
SEGMENT_NAME TABLESPACE_NAME
--------------- ---------------
DATE_LOG TOOLS
CREATE_DATE_PK INDX
基于时间戳表创建一个存储过程
conn snow/snow
CREATE OR REPLACE PROCEDURE create_date_log_row
IS
BEGIN
INSERT INTO date_log VALUES (SYSDATE,'--');
END;
/
创建一个job来执行存储过程,来模拟数据库在“运行中”
每分钟执行一次
conn snow/snow
VARIABLE jobno number;
BEGIN
-- Run the job every 1 minutes
DBMS_JOB.SUBMIT(:jobno, 'snow.create_date_log_row;', SYSDATE, '(SYSDATE + 1/(24*60))');
commit;
END;
/
SNOW@PRACTICE >print jobno
JOBNO
----------
24
SNOW@PRACTICE >col what for a30
SNOW@PRACTICE >SELECT job, what FROM USER_JOBS;
JOB WHAT
---------- ------------------------------
24 snow.create_date_log_row;
Oracle备份与恢复系列(2)
内容版权声明:除非注明,否则皆为本站原创文章。
转载注明出处:https://www.heiqu.com/e665e10e129224cb305f06c0f8cddb03.html