Showing posts with label instance. Show all posts
Showing posts with label instance. Show all posts

Monday, March 26, 2012

Looping through non system database objects using SMO and VB.net

Hi,

We are using SMO to compare objects in our SQL Server database with another instance of sql server. I'm able to loop thourgh the stored procedures with no problem and retreave the names of them however it loops through all of the SPs even the system ones. This makes the loop take a while since it has to cycle through all of the system stored procedures. Is there a way to loop through only the dbo sps? I'm using VB.net

For Each sp In theserver.Databases.Item(DBName).StoredProcedures

x = sp.ToString

If sp.IsSystemObject = False Then

'MsgBox(x)

End If

Next

Thanks

Hi,

see this here:

http://www.sqlteam.com/item.asp?ItemID=23185

The following can be used to test your code against your databases:

For one of my databases with 902 Procedures this was a huge difference.

using System;

using Microsoft.SqlServer.Management.Smo;

using Microsoft.Win32;

namespace SMOProject

{

class Program

{

static void Main(string[] args)

{

EvaluateSMOTime(".", "SQLSErver2005", true);

EvaluateSMOTime(".", "SQLSErver2005", false);

Console.ReadLine();

}

internal static void EvaluateSMOTime(string ServerName, string DatabaseBaseName, bool SetDefaultField)

{

DateTime Before = DateTime.Now;

Server theServer = new Server(ServerName);

if (SetDefaultField)

theServer.SetDefaultInitFields(typeof(StoredProcedure), "IsSystemObject");

Database myDB = theServer.Databases[DatabaseBaseName];

foreach (StoredProcedure sp in myDB.StoredProcedures)

{

if (!sp.IsSystemObject)

{

Console.Write(".");

}

}

DateTime After = DateTime.Now;

TimeSpan Diff = After.Subtract(Before);

Console.WriteLine(string.Format("With{1} tweaking the DefaultInitFields : {2} ms", Diff.Milliseconds, SetDefaultField ? string.Empty : "on"));

}

}

}

HTH, Jens K. Suessmeyer.

http://www.sqlserver20005.de

Friday, March 23, 2012

Loopback Adapter Hides Instance Names

I have laptops that require the loopback adapter when they are not
connected. However when they connect back to the network the networked
servers display just the computer name not the / instancename. Any
ideas? It only happens on network instances. The local instances are
correct. This happens in Enterprise Manager, Access connection tool
and using SQL-DMO.
Gary Shane LimIn message <ogfj31dfgdq76mvs61hj3aofv0k6vpg1j0@.4ax.com>, Shane Lim
<gslim@.blizzardice.com> writes
>I have laptops that require the loopback adapter when they are not
>connected. However when they connect back to the network the networked
>servers display just the computer name not the / instancename. Any
>ideas? It only happens on network instances. The local instances are
>correct. This happens in Enterprise Manager, Access connection tool
>and using SQL-DMO.
>Gary Shane Lim
Have you tried Bridging the Loopback Adapter to your main Lan Adapter.
This way your network settings remain the same whether on the network or
not.
--
Andrew D. Newbould E-Mail: newsgroups@.NOSPAMzadsoft.com
ZAD Software Systems Web : www.zadsoft.com

Loopback Adapter Hides Instance Names

I have laptops that require the loopback adapter when they are not
connected. However when they connect back to the network the networked
servers display just the computer name not the / instancename. Any
ideas? It only happens on network instances. The local instances are
correct. This happens in Enterprise Manager, Access connection tool
and using SQL-DMO.
Gary Shane Lim
In message <ogfj31dfgdq76mvs61hj3aofv0k6vpg1j0@.4ax.com>, Shane Lim
<gslim@.blizzardice.com> writes
>I have laptops that require the loopback adapter when they are not
>connected. However when they connect back to the network the networked
>servers display just the computer name not the / instancename. Any
>ideas? It only happens on network instances. The local instances are
>correct. This happens in Enterprise Manager, Access connection tool
>and using SQL-DMO.
>Gary Shane Lim
Have you tried Bridging the Loopback Adapter to your main Lan Adapter.
This way your network settings remain the same whether on the network or
not.
Andrew D. Newbould E-Mail: newsgroups@.NOSPAMzadsoft.com
ZAD Software Systems Web : www.zadsoft.com
sql

Loopback Adapter Hides Instance Names

