WEB开发网
开发学院数据库Oracle Sqlserver2005迁移至Oracle系列之一:生成表(上) 阅读

Sqlserver2005迁移至Oracle系列之一:生成表(上)

 2009-03-03 13:11:25 来源:WEB开发网   
核心提示: --创建32个分区表空间 if @onlydeltbs = 1 insert into ##table(ident,ctext) select 1,'--删除32个分区表空间' else insert into ##table(ident,ctext) select 1,

--创建32个分区表空间

    if @onlydeltbs = 1
        insert into ##table(ident,ctext) select 1,'--删除32个分区表空间'
    else
        insert into ##table(ident,ctext) select 1,'--创建32个分区表空间'
    insert into ##table(ident,ctext) select 1,'DECLARE'
    insert into ##table(ident,ctext) select 2,'DMSQL VARCHAR2(512):='''';'
    insert into ##table(ident,ctext) select 2,'EXIST INT:=0;'
    insert into ##table(ident,ctext) select 1,'BEGIN'
    insert into ##table(ident,ctext) select 2,'FOR i IN 1..32 LOOP'
    insert into ##table(ident,ctext) select 3,'SELECT COUNT(1) INTO EXIST FROM V$TABLESPACE WHERE NAME =  ''USER_'' || lpad(to_char(i),2,''0'');'
    if @onlydeltbs = 1
    begin
        insert into ##table(ident,ctext) select 3,'IF EXIST = 1 THEN'
        insert into ##table(ident,ctext) select 4,'DMSQL := ''DROP TABLESPACE user_'' || lpad(to_char(i),2,''0'') ||'' INCLUDING CONTENTS AND DATAFILES'';'
    end
    else
    begin
        insert into ##table(ident,ctext) select 3,'IF EXIST = 0 THEN'
        insert into ##table(ident,ctext) select 4,'DMSQL := ''CREATE TABLESPACE user_'' || lpad(to_char(i),2,''0'') ||'' DATAFILE ''''' + @tbspath + 'user_'' || lpad(to_char(i),2,''0'') || ''.dbf'''' SIZE 1M REUSE  AUTOEXTEND ON NEXT 1M MAXSIZE UNLIMITED  EXTENT MANAGEMENT LOCAL AUTOALLOCATE'';'
    end
    insert into ##table(ident,ctext) select 4,'EXECUTE IMMEDIATE DMSQL;'
    insert into ##table(ident,ctext) select 4,'EXIST:=0;'
    insert into ##table(ident,ctext) select 3,'END IF;'
    insert into ##table(ident,ctext) select 2,'END LOOP;'
    insert into ##table(ident,ctext) select 1,'END;'
end

上一页  1 2 3 4 5 6 7 8 9  下一页

Tags:Sqlserver 迁移 Oracle

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接