1 ETQ000 ================================================== 1 ETQ399 Executing SQL script '..\var\MSSUPGSPS.TSQL'. 2 ETQ399 Connecting to database 'mss'. 4 ETQ010 Date & Time: 20200722115103 3 ETQ398 SQL: if exists( select * from sysobjects where name = 'sap_drop_sapr3' and 3 ETQ398XSQL: id = object_id(user_name() + '.' + name, 'P') ) drop proc 3 ETQ398XSQL: sap_drop_sapr3 3 ETQ398 SQL: create proc sap_drop_sapr3 @ntuser sysname as BEGIN set nocount on 3 ETQ398XSQL: declare @dbname sysname declare @loginname sysname declare @cmd 3 ETQ398XSQL: varchar(256) if not exists( select * from master..syslogins where 3 ETQ398XSQL: loginname = 'sapr3' ) begin return end if(select dbname from 3 ETQ398XSQL: master..syslogins where loginname = 'sapr3') <> db_name() begin 3 ETQ398XSQL: return end select @loginname = loginname from master..syslogins 3 ETQ398XSQL: where upper(loginname) = upper(@ntuser) select @cmd = 3 ETQ398XSQL: 'msdb..sp_manage_jobs_by_login ''REASSIGN'', ''sapr3'', ''' + 3 ETQ398XSQL: @loginname + '''' exec( @cmd) create table #all_dbs (name sysname) 3 ETQ398XSQL: insert into #all_dbs select name from master..sysdatabases 3 ETQ398XSQL: declare get_all_dbs cursor for select name from #all_dbs open 3 ETQ398XSQL: get_all_dbs fetch next from get_all_dbs into @dbname while 3 ETQ398XSQL: (@@fetch_status <> -1) begin if(@@fetch_status <> -2) begin 3 ETQ398XSQL: select @cmd = 'if not exists( select * from ' + @dbname + 3 ETQ398XSQL: '..sysusers where name = ''sapr3'' )' + 3 ETQ398XSQL: ' delete from #all_dbs where name = ''' + @dbname + '''' exec( 3 ETQ398XSQL: @cmd ) end fetch next from get_all_dbs into @dbname end 3 ETQ398XSQL: close get_all_dbs deallocate get_all_dbs declare revoke_dbaccess 3 ETQ398XSQL: cursor for select name from #all_dbs open revoke_dbaccess 3 ETQ398XSQL: fetch next from revoke_dbaccess into @dbname while (@@fetch_status 3 ETQ398XSQL: <> -1) begin if(@@fetch_status <> -2) begin select 3 ETQ398XSQL: @cmd = @dbname + '..sp_revokedbaccess ''sapr3''' exec( @cmd ) 3 ETQ398XSQL: end fetch next from revoke_dbaccess into @dbname end close 3 ETQ398XSQL: revoke_dbaccess deallocate revoke_dbaccess delete from #all_dbs 3 ETQ398XSQL: insert into #all_dbs select name from master..sysdatabases declare 3 ETQ398XSQL: get_all_dbs cursor for select name from #all_dbs open 3 ETQ398XSQL: get_all_dbs fetch next from get_all_dbs into @dbname while 3 ETQ398XSQL: (@@fetch_status <> -1) begin if(@@fetch_status <> -2) begin 3 ETQ398XSQL: select @cmd = 'if not exists( select * from ' + @dbname + 3 ETQ398XSQL: '..sysusers where sid = suser_sid(''sapr3''))' + 3 ETQ398XSQL: ' delete from #all_dbs where name = ''' + @dbname + '''' exec( 3 ETQ398XSQL: @cmd ) end fetch next from get_all_dbs into @dbname end 3 ETQ398XSQL: close get_all_dbs deallocate get_all_dbs declare drop_aliases 3 ETQ398XSQL: cursor for select name from #all_dbs open drop_aliases fetch 3 ETQ398XSQL: next from drop_aliases into @dbname while (@@fetch_status <> -1) 3 ETQ398XSQL: begin if(@@fetch_status <> -2) begin select @cmd = 3 ETQ398XSQL: @dbname + '..sp_dropalias ''sapr3''' exec( @cmd ) end 3 ETQ398XSQL: fetch next from drop_aliases into @dbname end close drop_aliases 3 ETQ398XSQL: deallocate drop_aliases drop table #all_dbs select @cmd = 3 ETQ398XSQL: 'master..sp_droplogin ''sapr3''' exec( @cmd ) set nocount off END 3 ETQ398 SQL: if(exists(select name from sysobjects where name = 3 ETQ398XSQL: 'sap_upg_getrelease' and id = object_id(user_name() + '.' + name, 'P') 3 ETQ398XSQL: )) drop procedure sap_upg_getrelease 1 ETQ000 ================================================== 4 ETQ010 Date & Time: 20200722115103 1 ETQ003 exit code: "0"