I have laptops that require the loopback adapter when they are not
connected. However when they connect back to the network the networked
servers display just the computer name not the / instancename. Any
ideas? It only happens on network instances. The local instances are
correct. This happens in Enterprise Manager, Access connection tool
and using SQL-DMO.
Gary Shane LimIn message <ogfj31dfgdq76mvs61hj3aofv0k6vpg1j0@.4ax.com>, Shane Lim
<gslim@.blizzardice.com> writes
>I have laptops that require the loopback adapter when they are not
>connected. However when they connect back to the network the networked
>servers display just the computer name not the / instancename. Any
>ideas? It only happens on network instances. The local instances are
>correct. This happens in Enterprise Manager, Access connection tool
>and using SQL-DMO.
>Gary Shane Lim
Have you tried Bridging the Loopback Adapter to your main Lan Adapter.
This way your network settings remain the same whether on the network or
not.
Andrew D. Newbould E-Mail: newsgroups@.NOSPAMzadsoft.com
ZAD Software Systems Web : www.zadsoft.com

Loop Through SQL Server Instance ?

Hi,
Is it possible to loop through dynamically through all sql instances in a particular environment ?
Thanking you in advance.
Regards,
RanjitHi,

Is it possible to loop through dynamically through all sql instances in a particular environment ?

So you dynamically finding all SQL Servers and the connecting through (insert ADO or DMO here)? Or do you mean looping through a list of servers provided by another source.

The former can be a bit tricky; lots of ways to "hide" a SQL Instance (google SQL Recon). The latter should be relatively trivial.

Regards,

hmscott|||Hi hmscott .. Yup ..I wanted the former ..
Thanks so much for the sql recon .. It did rack up my grey cells to dig further .. It seems they will be coming out with a command line version in the near future ..

Just wondering about "lots of ways to "hide" a SQL Instance" .. the one I can think of being a newbie is change the default port of sql server ..any other ? ..

Thanks,
Ranjit.

Monday, March 19, 2012

Lookup Transformation: How can I join tables in different databases

I want to join tables that reside in different databases (same instance). The Lookup object only lets me select from one data source. Is there anyway to lookup using more than one data source? I can write a SQL query to lookup across databases.

Is this a feature that is being added to future releases?

I appreciate your help

-Marcus
Are these SQL Server databases? If so you can create a view in one database that selects data from another - thus making it appear as though the data is all in the same DB.

Voila!

-Jamie|||lol... didn't think of that one...

Thanks :)|||Still onthe lookup subject, I have noticed that if I write a simpley query in the box "User results of an SQL query" say select * from DB1.dbo.tablea, DB2.dbo.tableb, I can then click the "Build Query" button and hey presto both tables are then available for me to work with even thought they are from different databases. I do notice that the top left corner of the table boxes have an arrow.

However if I go straight to "Build Query", add my first table by right clicking and selecting "add table" there is no arrow in the top left corner of the table box. I can then modify the sql statment manually to include the table from the other database. This table then appears in the top window with an arrow in the top left corner of it's box.

Is this a bug? should there actually be an optin to add a table from an alternative database and it's missing? As detailed above I can manually add the tables and the tool recognisines them.

Has anyone else seen this? Has this been fixed in later builds? I'm using Junes.

Thanks|||

What you have observed is not a bug.

We do supply an option to add tables. But we only list tables in the current database context. Tables in other databases have to be added manually. This is the behavior in June CTP and are not changed since then.

|||

Do you know if this will be changed in future CTP's?

Thanks

|||

I do not think so.

But please feel free to open a DCR via BetaPlace.

|||What about MS Access using DAO? In DAO you use something like this.

CDaoRecordset rset(&db);
rset.Open(dbOpenSnapshot, SQLquery, dbReadOnly);

This does not allow for binding to more than one database at the time. Therefore, how can you do a join query between two tables residing in different databases?

Thank you.

Wednesday, March 7, 2012

Looking for technical books

