Showing posts with label time. Show all posts
Showing posts with label time. Show all posts

Sunday, March 11, 2012

Co-Existing with MSDE

Can SQL Express reside on the same server as MSDE and both run at the same time (different apps)?

I have one app that runs on MSDE and a new to be developed app by a vendor that needs SQL Express.

Thanks

JB

Yes, that is possible. When you start the SQL 2005 Express setup, it will detect the MSDE and ask if you wish to upgrade or install a new instance. Choose a new instance.

You may wish to read in Books Online about the topic: "Instance Naming Page"

Code to populate a table

Can someone help me with a code to read my database backup
time and populate it to a table for querying and
reporting.Hi,
The backup informations are already stored in MSDB database. The table name
is backupset.
select database_name,type,backup_start_date,backup_finish_date from
msdb..backupset
regarding backups you could alsee the below tables in msdb database.
backupfile
backupmediafamily
backupmediaset
Thanks
Hari
MCDBA
"Aboki" <hcokoli@.yahoo.com> wrote in message
news:0a4d01c46e75$185d8e70$a601280a@.phx.gbl...
> Can someone help me with a code to read my database backup
> time and populate it to a table for querying and
> reporting.

Code to flatten a CellSet into a datatable

Hi,

Here's some code I've written which flattens a CellSet into a datatable. I looked for a long time to find similar code but could not find any. Can I please have some thoughts on optimisation/elegance etc... I'm a bit new to .NET so any advice would be great!

Thanks.

Code Snippet

Public Function GetFlatData() As DataTable

'If (Me.Cells.Count = 1) Then
' Return New DataTable()
'End If

Dim table As DataTable = New DataTable()
Dim headers As ArrayList = New ArrayList()

For a As Integer = 0 To (Me.Axes.Count - 1)
For i As Integer = 0 To (Me.Axes(a).Set.Hierarchies.Count - 1)
Dim h As Hierarchy = Me.Axes(a).Set.Hierarchies(i)
If (Not h.Name.Contains("Measure")) Then
table.Columns.Add(h.Name)
End If
Next i
Next a

Dim items As ArrayList = New ArrayList()
For x As Int32 = 0 To (Me.Axes(0).Set.Tuples.Count - 1)
Dim tx As Tuple = Me.Axes(0).Set.Tuples(x)
Dim itemBase As CellItem = New CellItem()
For Each mx As Member In tx.Members
If (mx.LevelName.Contains("Measure")) Then
If table.Columns.IndexOf(mx.Caption) = -1 Then
table.Columns.Add(New DataColumn(mx.Caption, GetType(Double)))
End If
itemBase.AddMeasure(mx)
Else
itemBase.AddAttribute(mx)
End If
Next
If (Me.Axes.Count > 1) Then
For y As Int32 = 0 To (Me.Axes(1).Set.Tuples.Count - 1)
Dim item As CellItem = itemBase.Clone(True)

Dim ty As Tuple = Me.Axes(1).Set.Tuples(y)
Dim memy As Member
For Each memy In ty.Members
If (memy.LevelName.Contains("Measure")) Then
item.AddMeasure(memy)
Else
item.AddAttribute(memy)
End If
Next

item.ValueCell = Me.Cells.Item((y * Me.Axes(0).Set.Tuples.Count) + x)
'item.ValueCell = Me.CellGrid(x, y)
items.Add(item)
Next
Else
' for 1 axis cellsets
itemBase.ValueCell = Me.Cells.Item(x)
items.Add(itemBase)
End If
Next
'' might have no measures need to cater
For i As Integer = 0 To (items.Count - 1)
Dim row As DataRow = table.NewRow()
Dim attributes As ArrayList = (CType(items(i), CellItem)).Attributes
For j As Integer = 0 To (attributes.Count - 1)
Dim member As Member = CType(attributes(j), Member)
row(j) = member.Caption
Next
Dim measures As ArrayList = (CType(items(i), CellItem)).Measures
If Not measures Is Nothing Then
' each CellItem should only have one measure
For j As Integer = 0 To (measures.Count - 1)
Dim member As Member = CType(measures(j), Member)

Dim value As Cell = (CType(items(i), CellItem)).ValueCell
If Not (String.IsNullOrEmpty(value.Value)) Then
'need to set appropriate type accroding to cell
'table.Columns[member.Caption].DataType = value.CellProperties.
row(member.Caption) = value.Value
Else
row(member.Caption) = DBNull.Value
End If
Next
End If
table.Rows.Add(row)
Next

