Automate moving sql data between Azure SQL Databases
hi
i want do what see basic stuff.
nightly, 1 database 'updated' match master.
both azure sql db's on same 'azure sql server'.
know can't 'linked servers' in azure
5 tables fk.
to keep things simple will, on target database:
remove fk
delete/truncate target tables.
insert data master db.
there no syncs or updates needed, delete , dump in job.
problem none of seems possible azure can see though looks on surface azure meant task.
i've tried data factory while seems ok insert/append pile of rows 1 'connection' another, there doesn't seem be else can like first delete target rows never mind remove , re-apply fk's. being able insert new data seems pointless.
i tried the storedprocedureactivity well in data factory thinking able run 'pre' , 'post' sql after insert seems the 'storedprocedure' bit concerned 'mocking' the tables insert.
anybody ideas. said consider 'hello world' problem. dumping 5 tables 1 database another, easy way i.e. delete , dump. i'm stumped.
btw way thought bcp out 5 txt files azure storage , bcp target db. (i'm ok writing "web jobs , schedules in .net)
possible.?
thanks
found out how do it.
sql 2016 allows create 'proxy' external tables in db point tables in different db.
can just a simple 'insert from'.
the webjobs let me schedule sql script , truncate, insert etc.
--create master key create master key encryption password = 'mypassword'; ------------------------------------------------------------------- --create credential called myazurenamesecurity create database scoped credential myazurenamesecurity identity = 'myusername', secret = 'mypassword'; ------------------------------------------------------------------- --create 'access setting path' using credential myazurenamesecurity create external data source myazuresernameaccess ( type=rdbms, location='myazuresername.database.windows.net', database_name='mydatabasename', credential= myazurenamesecurity); ------------------------------------------------------------------- -- create 'external' tables proxy copies of 'real' ones in other database. create external table dbo.ib_site_appliance ( [appliance_id] [int] not null , [manufacturer_id] [int] not null , [appliance_name] [nvarchar](200) not null , [showindigrams] [int] not null , [showinsid] [int] not null , [extras] [nvarchar](200) null , ) ( data_source = myazuresernameaccess ); --when call example 'select * ib_site_appliance'. data coming other database. --so can insert data table here. e.g -- insert local_site_appliance(bla,bla2) -- select (bla,bla2) ib_site_appliance -------------------------------------------------------------------
Microsoft Azure > Azure SQL Database
Comments
Post a Comment