Showing posts with label agent. Show all posts
Showing posts with label agent. Show all posts

Wednesday, March 28, 2012

RMO: getting the agentid for AssignToAgent

Hello,

I'd like to assign a custom profile to a merge replication agent. The AssignToAgent() method takes the distribution db name and the agentID as an integer. Which method is used to get at this agentID? All I can find is the job ID in the subscription class.

Thanks!

Scott

You could try something like this

string distServerName = "mydistributionserver";
ServerConnection distServerConn = new ServerConnection(distServerName);
distServerConn.Connect();
AgentProfile logReaderAgentProfile = new AgentProfile("MyLogReader", distServerConn);
logReaderAgentProfile.Description = "My New LogReader Profile";
logReaderAgentProfile.AgentType = AgentType.LogReaderAgents; // change this to MergeAgents
logReaderAgentProfile.Create();
logReaderAgentProfile.CachePropertyChanges = true;
logReaderAgentProfile.MakeDefault();

// Set parameter values
logReaderAgentProfile.ChangeParameter("historyverboselevel", "1");
logReaderAgentProfile.ChangeParameter("logintimeout", "15");
logReaderAgentProfile.ChangeParameter("pollinginterval", "10");
logReaderAgentProfile.ChangeParameter("querytimeout", "1200");
logReaderAgentProfile.ChangeParameter("readbatchsize", "250");
logReaderAgentProfile.CommitPropertyChanges();

Hope this helps

Cheers

sql

Friday, March 23, 2012

Right to view jobs in SQL Agent

I've removed the System Administors role from my SQL 2000 login to prevent
accidental updates/changes to data. Now I can't see any of the jobs in SQL
Server Agent that are owned by dbo. How can I set up accounts so that they
don't have update rights to databases but do have read-only rights to the jo
b
scheduler?Add them to the TargetServersRole in msdb (assuming you are on SP3 or
higher) and you'll be able to view (but not modify) the jobs.
HTH,
Jasper Smith (SQL Server MVP)
http://www.sqldbatips.com
"Joel H" <JoelH@.discussions.microsoft.com> wrote in message
news:1216C851-0A92-4932-8F23-65F91083AFF6@.microsoft.com...
> I've removed the System Administors role from my SQL 2000 login to prevent
> accidental updates/changes to data. Now I can't see any of the jobs in
> SQL
> Server Agent that are owned by dbo. How can I set up accounts so that
> they
> don't have update rights to databases but do have read-only rights to the
> job
> scheduler?

right backup example

Please give me a good way to backup databases
on my MS SQL 2000 Server.
I've created a job in
"Enterprise Manager"..."SQL Server Agent"->Jobs
"BACKUP DATABASE [BUFF] TO DISK = N'C:\Program Files\Microsoft SQL
Server\MSSQL\BACKUP\BUFF.bkp' WITH NOINIT , NOUNLOAD , NAME = N'BUFF
backup', NOSKIP , STATS = 10, NOFORMAT"
and they creates the backup.
However, I don't like that BUFF.bkp grows too much.
How can I (probably using a third-party utility):
- create backups with file names with current date, for example
BUFF-DD_MM_YYYY.bkp,
- automatically delete too old backups
- move them on a network drive after creating
(I remember that SQL Server doesn't allow to backup directly to a network
drive).You can use the maintenance wizard to handle the full backup tasks with all
the features you asked for. BOL explains it better than I do.
You can also back up to a network share, you just have to follow a simple
procedure.
HowTo: Backup to UNC name using Database Maintenance Wizard
http://support.microsoft.com/?kbid=555128
--
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Michael Smirnov" <smbsmb@.mail.ru> wrote in message
news:urqrZOl1EHA.3236@.TK2MSFTNGP15.phx.gbl...
> Please give me a good way to backup databases
> on my MS SQL 2000 Server.
> I've created a job in
> "Enterprise Manager"..."SQL Server Agent"->Jobs
> "BACKUP DATABASE [BUFF] TO DISK = N'C:\Program Files\Microsoft SQL
> Server\MSSQL\BACKUP\BUFF.bkp' WITH NOINIT , NOUNLOAD , NAME = N'BUFF
> backup', NOSKIP , STATS = 10, NOFORMAT"
> and they creates the backup.
> However, I don't like that BUFF.bkp grows too much.
> How can I (probably using a third-party utility):
> - create backups with file names with current date, for example
> BUFF-DD_MM_YYYY.bkp,
> - automatically delete too old backups
> - move them on a network drive after creating
> (I remember that SQL Server doesn't allow to backup directly to a
network
> drive).
>
>|||Our product, MiniSQLBackup, does all that you require, besides giving you
the option to compress and encrypt your backups. An example of how the
backup command would look like in MiniSQLBackup:
BACKUP DATABASE [BUFF] TO DISK = '<AUTO> WITH NAME = 'BUFF backup',
COPYTO = '<remote folder 1>', COPYTO = '<remote folder 2>'
where <AUTO> represents a naming convention you can set up using date time
elements, and COPYTO are extensions to copy the backup file to other folders
upon completion of the backup. If you're interested, MiniSQLBackup can also
perform mirrored backups i.e. simultaneous backups to two or more disks.
Price is USD99/- per named server, free for the Lite edition.
--
Peter Yeoh
http://www.yohz.com
Need smaller SQL2K backups? Use MiniSQLBackup Lite, free.