處理Maximo序列不一致的問題

2021-06-16 04:51:20 字數 1585 閱讀 4761

注:下面的指令碼是在kevin網友的帖子上修改的,因為原帖指令碼執行時有些小問題。

執行下面的sql可以同步所有maximo序列與資料表中實際的id值不一致的問題:

declare

cursor seq_cursor is(select * from maxsequence);

seq_cursor_row seq_cursor%rowtype;

imaxseq        number(10);

icurvalseq     number(10);

strsql         varchar2(200);

ic             number;

i***ist        number(10);

begin

open seq_cursor;

loop

fetch seq_cursor into seq_cursor_row;

exit when seq_cursor%notfound;

imaxseq := 0;

strsql  := 'select count(*) from cols where column_name=:1 and table_name=:2';

execute immediate strsql into i***ist using seq_cursor_row.name, seq_cursor_row.tbname;

dbms_output.put_line(i***ist);

if (i***ist = 1) then

strsql := 'select max(' || seq_cursor_row.name || ')  from ' || seq_cursor_row.tbname;

execute immediate strsql into imaxseq;

strsql := 'select ' || seq_cursor_row.sequencename || '.nextval from dual';

execute immediate strsql into icurvalseq;

ic := imaxseq - icurvalseq;

if ic > -1 then

strsql := 'alter sequence ' || seq_cursor_row.sequencename || ' increment by ' || ic || ' nocache';

execute immediate strsql;

strsql := 'select ' || seq_cursor_row.sequencename || '.nextval from dual';

execute immediate strsql into ic;

strsql := 'alter sequence ' || seq_cursor_row.sequencename || ' increment by 1 cache 20';

execute immediate strsql;

end if;

end if;

end loop;

close seq_cursor;

end;

快取不一致

當程式在執行過程中,會將運算需要的資料從主存複製乙份到cpu的快取記憶體當中,那麼cpu進行計算時就可以直接從它的快取記憶體讀取資料和向其中寫入資料,當運算結束之後,再將快取記憶體中的資料重新整理到主存當中。舉個簡單的例子 i i 1。當執行緒執行這個語句時,會先從主存當中讀取i的值,然後複製乙份到...

version magic 不一致問題

碰到乙個問題,在開發過程中發現以前編譯的模組載入失敗了。wlan version magic 4.1.15 gfb2dbf6 smp preempt mod unload armv7 p2v8 should be 4.1.15 ge5de83b dirty smp preempt mod unloa...

ceph pg不一致問題

今天在公司環境中出現了pg不一致問題,通過ceph health detail命令檢視如下 pg 19.211 is active clean inconsistent,acting 88,16 pg 19.214 is active clean inconsistent,acting 59,36 ...