Return table
End Function

#End Region

#Region " Private Classes "
Private Class CellItem
Private _measures As ArrayList
Private _attributes As ArrayList
Private _valueCell As Cell

Public Property Attributes() As ArrayList
Get
Return _attributes
End Get
Set(ByVal value As ArrayList)
Me._attributes = value
End Set
End Property

Public Property Measures() As ArrayList
Get
Return _measures
End Get
Set(ByVal value As ArrayList)
Me._measures = value
End Set
End Property

Public Property ValueCell() As Cell
Get
Return _valueCell
End Get
Set(ByVal Value As Cell)
_valueCell = Value
End Set
End Property

Public Sub New()
_attributes = New ArrayList()
_measures = New ArrayList()
End Sub

Public Sub New(ByVal attributes As ArrayList, ByVal measures As ArrayList, ByVal valueCell As Cell)
Me.Attributes = attributes
Me.Measures = measures
Me.ValueCell = valueCell
End Sub

Public Sub AddAttribute(ByVal o As Object)
_attributes.Add(o)
End Sub

Public Sub AddMeasure(ByVal o As Object)
_measures.Add(o)
End Sub

Public Function Clone(ByVal isDeep As Boolean) As Object
If (isDeep) Then
Dim item As CellItem = New CellItem(Me.Attributes.Clone(), Me.Measures.Clone(), Me.ValueCell)
Return item
Else
Return New CellItem(Me.Attributes, Me.Measures, Me.ValueCell)
End If
End Function


AS 2005 can return query result as a flattened rowset instead of cellset. If you can take advantage of the feature then you don't have to do it yourself.|||The code transforms a cellset into a datatable that resembles a standard denormalized fact table.
How do you do that? Is there a feature in MDX to allow this?

|||Your code flattens a CellSet object. Given an AdomdCommand object, calling ExecuteCellSet method returns a CellSet object, calling ExecuteReader method returns an AdomdDataReader object which is a flattened recordset.

Wednesday, March 7, 2012

Code behaviour/performance on 2 machines

Hi,
I have UAT and production servers with same database schema. I am running a
stored procedure on both machines, Its taking much more time on UAT (31 hrs)
where as it is taking less time i.e. 8 hrs (which is expected because of
nature of query) Can someone please explain why is it taking more time on UA
T?
UAT SQL SERVER 2000 has SP4
Production SQL SERVER 2000 has SP3
Please help ASAP.
I can also be reached at sahil.arora@.cit.com
Thanks
SahilJust becuase the servers share the same database model, there is the issue
of differences in hardware configuration and even differences in the
physical implementation of the database such as: volume of data, placement
of files, index fragmentation, statistics, sever/database configurations,
etc. To start with, take a look at the Performance tab of Task Manager on
both servers and compare to what extent they are maxing out on memory and
CPU.
Compare the execution plan between the 2 servers:
http://msdn.microsoft.com/library/d... />
1_1pfd.asp
Also, the following article provides some good performance oriented check
lists and explains how to audit performance.
http://www.sql-server-performance.c...mance_audit.asp
"Sahil Arora" <Sahil Arora@.discussions.microsoft.com> wrote in message
news:40E34A48-D573-46EF-98BE-BA4A84A9A113@.microsoft.com...
> Hi,
> I have UAT and production servers with same database schema. I am running
> a
> stored procedure on both machines, Its taking much more time on UAT (31
> hrs)
> where as it is taking less time i.e. 8 hrs (which is expected because of
> nature of query) Can someone please explain why is it taking more time on
> UAT?
> UAT SQL SERVER 2000 has SP4
> Production SQL SERVER 2000 has SP3
> Please help ASAP.
> I can also be reached at sahil.arora@.cit.com
> Thanks
> Sahil|||I just checked everything on both servers, its same and the server on which
is taking more time is much more powerful than server with less time. any
comments?
"JT" wrote:

