How to run the same job on multiple instances without including it in all the instances i.e including it in only one instance?
Is there any way to do that?
Yes there is a way to do this. First you have to create master server (http://msdn.microsoft.com/en-us/library/ms175104.aspx) and then create a master job (http://msdn.microsoft.com/en-us/library/ms190662.aspx) that will be downloaded to defined target servers.
Regards,
Dean Savović
Related
How can I duplicate my instance in sql server !?
I want to have a test instance on my same server just for testing purposes instead of applying all tests on the real data.
is it possible to create an new instance and copy all the same data and users with permissions on a new instance?
Or is there any other way other than VM, because my DB is in running and in use from other user but I want to do my test environment without disturbing other users. And all that on the same server.
You could either install a new instance by starting the installer again or simply use the same instance and restore a backup of your prod database to a test database.
without disturbing other users
This requirement alone means you will have to run your instance on another machine or VM. You cannot expect to maintain an instance on a server without certain things affecting the server as a whole, and any other instance running on it. (e.g. restarts for patching or troubleshooting)
There is no reason if you have the resources to not just put it on another VM, but that all depends on what you want to test (e.g. unit, integration or performance testing).
With regards to duplicating your server, you can utilize dbatools. The Start-SqlMigration would perform the work to bring over the major parts. To make it the easiest process it helps to make sure your new SQL Server instance has the same drive configuration.
Yes, you can do it. Just create new instance, and then restore your prod. database on that instance. You might need to create users there.
Following might help with creating users and mapping them to users in DB.
USE [master]
GO
CREATE LOGIN [myDBUser] WITH PASSWORD=N'myPassword' MUST_CHANGE, DEFAULT_DATABASE=[myDB], CHECK_EXPIRATION=ON, CHECK_POLICY=ON
GO
USE mdb
exec sp_change_users_login #Action = 'Update_One',#UserNamePattern = 'myDBUser', #LoginName = 'myDBUser'
You can automate this work using DBATools's Start-SqlMigration powershell commandlet.
However, I would warn against running both the production & the test instances on the same physical hardware, as you will be starving the production instance of resources.
I have an SQL Azure Database instance which provide data to a windows 8 app. The data in my database should be updated periodically (weekly). Is the any way to make it? I'm thinking of write a app which will run weekly and update the database. But still don't know how to make it run on Window Azure? Please help!
Thank you,
There are a number of ways to achieve this, does the data however need to come from a different source or can it be calculated?
Either way, seeing as you're already knee deep in SQL Azure I would suggest putting your logic into a worker role that can be scheduled to run your updates once a week. This would give you a great opportunity to do calculations and/or fetch data externally.
Azure gives you the flexibility to scale this worker role into numerous instances as well depending on the work load.
Here is a nice intro tutorial on creating a worker role on Azure: link
Write the application and set it to run through your cron job manager on a weekly time schedule. The cron job manager should be provided by your host.
I am not sure what the best design pattern for this problem is so any suggestions would be greatly appreciated. I have two SQL Servers A (with DBs P,Q,R) and B (with DBs X,Y,Z).
What is an efficient way to do a join of tables situated on Server A with those on Server B from command-line? Basically, I am trying to automate a long running list of queries and am not really sure how to proceed.
EDIT: I do not have control over the servers and am not an admin.
At a minimum I would create a Link Server between the two servers. Using something like OPENROWSET will be slower than using a Link Server.
Depending on how fast you need these queries to run you might consider having a nightly process that copies the data from Server A to Server b (or the other way around) so that you don't need to worry about cross server.
There is no way of performing a join across different servers. You can either use a cluster solution on top of those servers to do it for you, or you can do it by yourself - reading from one table, and performing the join manually in your code.
I am looking for a Sybase utility that would update any data change in one table in a sybase main server to archive server.
I remember i used it once when I used to work in a different firm but I don't remember the name.
When I was in previous firm, when there was an issue with replciation server. I used that utility to manually sync main server to remote readyonly archive server. I don't think it was entire databas syce. It was more of synce of one table at a time.
Does anybody have any ideas?
This is called Warm Standby.
You can do this only via Sybase Replication Server
check official docs.
but in real world - Warm Standby is not stable B)
Also u can syncing via bcp copy or dump and restor via NFS.
We currently have merge replication set up to merge certain tables between two databases. I need to programmatically start one of the publications to make sure data has been synchronized prior to starting a certain job. SQL Server Books Online has not been too helpful.
So far, the only thing I have come up with is to use sp_start_job to start the merge replication sql job. Is it ok to do this?
Are there any other ways to programmatically start synchronizing a publication?
We ended up using the sp_start_job with the name of the merge replication publication. The only downside that we found was that the name of the sql job is dynamically generated when the publication is created so if the publication is drop and recreated, then the name will change. Other than that using sp_start_job has worked beautifully.
Couple other things:
The sql user was added to SQLAgentOperatorRole to allow the call to sp_start_job
sp_help_job was used to indicate if the job completed successfully before proceeding