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

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

 2009-03-03 13:11:13 来源:WEB开发网   
核心提示:--基本上完美处理了insert、update、delete、select、control、execute等权限--不能映射alter权限的处理set nocount on --清理临时表begin if not object_id('tempdb..#perminssion') is null dro

--基本上完美处理了insert、update、delete、select、control、execute等权限

--不能映射alter权限的处理

set nocount on

--清理临时表

begin
    if not object_id('tempdb..#perminssion')  is null
        drop table #perminssion
    if not object_id('tempdb..#usergroup')  is null
        drop table #usergroup
end

begin

--所有的显示权限

    select *
    into #perminssion
    from (
            select distinct user_name(grantee_principal_id) as grantee_name,grantee_principal_id
            ,class,class_desc
            ,case class
                when 0 then db_name()
                when 1 then object_name(major_id)
                when 3 then schema_name(major_id)
                when 4 then user_name(major_id)
                end
            as object_name
            ,(case when b.type is null and class = 3 then 'SCM' else b.type end ) as object_type
            ,permission_name,state_desc
            ,isnull(b.is_ms_shipped,0) as  is_ms_shipped
            from sys.database_permissions  a left join sys.objects b on a.major_id = b.object_id
    ) t
    where    class in (1,3)    --数据库、对象、构架
            and isnull(is_ms_shipped,0) = 0
            and not (class = 3 and object_name = 'sys')    --dbo架构
            and object_name not like 'sp%'
            and object_name not like 'sys%'
            and object_name not in ('fn_diagramobjects')
            and not (class = 1 and object_type is null)
            and permission_name not in ('VIEW DEFINITION')
    order by grantee_name,object_name

1 2 3 4 5 6  下一页

Tags:Sqlserver 迁移 Oracle

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