> Just becuase the servers share the same database model, there is the issue
> of differences in hardware configuration and even differences in the
> physical implementation of the database such as: volume of data, placement
> of files, index fragmentation, statistics, sever/database configurations,
> etc. To start with, take a look at the Performance tab of Task Manager on
> both servers and compare to what extent they are maxing out on memory and
> CPU.
> Compare the execution plan between the 2 servers:
> http://msdn.microsoft.com/library/d...>
n_1_1pfd.asp
> Also, the following article provides some good performance oriented check
> lists and explains how to audit performance.
> http://www.sql-server-performance.c...mance_audit.asp
>
> "Sahil Arora" <Sahil Arora@.discussions.microsoft.com> wrote in message
> news:40E34A48-D573-46EF-98BE-BA4A84A9A113@.microsoft.com...
>
>|||Do both servers have identical volumes of data, is the execution plan of the
query identical, is the OS level file fragmentation and database level index
fragmentation optimized or similar on both servers, etc.. It could be one or
all of a hundred things. Perhaps running a performance audit log on both
servers and comparing the results will reveal something.
INF: Job to Monitor SQL Server 2000 Performance and Activity
http://support.microsoft.com/defaul...kb;en-us;283696
"Sahil Arora" <SahilArora@.discussions.microsoft.com> wrote in message
news:2FE8B79F-9EC2-445A-9648-65F1C7CAABAD@.microsoft.com...
>I just checked everything on both servers, its same and the server on which
> is taking more time is much more powerful than server with less time. any
> comments?
> "JT" wrote:
>

Code - Integer, Nothing vs Zero

