WEB开发网
开发学院数据库Oracle Sqlserver2005迁移至Oracle系列之五:角色、用户、... 阅读

Sqlserver2005迁移至Oracle系列之五:角色、用户、及权限

 2009-03-03 13:11:13 来源:WEB开发网   
核心提示: --数据库用户的隶属关系 select * into #usergroup from ( select c.name as username,c.type,c.principal_id as user_principal_id,a.name as role_name,a.princip

--数据库用户的隶属关系

    select *
    into #usergroup
    from
    (
    select c.name as username,c.type,c.principal_id as user_principal_id,a.name as role_name,a.principal_id as role_principal_id,1 as is_role
    from sys.database_principals a inner join sys.database_role_members b on a.principal_id = b.role_principal_id inner join sys.database_principals c on b.member_principal_id = c.principal_id
    union all
    select name as username,type,principal_id as user_principal_id,'' as role_name,'' as role_principal_id,0 as is_role
    from sys.database_principals
    where type = 's'
    union all
    select name as username,type,principal_id as user_principal_id,'public' as role_name,0 as role_principal_id,1 as is_role
    from sys.database_principals
    where type = 's'
    )t
    where username not in ('guest')
    order by username,is_role,role_name
    /*
    select * from #usergroup
    select * from #perminssion
    */
end

--脚本开始部分

begin
    print replicate(char(9),0) + '--' + replicate('*',50) + '该脚本适用于 oracle数据库系统' + replicate('*',50)
    print replicate(char(9),0) + '--' + replicate('*',50) + '该脚本适用于 oracle数据库系统' + replicate('*',50)
    print replicate(char(9),0) + 'DECLARE'
    print replicate(char(9),1) + 'VA_EXIST_USER    INT:=0;'
    print replicate(char(9),1) + 'VA_EXIST_PRIV    INT:=0;'   
    print replicate(char(9),1) + 'VA_EXIST_OBJ    INT:=0;'   
    print replicate(char(9),0) + 'BEGIN'
end

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

Tags:Sqlserver 迁移 Oracle

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