How can we help you today? How can we help you today?
stan
Hi Andras CheckDB found 0 errors, here's the text: CHECKDB found 0 allocation errors and 0 consistency errors in database 'Registro'. DBCC execution completed. If DBCC printed error messages, contact your system administrator. My compatibility level for databases is SQL Server 2000 (80), I'm running with Service pack 3 (I don't know if this helps), I downloaded SQL Prompt 3.9 but it still finds problems while refreshing cache, it shows now: Unable to refresh or cache database [urldb1].[Registro] due to the following error: An unexpected null value has been encountered while querying the database system tables. Please make sure that the database is in a consistent state by running DBCC CHECKDB. If the problem persists, please contact our support.. RedGate.SqlPrompt.Engine.Cache.DatabaseRefreshException: Unable to refresh or cache database [urldb1].[Registro] due to the following error: An unexpected null value has been encountered while querying the database system tables. Please make sure that the database is in a consistent state by running DBCC CHECKDB. If the problem persists, please contact our support.. ---> RedGate.SQLCompare.Engine.SqlCompareException: An unexpected null value has been encountered while querying the database system tables. Please make sure that the database is in a consistent state by running DBCC CHECKDB. If the problem persists, please contact our support. ---> System.InvalidCastException: Unable to cast object of type 'System.DBNull' to type 'System.String'. at o.a(Boolean ) at o.a(n ) --- End of inner exception stack trace --- at o.a(n ) at RedGate.SQLCompare.Engine.Database.RegisterForSqlPrompt(ConnectionProperties connectionProperties, Options options, Boolean includeSystemObjects, Boolean includeDependencies) at cy.b(IAuthenticationTokenProvider ) --- End of inner exception stack trace --- at cy.b(IAuthenticationTokenProvider ) at cy.Refresh(IAuthenticationTokenProvider provider) at ao.DoTask() Thanks / comments
Hi Andras CheckDB found 0 errors, here's the text: CHECKDB found 0 allocation errors and 0 consistency errors in database 'Registro'. DBCC execution completed. If DBCC printed error messages, conta...
0 votes
Yes, I don't why this happens, here is the code I am trying: -- Testing for BACKUP rights. -- Work from server role to database role, to BACKUP DATABASE execution and restriction rights. -- # Aliases are not supported. DECLARE @hasrights INTEGER SELECT @hasrights = IS_SRVROLEMEMBER('sysadmin', 'dba') IF ( @hasrights = 0 ) OR ( @hasrights IS NULL ) BEGIN SETUSER 'dba' -- As long as the user has sysadmin server role, he can backup the database. SELECT @hasrights = IS_SRVROLEMEMBER('sysadmin') IF ( @hasrights = 0 ) OR ( @hasrights IS NULL ) BEGIN -- This has to be done because IS_SRVROLEMEMBER does not check recursively if a login name is provided. USE [MonitorMedios] DECLARE @login_type INTEGER DECLARE @login_name SYSNAME -- No sysadmin rights. Check for database db_owner role. SELECT @hasrights = IS_MEMBER('db_owner') -- Check for database db_backupoperator role. IF ( @hasrights <> 1 ) BEGIN SELECT @hasrights = IS_MEMBER('db_backupoperator') END -- No db_backupoperator role. Check BACKUP DATABASE execute rights. -- Quick check for explicit rights. IF ( @hasrights = 0 ) OR ( @hasrights IS NULL ) BEGIN SELECT @hasrights = 1 WHERE EXISTS ( SELECT 1 FROM sysprotects a INNER JOIN sysusers b ON a.uid = b.uid AND b.name = 'dba' WHERE a.action = 228 AND a.protecttype IN ( 204, 205 ) ) IF ( @hasrights = 0 ) OR ( @hasrights IS NULL ) BEGIN -- No direct rights. Now need to iterate and check all Windows groups and SQL Server roles. DECLARE cur_rights CURSOR FOR SELECT ( CASE WHEN b.isntgroup = 1 THEN 1 ELSE CASE WHEN b.issqlrole = 1 THEN 2 ELSE 0 END END ) type, b.name FROM sysprotects a INNER JOIN sysusers b ON a.uid = b.uid WHERE a.action = 228 AND a.protecttype IN ( 204, 205 ) AND ( b.isntgroup = 1 OR b.issqlrole = 1 ) OPEN cur_rights FETCH NEXT FROM cur_rights INTO @login_type, @login_name @FETCH_STATUS = 0 BEGIN SELECT @hasrights = IS_MEMBER(@login_name) IF @hasrights = 1 BEGIN BREAK END FETCH NEXT FROM cur_rights INTO @login_type, @login_name END CLOSE cur_rights DEALLOCATE cur_rights END END -- for database level rights, need to check if DENY restriction exists IF @hasrights = 1 BEGIN SELECT @hasrights = 0 WHERE EXISTS ( SELECT 1 FROM sysprotects a INNER JOIN sysusers b ON a.uid = b.uid AND b.name = 'dba' WHERE a.action = 228 AND a.protecttype IN ( 206 ) ) IF @hasrights = 1 BEGIN -- No explicit DENY restrictions. Check via group / role membership. DECLARE cur_rights CURSOR FOR SELECT ( CASE WHEN b.isntgroup = 1 THEN 1 ELSE CASE WHEN b.issqlrole = 1 THEN 2 ELSE 0 END END ) type, b.name FROM sysprotects a INNER JOIN sysusers b ON a.uid = b.uid WHERE a.action = 228 AND a.protecttype = 206 AND ( b.isntgroup = 1 OR b.issqlrole = 1 ) OPEN cur_rights FETCH NEXT FROM cur_rights INTO @login_type, @login_name @FETCH_STATUS = 0 BEGIN SELECT @hasrights = IS_MEMBER(@login_name) IF @hasrights = 1 BEGIN SET @hasrights = 0 BREAK END FETCH NEXT FROM cur_rights INTO @login_type, @login_name END CLOSE cur_rights DEALLOCATE cur_rights END END END SETUSER END DECLARE @dbname SYSNAME SELECT @dbname = name FROM master..sysdatabases WHERE name = N'MonitorMedios' IF @hasrights = 1 SELECT CAST(1 AS INT) AS hasrights, @dbname AS name ELSE SELECT CAST(0 AS INT) AS hasrights, @dbname AS NAME / comments
Yes, I don't why this happens, here is the code I am trying: -- Testing for BACKUP rights. -- Work from server role to database role, to BACKUP DATABASE execution and restriction rights. -- # Al...
0 votes
Where's the script SQL Backup uses for backup rights? do you mean runing the backup script SQL Backup creates for backing up the conflicting database? / comments
Where's the script SQL Backup uses for backup rights? do you mean runing the backup script SQL Backup creates for backing up the conflicting database?
0 votes