The piece of code below attempts to convert minutes to a time string.
The problem I am having is if the value of Minutes is NULL, it treats it as
zero.
Has anyone got any suggestions ?
Thanks
Steve
---
Public Function MinutesToTime(ByVal Minutes AS Integer)
On Error GoTo errorhandler
Dim mins
Dim hrs
If IsNothing(Minutes) Then
MinutesToTime = ""
Else
hrs = Fix(Minutes / 60)
mins = Minutes - (hrs * 60)
If mins < 10 Then mins = "0" & mins
MinutesToTime = hrs & ":" & mins
End If
Exit Function
errorhandler:
MinutesToTime = "##:##"
End FunctionFirst off this is a function, you should be explicit on your return values.
You have two DIM's without specifing the type... then you have a check for
NULL (if nothing) you return a string... so which is it?
What happens if the minutes is actually 0 - what would you return? Would it
be an empty string or "00:00" ' If that is the case, then why not, for NULL
values, return "00:00" - the same as if you specified 0 minutes?
=-Chris
"SteveH" <SteveH@.discussions.microsoft.com> wrote in message
news:05257274-EDEA-438A-B6E5-054E122BC5C1@.microsoft.com...
> The piece of code below attempts to convert minutes to a time string.
> The problem I am having is if the value of Minutes is NULL, it treats it
> as
> zero.
> Has anyone got any suggestions ?
> Thanks
> Steve
> ---
> Public Function MinutesToTime(ByVal Minutes AS Integer)
> On Error GoTo errorhandler
> Dim mins
> Dim hrs
> If IsNothing(Minutes) Then
> MinutesToTime = ""
> Else
> hrs = Fix(Minutes / 60)
> mins = Minutes - (hrs * 60)
> If mins < 10 Then mins = "0" & mins
> MinutesToTime = hrs & ":" & mins
> End If
> Exit Function
> errorhandler:
> MinutesToTime = "##:##"
> End Function
>|||Thanks Chris for your reply
I am wanting to pass in an integer representing minutes and return a string
that looks like a time as per the following examples.
67 returns "1:07"
0 returns "0:00"
NULL returns ""
My problems is that when NULL is passed in I am currently getting "0:00"
instead of "".
I have tried using IsNull function but I get a compilation error "Name
'IsNull' is not declared."
"Chris Conner" wrote:
> First off this is a function, you should be explicit on your return values.
> You have two DIM's without specifing the type... then you have a check for
> NULL (if nothing) you return a string... so which is it?
> What happens if the minutes is actually 0 - what would you return? Would it
> be an empty string or "00:00" ' If that is the case, then why not, for NULL
> values, return "00:00" - the same as if you specified 0 minutes?
> =-Chris
> "SteveH" <SteveH@.discussions.microsoft.com> wrote in message
> news:05257274-EDEA-438A-B6E5-054E122BC5C1@.microsoft.com...
> > The piece of code below attempts to convert minutes to a time string.
> >
> > The problem I am having is if the value of Minutes is NULL, it treats it
> > as
> > zero.
> >
> > Has anyone got any suggestions ?
> >
> > Thanks
> > Steve
> > ---
> >
> > Public Function MinutesToTime(ByVal Minutes AS Integer)
> > On Error GoTo errorhandler
> >
> > Dim mins
> > Dim hrs
> >
> > If IsNothing(Minutes) Then
> > MinutesToTime = ""
> > Else
> > hrs = Fix(Minutes / 60)
> > mins = Minutes - (hrs * 60)
> >
> > If mins < 10 Then mins = "0" & mins
> >
> > MinutesToTime = hrs & ":" & mins
> > End If
> >
> > Exit Function
> >
> > errorhandler:
> > MinutesToTime = "##:##"
> >
> > End Function
> >
>
>|||Reporting Services doesn't support 'code reuse'
so I would reccomend just doing this in Microsoft Access; it would be a
simple format string there; right?
-Aaron
SteveH wrote:
> Thanks Chris for your reply
> I am wanting to pass in an integer representing minutes and return a string
> that looks like a time as per the following examples.
> 67 returns "1:07"
> 0 returns "0:00"
> NULL returns ""
> My problems is that when NULL is passed in I am currently getting "0:00"
> instead of "".
> I have tried using IsNull function but I get a compilation error "Name
> 'IsNull' is not declared."
> "Chris Conner" wrote:
> > First off this is a function, you should be explicit on your return values.
> > You have two DIM's without specifing the type... then you have a check for
> > NULL (if nothing) you return a string... so which is it?
> > What happens if the minutes is actually 0 - what would you return? Would it
> > be an empty string or "00:00" ' If that is the case, then why not, for NULL
> > values, return "00:00" - the same as if you specified 0 minutes?
> >
> > =-Chris
> >
> > "SteveH" <SteveH@.discussions.microsoft.com> wrote in message
> > news:05257274-EDEA-438A-B6E5-054E122BC5C1@.microsoft.com...
> > > The piece of code below attempts to convert minutes to a time string.
> > >
> > > The problem I am having is if the value of Minutes is NULL, it treats it
> > > as
> > > zero.
> > >
> > > Has anyone got any suggestions ?
> > >
> > > Thanks
> > > Steve
> > > ---
> > >
> > > Public Function MinutesToTime(ByVal Minutes AS Integer)
> > > On Error GoTo errorhandler
> > >
> > > Dim mins
> > > Dim hrs
> > >
> > > If IsNothing(Minutes) Then
> > > MinutesToTime = ""
> > > Else
> > > hrs = Fix(Minutes / 60)
> > > mins = Minutes - (hrs * 60)
> > >
> > > If mins < 10 Then mins = "0" & mins
> > >
> > > MinutesToTime = hrs & ":" & mins
> > > End If
> > >
> > > Exit Function
> > >
> > > errorhandler:
> > > MinutesToTime = "##:##"
> > >
> > > End Function
> > >
> >
> >
> >|||Finally found a solution and thought I would post it here for anyone who has
the same problem.
datatype needed to be Nullable(Of Integer) instead of Integer
Public Function MinutesToTime(ByVal Minutes As Nullabe(Of Integer)) AS
String
then use HasValue instead of IsNothing
If Minutes.HasValue Then
and Minutes.Value
"SteveH" wrote:
> Thanks Chris for your reply
> I am wanting to pass in an integer representing minutes and return a string
> that looks like a time as per the following examples.
> 67 returns "1:07"
> 0 returns "0:00"
> NULL returns ""
> My problems is that when NULL is passed in I am currently getting "0:00"
> instead of "".
> I have tried using IsNull function but I get a compilation error "Name
> 'IsNull' is not declared."
> "Chris Conner" wrote:
> > First off this is a function, you should be explicit on your return values.
> > You have two DIM's without specifing the type... then you have a check for
> > NULL (if nothing) you return a string... so which is it?
> > What happens if the minutes is actually 0 - what would you return? Would it
> > be an empty string or "00:00" ' If that is the case, then why not, for NULL
> > values, return "00:00" - the same as if you specified 0 minutes?
> >
> > =-Chris
> >
> > "SteveH" <SteveH@.discussions.microsoft.com> wrote in message
> > news:05257274-EDEA-438A-B6E5-054E122BC5C1@.microsoft.com...
> > > The piece of code below attempts to convert minutes to a time string.
> > >
> > > The problem I am having is if the value of Minutes is NULL, it treats it
> > > as
> > > zero.
> > >
> > > Has anyone got any suggestions ?
> > >
> > > Thanks
> > > Steve
> > > ---
> > >
> > > Public Function MinutesToTime(ByVal Minutes AS Integer)
> > > On Error GoTo errorhandler
> > >
> > > Dim mins
> > > Dim hrs
> > >
> > > If IsNothing(Minutes) Then
> > > MinutesToTime = ""
> > > Else
> > > hrs = Fix(Minutes / 60)
> > > mins = Minutes - (hrs * 60)
> > >
> > > If mins < 10 Then mins = "0" & mins
> > >
> > > MinutesToTime = hrs & ":" & mins
> > > End If
> > >
> > > Exit Function
> > >
> > > errorhandler:
> > > MinutesToTime = "##:##"
> > >
> > > End Function
> > >
> >
> >
> >

