Showing posts with label servers. Show all posts
Showing posts with label servers. Show all posts

Monday, March 26, 2012

Fetching of data

hi,

I would like to know that, I have three instances of the same database at three different servers and I am trying to fetch the data from the select query. "select * from table_name"

I would like to know, whether the order of rows fetched by this query will be different on different servers of sql server or the same order of rows will be fetched.

For me the output is coming different on each server database with he same query . Pls let me know, is there any default order by or it takes it randomly.

Thanks

Gaurav Gupta

By spec, the order of rows are undetermined unless you specify an order by clause. Even multiple identical queries to the same server can return rows in different orders. It may or may not occur, but the order is not guaranteed unless you ask for the data that way.

Fetch data from Multiple SQL Servers

Hi,
I have 10+ SQL Servers, from my head office server i want
to connect to all branch server and execute a sql
statement and results to be inserted into a table of Head
Office Server.
RegardsYou can use a linked server... ( See linked Servers in Books on line.) Set
up a linked server then use the 4 part name
insert into mytable select * from server1.pubs.dbo.titles
etc
Or you could use replication to move the data on a regular basis...
--
Wayne Snyder, MCDBA, SQL Server MVP
Computer Education Services Corporation (CESC), Charlotte, NC
www.computeredservices.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Asmath" <anonymous@.discussions.microsoft.com> wrote in message
news:1071d01c3f3c4$e43bcdd0$a001280a@.phx.gbl...
> Hi,
> I have 10+ SQL Servers, from my head office server i want
> to connect to all branch server and execute a sql
> statement and results to be inserted into a table of Head
> Office Server.
>
> Regards|||Hi,
In my head office server, i found the list of all branch
server in Security->Remote Servers.
I found no entries in Security->LinkedServers, when i try
to add linked server, error appears already exists?
And how to use authentication process?
>--Original Message--
>You can use a linked server... ( See linked Servers in
Books on line.) Set
>up a linked server then use the 4 part name
>insert into mytable select * from server1.pubs.dbo.titles
>etc
>Or you could use replication to move the data on a
regular basis...
>--
>Wayne Snyder, MCDBA, SQL Server MVP
>Computer Education Services Corporation (CESC),
Charlotte, NC
>www.computeredservices.com
>(Please respond only to the newsgroups.)
>I support the Professional Association of SQL Server
(PASS) and it's
>community of SQL Server professionals.
>www.sqlpass.org
>
>"Asmath" <anonymous@.discussions.microsoft.com> wrote in
message
>news:1071d01c3f3c4$e43bcdd0$a001280a@.phx.gbl...
>> Hi,
>> I have 10+ SQL Servers, from my head office server i
want
>> to connect to all branch server and execute a sql
>> statement and results to be inserted into a table of
Head
>> Office Server.
>>
>> Regards
>
>.
>

Fetch data from Multiple SQL Servers

Hi,
I have 10+ SQL Servers, from my head office server i want
to connect to all branch server and execute a sql
statement and results to be inserted into a table of Head
Office Server.
RegardsYou can use a linked server... ( See linked Servers in Books on line.) Set
up a linked server then use the 4 part name
insert into mytable select * from server1.pubs.dbo.titles
etc
Or you could use replication to move the data on a regular basis...
Wayne Snyder, MCDBA, SQL Server MVP
Computer Education Services Corporation (CESC), Charlotte, NC
www.computeredservices.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Asmath" <anonymous@.discussions.microsoft.com> wrote in message
news:1071d01c3f3c4$e43bcdd0$a001280a@.phx
.gbl...
> Hi,
> I have 10+ SQL Servers, from my head office server i want
> to connect to all branch server and execute a sql
> statement and results to be inserted into a table of Head
> Office Server.
>
> Regards|||Hi,
In my head office server, i found the list of all branch
server in Security->Remote Servers.
I found no entries in Security->LinkedServers, when i try
to add linked server, error appears already exists?
And how to use authentication process?

>--Original Message--
>You can use a linked server... ( See linked Servers in
Books on line.) Set
>up a linked server then use the 4 part name
>insert into mytable select * from server1.pubs.dbo.titles
>etc
>Or you could use replication to move the data on a
regular basis...
>--
>Wayne Snyder, MCDBA, SQL Server MVP
>Computer Education Services Corporation (CESC),
Charlotte, NC
>www.computeredservices.com
>(Please respond only to the newsgroups.)
>I support the Professional Association of SQL Server
(PASS) and it's
>community of SQL Server professionals.
>www.sqlpass.org
>
>"Asmath" <anonymous@.discussions.microsoft.com> wrote in
message
> news:1071d01c3f3c4$e43bcdd0$a001280a@.phx
.gbl...
want
Head
>
>.
>

Monday, March 12, 2012

Fastest way to copy tables and their indexes between servers?

The DTS Task Copy Server Objects is PAINFULLY slow.

The Copy Table Wizard is fast but generates an unmanagable DTS and does not bring over the indexes.

Any tips or tricks to copy tables, data and indexes and a reasonable speed?

Thanks,

Carl

Without fully understanding the specifics but going by what you've done so far, one other option would be to script the database objects to file, run the generated scripts on the second server then use the BCP utility BCP.EXE (bulk copy program) to copy the data over.

See http://msdn2.microsoft.com/en-us/library/aa337544.aspx for more information on how to use the BCP utility.

Regards,

Uwa.

Friday, March 9, 2012

Fastest method to move data between two remote SQL servers?

