Monday, March 12, 2012
high availability questions
I just need help with one more thing tonight. I want to thank you all that
have helped me tonight with other questions.
I have a few short questions about high availability.
Is the process of log shipping just about restoring transaction logs?
Is transactional replication mostly just good for read-only data, while
snapshot replication is better in terms of restoring write data?
I know that snapshots good are for providing users with data that they need
from a previous "snapshot" of the system. And, I know that mirroring is
strictly a high availability procedure. So, with regard to snapshotting, my
guess is that mirroring is "better" than snapshotting. Is that right?
Thanks, again, to all of you! God bless you!
childofthe1980sMirroring is meant for high availability. While a snapshot could be used to
get you out of a jam, the data will only be as current as when the snapshot
was taken (if Im not mistaken, if created some snapshots, but not done a
restore). If you look in BOL under "high availability [SQL Server]", you
will see that snapshotting is not even listed. Log shipping is good, but I
think MS is trying to get people into Mirroring. Replication, in my opinion,
is not a valid high availability solution for many reasons. Many will
disagree with me on that one, but thats my take.
"childofthe1980s" <childofthe1980s@.discussions.microsoft.com> wrote in
message news:7E4D8463-4F59-4DAD-B5A2-E8B92C1F043D@.microsoft.com...
> Hello:
> I just need help with one more thing tonight. I want to thank you all
that
> have helped me tonight with other questions.
> I have a few short questions about high availability.
> Is the process of log shipping just about restoring transaction logs?
> Is transactional replication mostly just good for read-only data, while
> snapshot replication is better in terms of restoring write data?
> I know that snapshots good are for providing users with data that they
need
> from a previous "snapshot" of the system. And, I know that mirroring is
> strictly a high availability procedure. So, with regard to snapshotting,
my
> guess is that mirroring is "better" than snapshotting. Is that right?
> Thanks, again, to all of you! God bless you!
> childofthe1980s
>
high availability questions
I just need help with one more thing tonight. I want to thank you all that
have helped me tonight with other questions.
I have a few short questions about high availability.
Is the process of log shipping just about restoring transaction logs?
Is transactional replication mostly just good for read-only data, while
snapshot replication is better in terms of restoring write data?
I know that snapshots good are for providing users with data that they need
from a previous "snapshot" of the system. And, I know that mirroring is
strictly a high availability procedure. So, with regard to snapshotting, my
guess is that mirroring is "better" than snapshotting. Is that right?
Thanks, again, to all of you! God bless you!
childofthe1980s
Mirroring is meant for high availability. While a snapshot could be used to
get you out of a jam, the data will only be as current as when the snapshot
was taken (if Im not mistaken, if created some snapshots, but not done a
restore). If you look in BOL under "high availability [SQL Server]", you
will see that snapshotting is not even listed. Log shipping is good, but I
think MS is trying to get people into Mirroring. Replication, in my opinion,
is not a valid high availability solution for many reasons. Many will
disagree with me on that one, but thats my take.
"childofthe1980s" <childofthe1980s@.discussions.microsoft.com> wrote in
message news:7E4D8463-4F59-4DAD-B5A2-E8B92C1F043D@.microsoft.com...
> Hello:
> I just need help with one more thing tonight. I want to thank you all
that
> have helped me tonight with other questions.
> I have a few short questions about high availability.
> Is the process of log shipping just about restoring transaction logs?
> Is transactional replication mostly just good for read-only data, while
> snapshot replication is better in terms of restoring write data?
> I know that snapshots good are for providing users with data that they
need
> from a previous "snapshot" of the system. And, I know that mirroring is
> strictly a high availability procedure. So, with regard to snapshotting,
my
> guess is that mirroring is "better" than snapshotting. Is that right?
> Thanks, again, to all of you! God bless you!
> childofthe1980s
>
Friday, March 9, 2012
High ASYNC_NETWORK_IO value
I have been analyzing wait stats using get_waitstats_2005 on ou production S
QLserver (two node Active/Passive SQL Server 2005 64-bit cluster) and notice
d high values of
ASYNC_NETWORK_IO wait type (around 50% of total resource type). From what I
can see, our 1GB Network cards are all right. Has anyone had experience trou
bleshooting this wait type? What could be causing high percentage of this wa
it type?
Thanks,
IgorHi
"imarchenko" wrote:
> Hello!
> I have been analyzing wait stats using get_waitstats_2005 on ou production
SQLserver (two node Active/Passive SQL Server 2005 64-bit cluster) and noti
ced high values of
> ASYNC_NETWORK_IO wait type (around 50% of total resource type). From what
I can see, our 1GB Network cards are all right. Has anyone had experience tr
oubleshooting this wait type? What could be causing high percentage of this
wait type?
> Thanks,
> Igor
50% of not very much is probably not something to worry about! If perfmon
stats such as output queue length show no problems then you are probably ok.
I assume that your 1GB network cards are on a 1GB network that does not have
any bottlenecks? If you can ad an extra card I don't think it would not do
any harm doing that!
John|||Also..
Have you checked for queries that return a large result set? You may want to
use SQL profiler to identify them. If you return an excessive result set the
client may not be able to process this fast enough!
John|||John,
This could well be the case. We have old legacy report application
generating thousands of queries per report.
Thanks,
Igor
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:%23z%23wpltUHHA.192@.TK2MSFTNGP04.phx.gbl...
> Also..
> Have you checked for queries that return a large result set? You may want
> to use SQL profiler to identify them. If you return an excessive result
> set the client may not be able to process this fast enough!
> John
>|||Hi Igor
"imarchenko" wrote:
> John,
> This could well be the case. We have old legacy report application
> generating thousands of queries per report.
> Thanks,
> Igor
Profiling the system will certainly show high I/O and duration queries. Look
for instances where the result set is too wide or too many rows are being
returned that are not being used.
If you can't tune or re-write the queries, maybe a different method of
delivery would be more approprate such as a scheduled report or DTS/SSIS
export. Use of Analysis Service may allow you to process your data in a more
piecemeal way?
John|||John,
AS is out of question at the moment, but we are working on improving this
app.
Thanks again,
Igor
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:A4E11028-D4C0-4845-A347-03C5FEB1BE5D@.microsoft.com...
> Hi Igor
> "imarchenko" wrote:
>
> Profiling the system will certainly show high I/O and duration queries.
> Look
> for instances where the result set is too wide or too many rows are being
> returned that are not being used.
> If you can't tune or re-write the queries, maybe a different method of
> delivery would be more approprate such as a scheduled report or DTS/SSIS
> export. Use of Analysis Service may allow you to process your data in a
> more
> piecemeal way?
> John
>
High ASYNC_NETWORK_IO value
I have been analyzing wait stats using get_waitstats_2005 on ou production SQLserver (two node Active/Passive SQL Server 2005 64-bit cluster) and noticed high values of
ASYNC_NETWORK_IO wait type (around 50% of total resource type). From what I can see, our 1GB Network cards are all right. Has anyone had experience troubleshooting this wait type? What could be causing high percentage of this wait type?
Thanks,
Igor
Hi
"imarchenko" wrote:
> Hello!
> I have been analyzing wait stats using get_waitstats_2005 on ou production SQLserver (two node Active/Passive SQL Server 2005 64-bit cluster) and noticed high values of
> ASYNC_NETWORK_IO wait type (around 50% of total resource type). From what I can see, our 1GB Network cards are all right. Has anyone had experience troubleshooting this wait type? What could be causing high percentage of this wait type?
> Thanks,
> Igor
50% of not very much is probably not something to worry about! If perfmon
stats such as output queue length show no problems then you are probably ok.
I assume that your 1GB network cards are on a 1GB network that does not have
any bottlenecks? If you can ad an extra card I don't think it would not do
any harm doing that!
John
|||Also..
Have you checked for queries that return a large result set? You may want to
use SQL profiler to identify them. If you return an excessive result set the
client may not be able to process this fast enough!
John
|||John,
This could well be the case. We have old legacy report application
generating thousands of queries per report.
Thanks,
Igor
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:%23z%23wpltUHHA.192@.TK2MSFTNGP04.phx.gbl...
> Also..
> Have you checked for queries that return a large result set? You may want
> to use SQL profiler to identify them. If you return an excessive result
> set the client may not be able to process this fast enough!
> John
>
|||Hi Igor
"imarchenko" wrote:
> John,
> This could well be the case. We have old legacy report application
> generating thousands of queries per report.
> Thanks,
> Igor
Profiling the system will certainly show high I/O and duration queries. Look
for instances where the result set is too wide or too many rows are being
returned that are not being used.
If you can't tune or re-write the queries, maybe a different method of
delivery would be more approprate such as a scheduled report or DTS/SSIS
export. Use of Analysis Service may allow you to process your data in a more
piecemeal way?
John
|||John,
AS is out of question at the moment, but we are working on improving this
app.
Thanks again,
Igor
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:A4E11028-D4C0-4845-A347-03C5FEB1BE5D@.microsoft.com...
> Hi Igor
> "imarchenko" wrote:
>
> Profiling the system will certainly show high I/O and duration queries.
> Look
> for instances where the result set is too wide or too many rows are being
> returned that are not being used.
> If you can't tune or re-write the queries, maybe a different method of
> delivery would be more approprate such as a scheduled report or DTS/SSIS
> export. Use of Analysis Service may allow you to process your data in a
> more
> piecemeal way?
> John
>
hierarchy structure
I have a hierarchy structure copied from excel to a table in databse SQL.
Here is what i have in SQL table:
ContinentCountryCity
Europe
Norway
Oslo
Bergen
Trondheim
Sweden
Stockholm
Gotaborg
Denmark
Kopenhagen
Aalborg
Germany
Hamburg
Munchen
Hannover
Asia
Japan
Tokyo
Hirroshima
Kina
Shanghai
Africa
South-Africa
Pretoria
AND her is what i want
ContinentCountryCity
Europe
EuropeNorway
EuropeNorwayOslo
EuropeNorwayBergen
EuropeNorwayTrondheim
EuropeSweden
EuropeSwedenStockholm
EuropeSwedenGotaborg
EuropeDenmark
EuropeDenmarkKopenhagen
EuropeDenmarkAalborg
EuropeGermany
EuropeGermanyHamburg
EuropeGermanyMunchen
EuropeGermanyHannover
Asia
AsiaJapan
AsiaJapanTokyo
AsiaJapanHirroshima
AsiaKina
AsiaKinaShanghai
AfricaKina
AfricaSouth-Africa
AfricaSouth-AfricaPretoria
How do i that?
On Wed, 25 May 2005 02:23:02 -0700, CJ wrote:
>hello!
>I have a hierarchy structure copied from excel to a table in databse SQL.
>Here is what i have in SQL table:
(snip)
Hi CJ,
Do you mean that each row has either Continent, or Country, or City
populated, but none of the other columns? I guess you're out of luck
then. Since there is no inherent order in a relational table, there is
no difference between the table you posted and this one:
ContinentCountryCity
Africa
Asia
Europe
Denmark
Germany
Japan
Kina
Norway
South-Africa
Sweden
Aalborg
Bergen
Gotaborg
Hannover
Hamburg
Hirroshima
Kopenhagen
Munchen
Oslo
Pretoria
Stockholm
Shanghai
Tokyo
Trondheim
Besides - since this table has no key, it is officially not a relational
table at all. Of course, terminology is pretty much a question of
definitions, but a table without primary key is usually impossible to do
any serious operations on.
>AND her is what i want
>ContinentCountryCity
>Europe
>EuropeNorway
>EuropeNorwayOslo
>EuropeNorwayBergen
>EuropeNorwayTrondheim
>EuropeSweden
>EuropeSwedenStockholm
>EuropeSwedenGotaborg
>EuropeDenmark
>EuropeDenmarkKopenhagen
>EuropeDenmarkAalborg
>EuropeGermany
>EuropeGermanyHamburg
>EuropeGermanyMunchen
>EuropeGermanyHannover
>Asia
>AsiaJapan
>AsiaJapanTokyo
>AsiaJapanHirroshima
>AsiaKina
>AsiaKinaShanghai
>AfricaKina
>AfricaSouth-Africa
>AfricaSouth-AfricaPretoria
>How do i that?
You don't. The data above has no key either, so it's not a relational
table. Consider moving the data to some properly normalized tables:
CREATE TABLE Countries
(Country varchar(20) NOT NULL,
Continent varchar(10) NOT NULL,
PRIMARY KEY (Country)
)
CREATE TABLE Cities
(City varchar(25) NOT NULL,
Country varchar(20) NOT NULL,
PRIMARY KEY (City),
FOREIGN KEY (Country) REFERENCES Countries (Country)
)
INSERT INTO Countries (Country, Continent)
VALUES ('Norway', 'Europe')
INSERT INTO Countries (Country, Continent)
VALUES ('Sweden', 'Europe')
....
INSERT INTO Countries (Country, Continent)
VALUES ('South-Africa', 'Africa')
INSERT INTO Cities (City, Country)
VALUES ('Oslo', 'Norway')
INSERT INTO Cities (City, Country)
VALUES ('Bergen', 'Norway')
....
INSERT INTO Cities (City, Country)
VALUES ('Pretoria', 'South-Africa')
The input needed to get the listing you describe above would be returned
by
SELECT co.Continent, co.Country, ci.City
FROM Countries AS co
INNER JOIN Cities AS ci
ON ci.Country = co.Country
ORDER BY co.Continent, co.Country, ci.City
The final reformatting to get it displayed exectly as above (including
the repeating of some lines with partial blank data) should be handled
by the presentation tier.
Best, Hugo
(Remove _NO_ and _SPAM_ to get my e-mail address)
Wednesday, March 7, 2012
Hierarchy
I have a table that looks like this:
Col1; Col2; Col3; Col4; Col5
38; 75; 233; 916; 2770
38; 75; 233; 916; 2771
38; 75; 233; 916; 2772
38; 75; 233; 923; 2654
38; 75; 233; 923; 2655
38; 75; 245; 913; 2454
38; 75; 245; 913; 2456
...
And I need a query (not a procedure) that shows me this:
38; NULL; NULL; NULL; NULL
NULL; 75; NULL; NULL; NULL
NULL; NULL; 233; NULL; NULL
NULL; NULL; NULL; 916; NULL
NULL; NULL; NULL; NULL; 2770
NULL; NULL; NULL; NULL; 2771
NULL; NULL; NULL; NULL; 2772
NULL; NULL; NULL; 923; NULL
NULL; NULL; NULL; NULL; 2654
NULL; NULL; NULL; NULL; 2655
NULL; NULL; 245; NULL; NULL
NULL; NULL; NULL; 913; NULL
NULL; NULL; NULL; NULL; 2454
NULL; NULL; NULL; NULL; 2456
...
Does anybody know how i can get this result? How?
Help! Thank you!
SQLNull
ps: SQL-Server 2000SQLNull (ramonjor@.yahoo.com) writes:
Quote:
Originally Posted by
And I need a query (not a procedure) that shows me this:
38; NULL; NULL; NULL; NULL
NULL; 75; NULL; NULL; NULL
NULL; NULL; 233; NULL; NULL
NULL; NULL; NULL; 916; NULL
NULL; NULL; NULL; NULL; 2770
NULL; NULL; NULL; NULL; 2771
NULL; NULL; NULL; NULL; 2772
NULL; NULL; NULL; 923; NULL
NULL; NULL; NULL; NULL; 2654
NULL; NULL; NULL; NULL; 2655
NULL; NULL; 245; NULL; NULL
NULL; NULL; NULL; 913; NULL
NULL; NULL; NULL; NULL; 2454
NULL; NULL; NULL; NULL; 2456
...
>
Does anybody know how i can get this result? How?
>...
ps: SQL-Server 2000
You are going to regret this...
The query is below, and I encourage you to study it closely to see what
is going on. The query makes use of derived tables - a derived table is
a temp table within the query so to speak, but not necessarily
materialsed. All SELECTs are derived tables, execpt the two SELECT
COUNT - they are correlated subqueries.
Had you been on SQL 2005, it would have been possible to write the
query more compactly with help of a CTE - Common Table Expression.
Also the row_number() function would have come in handy.
The keystr that appears in the query is a simplifcation that I could
permit myself, when all columns where numeric. It may not work well,
if your actual table have different data types. But they query could
be written without keystr. (Which is left as an exercise to the reader.)
Performance is not likely to be good.
CREATE TABLE h (col1 int NOT NULL,
col2 int NOT NULL,
col3 int NOT NULL,
col4 int NOT NULL,
col5 int NOT NULL,
PRIMARY KEY (col1, col2, col3, col4, col5))
go
INSERT h (col1, col2, col3, col4, col5)
EXEC ('SELECT 38, 75, 233, 916, 2770
SELECT 38, 75, 233, 916, 2771
SELECT 38, 75, 233, 916, 2772
SELECT 38, 75, 233, 923, 2654
SELECT 38, 75, 233, 923, 2655
SELECT 38, 75, 245, 913, 2454
SELECT 38, 75, 245, 913, 2456')
go
SELECT keystr, col1, col2, col3, col4, col5
FROM (SELECT a.keystr,
col1 = CASE WHEN a.col1 <b.col1 OR b.col1 IS NULL
THEN a.col1
END,
col2 = CASE WHEN a.col2 <b.col2 OR b.col2 IS NULL
THEN a.col2
END,
col3 = CASE WHEN a.col3 <b.col3 OR b.col3 IS NULL
THEN a.col3
END,
col4 = CASE WHEN a.col4 <b.col4 OR b.col4 IS NULL
THEN a.col4
END,
col5 = CASE WHEN a.col5 <b.col5 OR b.col5 IS NULL
THEN a.col5
END
FROM (SELECT keystr,
rowno = (SELECT COUNT(*)
FROM h AS h1
WHERE str(h1.col1) + str(h1.col2) +
str(h1.col3) + str(h1.col4) +
str(h1.col5) <=
str(h.col1) + str(h.col2) +
str(h.col3) + str(h.col4) +
str(h.col5)),
col1 = CASE n WHEN 1 THEN h.col1 END,
col2 = CASE n WHEN 2 THEN h.col2 END,
col3 = CASE n WHEN 3 THEN h.col3 END,
col4 = CASE n WHEN 4 THEN h.col4 END,
col5 = CASE n WHEN 5 THEN h.col5 END,
v.n
FROM (SELECT keystr = str(h.col1) + str(h.col2) +
str(h.col3) + str(h.col4) +
str(h.col5),
col1, col2, col3, col4, col5
FROM h) AS h
CROSS JOIN (SELECT n = 1 UNION
SELECT 2 UNION
SELECT 3 UNION
SELECT 4 UNION
SELECT 5) AS v) AS a
LEFT JOIN
(SELECT keystr = str(h.col1) + str(h.col2) + str(h.col3) +
str(h.col4) + str(h.col5),
rowno = (SELECT COUNT(*)
FROM h AS h1
WHERE str(h1.col1) + str(h1.col2) +
str(h1.col3) + str(h1.col4) +
str(h1.col5) <=
str(h.col1) + str(h.col2) +
str(h.col3) + str(h.col4) +
str(h.col5)),
col1 = CASE n WHEN 1 THEN h.col1 END,
col2 = CASE n WHEN 2 THEN h.col2 END,
col3 = CASE n WHEN 3 THEN h.col3 END,
col4 = CASE n WHEN 4 THEN h.col4 END,
col5 = CASE n WHEN 5 THEN h.col5 END,
v.n
FROM h
CROSS JOIN (SELECT n = 1 UNION
SELECT 2 UNION
SELECT 3 UNION
SELECT 4 UNION
SELECT 5) AS v) AS b
ON a.rowno = b.rowno + 1
AND a.n = b.n) AS final
WHERE col1 IS NOT NULL OR
col2 IS NOT NULL OR
col3 IS NOT NULL OR
col4 IS NOT NULL OR
col5 IS NOT NULL
ORDER BY keystr
go
DROP TABLE h
--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||You are right, I'm going to regret your query... :-) Thank you!
This one ist very simple n fast!
The difference is that it will be sorted. But it doesn't matter, I just
need the hierarchy.
Thank you!
SQLNULL
CREATE TABLE h (col1 int NOT NULL,
col2 int NOT NULL,
col3 int NOT NULL,
col4 int NOT NULL,
col5 int NOT NULL,
PRIMARY KEY (col1, col2, col3, col4, col5))
go
INSERT h (col1, col2, col3, col4, col5)
EXEC ('SELECT 38, 75, 233, 916, 2770
SELECT 38, 75, 233, 916, 2771
SELECT 38, 75, 233, 916, 2772
SELECT 38, 75, 233, 923, 2654
SELECT 38, 75, 233, 923, 2655
SELECT 38, 75, 245, 913, 2454
SELECT 38, 75, 245, 913, 2456')
go
SELECT c1 as col1, c2 as col2, c3 as col3, c4 as col4, c5 as col5
FROM (
SELECT DISTINCT col1 AS c1, c2=NULL, c3=NULL, c4=NULL, c5=NULL,
col1, col2=NULL, col3=NULL, col4=NULL,
col5=NULL
FROM h
UNION
SELECT DISTINCT NULL, col2, NULL, NULL, NULL,
col1, col2, NULL, NULL, NULL
FROM h
UNION
SELECT DISTINCT NULL, NULL, col3, NULL, NULL,
col1, col2, col3, NULL, NULL
FROM h
UNION
SELECT DISTINCT NULL, NULL, NULL, col4, NULL,
col1, col2, col3, col4, NULL
FROM h
UNION
SELECT NULL, NULL, NULL, NULL, col5,
col1, col2, col3, col4, col5
FROM h
) BIGUNION
ORDER BY col1, col2, col3, col4, col5
go
DROP TABLE h|||Let me do what I always do and suggest that you get a copy of TREES &
HIERARCHIES IN SQL for several better approachs for modeling this kind
of structure. Right now, you are destroying information with false
NULLs. What were you trying to do?