COALESCE(NULLIF(@intError, 0), @@ERROR)

Anybody know if the COALESCE(NULLIF ...)...) can raise error itself, and if
it safely to use this combination of checking error status
Every time after i calling to some store procedure i use this:
---
DECLARE @.intError int
EXEC @.intError = myProcedure @.param1, @.param2 ....
SELECT @.intError = COALESCE(NULLIF(@.intError, 0), @.@.ERROR)
IF(@.intError =0 )
.....
.....
---
my question is, can the @.@.ERROR variable have an error that COALESCE or
NULLIF function were raise?
Thanks.
P.S. if it's not good idea to use it after calling to stored procedures so
what can u advice me
Message posted via http://www.webservertalk.comHi
I'm not sure I understand you.
Why not just doing the following?
create proc myproc
@.par int
as
--do something here
if @.@.error <>0
return -1
else
resturn 1
go
declare @.err int
select @.err=exec myproc @.par
if @.err =-1
raiserror ('It was an error',16,1)
Read this great article
http://www.sommarskog.se/error-handling-I.html
"E B via webservertalk.com" <forum@.nospam.webservertalk.com> wrote in message
news:dc61838570f642498321c727d4c5742b@.SQ
webservertalk.com...
> Anybody know if the COALESCE(NULLIF ...)...) can raise error itself, and
if
> it safely to use this combination of checking error status
> Every time after i calling to some store procedure i use this:
> ---
> DECLARE @.intError int
> EXEC @.intError = myProcedure @.param1, @.param2 ....
> SELECT @.intError = COALESCE(NULLIF(@.intError, 0), @.@.ERROR)
> IF(@.intError =0 )
> .....
> .....
> ---
> my question is, can the @.@.ERROR variable have an error that COALESCE or
> NULLIF function were raise?
> Thanks.
> P.S. if it's not good idea to use it after calling to stored procedures so
> what can u advice me
> --
> Message posted via http://www.webservertalk.com|||However my question is, can the COALESCE or NULLIF functions change the
status of @.@.ERROR variable
Message posted via http://www.webservertalk.com|||Any statement *could* result in an error but that looks pretty unlikely
in this case. Your code is about as safe as any other error-handling
code can be. In general keep your error handling code as simple as
possible.
David Portas
SQL Server MVP
--|||so is it good idea to use COALESCE(NULLIF(@.intError, 0), @.@.ERROR)
after caling to some stored procedure or function in sql
Thanks
Message posted via http://www.webservertalk.com|||what the way i need to check if any error occured after calling to stored
procedure?
Message posted via http://www.webservertalk.com|||An SP won't actually return a value of NULL but if the SP can't be run (mayb
e
it doesn't exist or you don't have EXEC permissions) then the result leaves
the value of @.interror unaffected (NULL in your case). In that situation you
r
code will assign the error code to @.interror, which seems reasonable enough.
David Portas
SQL Server MVP
--
"E B via webservertalk.com" wrote:

> so is it good idea to use COALESCE(NULLIF(@.intError, 0), @.@.ERROR)
> after caling to some stored procedure or function in sql
> Thanks
> --
> Message posted via http://www.webservertalk.com
>|||There is no error event in TSQL so the only way is to check the @.@.ERROR valu
e
after EVERY statement. This doesn't catch all errors though (see the article
that Uri posted). A system I'm using is to put error-handling in its own pro
c
and call that with @.@.ERROR as a parameter:
EXEC @.err = usp_error_handler @.@.ERROR, @.calling_proc, @.user_id
the proc redturns the @.@.ERROR value. If @.@.ERROR is zero the proc just
returns immediately without executing the handling code.
That's reasonable for processes that are long running but maybe not an
overhead you'll want in an SP that's called frequently. TSQL in SQL Server
2000 provides very little scope for good error handling and much of the time
you may find it easier and better to catch errors in your calling code in VB
/ C# or whatever.
David Portas
SQL Server MVP
--

COALESCE with parameters

