Hello everyone,
I'm looking to get a list of publications on a given SQL Server
instance via RMO. I can't seem to find any information on how to do
this. What I need is, given a server name or existing connection, find
out if the machine is a publisher and if so, get a list of its
publications. Currently I am able to query the publication and
articles, but I have to specify the publication/article name in
advance. I need the ability to discover them at runtime.
Any help or nudge in the right direction would be appreciated,
Regards,
Anthony
Hello everyone,
I was able to find something in the Microsoft.SqlServer.Replication
namespace that does exactly what I want; however, it comes with the
following disclaimer from Microsoft : "This class supports the SQL
Server 2005 infrastructure and is not intended to be used directly
from your code." This leads me to believe that there's another way of
enumerating publications on a SQL Server 2005 instance via RMO, but
for now I'll post what I found because... well, it works for me. The
following is sample code to iterate through all the publications on a
given SQL Server (2005?) instance and enumerate through the articles
within, outputing to the richtextbox rtbFilter :
**referencing :
[C:\Program Files\Microsoft SQL Server\90\SDK\Assemblies
\Microsoft.SqlServer.ConnectionInfo.dllusing
Microsoft.SqlServer.Management.Common]
[C:\Program Files\Microsoft SQL Server\90\SDK\Assemblies
\Microsoft.SqlServer.Rmo.dll]
using Microsoft.SqlServer.Replication;
...
ServerConnection conn = new ServerConnection("sql server name", "user
name", "user password");
try
{
conn.Connect();
ReplicationServer rs = new ReplicationServer(conn);
ArrayList al = rs.EnumLightPublications("name of the database being
replicated", 3, true, true); // 1 = trans, 2 = merge, 3 = all. I
*presume* these are correct (tested through quick trial and error,
didn't find the proper enum equivalent)
foreach (LightPublication lp in al)
{
rtbFilter.AppendText("Name:" + lp.Name + "\r\n");
rtbFilter.AppendText("Description:" + lp.Description + "\r\n");
rtbFilter.AppendText("Type:" + lp.Type.ToString() + "\r\n");
rtbFilter.AppendText("PublisherName:" + lp.PublisherName + "\r\n");
rtbFilter.AppendText("PublisherType:" + lp.PublisherType + "\r\n");
rtbFilter.AppendText("PublicationDBName:" + lp.PublicationDBName +
"\r\n");
rtbFilter.AppendText("\r\n");
TransPublication tp = new TransPublication(lp.Name,
lp.PublicationDBName, conn);
foreach (TransArticle ta in tp.EnumArticles())
{
rtbFilter.AppendText("\tName:" + ta.Name + "\r\n");
rtbFilter.AppendText("\tDescription:" + ta.Description + "\r\n");
rtbFilter.AppendText("\tType:" + ta.Type.ToString() + "\r\n");
rtbFilter.AppendText("\tFilterProcOwner:" + ta.FilterProcOwner + "\r
\n");
rtbFilter.AppendText("\tFilterProcName:" + ta.FilterProcName + "\r
\n");
rtbFilter.AppendText("\tFilterClause:" + ta.FilterClause + "\r\n");
}
}
}
catch(Exception ex)
{
Console.Out.WriteLine(ex.Message);
}
finally
{
conn.Disconnect();
}
Hope this helps,
Anthony
Showing posts with label cant. Show all posts
Showing posts with label cant. Show all posts
Thursday, March 29, 2012
Friday, February 24, 2012
enterprise manager can't see databases
Hi everyone,
Happy New Year ! Another year of fun ahead, solving sql server problems. I c
an hardly wait !
We have Sql Server 2000 installed on a server called taggart. On the client
p.c. we have Enterprise Manager and Query Analyser installed.
Using query analyser I can connect to taggart and can see all it's databases
no problem.
Using enterprise manager I can connect to taggart ok but can't see it's data
base. It says 'no items' ! I tried to delete the sql server registration an
d re-created it but it still can't see them. I can connect to other servers
using enterprise manager an
d can see their databases ok, just not this server.
We tried re-booting the server but that had no effect.
Eileen.Can you connect using Query Analyser and run the folllowing query?
select * from master..sysdatabases
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.|||yes i can|||I get an entry for each database in the following
d:\MSSQL\data\msdbdata.mdf
d:\MSSQL\data\northwnd.mdf
d:\MSSQL\data\pubs.mdf
d:\MSSQL\data\tempdb.mdf|||log-files on two of the databases had filled up their log partitions. shrink
ing this allowed us to see the databases.
Happy New Year ! Another year of fun ahead, solving sql server problems. I c
an hardly wait !
We have Sql Server 2000 installed on a server called taggart. On the client
p.c. we have Enterprise Manager and Query Analyser installed.
Using query analyser I can connect to taggart and can see all it's databases
no problem.
Using enterprise manager I can connect to taggart ok but can't see it's data
base. It says 'no items' ! I tried to delete the sql server registration an
d re-created it but it still can't see them. I can connect to other servers
using enterprise manager an
d can see their databases ok, just not this server.
We tried re-booting the server but that had no effect.
Eileen.Can you connect using Query Analyser and run the folllowing query?
select * from master..sysdatabases
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.|||yes i can|||I get an entry for each database in the following
d:\MSSQL\data\msdbdata.mdf
d:\MSSQL\data\northwnd.mdf
d:\MSSQL\data\pubs.mdf
d:\MSSQL\data\tempdb.mdf|||log-files on two of the databases had filled up their log partitions. shrink
ing this allowed us to see the databases.
Enterprise Manager can't get database properties
Hi again!
On my previous question I got no answers or any help,
yet it is for me great problem.
I can't get DB properties from any DB on any
instance of three installed. EM shut itself down instead,
without any warning or error message.
I need to change some data types and collation settings.
Any help (desperately needed) would be appreciated!
Peter
Message posted via http://www.sqlmonster.com
Sounds like you might need to reregister SQL-DMO. From a command prompt run
the following and see if that helps
regsvr32 "C:\Program Files\Microsoft SQL Server\80\Tools\Binn\sqldmo.dll"
HTH
Jasper Smith (SQL Server MVP)
http://www.sqldbatips.com
I support PASS - the definitive, global
community for SQL Server professionals -
http://www.sqlpass.org
"Peter K. via SQLMonster.com" <forum@.SQLMonster.com> wrote in message
news:4ef1c47f4a7f460b9dcc1ddf45893888@.SQLMonster.c om...
> Hi again!
> On my previous question I got no answers or any help,
> yet it is for me great problem.
> I can't get DB properties from any DB on any
> instance of three installed. EM shut itself down instead,
> without any warning or error message.
> I need to change some data types and collation settings.
> Any help (desperately needed) would be appreciated!
> Peter
> --
> Message posted via http://www.sqlmonster.com
|||Hi,
I am sorry for late answer, but i've been busy lately.
Yes, I tried reregister sqldmo.dll and it helped.
But I am curious what couses that mysterious
disappearance of properties.
Thank you very much for your help!
Sincerely,
Peter
Message posted via http://www.sqlmonster.com
|||I'm not sure. I've had this myself on my home PC and can't remember doing
anything that should have affected it. Things like service packs/hotfixes
etc could do it. Generally, (re)registering sqldmo.dll seems to fix it.
HTH
Jasper Smith (SQL Server MVP)
http://www.sqldbatips.com
I support PASS - the definitive, global
community for SQL Server professionals -
http://www.sqlpass.org
"Peter K. via SQLMonster.com" <forum@.SQLMonster.com> wrote in message
news:689d519bd4d849318cf6cc5442345bbb@.SQLMonster.c om...
> Hi,
> I am sorry for late answer, but i've been busy lately.
> Yes, I tried reregister sqldmo.dll and it helped.
> But I am curious what couses that mysterious
> disappearance of properties.
> Thank you very much for your help!
> Sincerely,
> Peter
> --
> Message posted via http://www.sqlmonster.com
On my previous question I got no answers or any help,
yet it is for me great problem.
I can't get DB properties from any DB on any
instance of three installed. EM shut itself down instead,
without any warning or error message.
I need to change some data types and collation settings.
Any help (desperately needed) would be appreciated!
Peter
Message posted via http://www.sqlmonster.com
Sounds like you might need to reregister SQL-DMO. From a command prompt run
the following and see if that helps
regsvr32 "C:\Program Files\Microsoft SQL Server\80\Tools\Binn\sqldmo.dll"
HTH
Jasper Smith (SQL Server MVP)
http://www.sqldbatips.com
I support PASS - the definitive, global
community for SQL Server professionals -
http://www.sqlpass.org
"Peter K. via SQLMonster.com" <forum@.SQLMonster.com> wrote in message
news:4ef1c47f4a7f460b9dcc1ddf45893888@.SQLMonster.c om...
> Hi again!
> On my previous question I got no answers or any help,
> yet it is for me great problem.
> I can't get DB properties from any DB on any
> instance of three installed. EM shut itself down instead,
> without any warning or error message.
> I need to change some data types and collation settings.
> Any help (desperately needed) would be appreciated!
> Peter
> --
> Message posted via http://www.sqlmonster.com
|||Hi,
I am sorry for late answer, but i've been busy lately.
Yes, I tried reregister sqldmo.dll and it helped.
But I am curious what couses that mysterious
disappearance of properties.
Thank you very much for your help!
Sincerely,
Peter
Message posted via http://www.sqlmonster.com
|||I'm not sure. I've had this myself on my home PC and can't remember doing
anything that should have affected it. Things like service packs/hotfixes
etc could do it. Generally, (re)registering sqldmo.dll seems to fix it.
HTH
Jasper Smith (SQL Server MVP)
http://www.sqldbatips.com
I support PASS - the definitive, global
community for SQL Server professionals -
http://www.sqlpass.org
"Peter K. via SQLMonster.com" <forum@.SQLMonster.com> wrote in message
news:689d519bd4d849318cf6cc5442345bbb@.SQLMonster.c om...
> Hi,
> I am sorry for late answer, but i've been busy lately.
> Yes, I tried reregister sqldmo.dll and it helped.
> But I am curious what couses that mysterious
> disappearance of properties.
> Thank you very much for your help!
> Sincerely,
> Peter
> --
> Message posted via http://www.sqlmonster.com
Labels:
againon,
answers,
anyinstance,
cant,
database,
enterprise,
manager,
microsoft,
mysql,
oracle,
previous,
properties,
server,
sql
Subscribe to:
Posts (Atom)