Need to move approximately 2-5 GB of data between two servers located
in different states but on same WAN. What is the fastest method with
least intrusion on daily updates to file? (SQL Server 2000)
1. "Copy Server Object" task in DTS (any special options to enable?)
2. Use ODBC/Transformation within DTS.
3. Replication?
4. DROP / Select into via linked server?
5. Other options?P.S. I'm testing this out, but it appears step 1 and 2 are taking 6-8
hours each, so any advance help would be appreciated...|||2 options for a one-off
1 - backup and copy/restore on target server
2 - detach/copy/attach again on both servers.
But if you want to do this regularly then maybe 1 with jobs running scripts.
Nik Marshall-Blank MCSD/MCDBA
Linz, Austria
"Mnemonic" <sunlinmj@.hotmail.com> wrote in message
news:1129059378.818147.103050@.f14g2000cwb.googlegroups.com...
> Need to move approximately 2-5 GB of data between two servers located
> in different states but on same WAN. What is the fastest method with
> least intrusion on daily updates to file? (SQL Server 2000)
>
> 1. "Copy Server Object" task in DTS (any special options to enable?)
> 2. Use ODBC/Transformation within DTS.
> 3. Replication?
> 4. DROP / Select into via linked server?
> 5. Other options?
>|||I'm assuming the SQL Servers are reasonably fast, the bottle neck is the WAN
pipe, and the only scheduler available is SQL Agent.
Create a linked server from the source to the destination
On the source server have a job that does the following steps
Write a DTS package to export the data to a file
xp_cmdshell or operating system command within a job step: use gzip or
some other compression software to do reasonable compression. Gzip has
different compression levels.
xp_cmdshell or operating system command within a job step: copy the file
to the destination server (FTP is a little faster but less managable)
Use the linked server to start a job on the destination server or just
call a stored procedure
On the destination server, the job or stored procedure should
xp_cmdshell or operating system command within a job step: decompress the
file
bcp, bulk insert, or DTS (bulk loader) into SQL Server.
"Mnemonic" <sunlinmj@.hotmail.com> wrote in message
news:1129059378.818147.103050@.f14g2000cwb.googlegroups.com...
> Need to move approximately 2-5 GB of data between two servers located
> in different states but on same WAN. What is the fastest method with
> least intrusion on daily updates to file? (SQL Server 2000)
>
> 1. "Copy Server Object" task in DTS (any special options to enable?)
> 2. Use ODBC/Transformation within DTS.
> 3. Replication?
> 4. DROP / Select into via linked server?
> 5. Other options?
>|||Interesting! It'll take a bit to test and coordinate schedule times,
but I'll give it a shot. I believe you are correct on all your
assumptions too, althought I also suspect a little Disk IO competition.
Thanks!
FYI. Yesterday Option 1 took 15 hours, and option 2 took 8 hours.
Option 1 did run during the day, when Option 2 had nighttime/early
morning.|||This is the time I usually get on my soap box about an enterprise batch
scheduler and preach to management.
If you have your source server start a job on the destination server after
the copy then you shouldn't have to worry about schedule times between the
servers.
Good luck.
"Mnemonic" <sunlinmj@.hotmail.com> wrote in message
news:1129132709.159007.124640@.g49g2000cwa.googlegroups.com...
> Interesting! It'll take a bit to test and coordinate schedule times,
> but I'll give it a shot. I believe you are correct on all your
> assumptions too, althought I also suspect a little Disk IO competition.
>
> Thanks!
>
> FYI. Yesterday Option 1 took 15 hours, and option 2 took 8 hours.
> Option 1 did run during the day, when Option 2 had nighttime/early
> morning.
>

Fastest method to move data between two remote SQL servers?

Need to move approximately 2-5 GB of data between two servers located
in different states but on same WAN. What is the fastest method with
least intrusion on daily updates to file? (SQL Server 2000)
1. "Copy Server Object" task in DTS (any special options to enable?)
2. Use ODBC/Transformation within DTS.
3. Replication?
4. DROP / Select into via linked server?
5. Other options?
P.S. I'm testing this out, but it appears step 1 and 2 are taking 6-8
hours each, so any advance help would be appreciated...
|||2 options for a one-off
1 - backup and copy/restore on target server
2 - detach/copy/attach again on both servers.
But if you want to do this regularly then maybe 1 with jobs running scripts.
Nik Marshall-Blank MCSD/MCDBA
Linz, Austria
"Mnemonic" <sunlinmj@.hotmail.com> wrote in message
news:1129059378.818147.103050@.f14g2000cwb.googlegr oups.com...
> Need to move approximately 2-5 GB of data between two servers located
> in different states but on same WAN. What is the fastest method with
> least intrusion on daily updates to file? (SQL Server 2000)
>
> 1. "Copy Server Object" task in DTS (any special options to enable?)
> 2. Use ODBC/Transformation within DTS.
> 3. Replication?
> 4. DROP / Select into via linked server?
> 5. Other options?
>
|||I'm assuming the SQL Servers are reasonably fast, the bottle neck is the WAN
pipe, and the only scheduler available is SQL Agent.
Create a linked server from the source to the destination
On the source server have a job that does the following steps
Write a DTS package to export the data to a file
xp_cmdshell or operating system command within a job step: use gzip or
some other compression software to do reasonable compression. Gzip has
different compression levels.
xp_cmdshell or operating system command within a job step: copy the file
to the destination server (FTP is a little faster but less managable)
Use the linked server to start a job on the destination server or just
call a stored procedure
On the destination server, the job or stored procedure should
xp_cmdshell or operating system command within a job step: decompress the
file
bcp, bulk insert, or DTS (bulk loader) into SQL Server.
"Mnemonic" <sunlinmj@.hotmail.com> wrote in message
news:1129059378.818147.103050@.f14g2000cwb.googlegr oups.com...
> Need to move approximately 2-5 GB of data between two servers located
> in different states but on same WAN. What is the fastest method with
> least intrusion on daily updates to file? (SQL Server 2000)
>
> 1. "Copy Server Object" task in DTS (any special options to enable?)
> 2. Use ODBC/Transformation within DTS.
> 3. Replication?
> 4. DROP / Select into via linked server?
> 5. Other options?
>
|||Interesting! It'll take a bit to test and coordinate schedule times,
but I'll give it a shot. I believe you are correct on all your
assumptions too, althought I also suspect a little Disk IO competition.
Thanks!
FYI. Yesterday Option 1 took 15 hours, and option 2 took 8 hours.
Option 1 did run during the day, when Option 2 had nighttime/early
morning.
|||This is the time I usually get on my soap box about an enterprise batch
scheduler and preach to management.
If you have your source server start a job on the destination server after
the copy then you shouldn't have to worry about schedule times between the
servers.
Good luck.
"Mnemonic" <sunlinmj@.hotmail.com> wrote in message
news:1129132709.159007.124640@.g49g2000cwa.googlegr oups.com...
> Interesting! It'll take a bit to test and coordinate schedule times,
> but I'll give it a shot. I believe you are correct on all your
> assumptions too, althought I also suspect a little Disk IO competition.
>
> Thanks!
>
> FYI. Yesterday Option 1 took 15 hours, and option 2 took 8 hours.
> Option 1 did run during the day, when Option 2 had nighttime/early
> morning.
>