I am trying to build a report table based on user supplied criteria at run time. The user may or may not enter criteria into one or more fields. I used the COLAESCE as follows (the temp vars may be passed valid data or left null by the user):

select * from dbo.employee

where LastName>=COALESCE(@.ln,lastname) andLastName<=COALESCE(@.ln2,lastname) andFirstName>=COALESCE(@.fn,firstname) andFirstName<=COALESCE(@.fn2,firstname) andhiredate>=COALESCE(@.hire,hiredate) andhiredate<=COALESCE(@.hire2,hiredate) andcheckdate>=COALESCE(@.chk,checkdate) andcheckdate<=COALESCE(@.chk2,checkdate)

The problem comes when I want to return rows that include columns that may be null. For example the CHECKDATE col might be the date the employee was reviewed and for new employees it may be null. I still want to return that row.

I had thought of creating default values for every column when the user adds a row to a table. I can set all char fields = ' ' and int fields = 0, but what is a valid default value for a date type col that won't cause problems when other procs try to grab the field and use it?

Or is there a better way to use the COALESCE function?

Thanks all!

I would add a third parameter to the coalesce function. For instance COALESCE(@.var,FieldName,'1/1/1900'). The third field would be the "default" value if the first two return null. HTH.

-Chris

|||If you couldn't choose some value as "empty", you could add additional parameter like @.ln_is_empty and then use something like (@.ln_is_empty=1 or (Lastname>=@.ln and @.ln_is_empty=0) )|||

Assuming that the query is contained within a stored procedure then you would have to start by declaring another input parameter per search term to indicate whether the WHERE condition for the relevant column should check for NULL or whether the search term should be ignored (i.e. equal to itself), currently it seems that you have no way to distinguish between the two.

Once this has been done you can use:

WHERE ((checkdate >= COALESCE(@.chk,checkdate) and checkdate <= COALESCE(@.chk2,checkdate))

OR (@.checkdateisnull = 1 AND checkdate IS NULL))

As an aside, with a query such as the one you have presented you are unlikely to see great performance. It might be better to dynamically create and execute a SQL string inside the stored procedure, forget using COALESCE inside the SQL string and include only what's actually needed in the WHERE clause - using COALESCE in the way that you have done is likely to lead to table / index scans and gives little scope for performance improvements by indexing.

Chris

|||

There are better ways to write this query than using COALESCE with column names. The above usage will negate use of any indexes on the columns. So you will be pretty much scanning the entire table for any combination of parameters. See the link below for various techniques that will help you solve the problem. Look for my name to see some techniques that use COALESCE/ISNULL but with better results. Erland also covers in detail other techniques that will help you get the best results.

http://www.sommarskog.se/dyn-search.html

|||

Thanks!!!

I'll be studying that document for quite some time!

Friday, February 24, 2012

Clustering on SQL Standard Edition?

I guess it is not possible. We can't afford the cost and at the same time downtime, I want to know if it is possible to simulate clustering using SQL Standard edition with minimal downtime. E.g., if I am running Windows 2000 Advanced Server in a cluster a
nd install SQL Server 1 on box1 and point to the data on the disk array and keep it running. When SQL server 1 crashes or stops functioning, can I start SQL Server 2 (on a diff box) and attach the databases on the disk array will it function smoothly. I g
uess it is a stupid question (it doesn't makes sense to me either), but if you have some insights on this please post them.
If you can count the cost of downtime then, depending on these costs to business, you may be able to justify to management the cost of moving to W2K Advanced Server or W2K3 Enterprise Edition and SQL2K Enterprise Edition. Introducing manual processes to
simulate High Availaible is a mistake. But you already knew that ;-)
|||Clustering is an Enterprise Edition feature only.
However, what you outline for a failover scenario will work exactly as you
expect it will. As long as the second SQL Server can gain access to the
data files, the SQL Server will start up cleanly with full access to your
data. The only thing you would have to manage is that your applications
have to be repointed to the new server.
Mike
Principal Mentor
Solid Quality Learning
"More than just Training"
SQL Server MVP
http://www.solidqualitylearning.com
http://www.mssqlserver.com
|||I can completely understand the cost factor of implementing the cluster.
But the bigger question that needs to be asked is - does the downtime and
loss of productivity justify the savings or a workaround for NOT
implementing high availability clustering ? I guess, the mere fact that
your company is looking at clustering is that they value the high
availability aspect of running a database application and they value the
money lost in terms of lost productivity. From now onwards, it would be a
question of justifying the cost-benefit scenario to your BDMs.
If you try to manually point the database to the shared disk, its possible,
but why would you like to do that? There will be a lot of contingencies to
consider and plan for if we go the manual way.
I would sugges that you have a look at this link
MS SQL Server 2000 High Availability Series
http://www.microsoft.com/technet/pro...y/sqlhalp.mspx
This is written for both Business and Technical folks and could give you
possible pointers on how you can achieve the functionality by justifying
the costs.
Hope this helps.
Sanchan [MSFT]
sanchans@.online.microsoft.com
This posting is provided "AS IS" with no warranties, and confers no rights.

