Копировать права доступа на БД из вкладки Securables (SQL Server)
Запись от Poleax размещена 07.12.2012 в 09:55
После восстановления БД Ax , AOS не подключается к БД. У БД другой логин, не такой под которым стартует AOS.
Ошибка:
Надо перенести настройки от OldUser --> NewUser
http://social.msdn.microsoft.com/For...9-530a73a0814d
http://vyaskn.tripod.com/scripting_p...erver_2005.htm
Ошибка:
Цитата:
The Microsoft Dynamics AX Object Server 6.2$01-MicrosoftDynamicsAX2012R2 service terminated unexpectedly. It has done this 2 time(s).
Windows detected your registry file is still in use by other applications or services. The file will be unloaded now. The applications or services that hold your registry file may not function properly afterwards.
DETAIL -
2 user registry handles leaked from \Registry\User\S-1-5-21-3493872076-3631449775-1555872641-12685:
Process 5144 (\Device\HarddiskVolume2\Windows\System32\WerFault.exe) has opened key \REGISTRY\USER\S-1-5-21-3493872076-3631449775-1555872641-12685
Process 5144 (\Device\HarddiskVolume2\Windows\System32\WerFault.exe) has opened key \REGISTRY\USER\S-1-5-21-3493872076-3631449775-1555872641-12685\Control Panel\International
Faulting application name: Ax32Serv.exe, version: 6.2.158.0, time stamp: 0x50a65c76
Faulting module name: Ax32Serv.exe, version: 6.2.158.0, time stamp: 0x50a65c76
Exception code: 0xc0000005
Fault offset: 0x0000000000667fbc
Faulting process id: 0x804
Faulting application start time: 0x01cdd43caa5d6aab
Faulting application path: C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX2012R2\Bin\Ax32Serv.exe
Faulting module path: C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX2012R2\Bin\Ax32Serv.exe
Report Id: e88ab5b8-402f-11e2-bd5e-0050568c0067
Object Server 01: The database reported (session 1 (-AOS-)): [Microsoft][SQL Server Native Client 10.0][SQL Server]The EXECUTE permission was denied on the
object 'XU_GetSchemaVersion', database 'MicrosoftDynamicsAX_model', schema 'dbo'.. The SQL statement was: "{ ? = CALL [MicrosoftDynamicsAX_model].[dbo].[XU_GetSchemaVersion](?, ?) }"
Windows detected your registry file is still in use by other applications or services. The file will be unloaded now. The applications or services that hold your registry file may not function properly afterwards.
DETAIL -
2 user registry handles leaked from \Registry\User\S-1-5-21-3493872076-3631449775-1555872641-12685:
Process 5144 (\Device\HarddiskVolume2\Windows\System32\WerFault.exe) has opened key \REGISTRY\USER\S-1-5-21-3493872076-3631449775-1555872641-12685
Process 5144 (\Device\HarddiskVolume2\Windows\System32\WerFault.exe) has opened key \REGISTRY\USER\S-1-5-21-3493872076-3631449775-1555872641-12685\Control Panel\International
Faulting application name: Ax32Serv.exe, version: 6.2.158.0, time stamp: 0x50a65c76
Faulting module name: Ax32Serv.exe, version: 6.2.158.0, time stamp: 0x50a65c76
Exception code: 0xc0000005
Fault offset: 0x0000000000667fbc
Faulting process id: 0x804
Faulting application start time: 0x01cdd43caa5d6aab
Faulting application path: C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX2012R2\Bin\Ax32Serv.exe
Faulting module path: C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX2012R2\Bin\Ax32Serv.exe
Report Id: e88ab5b8-402f-11e2-bd5e-0050568c0067
Object Server 01: The database reported (session 1 (-AOS-)): [Microsoft][SQL Server Native Client 10.0][SQL Server]The EXECUTE permission was denied on the
object 'XU_GetSchemaVersion', database 'MicrosoftDynamicsAX_model', schema 'dbo'.. The SQL statement was: "{ ? = CALL [MicrosoftDynamicsAX_model].[dbo].[XU_GetSchemaVersion](?, ?) }"
http://social.msdn.microsoft.com/For...9-530a73a0814d
http://vyaskn.tripod.com/scripting_p...erver_2005.htm
PHP код:
SET NOCOUNT ON
DECLARE @OldUser sysname, @NewUser sysname
SET @OldUser = 'HRUser'
SET @NewUser = 'PersonnelAdmin'
SELECT 'USE' + SPACE(1) + QUOTENAME(DB_NAME()) AS '--Database Context'
SELECT '--Cloning permissions from' + SPACE(1) + QUOTENAME(@OldUser) + SPACE(1) + 'to' + SPACE(1) + QUOTENAME(@NewUser) AS '--Comment'
SELECT 'EXEC sp_addrolemember @rolename ='
+ SPACE(1) + QUOTENAME(USER_NAME(rm.role_principal_id), '''') + ', @membername =' + SPACE(1) + QUOTENAME(@NewUser, '''') AS '--Role Memberships'
FROM sys.database_role_members AS rm
WHERE USER_NAME(rm.member_principal_id) = @OldUser
ORDER BY rm.role_principal_id ASC
SELECT CASE WHEN perm.state <> 'W' THEN perm.state_desc ELSE 'GRANT' END
+ SPACE(1) + perm.permission_name + SPACE(1) + 'ON ' + QUOTENAME(USER_NAME(obj.schema_id)) + '.' + QUOTENAME(obj.name)
+ CASE WHEN cl.column_id IS NULL THEN SPACE(0) ELSE '(' + QUOTENAME(cl.name) + ')' END
+ SPACE(1) + 'TO' + SPACE(1) + QUOTENAME(@NewUser) COLLATE database_default
+ CASE WHEN perm.state <> 'W' THEN SPACE(0) ELSE SPACE(1) + 'WITH GRANT OPTION' END AS '--Object Level Permissions'
FROM sys.database_permissions AS perm
INNER JOIN
sys.objects AS obj
ON perm.major_id = obj.[object_id]
INNER JOIN
sys.database_principals AS usr
ON perm.grantee_principal_id = usr.principal_id
LEFT JOIN
sys.columns AS cl
ON cl.column_id = perm.minor_id AND cl.[object_id] = perm.major_id
WHERE usr.name = @OldUser
ORDER BY perm.permission_name ASC, perm.state_desc ASC
SELECT CASE WHEN perm.state <> 'W' THEN perm.state_desc ELSE 'GRANT' END
+ SPACE(1) + perm.permission_name + SPACE(1)
+ SPACE(1) + 'TO' + SPACE(1) + QUOTENAME(@NewUser) COLLATE database_default
+ CASE WHEN perm.state <> 'W' THEN SPACE(0) ELSE SPACE(1) + 'WITH GRANT OPTION' END AS '--Database Level Permissions'
FROM sys.database_permissions AS perm
INNER JOIN
sys.database_principals AS usr
ON perm.grantee_principal_id = usr.principal_id
WHERE usr.name = @OldUser
AND perm.major_id = 0
ORDER BY perm.permission_name ASC, perm.state_desc ASC
Всего комментариев 0