Fastest method to move data between two remote SQL servers?

Need to move approximately 2-5 GB of data between two servers located
in different states but on same WAN. What is the fastest method with
least intrusion on daily updates to file? (SQL Server 2000)
1. "Copy Server Object" task in DTS (any special options to enable?)
2. Use ODBC/Transformation within DTS.
3. Replication?
4. DROP / Select into via linked server?
5. Other options?P.S. I'm testing this out, but it appears step 1 and 2 are taking 6-8
hours each, so any advance help would be appreciated...|||2 options for a one-off
1 - backup and copy/restore on target server
2 - detach/copy/attach again on both servers.
But if you want to do this regularly then maybe 1 with jobs running scripts.
--
Nik Marshall-Blank MCSD/MCDBA
Linz, Austria
"Mnemonic" <sunlinmj@.hotmail.com> wrote in message
news:1129059378.818147.103050@.f14g2000cwb.googlegroups.com...
> Need to move approximately 2-5 GB of data between two servers located
> in different states but on same WAN. What is the fastest method with
> least intrusion on daily updates to file? (SQL Server 2000)
>
> 1. "Copy Server Object" task in DTS (any special options to enable?)
> 2. Use ODBC/Transformation within DTS.
> 3. Replication?
> 4. DROP / Select into via linked server?
> 5. Other options?
>|||I'm assuming the SQL Servers are reasonably fast, the bottle neck is the WAN
pipe, and the only scheduler available is SQL Agent.
Create a linked server from the source to the destination
On the source server have a job that does the following steps
Write a DTS package to export the data to a file
xp_cmdshell or operating system command within a job step: use gzip or
some other compression software to do reasonable compression. Gzip has
different compression levels.
xp_cmdshell or operating system command within a job step: copy the file
to the destination server (FTP is a little faster but less managable)
Use the linked server to start a job on the destination server or just
call a stored procedure
On the destination server, the job or stored procedure should
xp_cmdshell or operating system command within a job step: decompress the
file
bcp, bulk insert, or DTS (bulk loader) into SQL Server.
"Mnemonic" <sunlinmj@.hotmail.com> wrote in message
news:1129059378.818147.103050@.f14g2000cwb.googlegroups.com...
> Need to move approximately 2-5 GB of data between two servers located
> in different states but on same WAN. What is the fastest method with
> least intrusion on daily updates to file? (SQL Server 2000)
>
> 1. "Copy Server Object" task in DTS (any special options to enable?)
> 2. Use ODBC/Transformation within DTS.
> 3. Replication?
> 4. DROP / Select into via linked server?
> 5. Other options?
>|||Interesting! It'll take a bit to test and coordinate schedule times,
but I'll give it a shot. I believe you are correct on all your
assumptions too, althought I also suspect a little Disk IO competition.
Thanks!
FYI. Yesterday Option 1 took 15 hours, and option 2 took 8 hours.
Option 1 did run during the day, when Option 2 had nighttime/early
morning.|||This is the time I usually get on my soap box about an enterprise batch
scheduler and preach to management.
If you have your source server start a job on the destination server after
the copy then you shouldn't have to worry about schedule times between the
servers.
Good luck.
"Mnemonic" <sunlinmj@.hotmail.com> wrote in message
news:1129132709.159007.124640@.g49g2000cwa.googlegroups.com...
> Interesting! It'll take a bit to test and coordinate schedule times,
> but I'll give it a shot. I believe you are correct on all your
> assumptions too, althought I also suspect a little Disk IO competition.
>
> Thanks!
>
> FYI. Yesterday Option 1 took 15 hours, and option 2 took 8 hours.
> Option 1 did run during the day, when Option 2 had nighttime/early
> morning.
>

Wednesday, March 7, 2012

faster box but slower database