Sunday, February 19, 2012

Clustering more than one SQL Server instance at a time

Hi, ever since last week I have a doubt about a type of clustering
implementation. Is it possible to cluster more than one SQL Server
instance. I mean i know it is possible to cluster one instance... so
that when that instance fails the other one enter into context be it
either manually or automatically... but what happens when there are 3
instances? if one instance fails the other two instances would be
forced to pass their execution to the other server even when maybe
everthing was ok with them
Thanks in advance for the response
AlanI think you misunderstand the relationship between an instance and a server
in a cluster.
A cluster is a group of machines that share a common storage unit and are
configured for failover. The cluster software arbitrates the shared storage
unit so that only one host computer (node) can control a logical disk (LUN)
at a time. Note that the storage logical disk appears to a node as a
physical disk.
A node is a particular host computer within a cluster.
An instance is a virtualized SQL server. It has one or more LUNs from the
shared unit, its own network name and IP address. It is hosted on a single
node at a tim, but can move to another node either in response to a failure
event or by administrator command. It is important to understand the
separation of nodes and instances. Instances are part of the overall
cluster. Nodes are either current or potential hosts. This type of
clustering is called "shared nothing" since no node requires any resource
from any other node in order to operate. When an instance moves to another
host node, the client sees the SQL Server stop and a restart. It still
connects exactly as before, since the IP address and network name moved to
the new host node along with the rest of the instance resources.
Just as a stand-alone system can support multiple instances, o can a
cluster. Each instance is completely independent of any other instance
(more of the "shared nothing" design). Each new instance must have its own
disk(s), IP address, and network name. You can move instances around on
various cluster nodes as you want, completely independent of each other. Of
course, each host node has a finite amount of processor and memory, which
must be shared between any instances it currently hosts.
So yes, you can have many instances in a cluster. Note that with shared
storage systems other than SCSI, you can have more than two nodes in a
cluster. Clusters with X nodes and X- instances are classified as N-1
Clusters.
--
Geoff N. Hiten
Senior SQL Infrastructure Consultant
Microsoft SQL Server MVP
<aferrandiz@.gmail.com> wrote in message
news:1187730948.651429.86880@.r23g2000prd.googlegroups.com...
> Hi, ever since last week I have a doubt about a type of clustering
> implementation. Is it possible to cluster more than one SQL Server
> instance. I mean i know it is possible to cluster one instance... so
> that when that instance fails the other one enter into context be it
> either manually or automatically... but what happens when there are 3
> instances? if one instance fails the other two instances would be
> forced to pass their execution to the other server even when maybe
> everthing was ok with them
> Thanks in advance for the response
> Alan
>|||Hi Geoff,
I believe that the cluster appears to the application as a single IP
address that it connects to. Is it mandatory that this IP address
happens to be one of the nodes participating in the cluster? Or is it a
virtual one?
If yes, what happens when the node whose IP address is visible to the
application happens to crash? If no, does the externally visible IP
address that was mapped to the node that crashed get transferred to
another node that is available and has been elected as the new interface
to the application?
How does this happen exactly?
Thanks,
Sanchet|||The IP ia a virtual one and cannot be a host IP address.
Geoff N. Hiten
Senior SQL Infrastructure Consultant
Microsoft SQL Server MVP
"Sanchet Dighe" <sanchetd@.gmail.com> wrote in message
news:46CC35EA.3030706@.gmail.com...
> Hi Geoff,
> I believe that the cluster appears to the application as a single IP
> address that it connects to. Is it mandatory that this IP address happens
> to be one of the nodes participating in the cluster? Or is it a virtual
> one?
> If yes, what happens when the node whose IP address is visible to the
> application happens to crash? If no, does the externally visible IP
> address that was mapped to the node that crashed get transferred to
> another node that is available and has been elected as the new interface
> to the application?
> How does this happen exactly?
> Thanks,
> Sanchet|||Hi, ever since last week I have a doubt about a type of clustering
implementation.
Is it possible to cluster more than one SQL Server instance. I mean i know
it is possible to cluster one instance...
-- Yes is possible, for each SQL Server instance in a custer you need the
following :
-- A group for each instance of SQL
-- In the new group one disk(lun) o more, It is for install the new SQL
instance, if you plan to have more than 1 disk for the instance at the end
you need to add the disk like dependecies of SQL Server resource in the group
-- Ip Addrees, the setup ask for the ip and at the end of the setup
automatically add the ip resource into the group,
-- SQL name (instance name) , the setup ask for the instance name and at
the end of the setup automatically add the instance name resource into the
group,
so that when that instance fails the other one enter into context be it
either manually or automatically...
-- automatically
but what happens when there are 3 instances? if one instance fails the other
two instances would be forced to pass their execution to the other server
even when maybe everthing was ok with them
-- No, just the instance failed pass to other node in the cluster.. the
other instances still working without problem
Let me know any doubt about the problem...
"aferrandiz@.gmail.com" wrote:
> Hi, ever since last week I have a doubt about a type of clustering
> implementation. Is it possible to cluster more than one SQL Server
> instance. I mean i know it is possible to cluster one instance... so
> that when that instance fails the other one enter into context be it
> either manually or automatically... but what happens when there are 3
> instances? if one instance fails the other two instances would be
> forced to pass their execution to the other server even when maybe
> everthing was ok with them
> Thanks in advance for the response
> Alan
>|||> If yes, what happens when the node whose IP address is visible to the
> application happens to crash? If no, does the externally visible IP
> address that was mapped to the node that crashed get transferred to
> another node that is available and has been elected as the new interface
> to the application?
> How does this happen exactly?
How does this work is how TCP/IP ARP (address resolution protocol) works.
When node A that currently has an IP resource crashes and the cluster service
decides to bring the IP resource up on node B, node B will broadcast an ARP
request to force all the nodes on the subnet to update their ARP cache to map
the IP address to the machine address of node B. So when an external computer
tries to access that same IP address, that IP address now will be resolved to
node B.
I believe in Longhorn this will work slightly differently because the "same
subnet" restriction will be lifted. But the general principle is the same. So
the IP address is not really 'moved', it is just being resolved to a
different computer.
Linchi
"Sanchet Dighe" wrote:
> Hi Geoff,
> I believe that the cluster appears to the application as a single IP
> address that it connects to. Is it mandatory that this IP address
> happens to be one of the nodes participating in the cluster? Or is it a
> virtual one?
> If yes, what happens when the node whose IP address is visible to the
> application happens to crash? If no, does the externally visible IP
> address that was mapped to the node that crashed get transferred to
> another node that is available and has been elected as the new interface
> to the application?
> How does this happen exactly?
> Thanks,
> Sanchet
>

