sábado, 3 de abril de 2010

RM/SQL - Script de Usuários - SQL 2008

Script de criação de usuários - SQL 2008

SP_DROPUSER SYSDBA
GO
SP_DROPALIAS RM
GO

IF NOT EXISTS(SELECT * FROM MASTER.DBO.SYSLOGINS WHERE NAME = 'rm')
CREATE LOGIN rm WITH PASSWORD = 'rm',CHECK_POLICY=OFF
GO


EXEC SP_CHANGEDBOWNER rm
GO

IF NOT EXISTS(SELECT * FROM MASTER.DBO.SYSLOGINS WHERE NAME = 'sysdba')
CREATE LOGIN sysdba WITH PASSWORD = 'masterkey',CHECK_POLICY=OFF
GO

sp_adduser sysdba,sysdba
GO

GRANT SELECT ON GPARAMS TO sysdba
GO
GRANT SELECT , UPDATE ON GUSUARIO TO sysdba
GO
GRANT SELECT ON GPERMIS TO sysdba
GO
GRANT SELECT ON GACESSO TO sysdba
GO
GRANT SELECT ON GSISTEMA TO sysdba
GO
GRANT SELECT ON GCOLIGADA TO sysdba
GO
GRANT SELECT ON GUSRPERFIL TO sysdba
GO
GRANT SELECT ON GSERVICO TO sysdba
GO