Hello everybody. I'm looking for book(s) that have very technical
information about MS SQL Server. For instance a book that has
information about that sysfiles queried in system stored procedures
always queries master. I can't find any books that have these kind of
details. Can anyone help?
DeboraIf you want information on internals then the book you need is:
http://www.insidesqlserver.com/book2000.html
David Portas
SQL Server MVP
--|||Hi
Another internals books that you should also check out in addition to
Kalen's is
"The Guru's guide to SQL Server Architecture and Internals" by Ken Henderson
ISBN 0-201-7004706 (you may want to get the whole boxed set!)
You may want to consider the articles that Kalen, Itzik and others do in SQL
Server Magazine
http://www.windowsitpro.com/SQLServer/
John
"Donck" <ddonck@.hotmail.com> wrote in message
news:1126163586.752794.246890@.g43g2000cwa.googlegroups.com...
> Hello everybody. I'm looking for book(s) that have very technical
> information about MS SQL Server. For instance a book that has
> information about that sysfiles queried in system stored procedures
> always queries master. I can't find any books that have these kind of
> details. Can anyone help?
> Debora
>

Looking for suggestions Cluster or Mirror

Hello,

We currently have one instance of SQL2k5 SP1. We have a couple of publications, and 30 subscribers, on the instance and are considering going to either a cluster environment or db mirroring. Currently our instance seems to be busy and I am wondering if clustering really gives it a performance boost. What are your thoughts/suggestions on going to a cluster environment versus just db mirroring? Can mirroring be used for real-time failover as we need to add that as well? Thanks in advance.

John

Fail-over clustering and database mirroring are both high availability solutions that don't have any direct effect on performance. Fail-over clustering relies on shared external storage between the nodes (which is a potential single point of failure), and requires higher-end hardware in most cases. It works at the instance level. Failing over a node in the cluster typically takes 1-2 minutes on a large, active database instance.

Database mirroring works at the database level(not the instance level). There are two copies of the data (one on the Principle and one on the Mirror), so you need twice the storage space. Only the Principal database is available to service clients. If you want automatic fail-over with DB Mirroring, you need a Witness Server. You have to be running in Synchronous mode with Saftey turned on to get automatic fail-over with DB Mirroring. Database fail-over with mirroring is more like 10-15 seconds.

If you are doing Replication, it will might be easier to do fail-over clustering.

|||

here are some resources that may be helpful in your decision-making:

Failover Clustering white paper:

http://www.microsoft.com/downloads/details.aspx?FamilyID=818234dc-a17b-4f09-b282-c6830fead499&DisplayLang=en

Database Mirroring:

http://www.microsoft.com/technet/prodtechnol/sql/2005/dbmirror.mspx

http://www.microsoft.com/technet/prodtechnol/sql/2005/dbmirfaq.mspx

http://www.microsoft.com/technet/prodtechnol/sql/2005/technologies/dbm_best_pract.mspx

SQL Server 2005 High Availability Resources:

http://www.microsoft.com/technet/prodtechnol/sql/themes/high-availability.mspx

Looking for suggestions Cluster or Mirror

Hello,

We currently have one instance of SQL2k5 SP1. We have a couple of publications, and 30 subscribers, on the instance and are considering going to either a cluster environment or db mirroring. Currently our instance seems to be busy and I am wondering if clustering really gives it a performance boost. What are your thoughts/suggestions on going to a cluster environment versus just db mirroring? Can mirroring be used for real-time failover as we need to add that as well? Thanks in advance.

John

Fail-over clustering and database mirroring are both high availability solutions that don't have any direct effect on performance. Fail-over clustering relies on shared external storage between the nodes (which is a potential single point of failure), and requires higher-end hardware in most cases. It works at the instance level. Failing over a node in the cluster typically takes 1-2 minutes on a large, active database instance.

Database mirroring works at the database level(not the instance level). There are two copies of the data (one on the Principle and one on the Mirror), so you need twice the storage space. Only the Principal database is available to service clients. If you want automatic fail-over with DB Mirroring, you need a Witness Server. You have to be running in Synchronous mode with Saftey turned on to get automatic fail-over with DB Mirroring. Database fail-over with mirroring is more like 10-15 seconds.

If you are doing Replication, it will might be easier to do fail-over clustering.

|||

here are some resources that may be helpful in your decision-making:

Failover Clustering white paper:

http://www.microsoft.com/downloads/details.aspx?FamilyID=818234dc-a17b-4f09-b282-c6830fead499&DisplayLang=en

Database Mirroring:

http://www.microsoft.com/technet/prodtechnol/sql/2005/dbmirror.mspx

http://www.microsoft.com/technet/prodtechnol/sql/2005/dbmirfaq.mspx

http://www.microsoft.com/technet/prodtechnol/sql/2005/technologies/dbm_best_pract.mspx

SQL Server 2005 High Availability Resources:

http://www.microsoft.com/technet/prodtechnol/sql/themes/high-availability.mspx