Thursday, February 16, 2012

Clustering

I have a question relating more to documentation and support. I'm trying to find documentation on clustering.

I remember quite some time ago I found a white paper that literally walked you through every step involved in setting up a SQL Server failover cluster. I had also found a white paper that walked you through setting up an Active/Active cluster.

I've been going through Microsoft's site, but all I've found are little bits and pieces.

If anyone can point me in the right direction, or even provide a link, etc. as to where to find some good solid documentation, that would be awesome.

Thanks!!

Anthonyhttp://www.dell.com/sql and scroll to the White papers section|||Gracias Amigo!!!!!

Friday, February 10, 2012

Clustered DB Server

I had prior experience in clustering DB servers. But at that time, the OS did seem to be mature enough to handle clustering. Does any one have more current experience about how clustering sql database servers runs. Faster or slower? Any performance gain at all? Any opinions will be appreciated.Sorry! I made the wrong statement. I meant to say when I did the clustering, the OS did NOT seem to be able to handle it very well. I am looking for opinions from any one who has experience in clustering in a Windows 2000 or 2003(perferrable) environment.|||Windows 2000 seems to have made decent progress in this area, but we have had extraordinary pain with our hardware not liking life. Be forewarned that although MS says it is up and running 24x7, there are some hardware fixes that will bring you down entirely. Notably anything to do with your disk array/cabinet. Also make sure that you place the quorum on its own physical (that's right, physical) device. I know the quorum takes up all of maybe 100MB, but MS suggests this, in order to keep the server running. Basically, if you generate enough I/O on the disk, you can lose sight of the quorum disk, which means the cluster will fall down and go boom.