job中执行表占用空间释放 各位高手,小弟写了一sql语句:alter table sm.push_real_url move tablespace users用来释放表占用空间,想把它放在job中,每天定时执行一次,可总是报错,但我在plsql的sql窗口中可以成功执行,请哪位高手不吝指教. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 可能是做的过程中,表被别的用户占用了,建议用:alter table xxx deallocate unusedmove后,需要重建索引。 CREATE OR REPLACE PROCEDURE PRO_PUSHREAL_CLEARASBEGINdelete from sm.push_real_url where months_between(sysdate,push_date)>=2;--alter table sm.push_real_url move tablespace users;alter table sm.push_real_url deallocat unused;--alter table xxx deallocate unusedEND PRO_PUSHREAL_CLEAR;这样写后编译:出现下面错误错误:PLS-00103: 出现符号 "ALTER"在需要下列之一时:begin case declare end exception exit for goto if loop mod null pragma raise return select update while with <an identifier> <a double-quoted delimited-identifier> <a bind variable> << close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge <a single-quoted SQL string> pipe 符号 "lock在 "ALTER" 继续之前已插入。行:7文本:alter table sm.push_real_url deallocat unused;错误:PLS-00103: 出现符号 "UNUSED"在需要下列之一时: , in行:7文本:alter table sm.push_real_url deallocat unused; create or replace procedure p_release_tableasbegindelete from test where id=2;execute immediate 'alter table test move tablespace system';end; 收缩表空间问题 写的存储过程报错,如何调试 找错? 【小白】求解:' '(空格)在存储过程和pL/SQL sql window里的不同 关于带多步数据更新的存储过程优化 急,在线等。INSERT INTO ....select 语句 怎么查看Oracle中已建好数据库的关系图? 如何得到两个日期的之间相差的天数? 不同用户间的序列权限访问的问题,请高手帮忙!!! 我们公司的数据库在表中都是用两列分别记录日期和时间的,怎么用sql得出时间差? 关于触发器! oracle 中如何知道数据表中数据做的修改记录 为什么从BDE中得到的结果与TOAD中不同
alter table xxx deallocate unusedmove后,需要重建索引。
AS
BEGIN
delete from sm.push_real_url where months_between(sysdate,push_date)>=2;
--alter table sm.push_real_url move tablespace users;
alter table sm.push_real_url deallocat unused;
--alter table xxx deallocate unused
END PRO_PUSHREAL_CLEAR;
这样写后编译:出现下面错误
错误:PLS-00103: 出现符号 "ALTER"在需要下列之一时:
begin case declare end
exception exit for goto if loop mod null pragma raise return
select update while with <an identifier>
<a double-quoted delimited-identifier> <a bind variable> <<
close current delete fetch lock insert open rollback
savepoint set sql execute commit forall merge
<a single-quoted SQL string> pipe
符号 "lock在 "ALTER" 继续之前已插入。
行:7
文本:alter table sm.push_real_url deallocat unused;错误:PLS-00103: 出现符号 "UNUSED"在需要下列之一时:
, in
行:7
文本:alter table sm.push_real_url deallocat unused;
as
begin
delete from test where id=2;
execute immediate 'alter table test move tablespace system';
end;