Thursday, 23 July 2020

How to open SSIS package from SQL Server - Integration Services catalog


Open "Visual Studio" on your <ENTAD00110155> server (SSIS Server). 

Go to File --> New Project -->  select "Integration services" --> 

Select "Integration Services Import Project wizard" -->  Next --> 

Select "Integration Services catalog" --> Browse (Server name) --> 

Select <ENTAD00110155> server to connect --> OK --> 

Click browse (To select Package)  --> SSISDB--> Select Folder-->

Select DTSX  --> Next --> Import --> Close --> Go to View --> 

Solution explorer -->  Open "SQL_Restore.dtsx". 

Now you can see the SSIS package workflow and tasks!!

Sunday, 19 July 2020

How to use Robocopy for transferring data



robocopy H:\Resource \\WN0001101\h$\Backupfrom2008 /e /sec /LOG:H:\Copy_Log.txt


robocopy H:\Resource J:\Destination /e /sec /LOG:H:\Copy_Log.txt



robocopy H:\Resource  \\WN0001101\h$\Backupfrom2008 /mir /sec /LOG:H:\Copy_Log.txt

How to Add new Disk on Azure Windows server and make visible.


I created a new VM1 using the new Azure portal (Resource manager?) and attached a new drive (4 GB) to the vm1. and when I RDP to VM1, I can't see the new drive. I deleted the drive and added one of 20gb as I think that there may be a 20gb limit on drives for A0. Still nothing.
Using this Microsoft link I fixed the issue: 

https://docs.microsoft.com/en-us/azure/virtual-machines/windows/attach-managed-disk-portal?toc=%2Fazure%2Fvirtual-machines%2Fwindows%2Fclassic%2Ftoc.json

How to add a data disk
  1. Go to the Azure portal to add a data disk. Search for and select Virtual machines.
  2. Select a virtual machine from the list.
  3. On the Virtual machine page, select Disks.
  4. On the Disks page, select Add data disk.
  5. In the drop-down for the new disk, select Create disk.
  6. In the Create managed disk page, type in a name for the disk and adjust the other settings as necessary. When you're done, select Create.
  7. In the Disks page, select Save to save the new disk configuration for the VM.
  8. After Azure creates the disk and attaches it to the virtual machine, the new disk is listed in the virtual machine's disk settings under Data disks.

How to Initialize a new data disk

  1. Connect to the VM.
  2. Select the Windows Start menu inside the running VM and enter diskmgmt.msc in the search box. The Disk Management console opens.
  3. Disk Management recognizes that you have a new, uninitialized disk and the Initialize Disk window appears.
  4. Verify the new disk is selected and then select OK to initialize it.
  5. The new disk appears as unallocated. Right-click anywhere on the disk and select New simple volume. The New Simple Volume Wizard window opens.
  6. Proceed through the wizard, keeping all of the defaults, and when you're done select Finish.
  7. Close Disk Management.
  8. A pop-up window appears notifying you that you need to format the new disk before you can use it. Select Format disk.
  9. In the Format new disk window, check the settings, and then select Start.
  10. A warning appears notifying you that formatting the disks erases all of the data. Select OK.
  11. When the formatting is complete, select OK.

Next steps

Wednesday, 1 July 2020

Add new Article to existing Transnational Replication using Script


Add Article to existing Publication

To add the new (articles/SP/Views/Functions) to Transactional replication,  Don't not use GUI to add articles (including Tables, views, SP’s and Functions), always use sp_addarticle and sp_addsubscription like following scripts.

                   

Make sure that your publication has IMMEDIATE_SYNC and ALLOW_ANONYMOUS properties set to FALSE or 0.
use JAIVERMA_DB

select immediate_sync , allow_anonymous from syspublications

If either of them is TRUE then modify that to FALSE by using the following command
EXEC sp_changepublication
@publication = My-Replication',
@property = 'allow_anonymous' ,
@value = 'false'
GO

EXEC sp_changepublication
@publication = My-Replication',
s@property = 'immediate_sync' ,
@value = 'false'


Adding the Tables to Replication -

1)    Add the article to the publication


use JAIVERMA_DB

use [JAIVERMA_DB]
exec sp_addarticle @publication = N’MY-Replication’, @article = N'New_Table_name', @source_object = N'New_Table_name', @force_invalidate_snapshot=1
GO



2)     Add the subscription for this new article


use [JAIVERMA_DB]
exec sp_addsubscription @publication = N’MY-Replication’, @subscriber = N’SECONDARYSERVERNAME’, @destination_db = N'JAIVERMA_DB', @article = N'New_Table_name',  @reserved='Internal', @subscription_type = N'Pull'
GO


use [JAIVERMA_DB]
exec sp_addsubscription @publication = N’MY-Replication’, @subscriber = N'GPC-INISQDB06', @destination_db = N'JAIVERMA_DB', @article = N' New_Table_name',  @reserved='Internal', @subscription_type = N'Pull'
GO



Adding the SP to Replication -
1)      Adding the SP to publication

use [JAIVERMA_DB]
exec sp_addarticle @publication = N’MY-Replication’, @article = N'New_SP_Name', @source_object = N'New_SP_name', @type = N'proc schema only', @destination_table = N'New_SP_name',  @force_invalidate_snapshot=1
GO

2)      Add the subscription for this new SP


use [JAIVERMA_DB]
exec sp_addsubscription @publication = N’MY-Replication’, @subscriber = N’SECONDARYSERVERNAME’, @destination_db = N'JAIVERMA_DB', @article = N' New_SP_Name'',  @reserved='Internal', @subscription_type = N'Pull'
GO






Adding the View to existing replication

1)      Adding the View to publication


use [JAIVERMA_DB]
exec sp_addarticle @publication = N’MY-Replication’,
@article = N'New_View_name',
@source_object = N'New_View_name',
@type = N'view schema only',
@destination_table = N'New_View_name',
@force_invalidate_snapshot=1
GO


2)      Add the subscription for this new view

use [JAIVERMA_DB]
exec sp_addsubscription @publication = N’MY-Replication’, @subscriber = N’SECONDARYSERVERNAME’, @destination_db = N'JAIVERMA_DB', @article = N'New_View_name', @reserved='Internal', @subscription_type = N'Pull'
GO




Adding the User Defined Functions to existing replication

1)      Adding the User Defined Functions to publication

use [JAIVERMA_DB]

exec sp_addarticle @publication = N’MY-Replication’,
@article = N'New_Function_name',
@source_object = N'New_Function_name',
@type = N'func schema only',
@destination_table = N'New_Function_name',
@force_invalidate_snapshot=1
GO


2)      Add the subscription for this new Function

use [JAIVERMA_DB]

exec sp_addsubscription @publication = N’MY-Replication’, @subscriber = N’SECONDARYSERVERNAME’, @destination_db = N'JAIVERMA_DB', @article = N'New_Function_name',  @reserved='Internal', @subscription_type = N'Pull'
GO






3)    Lastly start the SNAPSHOT AGENT job from the job activity monitor. Verify that the snapshot was generated for only newly added articles .