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

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

 2009-03-03 13:11:25 来源:WEB开发网   
核心提示: --创建默认用户表空间(大文件) if @onlydeltbs = 1 insert into ##table(ident,ctext) select 1,'--删除默认用户表空间,设置system为默认用户表空间' else insert into ##table(id

--创建默认用户表空间(大文件)

    if @onlydeltbs = 1
        insert into ##table(ident,ctext) select 1,'--删除默认用户表空间,设置system为默认用户表空间'
    else
        insert into ##table(ident,ctext) select 1,'--创建默认用户表空间'
    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,'SELECT COUNT(1) INTO EXIST FROM V$TABLESPACE WHERE NAME =  ''USER_DEFAULT_SPACE'';'
    if @onlydeltbs = 1
    begin
        insert into ##table(ident,ctext) select 2,'IF EXIST = 1 THEN'
        insert into ##table(ident,ctext) select 3,'EXECUTE IMMEDIATE ''ALTER DATABASE DEFAULT TABLESPACE SYSTEM'';'
        insert into ##table(ident,ctext) select 3,'EXECUTE IMMEDIATE ''DROP TABLESPACE USER_DEFAULT_SPACE INCLUDING CONTENTS AND DATAFILES'';'
    end       
    else
    begin
        insert into ##table(ident,ctext) select 2,'IF EXIST = 0 THEN'
        insert into ##table(ident,ctext) select 3,'DMSQL := ''CREATE BIGFILE TABLESPACE USER_DEFAULT_SPACE DATAFILE ''''' + @tbspath + 'user_default_space.dbf'''' SIZE 10m REUSE  AUTOEXTEND ON NEXT 10M MAXSIZE UNLIMITED  EXTENT MANAGEMENT LOCAL AUTOALLOCATE'';'
        insert into ##table(ident,ctext) select 3,'EXECUTE IMMEDIATE DMSQL;'
        insert into ##table(ident,ctext) select 3,'--设置为默认用户表空间'
        insert into ##table(ident,ctext) select 3,'EXECUTE IMMEDIATE ''ALTER DATABASE DEFAULT TABLESPACE USER_DEFAULT_SPACE'';'
    end
    insert into ##table(ident,ctext) select 2,'END IF;'
    insert into ##table(ident,ctext) select 1,'END;'
    insert into ##table(ident,ctext) select 1,''

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

Tags:Sqlserver 迁移 Oracle

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