Hi,
Got two SQL servers (production,dev) and I noticed recently that my
production servers is much slower when running one import stored
procedure. The stored proc only uses tables variables a lot and only
performs selects on actual tables. The specs are:
Productions server:
SQL 2000 v. 8002039 (SP4)
2x Dual Core Intel Xeon 3,2GH
1GB Memory
RAID 1
Windows 2003 Server
Development server:
SQL 2000 v. 800194 (no service pack)
1x Dual Core Intel Pentium 4 3GHz
Windows XP Professional
The stored procedures takes 20 sec running on the dev box but 2.4 min
on the production box.
All indexes and tables are the same in both databases. I tried
updating the stats, rebuild indexes, recompile the stored proc, free
the proc cache but without any luck.
Any help would be very much appricated.
KristjanOne thing I forgot to mention. The execution tree found in the
profiler differ for the same query in diffrent databases.|||You didn't mention how much ram is on the dev box.
Also how many rows and what is the DB size? 1GB of ram on a production SQL
box with that kind of CPU seems way low to me.
Mike
"kgb" <kristjan.gudni.bjarnason@.gmail.com> wrote in message
news:1138125661.913476.224860@.g14g2000cwa.googlegroups.com...
> Hi,
> Got two SQL servers (production,dev) and I noticed recently that my
> production servers is much slower when running one import stored
> procedure. The stored proc only uses tables variables a lot and only
> performs selects on actual tables. The specs are:
> Productions server:
> SQL 2000 v. 8002039 (SP4)
> 2x Dual Core Intel Xeon 3,2GH
> 1GB Memory
> RAID 1
> Windows 2003 Server
> Development server:
> SQL 2000 v. 800194 (no service pack)
> 1x Dual Core Intel Pentium 4 3GHz
> Windows XP Professional
> The stored procedures takes 20 sec running on the dev box but 2.4 min
> on the production box.
> All indexes and tables are the same in both databases. I tried
> updating the stats, rebuild indexes, recompile the stored proc, free
> the proc cache but without any luck.
> Any help would be very much appricated.
> Kristjan
>|||The dev box also got 1 GB ram. The databases are almost the same size
because the app is not writing very much on runtime.
The stored proc spends most time on single table containing about
600,000 rows (both dev and production server). By the way, the
profiler tells me the production servers is doing ~10 times more reads
and spending ~10 more CPU than the dev server.
The total databsize is about 0,5 GB but maybe 1/4 of it is accessed
realtime.|||What different you found in Execution plan?
Try to run query on Prod. using option (maxdop 1).
If you have joins check that fields on both sides of the join have same
datatypes.
Regards
Amish Shah|||Tried the maxdop 1 option, no big difference.
The datatypes were ok.
Installed the database on my laptop to reproduce this. With no service
pack the stored proc ran fine (30 secs). With SP4 it ran for minutes.
Seems like updated server optimizer is not doing a good job with my
stored proc. Collecting some more data which I will post to this
thread soon.|||There have been a number of changes from GOLD and SP1 to SP4. A number of
these fixes result in different query plans being generated. It is not a far
comparison of performance between GOLD and SP4. Your GOLD version is also a
lot less secure in that it does not protect against SLAMMER.
Chris
"kgb" <kristjan.gudni.bjarnason@.gmail.com> wrote in message
news:1138274581.095820.120850@.o13g2000cwo.googlegroups.com...
> Tried the maxdop 1 option, no big difference.
> The datatypes were ok.
> Installed the database on my laptop to reproduce this. With no service
> pack the stored proc ran fine (30 secs). With SP4 it ran for minutes.
> Seems like updated server optimizer is not doing a good job with my
> stored proc. Collecting some more data which I will post to this
> thread soon.
>|||This may sound silly, but have you opened the sproc on the SP4 box and
recompiled it on SP4. I have seen a few odd things from time to time when
sprocs were compiled on a lower SPack DB then restored to a differnt SPack
server. Views too.
At least you would give the SP4 query optimizer a chance to take a look at
the sproc to build a new plan to store with the sproc.
Mike
"Chris Wood" <anonymous@.discussions.microsoft.com> wrote in message
news:uu3f3HpIGHA.532@.TK2MSFTNGP15.phx.gbl...
> There have been a number of changes from GOLD and SP1 to SP4. A number of
> these fixes result in different query plans being generated. It is not a
> far comparison of performance between GOLD and SP4. Your GOLD version is
> also a lot less secure in that it does not protect against SLAMMER.
> Chris
> "kgb" <kristjan.gudni.bjarnason@.gmail.com> wrote in message
> news:1138274581.095820.120850@.o13g2000cwo.googlegroups.com...
>|||can you post the DDL and query you are running?|||Currently changing the query to "fit" the SP4 optimizer and think I
almost there, meaning the duration of the query is dropping to what I
expected. The changes sofar involved rewriting of several joins. I
get back to the thread in few hours or less - hopfully with result of
success. Thanks for all your replies. Its amazing to find the support
available on this group.

faster box but slower database

