Search Chirayu Software Solutions Blog

Saturday, April 27, 2019

IIS Backup and Restore Steps

using appcmd, create IIS configuration backup on first server. To do it, run the command prompt with the administrator privileges and go to the following directory:
cd c:\Windows\system32\inetsrv
Create the IIS configuration backup with name srviis1-backup-20161107:
appcmd add backup srviis1-backup-20161107
Copy the backup folder to the same directory c:\windows\system32\backup on another server.
To display the list of all available backups, run the following command:
appcmd list backup
As we can see, the backup we have copied has appeared in the list of available backups.
Recover IIS configuration from this backup:
appcmd restore backup srviis1-backup-20161107
The same IIS version has to be used on both servers

Friday, April 19, 2019

Delete all data of particular MiniadminUsername

 
CREATE TABLE [dbo].[MiniadminLoginMappingBackup](
 [miniadminUsername] [varchar](20) NOT NULL,
 [LoginId] [varchar](20) NOT NULL,
 CONSTRAINT [PK_MiniadminLoginMappingBackup] PRIMARY KEY CLUSTERED
(
 [miniadminUsername] ASC,
 [LoginId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO

delete from [MiniadminLoginMappingBackup]
insert into [MiniadminLoginMappingBackup] select * from MiniadminLoginMapping

delete from [tblOrdersBook] where ordClientCode in ( select clientcode from miniadminclientmapping where miniadminUsername = 'mandev')
  delete from [tblTrades] where trdClientCode in ( select clientcode from miniadminclientmapping where miniadminUsername = 'mandev')
  delete from [DeletedTrades] where trdClientCode in ( select clientcode from miniadminclientmapping where miniadminUsername = 'mandev')
  delete from [DeletedTrades] where trdClientCode in ( select clientcode from miniadminclientmapping where miniadminUsername = 'mandev')
  delete from tblClientLimit where clClientCode in  ( select clientcode from miniadminclientmapping where miniadminUsername = 'mandev')
  delete from tblClientLimitLotWise where cllClientCode in  ( select clientcode from miniadminclientmapping where miniadminUsername = 'mandev')
  delete from UserMargin where ClientCode in  ( select clientcode from miniadminclientmapping where miniadminUsername = 'mandev')
  delete from tblLedger where lrClientCode  in ( select clientcode from miniadminclientmapping where miniadminUsername = 'mandev')
 
  delete from MobileNotificationMaster where MobileUsername in ( select clientcode from miniadminclientmapping where miniadminUsername = 'mandev')
  delete from MobileLogin where Username in ( select clientcode from miniadminclientmapping where miniadminUsername = 'mandev')
  
  delete from UserPortfolio where UserName in  ( select clientcode from miniadminclientmapping where miniadminUsername = 'mandev')
  delete from MiniadminLoginMapping where miniadminUsername = 'mandev'
  delete from MiniadminClientMapping where miniadminUsername = 'mandev'
  delete from tblLogin where Username in ( select loginid from MiniadminLoginMappingBackup where miniadminUsername = 'mandev')
 
  delete from tblClientMaster where cmClientCode in ( select loginid from MiniadminLoginMappingBackup where miniadminUsername = 'mandev')