你所描述的实质上是一种审计脚本执行的方法。无论是经过时间,还是特定的开始和结束时间,您都需要正确记录它们,以确定事情进展顺利(或者如果不行,为什么不)。
下面是一个模板,与我们用于捕获和记录我们正在实施的所有数据库活动的模板类似。我们通过sqlplus.exe
为所有DDL更新(例如CREATE TABLE
)和插入到设置表中使用它。
--Beginning of all SQL scripts:
set serveroutput on feedback on echo on verify on sqlblanklines on timing on define on
col time new_v v_time
col name new_v v_name
col user new_v v_user
select name, USER, to_char(sysdate, 'YYYYMMDD-HH24MISS') time from v$database;
--Creates a new log file every time the script is run, and it's immediately
--obvious when it was run, which environment it ran in, and who ran it.
spool &v_time._&v_name._&v_user..log
--Run the select again so it appears in the log file itself
select name, USER, to_char(sysdate, 'YYYYMMDD-HH24MISS') time from v$database;
把你的工作的身体放在这里。
--End of all SQL scripts:
select name, USER, to_char(sysdate, 'YYYYMMDD-HH24MISS') time from v$database;
spool off
只是打败了我....或者在SQL Developer或PLSQL Developer等工具中运行您的脚本,它会告诉您自己已经过去的时间。 – Rene
该函数的输出是'PL/SQL过程已成功完成。'而不是时间:),是否可以使用'systimestamp'来拥有日期等?剧本将在某个时间点需要几个小时,并在夜间运行,所以日期将很重要! – aweis
是的,就在我退出之前; – aweis