Hi,
Got two SQL servers (production,dev) and I noticed recently that my
production servers is much slower when running one import stored
procedure. The stored proc only uses tables variables a lot and only
performs selects on actual tables. The specs are:
Productions server:
SQL 2000 v. 8002039 (SP4)
2x Dual Core Intel Xeon 3,2GH
1GB Memory
RAID 1
Windows 2003 Server
Development server:
SQL 2000 v. 800194 (no service pack)
1x Dual Core Intel Pentium 4 3GHz
Windows XP Professional
The stored procedures takes 20 sec running on the dev box but 2.4 min
on the production box.
All indexes and tables are the same in both databases. I tried
updating the stats, rebuild indexes, recompile the stored proc, free
the proc cache but without any luck.
Any help would be very much appricated.
Kristjan
One thing I forgot to mention. The execution tree found in the
profiler differ for the same query in diffrent databases.
|||You didn't mention how much ram is on the dev box.
Also how many rows and what is the DB size? 1GB of ram on a production SQL
box with that kind of CPU seems way low to me.
Mike
"kgb" <kristjan.gudni.bjarnason@.gmail.com> wrote in message
news:1138125661.913476.224860@.g14g2000cwa.googlegr oups.com...
> Hi,
> Got two SQL servers (production,dev) and I noticed recently that my
> production servers is much slower when running one import stored
> procedure. The stored proc only uses tables variables a lot and only
> performs selects on actual tables. The specs are:
> Productions server:
> SQL 2000 v. 8002039 (SP4)
> 2x Dual Core Intel Xeon 3,2GH
> 1GB Memory
> RAID 1
> Windows 2003 Server
> Development server:
> SQL 2000 v. 800194 (no service pack)
> 1x Dual Core Intel Pentium 4 3GHz
> Windows XP Professional
> The stored procedures takes 20 sec running on the dev box but 2.4 min
> on the production box.
> All indexes and tables are the same in both databases. I tried
> updating the stats, rebuild indexes, recompile the stored proc, free
> the proc cache but without any luck.
> Any help would be very much appricated.
> Kristjan
>
|||The dev box also got 1 GB ram. The databases are almost the same size
because the app is not writing very much on runtime.
The stored proc spends most time on single table containing about
600,000 rows (both dev and production server). By the way, the
profiler tells me the production servers is doing ~10 times more reads
and spending ~10 more CPU than the dev server.
The total databsize is about 0,5 GB but maybe 1/4 of it is accessed
realtime.
|||What different you found in Execution plan?
Try to run query on Prod. using option (maxdop 1).
If you have joins check that fields on both sides of the join have same
datatypes.
Regards
Amish Shah
|||Tried the maxdop 1 option, no big difference.
The datatypes were ok.
Installed the database on my laptop to reproduce this. With no service
pack the stored proc ran fine (30 secs). With SP4 it ran for minutes.
Seems like updated server optimizer is not doing a good job with my
stored proc. Collecting some more data which I will post to this
thread soon.
|||There have been a number of changes from GOLD and SP1 to SP4. A number of
these fixes result in different query plans being generated. It is not a far
comparison of performance between GOLD and SP4. Your GOLD version is also a
lot less secure in that it does not protect against SLAMMER.
Chris
"kgb" <kristjan.gudni.bjarnason@.gmail.com> wrote in message
news:1138274581.095820.120850@.o13g2000cwo.googlegr oups.com...
> Tried the maxdop 1 option, no big difference.
> The datatypes were ok.
> Installed the database on my laptop to reproduce this. With no service
> pack the stored proc ran fine (30 secs). With SP4 it ran for minutes.
> Seems like updated server optimizer is not doing a good job with my
> stored proc. Collecting some more data which I will post to this
> thread soon.
>
|||This may sound silly, but have you opened the sproc on the SP4 box and
recompiled it on SP4. I have seen a few odd things from time to time when
sprocs were compiled on a lower SPack DB then restored to a differnt SPack
server. Views too.
At least you would give the SP4 query optimizer a chance to take a look at
the sproc to build a new plan to store with the sproc.
Mike
"Chris Wood" <anonymous@.discussions.microsoft.com> wrote in message
news:uu3f3HpIGHA.532@.TK2MSFTNGP15.phx.gbl...
> There have been a number of changes from GOLD and SP1 to SP4. A number of
> these fixes result in different query plans being generated. It is not a
> far comparison of performance between GOLD and SP4. Your GOLD version is
> also a lot less secure in that it does not protect against SLAMMER.
> Chris
> "kgb" <kristjan.gudni.bjarnason@.gmail.com> wrote in message
> news:1138274581.095820.120850@.o13g2000cwo.googlegr oups.com...
>
|||can you post the DDL and query you are running?
|||Currently changing the query to "fit" the SP4 optimizer and think I
almost there, meaning the duration of the query is dropping to what I
expected. The changes sofar involved rewriting of several joins. I
get back to the thread in few hours or less - hopfully with result of
success. Thanks for all your replies. Its amazing to find the support
available on this group.

faster box but slower database

Hi,
Got two SQL servers (production,dev) and I noticed recently that my
production servers is much slower when running one import stored
procedure. The stored proc only uses tables variables a lot and only
performs selects on actual tables. The specs are:
Productions server:
SQL 2000 v. 8002039 (SP4)
2x Dual Core Intel Xeon 3,2GH
1GB Memory
RAID 1
Windows 2003 Server
Development server:
SQL 2000 v. 800194 (no service pack)
1x Dual Core Intel Pentium 4 3GHz
Windows XP Professional
The stored procedures takes 20 sec running on the dev box but 2.4 min
on the production box.
All indexes and tables are the same in both databases. I tried
updating the stats, rebuild indexes, recompile the stored proc, free
the proc cache but without any luck.
Any help would be very much appricated.
KristjanOne thing I forgot to mention. The execution tree found in the
profiler differ for the same query in diffrent databases.|||You didn't mention how much ram is on the dev box.
Also how many rows and what is the DB size? 1GB of ram on a production SQL
box with that kind of CPU seems way low to me.
Mike
"kgb" <kristjan.gudni.bjarnason@.gmail.com> wrote in message
news:1138125661.913476.224860@.g14g2000cwa.googlegroups.com...
> Hi,
> Got two SQL servers (production,dev) and I noticed recently that my
> production servers is much slower when running one import stored
> procedure. The stored proc only uses tables variables a lot and only
> performs selects on actual tables. The specs are:
> Productions server:
> SQL 2000 v. 8002039 (SP4)
> 2x Dual Core Intel Xeon 3,2GH
> 1GB Memory
> RAID 1
> Windows 2003 Server
> Development server:
> SQL 2000 v. 800194 (no service pack)
> 1x Dual Core Intel Pentium 4 3GHz
> Windows XP Professional
> The stored procedures takes 20 sec running on the dev box but 2.4 min
> on the production box.
> All indexes and tables are the same in both databases. I tried
> updating the stats, rebuild indexes, recompile the stored proc, free
> the proc cache but without any luck.
> Any help would be very much appricated.
> Kristjan
>|||The dev box also got 1 GB ram. The databases are almost the same size
because the app is not writing very much on runtime.
The stored proc spends most time on single table containing about
600,000 rows (both dev and production server). By the way, the
profiler tells me the production servers is doing ~10 times more reads
and spending ~10 more CPU than the dev server.
The total databsize is about 0,5 GB but maybe 1/4 of it is accessed
realtime.|||What different you found in Execution plan?
Try to run query on Prod. using option (maxdop 1).
If you have joins check that fields on both sides of the join have same
datatypes.
Regards
Amish Shah|||Tried the maxdop 1 option, no big difference.
The datatypes were ok.
Installed the database on my laptop to reproduce this. With no service
pack the stored proc ran fine (30 secs). With SP4 it ran for minutes.
Seems like updated server optimizer is not doing a good job with my
stored proc. Collecting some more data which I will post to this
thread soon.|||There have been a number of changes from GOLD and SP1 to SP4. A number of
these fixes result in different query plans being generated. It is not a far
comparison of performance between GOLD and SP4. Your GOLD version is also a
lot less secure in that it does not protect against SLAMMER.
Chris
"kgb" <kristjan.gudni.bjarnason@.gmail.com> wrote in message
news:1138274581.095820.120850@.o13g2000cwo.googlegroups.com...
> Tried the maxdop 1 option, no big difference.
> The datatypes were ok.
> Installed the database on my laptop to reproduce this. With no service
> pack the stored proc ran fine (30 secs). With SP4 it ran for minutes.
> Seems like updated server optimizer is not doing a good job with my
> stored proc. Collecting some more data which I will post to this
> thread soon.
>|||This may sound silly, but have you opened the sproc on the SP4 box and
recompiled it on SP4. I have seen a few odd things from time to time when
sprocs were compiled on a lower SPack DB then restored to a differnt SPack
server. Views too.
At least you would give the SP4 query optimizer a chance to take a look at
the sproc to build a new plan to store with the sproc.
Mike
"Chris Wood" <anonymous@.discussions.microsoft.com> wrote in message
news:uu3f3HpIGHA.532@.TK2MSFTNGP15.phx.gbl...
> There have been a number of changes from GOLD and SP1 to SP4. A number of
> these fixes result in different query plans being generated. It is not a
> far comparison of performance between GOLD and SP4. Your GOLD version is
> also a lot less secure in that it does not protect against SLAMMER.
> Chris
> "kgb" <kristjan.gudni.bjarnason@.gmail.com> wrote in message
> news:1138274581.095820.120850@.o13g2000cwo.googlegroups.com...
>> Tried the maxdop 1 option, no big difference.
>> The datatypes were ok.
>> Installed the database on my laptop to reproduce this. With no service
>> pack the stored proc ran fine (30 secs). With SP4 it ran for minutes.
>> Seems like updated server optimizer is not doing a good job with my
>> stored proc. Collecting some more data which I will post to this
>> thread soon.
>|||can you post the DDL and query you are running?|||Currently changing the query to "fit" the SP4 optimizer and think I
almost there, meaning the duration of the query is dropping to what I
expected. The changes sofar involved rewriting of several joins. I
get back to the thread in few hours or less - hopfully with result of
success. Thanks for all your replies. Its amazing to find the support
available on this group.|||Below you find the exec tree for the query, both versions. Being
novice mssql programmer I am not sure what part of the tree is taking
most time. The execution plan makes not much sense to me - the figures
are cost estimated rows seem all wrong.
the execution tree from the profilier is like this for the SP4 box.
Execution Tree
--
Table Insert(OBJECT:(@.f3), SET:(@.f3.[outbound]=RaiseIfNull(1),
@.f3.[groundDur_2]=[t2].[TransitTime],
@.f3.[groundDur_1]=[t1].[TransitTime], @.f3.[duration_3]=[f3].[Duration],
@.f3.[duration_2]=[f2].[Duration], @.f3.[duration_1]=[f1].[Duration],
@.f3.[FlightDate_3]=[f3].[FlightDate],
@.f3.[f1_FlightID]=[f2].[FlightID], @.f3.[flightset_3]=[f3].[flightset],
@.f3.[FlightID_3]=[f3].[FlightID],
@.f3.[fromairport_3]=[f3].[fromairport],
@.f3.[toairport_3]=[f3].[toairport], @.f3.[eta_3]=[f3].[eta],
@.f3.[std_3]=[f3].[std], @.f3.[FlightDate_2]=RaiseIfNull([@.out]),
@.f3.[f0_ID]=[f1].[ID], @.f3.[f0_FlightID]=[f1].[FlightID],
@.f3.[flightset_2]=[f2].[FlightSet], @.f3.[FlightID_2]=[f2].[FlightID],
@.f3.[fromairport_2]=[f2].[FromAirport],
@.f3.[toairport_2]=[f2].[ToAirport], @.f3.[eta_2]=[f2].[ETA],
@.f3.[std_2]=[f2].[STD], @.f3.[flightdate_1]=[f1].[FlightDate],
@.f3.[flightset_1]=[f1].[flightset], @.f3.[FlightID_1]=[f1].[FlightID],
@.f3.[fromairport_1]=[f1].[fromairport],
@.f3.[toairport_1]=[f1].[toairport], @.f3.[eta_1]=[f1].[eta],
@.f3.[std_1]=[f1].[std], @.f3.[ID]=RaiseIfNull([Expr1009]),
@.f3.[FlightNumber_1]=[f1].[FlightNumber],
@.f3.[AirlineCode_1]=[f1].[AirlineCode],
@.f3.[FlightNumber_2]=[f2].[FlightNumber],
@.f3.[AirlineCode_2]=[f2].[AirlineCode],
@.f3.[FlightNumber_3]=[f3].[FlightNumber],
@.f3.[AirlineCode_3]=[f3].[AirlineCode]))
|--Top(ROWCOUNT est 0)
|--Compute Scalar(DEFINE:([Expr1009]=getidentity(1295343679, 2,
'@.f3')))
|--Filter(WHERE:([f3].[std]>[f2].[ETA]+Convert([@.transitDuration])+isnull([t2].[TransitTime],
0)))
|--Nested Loops(Left Outer Join, OUTER REFERENCES:([f2].[ArrTerm],
[f2].[ToAirport], [f3].[depTerm], [f3].[fromairport]))
|--Filter(WHERE:([f2].[STD]>[f1].[eta]+Convert([@.transitDuration])+isnull([t1].[TransitTime],
0)))
| |--Nested Loops(Left Outer Join, OUTER REFERENCES:([f1].[arrTerm],
[f1].[toairport], [f2].[DepTerm], [f2].[FromAirport]))
| |--Nested Loops(Inner Join,
WHERE:([f1].[toairport]<>[a].[AirportCode]))
| | |--Nested Loops(Inner Join,
WHERE:([f2].[ToAirport]<>[b].[AirportCode]))
| | | |--Hash Match(Inner Join,
HASH:([f1].[toaptjoin])=([f2].[FromAptJoin]),
RESIDUAL:([f1].[fromairport]<>[f3].[fromairport] AND
((([f1].[eta]-[f1].[std])*[f3].[dayafter]>0 AND
([f1].[eta]-[f1].[std])*[d].[dayafter]>0) OR ([f1].[eta]>[f1].[std] AND
([f2].[ETA]-[f2].[STD])*[f3].[dayafter]>0))))
| | | | |--Table Scan(OBJECT:(@.f1 AS [f1]),
WHERE:([f1].[outbound]=1))
| | | | |--Bookmark Lookup(BOOKMARK:([Bmk1002]),
OBJECT:([dohop].[dbo].[Flight1] AS [f2]))
| | | | |--Nested Loops(Inner Join, OUTER
REFERENCES:([d].[date], [d].[weekday], [f3].[fromaptjoin]))
| | | | |--Nested Loops(Inner Join)
| | | | | |--Table Scan(OBJECT:(@.flast AS
[f3]), WHERE:([f3].[outbound]=1))
| | | | | |--Table
Scan(OBJECT:(@.weekdays_out AS [d]))
| | | | |--Index
Seek(OBJECT:([dohop].[dbo].[Flight1].[IX3_Flight1] AS [f2]),
SEEK:([f2].[ToAptJoin]=[f3].[fromaptjoin]),
WHERE:((([f2].[ValidFrom]<=[d].[date] AND [f2].[ValidTo]>=[d].[date])
AND [f2].[Status]=0) AND (Convert([f2].[Weekdays])&[d].[weekday])>0)
ORDERED FORWARD)
| | | |--Table Scan(OBJECT:(@.arrivalList AS [b]))
| | |--Table Scan(OBJECT:(@.arrivalList AS [a]))
| |--Clustered Index
Seek(OBJECT:([dohop].[dbo].[Transit].[PK_Transit] AS [t1]),
SEEK:([t1].[Apt1]=[f1].[toairport]),
WHERE:([t1].[Apt2]=[f2].[FromAirport] AND (([t1].[Term1]=' ' AND
[t1].[Term2]=' ') OR ([f1].[arrTerm]=[t1].[Term1] AND
[f2].[DepTerm]=[t1].[Term2]))) ORDERED FORWARD)
|--Clustered Index Seek(OBJECT:([dohop].[dbo].[Transit].[PK_Transit] AS
[t2]), SEEK:([t2].[Apt1]=[f2].[ToAirport]),
WHERE:([t2].[Apt2]=[f3].[fromairport] AND (([t2].[Term1]=' ' AND
[t2].[Term2]=' ') OR ([f2].[ArrTerm]=[t2].[Term1] AND
[f3].[depTerm]=[t2].[Term2]))) ORDERED FORWARD)
and for the GOLD box its like:
Execution Tree
--
Table Insert(OBJECT:(@.f3), SET:(@.f3.[outbound]=RaiseIfNull(1),
@.f3.[groundDur_2]=[t2].[TransitTime],
@.f3.[groundDur_1]=[t1].[TransitTime], @.f3.[duration_3]=[f3].[Duration],
@.f3.[duration_2]=[f2].[Duration], @.f3.[duration_1]=[f1].[Duration],
@.f3.[FlightDate_3]=[f3].[FlightDate],
@.f3.[f1_FlightID]=[f2].[FlightID], @.f3.[flightset_3]=[f3].[flightset],
@.f3.[FlightID_3]=[f3].[FlightID],
@.f3.[fromairport_3]=[f3].[fromairport],
@.f3.[toairport_3]=[f3].[toairport], @.f3.[eta_3]=[f3].[eta],
@.f3.[std_3]=[f3].[std], @.f3.[FlightDate_2]=RaiseIfNull([@.out]),
@.f3.[f0_ID]=[f1].[ID], @.f3.[f0_FlightID]=[f1].[FlightID],
@.f3.[flightset_2]=[f2].[FlightSet], @.f3.[FlightID_2]=[f2].[FlightID],
@.f3.[fromairport_2]=[f2].[FromAirport],
@.f3.[toairport_2]=[f2].[ToAirport], @.f3.[eta_2]=[f2].[ETA],
@.f3.[std_2]=[f2].[STD], @.f3.[flightdate_1]=[f1].[FlightDate],
@.f3.[flightset_1]=[f1].[flightset], @.f3.[FlightID_1]=[f1].[FlightID],
@.f3.[fromairport_1]=[f1].[fromairport],
@.f3.[toairport_1]=[f1].[toairport], @.f3.[eta_1]=[f1].[eta],
@.f3.[std_1]=[f1].[std], @.f3.[ID]=RaiseIfNull([Expr1011]),
@.f3.[FlightNumber_1]=[f1].[FlightNumber],
@.f3.[AirlineCode_1]=[f1].[AirlineCode],
@.f3.[FlightNumber_2]=[f2].[FlightNumber],
@.f3.[AirlineCode_2]=[f2].[AirlineCode],
@.f3.[FlightNumber_3]=[f3].[FlightNumber],
@.f3.[AirlineCode_3]=[f3].[AirlineCode]))
|--Top(ROWCOUNT est 0)
|--Compute Scalar(DEFINE:([Expr1011]=getidentity(1329804195, 2,
'@.f3')))
|--Filter(WHERE:([f3].[std]>[f2].[ETA]+Convert([@.transitDuration])+isnull([t2].[TransitTime],
0)))
|--Nested Loops(Left Outer Join, OUTER REFERENCES:([f2].[ArrTerm],
[f2].[ToAirport], [f3].[depTerm], [f3].[fromairport]))
|--Filter(WHERE:([f2].[STD]>[f1].[eta]+Convert([@.transitDuration])+isnull([t1].[TransitTime],
0)))
| |--Nested Loops(Left Outer Join, OUTER REFERENCES:([f1].[arrTerm],
[f1].[toairport], [f2].[DepTerm], [f2].[FromAirport]))
| |--Nested Loops(Left Anti Semi Join,
WHERE:(@.arrivalList.[AirportCode]=NULL OR
[f2].[ToAirport]=@.arrivalList.[AirportCode]))
| | |--Nested Loops(Left Anti Semi Join,
WHERE:(@.arrivalList.[AirportCode]=NULL OR
[f1].[toairport]=@.arrivalList.[AirportCode]))
| | | |--Nested Loops(Inner Join,
WHERE:(((((([f1].[eta]-[f1].[std])*[f3].[dayafter]>0 AND
([f1].[eta]-[f1].[std])*[d].[dayafter]>0) OR ([f1].[eta]>[f1].[std] AND
([f2].[ETA]-[f2].[STD])*[f3].[dayafter]>0)) AND
Convert([f2].[Weekdays])&[d].[weekday]>0) AND
[f2].[ValidFrom]<=[d].[date]) AND [f2].[ValidTo]>=[d].[date]))
| | | | |--Bookmark Lookup(BOOKMARK:([Bmk1001]),
OBJECT:([dohop].[dbo].[Flight1] AS [f2]))
| | | | | |--Nested Loops(Inner Join, OUTER
REFERENCES:([f1].[toaptjoin], [f3].[fromaptjoin]))
| | | | | |--Nested Loops(Inner Join,
WHERE:([f1].[fromairport]<>[f3].[fromairport]))
| | | | | | |--Table Scan(OBJECT:(@.f1 AS
[f1]), WHERE:([f1].[outbound]=1))
| | | | | | |--Table Scan(OBJECT:(@.flast AS
[f3]), WHERE:([f3].[outbound]=1))
| | | | | |--Index
Seek(OBJECT:([dohop].[dbo].[Flight1].[IX3_Flight1] AS [f2]),
SEEK:([f2].[ToAptJoin]=[f3].[fromaptjoin] AND
[f2].[FromAptJoin]=[f1].[toaptjoin] AND [f2].[Status]=0) ORDERED
FORWARD)
| | | | |--Table Scan(OBJECT:(@.weekdays_out AS [d]))
| | | |--Table Scan(OBJECT:(@.arrivalList))
| | |--Table Scan(OBJECT:(@.arrivalList))
| |--Clustered Index
Seek(OBJECT:([dohop].[dbo].[Transit].[PK_Transit] AS [t1]),
SEEK:([t1].[Apt1]=[f1].[toairport]),
WHERE:([t1].[Apt2]=[f2].[FromAirport] AND (([t1].[Term1]=' ' AND
[t1].[Term2]=' ') OR ([f1].[arrTerm]=[t1].[Term1] AND
[f2].[DepTerm]=[t1].[Term2]))) ORDERED FORWARD)
|--Clustered Index Seek(OBJECT:([dohop].[dbo].[Transit].[PK_Transit] AS
[t2]), SEEK:([t2].[Apt1]=[f2].[ToAirport]),
WHERE:([t2].[Apt2]=[f3].[fromairport] AND (([t2].[Term1]=' ' AND
[t2].[Term2]=' ') OR ([f2].[ArrTerm]=[t2].[Term1] AND
[f3].[depTerm]=[t2].[Term2]))) ORDERED FORWARD)|||after reading this
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=58294&whichpage=1
thread I think I will move to SP3.

Friday, February 24, 2012

Failure with transactional replication with immediate updating subscriptions

I have set up a transactional replication with immediate updating
subscriptions,
Distributor and Subscriber on diff servers.
When I try to update rows in the subscriber I have the following error:
[Microsoft][ODBC SQL Server Driver][SQLServer] Login failed for user 'sa'
(Both servers have the same 'sa' password)
Does anybody know how can I do that ?
Thank you
Hernn Rado
review this kb article:
http://support.microsoft.com/default...b;en-us;320773
"Hernn Rado" <hernan_radovitzki@.hotmail.com> wrote in message
news:eAt7HgE6EHA.2592@.TK2MSFTNGP09.phx.gbl...
> I have set up a transactional replication with immediate updating
> subscriptions,
> Distributor and Subscriber on diff servers.
>
> When I try to update rows in the subscriber I have the following error:
> [Microsoft][ODBC SQL Server Driver][SQLServer] Login failed for user 'sa'
> (Both servers have the same 'sa' password)
> Does anybody know how can I do that ?
> Thank you
> Hernn Rado
>
|||Thanks Hilary !
I changed the SA password to a blank one and its works ! Later, I changed
again both password (to the original) and ran the sp_link_publication on the
subscriber (specifying the SA psw) but its doesnt work !!
What can I do?
"Hilary Cotter" <hilary.cotter@.gmail.com> escribi en el mensaje
news:O5fVNsE6EHA.248@.TK2MSFTNGP10.phx.gbl...[vbcol=seagreen]
> review this kb article:
> http://support.microsoft.com/default...b;en-us;320773
> "Hernn Rado" <hernan_radovitzki@.hotmail.com> wrote in message
> news:eAt7HgE6EHA.2592@.TK2MSFTNGP09.phx.gbl...
'sa'
>