Showing posts with label following. Show all posts
Showing posts with label following. Show all posts

Tuesday, March 27, 2012

Cluster setup

We are on SQL Server 2000 A/A cluster and are moving to SQL Server 2005 cluster.

Following are the list of things before proceeding, please let me know if it needs any corrections and add-ons:

(side-by-side) Planning for new installation of SQL Server 2005 ( SQL2005INST1 and SQL2005INST2) on node1 and node2 and restoring the databases on SQL2005INST1 and SQL2005INST2 from respective 2000 instances.

1) SQL2005INST1

SQL Network Name

SQL IP address

2) SQL2005INST2

SQL Network Name

SQL IP address

As 2000 is already existing on the cluster.Want some clarity on following questions.

Can I keep the data files on the same disk as 2000 was using ?

Do I need to have new disk for the Quoram drive?

Under "Virtual Server Configuration" wizard during the setup under "Network to use" for "private cluster network" and "public cluster network" do that IP Address and network address and network subnet will be different from what we gave for SQL 2000.

Thanks

ITTECH

1. For eachc cluster instance, you need separate physically shared disk and IP address.

2. If you have enough physical disks and IP addresses, then you can install SQL Server 2005 on the cluster side by side with SQL Server 2000 without affecting SQL Server 2000.

3. IP address may not be in the same subnet, but it should not be already used by any other application. Otherwise, setup will complain that the IP address is already in use.

|||

Thanks for your reply!

Do I need to have separate shared disk for 2005 instances or is this something recommended ?

|||Yes. Each 2005 instance requires separate physically shared disk and IP address.

Cluster problems?

Every now and then (about once a week) our SQL server cluster
(active/passive) becomes unresponsive, and the following events are logged:
Type: Error
Event ID: 17052
Source: MSSQLSERVER
User: N/A
Generated: 8/7/2005 7:58:33 AM
Category: Failover
Message: [sqsrvres] CheckQueryProcessorAlive: sqlexecdirect failed
Data: 9C 42 00 40 01 00 00 00 0B 00 00 00 44 00 41 00 54 00 41 00 42 00 41
00 53 00 45 00 30 00 31 00 00 00 00 00 00 00
Type: Error
Event ID: 17052
Source: MSSQLSERVER
User: N/A
Generated: 8/7/2005 7:58:33 AM
Category: Failover
Message: [sqsrvres] printODBCError: sqlstate = HYT00; native error = 0;
message = [Microsoft][ODBC SQL Server Driver]Timeout expired
Data: 9C 42 00 40 01 00 00 00 0B 00 00 00 44 00 41 00 54 00 41 00 42 00 41
00 53 00 45 00 30 00 31 00 00 00 00 00 00 00
Type: Error
Event ID: 17052
Source: MSSQLSERVER
User: N/A
Generated: 8/7/2005 7:58:33 AM
Category: Failover
Message: [sqsrvres] OnlineThread: QP is not online.
Data: 9C 42 00 40 01 00 00 00 0B 00 00 00 44 00 41 00 54 00 41 00 42 00 41
00 53 00 45 00 30 00 31 00 00 00 00 00 00 00
SQL server errorlog contains these errors:
2005-08-07 07:52:16 - ! [165] ODBC Error: 0, Timeout expired [SQLSTATE HYT00]
2005-08-07 07:52:16 - ! [382] Logon to server '(local)' failed (JobManager)
2005-08-07 07:52:19 - ! [165] ODBC Error: 0, Timeout expired [SQLSTATE HYT00]
2005-08-07 07:52:19 - ! [382] Logon to server '(local)' failed (JobManager)
2005-08-07 07:53:27 - ! [165] ODBC Error: 0, Timeout expired [SQLSTATE HYT00]
2005-08-07 07:53:27 - ! [382] Logon to server '(local)' failed (JobManager)
2005-08-07 07:53:47 - ! [165] ODBC Error: 0, Timeout expired [SQLSTATE HYT00]
2005-08-07 07:53:47 - ! [382] Logon to server '(local)' failed (JobManager)
2005-08-07 07:54:27 - ! [298] SQLServer Error: 11, General network error.
Check your network documentation. [SQLSTATE 08001]
2005-08-07 07:54:27 - ! [298] SQLServer Error: 65534, ConnectionOpen
(PreLoginHandshake()). [SQLSTATE 01000]
2005-08-07 07:54:27 - ! [382] Logon to server '(local)' failed (JobManager)
2005-08-07 07:54:27 - ! [165] ODBC Error: 0, Timeout expired [SQLSTATE HYT00]
2005-08-07 07:54:27 - ! [382] Logon to server '(local)' failed (JobManager)
2005-08-07 07:55:05 - ! [298] SQLServer Error: 11, General network error.
Check your network documentation. [SQLSTATE 08001]
2005-08-07 07:55:05 - ! [298] SQLServer Error: 65534, ConnectionOpen
(PreLoginHandshake()). [SQLSTATE 01000]
2005-08-07 07:57:03 - ! [298] SQLServer Error: 11, General network error.
Check your network documentation. [SQLSTATE 08001]
2005-08-07 07:57:03 - ! [298] SQLServer Error: 65534, ConnectionOpen
(PreLoginHandshake()). [SQLSTATE 01000]
2005-08-07 07:57:03 - ! [382] Logon to server '(local)' failed (JobManager)
During this time, connections are terminated and SQL server does not allow
legitimate accounts to log in. it last for a couple of minutes. The server is
clearly not overloaded, and it doesn't have any specific jobs or anything to
do at this time. I would like to exclude network problems too, because the
machine is otherwise responsive and fine. it's just the SQL server service
that seems to "take a nap". Has anyone seen this before? Win2k3 Ent, SQL 2000
Ent.
thanks
> that seems to "take a nap". Has anyone seen this before? Win2k3 Ent, SQL
2000
> Ent.
I forgot one thing, Win2k3 has SP1, and SQL server has SP3 applied.
- Gabor
sqlsql

Cluster problems?

Every now and then (about once a week) our SQL server cluster
(active/passive) becomes unresponsive, and the following events are logged:
Type: Error
Event ID: 17052
Source: MSSQLSERVER
User: N/A
Generated: 8/7/2005 7:58:33 AM
Category: Failover
Message: [sqsrvres] CheckQueryProcessorAlive: sqlexecdirect failed
Data: 9C 42 00 40 01 00 00 00 0B 00 00 00 44 00 41 00 54 00 41 00 42 00 41
00 53 00 45 00 30 00 31 00 00 00 00 00 00 00
Type: Error
Event ID: 17052
Source: MSSQLSERVER
User: N/A
Generated: 8/7/2005 7:58:33 AM
Category: Failover
Message: [sqsrvres] printODBCError: sqlstate = HYT00; native error = 0;
message = [Microsoft][ODBC SQL Server Driver]Timeout expired
Data: 9C 42 00 40 01 00 00 00 0B 00 00 00 44 00 41 00 54 00 41 00 42 00 41
00 53 00 45 00 30 00 31 00 00 00 00 00 00 00
Type: Error
Event ID: 17052
Source: MSSQLSERVER
User: N/A
Generated: 8/7/2005 7:58:33 AM
Category: Failover
Message: [sqsrvres] OnlineThread: QP is not online.
Data: 9C 42 00 40 01 00 00 00 0B 00 00 00 44 00 41 00 54 00 41 00 42 00 41
00 53 00 45 00 30 00 31 00 00 00 00 00 00 00
SQL server errorlog contains these errors:
2005-08-07 07:52:16 - ! [165] ODBC Error: 0, Timeout expired [SQLSTATE HYT00]
2005-08-07 07:52:16 - ! [382] Logon to server '(local)' failed (JobManager)
2005-08-07 07:52:19 - ! [165] ODBC Error: 0, Timeout expired [SQLSTATE HYT00]
2005-08-07 07:52:19 - ! [382] Logon to server '(local)' failed (JobManager)
2005-08-07 07:53:27 - ! [165] ODBC Error: 0, Timeout expired [SQLSTATE HYT00]
2005-08-07 07:53:27 - ! [382] Logon to server '(local)' failed (JobManager)
2005-08-07 07:53:47 - ! [165] ODBC Error: 0, Timeout expired [SQLSTATE HYT00]
2005-08-07 07:53:47 - ! [382] Logon to server '(local)' failed (JobManager)
2005-08-07 07:54:27 - ! [298] SQLServer Error: 11, General network error.
Check your network documentation. [SQLSTATE 08001]
2005-08-07 07:54:27 - ! [298] SQLServer Error: 65534, ConnectionOpen
(PreLoginHandshake()). [SQLSTATE 01000]
2005-08-07 07:54:27 - ! [382] Logon to server '(local)' failed (JobManager)
2005-08-07 07:54:27 - ! [165] ODBC Error: 0, Timeout expired [SQLSTATE HYT00]
2005-08-07 07:54:27 - ! [382] Logon to server '(local)' failed (JobManager)
2005-08-07 07:55:05 - ! [298] SQLServer Error: 11, General network error.
Check your network documentation. [SQLSTATE 08001]
2005-08-07 07:55:05 - ! [298] SQLServer Error: 65534, ConnectionOpen
(PreLoginHandshake()). [SQLSTATE 01000]
2005-08-07 07:57:03 - ! [298] SQLServer Error: 11, General network error.
Check your network documentation. [SQLSTATE 08001]
2005-08-07 07:57:03 - ! [298] SQLServer Error: 65534, ConnectionOpen
(PreLoginHandshake()). [SQLSTATE 01000]
2005-08-07 07:57:03 - ! [382] Logon to server '(local)' failed (JobManager)
During this time, connections are terminated and SQL server does not allow
legitimate accounts to log in. it last for a couple of minutes. The server is
clearly not overloaded, and it doesn't have any specific jobs or anything to
do at this time. I would like to exclude network problems too, because the
machine is otherwise responsive and fine. it's just the SQL server service
that seems to "take a nap". Has anyone seen this before? Win2k3 Ent, SQL 2000
Ent.
thanks> that seems to "take a nap". Has anyone seen this before? Win2k3 Ent, SQL
2000
> Ent.
I forgot one thing, Win2k3 has SP1, and SQL server has SP3 applied.
- Gabor

Cluster problems?

Every now and then (about once a week) our SQL server cluster
(active/passive) becomes unresponsive, and the following events are logged:
Type: Error
Event ID: 17052
Source: MSSQLSERVER
User: N/A
Generated: 8/7/2005 7:58:33 AM
Category: Failover
Message: [sqsrvres] CheckQueryProcessorAlive: sqlexecdirect failed
Data: 9C 42 00 40 01 00 00 00 0B 00 00 00 44 00 41 00 54 00 41 00 42 00 41
00 53 00 45 00 30 00 31 00 00 00 00 00 00 00
Type: Error
Event ID: 17052
Source: MSSQLSERVER
User: N/A
Generated: 8/7/2005 7:58:33 AM
Category: Failover
Message: [sqsrvres] printODBCError: sqlstate = HYT00; native error = 0;
message = [Microsoft][ODBC SQL Server Driver]Timeout expired
Data: 9C 42 00 40 01 00 00 00 0B 00 00 00 44 00 41 00 54 00 41 00 42 00 41
00 53 00 45 00 30 00 31 00 00 00 00 00 00 00
Type: Error
Event ID: 17052
Source: MSSQLSERVER
User: N/A
Generated: 8/7/2005 7:58:33 AM
Category: Failover
Message: [sqsrvres] OnlineThread: QP is not online.
Data: 9C 42 00 40 01 00 00 00 0B 00 00 00 44 00 41 00 54 00 41 00 42 00 41
00 53 00 45 00 30 00 31 00 00 00 00 00 00 00
SQL server errorlog contains these errors:
2005-08-07 07:52:16 - ! [165] ODBC Error: 0, Timeout expired [SQLSTA
TE HYT00]
2005-08-07 07:52:16 - ! [382] Logon to server '(local)' failed (JobManag
er)
2005-08-07 07:52:19 - ! [165] ODBC Error: 0, Timeout expired [SQLSTA
TE HYT00]
2005-08-07 07:52:19 - ! [382] Logon to server '(local)' failed (JobManag
er)
2005-08-07 07:53:27 - ! [165] ODBC Error: 0, Timeout expired [SQLSTA
TE HYT00]
2005-08-07 07:53:27 - ! [382] Logon to server '(local)' failed (JobManag
er)
2005-08-07 07:53:47 - ! [165] ODBC Error: 0, Timeout expired [SQLSTA
TE HYT00]
2005-08-07 07:53:47 - ! [382] Logon to server '(local)' failed (JobManag
er)
2005-08-07 07:54:27 - ! [298] SQLServer Error: 11, General network error
.
Check your network documentation. [SQLSTATE 08001]
2005-08-07 07:54:27 - ! [298] SQLServer Error: 65534, ConnectionOpen
(PreLoginHandshake()). [SQLSTATE 01000]
2005-08-07 07:54:27 - ! [382] Logon to server '(local)' failed (JobManag
er)
2005-08-07 07:54:27 - ! [165] ODBC Error: 0, Timeout expired [SQLSTA
TE HYT00]
2005-08-07 07:54:27 - ! [382] Logon to server '(local)' failed (JobManag
er)
2005-08-07 07:55:05 - ! [298] SQLServer Error: 11, General network error
.
Check your network documentation. [SQLSTATE 08001]
2005-08-07 07:55:05 - ! [298] SQLServer Error: 65534, ConnectionOpen
(PreLoginHandshake()). [SQLSTATE 01000]
2005-08-07 07:57:03 - ! [298] SQLServer Error: 11, General network error
.
Check your network documentation. [SQLSTATE 08001]
2005-08-07 07:57:03 - ! [298] SQLServer Error: 65534, ConnectionOpen
(PreLoginHandshake()). [SQLSTATE 01000]
2005-08-07 07:57:03 - ! [382] Logon to server '(local)' failed (JobManag
er)
During this time, connections are terminated and SQL server does not allow
legitimate accounts to log in. it last for a couple of minutes. The server i
s
clearly not overloaded, and it doesn't have any specific jobs or anything to
do at this time. I would like to exclude network problems too, because the
machine is otherwise responsive and fine. it's just the SQL server service
that seems to "take a nap". Has anyone seen this before? Win2k3 Ent, SQL 200
0
Ent.
thanks> that seems to "take a nap". Has anyone seen this before? Win2k3 Ent, SQL
2000
> Ent.
I forgot one thing, Win2k3 has SP1, and SQL server has SP3 applied.
- Gabor

Sunday, March 25, 2012

Cluster Model Viewer Timeout

Hi,

I am trying to browse a clustering model and encounter the following timeout error:

XML for Analysis parser: The XML for Analysis request timed out before it was completed.
Execution of the managed stored procedure GetNodeGraph failed with the following error: Exception has been thrown by the target of an invocation.Microsoft::AnalysisServices::AdomdServer::AdomdException.

Is there anything I can do to change settings to enable viewing of this model? Or, perhaps we have too many attributes in the model?

Thanks.

Please try the following:

In BI Dev Studio, go to the Tools menu and select Options\Business Intelligence Designers. Change the value of the Query Timeout to some larger value (600 would be a good start)

|||

Excellent, thanks Bogdan! That worked perfectly. For clarification, it's:

Tools --> Options

--> Browse left-side tree in the pop-up window to Designers --> Analysis Services Designers --> General

Thursday, March 22, 2012

Cluster Failover

Each morning I find that 1 of my servers has failed across and I'm
getting the following error:
Does anyone have any ideas'
Many Thanks
Event Type: Error
Event Source: ClusSvc
Event Category: Startup/Shutdown
Event ID: 1234
Date: 06/09/2006
Time: 09:09:18
User: N/A
Computer: NXNHPSQLSRV1
Description:
The Cluster service account does not have the following required user
rights:
Act as part of the operating system
These user rights were granted to the Cluster service account during
cluster setup and must not be removed.
User Action
Assign these rights to the Cluster service account. One way to do this
is to use Local Security Settings (Secpol.msc). Another way is to edit
the Group Policy object that is associated with the Cluster service
account's user object in Active Directory.
If you have already assigned these rights to the Cluster service
account, and the user rights appear to be removed, a Group Policy
object might be removing the rights. Check with your domain
administrator to find out if this is happening.Hi
Have you checked the rights? I assume it is a domain account that you are
using for the cluster service account?
John
<Joe.Mobley@.nationalexpress.com> wrote in message
news:1157531034.223893.106160@.b28g2000cwb.googlegroups.com...
> Each morning I find that 1 of my servers has failed across and I'm
> getting the following error:
> Does anyone have any ideas'
> Many Thanks
> Event Type: Error
> Event Source: ClusSvc
> Event Category: Startup/Shutdown
> Event ID: 1234
> Date: 06/09/2006
> Time: 09:09:18
> User: N/A
> Computer: NXNHPSQLSRV1
> Description:
> The Cluster service account does not have the following required user
> rights:
> Act as part of the operating system
> These user rights were granted to the Cluster service account during
> cluster setup and must not be removed.
> User Action
> Assign these rights to the Cluster service account. One way to do this
> is to use Local Security Settings (Secpol.msc). Another way is to edit
> the Group Policy object that is associated with the Cluster service
> account's user object in Active Directory.
> If you have already assigned these rights to the Cluster service
> account, and the user rights appear to be removed, a Group Policy
> object might be removing the rights. Check with your domain
> administrator to find out if this is happening.
>|||It's probably time to work with your server admin folks to see what else are
being modified. Nobody should be revoking privileges like this from service
accounts. Whether it's modified systematically via some group policy or
manually by someone mucking around, you've got a potentially big problem.
Linchi
"Joe.Mobley@.nationalexpress.com" wrote:

> Each morning I find that 1 of my servers has failed across and I'm
> getting the following error:
> Does anyone have any ideas'
> Many Thanks
> Event Type: Error
> Event Source: ClusSvc
> Event Category: Startup/Shutdown
> Event ID: 1234
> Date: 06/09/2006
> Time: 09:09:18
> User: N/A
> Computer: NXNHPSQLSRV1
> Description:
> The Cluster service account does not have the following required user
> rights:
> Act as part of the operating system
> These user rights were granted to the Cluster service account during
> cluster setup and must not be removed.
> User Action
> Assign these rights to the Cluster service account. One way to do this
> is to use Local Security Settings (Secpol.msc). Another way is to edit
> the Group Policy object that is associated with the Cluster service
> account's user object in Active Directory.
> If you have already assigned these rights to the Cluster service
> account, and the user rights appear to be removed, a Group Policy
> object might be removing the rights. Check with your domain
> administrator to find out if this is happening.
>|||Sounds like a GP issue -removing rights from the cluster service account.
Check with the Domain admins about providing a static profile to the cluster
service account.
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
<Joe.Mobley@.nationalexpress.com> wrote in message
news:1157531034.223893.106160@.b28g2000cwb.googlegroups.com...
> Each morning I find that 1 of my servers has failed across and I'm
> getting the following error:
> Does anyone have any ideas'
> Many Thanks
> Event Type: Error
> Event Source: ClusSvc
> Event Category: Startup/Shutdown
> Event ID: 1234
> Date: 06/09/2006
> Time: 09:09:18
> User: N/A
> Computer: NXNHPSQLSRV1
> Description:
> The Cluster service account does not have the following required user
> rights:
> Act as part of the operating system
> These user rights were granted to the Cluster service account during
> cluster setup and must not be removed.
> User Action
> Assign these rights to the Cluster service account. One way to do this
> is to use Local Security Settings (Secpol.msc). Another way is to edit
> the Group Policy object that is associated with the Cluster service
> account's user object in Active Directory.
> If you have already assigned these rights to the Cluster service
> account, and the user rights appear to be removed, a Group Policy
> object might be removing the rights. Check with your domain
> administrator to find out if this is happening.
>

Cluster Failover

Each morning I find that 1 of my servers has failed across and I'm
getting the following error:
Does anyone have any ideas'
Many Thanks
Event Type: Error
Event Source: ClusSvc
Event Category: Startup/Shutdown
Event ID: 1234
Date: 06/09/2006
Time: 09:09:18
User: N/A
Computer: NXNHPSQLSRV1
Description:
The Cluster service account does not have the following required user
rights:
Act as part of the operating system
These user rights were granted to the Cluster service account during
cluster setup and must not be removed.
User Action
Assign these rights to the Cluster service account. One way to do this
is to use Local Security Settings (Secpol.msc). Another way is to edit
the Group Policy object that is associated with the Cluster service
account's user object in Active Directory.
If you have already assigned these rights to the Cluster service
account, and the user rights appear to be removed, a Group Policy
object might be removing the rights. Check with your domain
administrator to find out if this is happening.Hi
Have you checked the rights? I assume it is a domain account that you are
using for the cluster service account?
John
<Joe.Mobley@.nationalexpress.com> wrote in message
news:1157531034.223893.106160@.b28g2000cwb.googlegroups.com...
> Each morning I find that 1 of my servers has failed across and I'm
> getting the following error:
> Does anyone have any ideas'
> Many Thanks
> Event Type: Error
> Event Source: ClusSvc
> Event Category: Startup/Shutdown
> Event ID: 1234
> Date: 06/09/2006
> Time: 09:09:18
> User: N/A
> Computer: NXNHPSQLSRV1
> Description:
> The Cluster service account does not have the following required user
> rights:
> Act as part of the operating system
> These user rights were granted to the Cluster service account during
> cluster setup and must not be removed.
> User Action
> Assign these rights to the Cluster service account. One way to do this
> is to use Local Security Settings (Secpol.msc). Another way is to edit
> the Group Policy object that is associated with the Cluster service
> account's user object in Active Directory.
> If you have already assigned these rights to the Cluster service
> account, and the user rights appear to be removed, a Group Policy
> object might be removing the rights. Check with your domain
> administrator to find out if this is happening.
>|||It's probably time to work with your server admin folks to see what else are
being modified. Nobody should be revoking privileges like this from service
accounts. Whether it's modified systematically via some group policy or
manually by someone mucking around, you've got a potentially big problem.
Linchi
"Joe.Mobley@.nationalexpress.com" wrote:
> Each morning I find that 1 of my servers has failed across and I'm
> getting the following error:
> Does anyone have any ideas'
> Many Thanks
> Event Type: Error
> Event Source: ClusSvc
> Event Category: Startup/Shutdown
> Event ID: 1234
> Date: 06/09/2006
> Time: 09:09:18
> User: N/A
> Computer: NXNHPSQLSRV1
> Description:
> The Cluster service account does not have the following required user
> rights:
> Act as part of the operating system
> These user rights were granted to the Cluster service account during
> cluster setup and must not be removed.
> User Action
> Assign these rights to the Cluster service account. One way to do this
> is to use Local Security Settings (Secpol.msc). Another way is to edit
> the Group Policy object that is associated with the Cluster service
> account's user object in Active Directory.
> If you have already assigned these rights to the Cluster service
> account, and the user rights appear to be removed, a Group Policy
> object might be removing the rights. Check with your domain
> administrator to find out if this is happening.
>|||Sounds like a GP issue -removing rights from the cluster service account.
Check with the Domain admins about providing a static profile to the cluster
service account.
--
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
<Joe.Mobley@.nationalexpress.com> wrote in message
news:1157531034.223893.106160@.b28g2000cwb.googlegroups.com...
> Each morning I find that 1 of my servers has failed across and I'm
> getting the following error:
> Does anyone have any ideas'
> Many Thanks
> Event Type: Error
> Event Source: ClusSvc
> Event Category: Startup/Shutdown
> Event ID: 1234
> Date: 06/09/2006
> Time: 09:09:18
> User: N/A
> Computer: NXNHPSQLSRV1
> Description:
> The Cluster service account does not have the following required user
> rights:
> Act as part of the operating system
> These user rights were granted to the Cluster service account during
> cluster setup and must not be removed.
> User Action
> Assign these rights to the Cluster service account. One way to do this
> is to use Local Security Settings (Secpol.msc). Another way is to edit
> the Group Policy object that is associated with the Cluster service
> account's user object in Active Directory.
> If you have already assigned these rights to the Cluster service
> account, and the user rights appear to be removed, a Group Policy
> object might be removing the rights. Check with your domain
> administrator to find out if this is happening.
>

Tuesday, March 20, 2012

Cluster and Mirroring with 2005

I am looking for some advice on the following problem.
I need a redundant SQL solution at our main location and a warm site in
a different, off site location. The warm site would only become a hot
site if we had a complete failure at the main location.
What I was thinking was to create a failover cluster at our main
location incase of simple hardware failure, the other server could take
over. At the warm site I would have a witness server and have the
database mirrored to a sql server there. I am going to be using sql
server 2005.
Is this a possible solution? If not, can you please point me in the
right direction. $$$ is not really an issue.
That is certainly a possible scenario. Remember that mirroring works at the
database level, not at the server level. You will have to do some
customization if you want to make it work for multiple databases. There are
also performance, latency, and network bandwidth costs for mirroring. The
lower your tolerance for data loss and outage time, the higher those costs.
If money really isn't an issue, you may want to look at SAN-level data
replication technologies. Since you will have a SAN for the cluster anyway,
this may be a better option. Make sure the SAN vendor can keep multiple
LUNS in synch or you may end up with mismatched data and log partitions,
causing a corrupt and unusable database.
Geoff N. Hiten
Senior Database Administrator
Microsoft SQL Server MVP
<dwclark@.gmail.com> wrote in message
news:1130250702.646778.85520@.g47g2000cwa.googlegro ups.com...
>I am looking for some advice on the following problem.
> I need a redundant SQL solution at our main location and a warm site in
> a different, off site location. The warm site would only become a hot
> site if we had a complete failure at the main location.
> What I was thinking was to create a failover cluster at our main
> location incase of simple hardware failure, the other server could take
> over. At the warm site I would have a witness server and have the
> database mirrored to a sql server there. I am going to be using sql
> server 2005.
> Is this a possible solution? If not, can you please point me in the
> right direction. $$$ is not really an issue.
>
|||I noticed that you said 'warm site'. By 'warm', I assume you can afford
losing some data during a site failover. If you can afford data loss of up
to 15 minutes or so, the plain old log shipping may be the simplest and
cheapest solution to consider. I'd keep it simple if a simple solution is
enough.
Linchi
<dwclark@.gmail.com> wrote in message
news:1130250702.646778.85520@.g47g2000cwa.googlegro ups.com...
>I am looking for some advice on the following problem.
> I need a redundant SQL solution at our main location and a warm site in
> a different, off site location. The warm site would only become a hot
> site if we had a complete failure at the main location.
> What I was thinking was to create a failover cluster at our main
> location incase of simple hardware failure, the other server could take
> over. At the warm site I would have a witness server and have the
> database mirrored to a sql server there. I am going to be using sql
> server 2005.
> Is this a possible solution? If not, can you please point me in the
> right direction. $$$ is not really an issue.
>
|||Database mirroring is certainly an option, but so would be log shipping,
remote mirroring, or stretch clustering.
You might want to check out the following. Although for SS2K, most of the
information still applies, with the exception of DB mirroring.
Microsoft SQL Server 2000 High Availability Series
http://www.microsoft.com/technet/pro...y/sqlhalp.mspx
SQL Server 2000 High Availability Series
Implementing Remote Mirroring and Stretch Clustering
http://www.microsoft.com/technet/pro...y/hasog05.mspx
SQL Server 2005 Mission Critical High Availability
http://www.microsoft.com/technet/pro...s/default.mspx
Sincerely,
Anthony Thomas

<dwclark@.gmail.com> wrote in message
news:1130250702.646778.85520@.g47g2000cwa.googlegro ups.com...
> I am looking for some advice on the following problem.
> I need a redundant SQL solution at our main location and a warm site in
> a different, off site location. The warm site would only become a hot
> site if we had a complete failure at the main location.
> What I was thinking was to create a failover cluster at our main
> location incase of simple hardware failure, the other server could take
> over. At the warm site I would have a witness server and have the
> database mirrored to a sql server there. I am going to be using sql
> server 2005.
> Is this a possible solution? If not, can you please point me in the
> right direction. $$$ is not really an issue.
>

Cluster active/active/active

Dear, I am needing to grant tolerance to shortcomings to a Server
SQL. The consultation is the following one, in Windows 2003 can have up to 8
nodes
in a Cluster, in my Cluster at the moment have two instances of SQL, it is
to say, an active/active, according to the above-mentioned, I can add him a
third
node to the Cluster, but I don't have clear if I can install a third
instance
in that same cluster, a thing like activo/activo/activo, somebody has him
fact or is it theoretically and technically fctible...?, according to my
theory,
it could be feasible, since to the moment to install the third instance
Virtual, he/she should only choose available two nodes of the three....,
now
not you if this is feasible in he/she practices it.
Thank you for their attention.
Greetings.
Atte.,
Carlo Sorrel
Hi
Windows 2003 supports 8 node clusters.
SQL Server 2000 supports 4 node clusters, with up to 16 instances of SQL
Server per cluster.
Yes, adding a 3rd node, and running a 3rd instance is possible as is being
used by various customers of Microsoft.
Done think about active/passive active/active etc, think using the new
terminology of "instances".
The biggest thing you have to worry about in multiple instance clusters is
if all instances were to be failed over to 1 node, does the 1 node have
enough RAM to support them all? If you have 3 nodes, each node with 4 GB RAM
and you allocate 2GB per instance, and you failed all 3 instances over to 1
node, the 1 node would not be able to start the last instance as there is
2GB RAM too little.
If you had 2 nodes, in effect, you could run 8 instances on node 1 and 8
instances on node 2, or any combination, adding up to 16, assuming you have
enough resources.
Regards
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Carlo Sorrel" <csorrel@.hotmail.com> wrote in message
news:uYaN9BhbFHA.1040@.TK2MSFTNGP10.phx.gbl...
> Dear, I am needing to grant tolerance to shortcomings to a Server
> SQL. The consultation is the following one, in Windows 2003 can have up to
> 8 nodes
> in a Cluster, in my Cluster at the moment have two instances of SQL, it is
> to say, an active/active, according to the above-mentioned, I can add him
> a third
> node to the Cluster, but I don't have clear if I can install a third
> instance
> in that same cluster, a thing like activo/activo/activo, somebody has him
> fact or is it theoretically and technically fctible...?, according to
> my theory,
> it could be feasible, since to the moment to install the third instance
> Virtual, he/she should only choose available two nodes of the three....,
> now
> not you if this is feasible in he/she practices it.
> Thank you for their attention.
> Greetings.
> Atte.,
> Carlo Sorrel
>

Sunday, March 11, 2012

CLR Trigger Error: Could not find Type xxxx in Assembly

I've got the following code (C# code) but when I execute the Create Trigger
statement I get the error
"Could not find Type 'InheritanceTriggers' in assembly 'CLRTriggers'
I believe I'm satisfying all the rules: the class is public, the method is
public, and the method is static.
Anythoughts?
Create Trigger EnforceInheritanceTrigger on [Person]
For INSERT as External Name CLRTriggers.InheritanceTriggers.EnforceBaseObjec
t
GO
CLRTriggers.dll code below
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using Microsoft.SqlServer.Server;
namespace My.SQLServer
{
public class InheritanceTriggers
{
[SqlTrigger(Name = @."EnforceInheritanceTrigger", Target =
"[dbo].[Person]", Event = "FOR INSERT")]
public static void EnforceBaseObject()
{
SqlTriggerContext context = SqlContext.TriggerContext;
String SQLForInserted = "SELECT * FROM INSERTED;";
string ATableName = "dbo.Person";
if (context.TriggerAction == TriggerAction.Insert)
{
using (SqlConnection connection
= new SqlConnection(@."context connection=true"))
{
connection.Open();
SqlCommand command = new SqlCommand(SQLForInserted,
connection);
SqlDataReader reader = command.ExecuteReader();
while(reader.Read())
{
System.Guid id = (System.Guid)reader[0];
string s = <sql statement is here>;
SqlCommand command1 = new SqlCommand(s, connection);
SqlPipe pipe = SqlContext.Pipe;
pipe.Send(s);
}
reader.Close();
}
}
}
}
}
> Create Trigger EnforceInheritanceTrigger on [Person]
> For INSERT as External Name
> CLRTriggers.InheritanceTriggers.EnforceBaseObject
You need to include your namespace:
Create Trigger EnforceInheritanceTrigger on [Person]
For INSERT as External Name
CLRTriggers.[My.SQLServer.InheritanceTriggers].EnforceBaseObject
Steven|||Unfortunately, that still didn't help:
Could not find Type 'My.SQLServer.InheritanceTriggers' in assembly
'CLRTriggers'.
but thanks for the suggestion...at least it gave me something new to try. :
)
"Steven Hemingray [MSFT]" wrote:

>
> You need to include your namespace:
> Create Trigger EnforceInheritanceTrigger on [Person]
> For INSERT as External Name
> CLRTriggers.[My.SQLServer.InheritanceTriggers].EnforceBaseObject
> Steven
>
>|||I beg your pardon! I got my namespaces mixed up and you are absolutely
correct! Thank you Steve H! (I'll bet you were saying to yourself, "this
guy's nuts", I know that's the problem) :)
"Steven Hemingray [MSFT]" wrote:

>
> You need to include your namespace:
> Create Trigger EnforceInheritanceTrigger on [Person]
> For INSERT as External Name
> CLRTriggers.[My.SQLServer.InheritanceTriggers].EnforceBaseObject
> Steven
>
>

CLR stored procedure crashing SQL Server

I had the following erroneous code in a SQL Server stored C# procedure:

class P

{

private DateTime? e;

public P(

DateTime? e)

{

this.e= e;

}

public DateTime? E

{

get

{

return E; // correction return e;

}

set

{

E= value; // correction e = value;

}

}

}

Calling the getter of E of the class P creates an infinite number of method calls. This causes the .NET stack overflow. This sometimes caused our SQL crash. Here's the log:

29.3.2007 9:46:08 A fatal error occurred in .NET Framework runtime. The server is shutting down.

29.3.2007 9:46:10 Microsoft SQL Server 2005 - 9.00.2153.00 (X64)

May 9 2006 13:58:37

Copyright (c) 1988-2005 Microsoft Corporation

In my opinion an error in SQL server CLR stored procedure must not be able to crash the whole SQL Server, as it seems to do. Could someone verify this?

What makes finding problems like this problematic is that the only error is like ".NET stack overflow". No pointer to where in the code the error occured. It took hours for me to find the problem

Hi JM_F,

This type of coding error certainly should not cause a shutdown in SQL Server, as SQL should be resiliant to stack overflow issues within the CLR. When I run your repro on my machine (x86) I get the expected behavior:

Msg 6538, Level 16, State 49, Procedure sp, Line 0

.NET Framework execution was aborted because of stack overflow.

It's likely that you are hitting a bug in the CLR. Can you describe your specific repro scenario that causes SQL to crash? You mention that SQL only crashes sometimes when you call this SP, do you know of anything that is different between when it causes SQL to crash, and when it does not?

Can you file this as a bug on connect.microsoft.com with any extra information you have? This will make it easier to investigate. If there is a dump file located in your MSSQL\LOG directory, please include that in the bug or email them to me directly at stevehem at microsoft dot com.

Thanks,

Steven

|||

Thank you for your quick reply.

We have two SQL servers installed on two physical servers.

A: a 64-bit Windows server. SQL Server 2005 SP1. The production server.

B: a 64-bit Windows server. SQL Server 2005 SP1. The test server.

The problem in the C# code causes the error message you sent when I run it on B. I've never managed to reproduce the crash on B. Because A is our production server, I can't try to reproduce the problem there anymore. Yesterday I run the erroneuos code maybe ten of times in A and it crashed two times (that I can see from the server log).

I'll send next week a message to connect.microsoft.com with more detailed information that I don't want to put here in the discussion forum.

I don't know whether this is related to the CLR problem, but yesterday evening and today morning the SQL server A got somehow jammed. For example, we couldn't open Management Studio and open Programmability/Stored procedures. It just didn't open. Also the CLR stored procedures just didn't work, they never seemed to finish. We had to restart the SQL server A (I guess this was done by starting and stopping the windows service, don't know for sure, because I didn't do this). Now we have a new problem with registering CLR stored procedures - both of the following commands produce an error:

CREATE PROCEDURE [dbo].prA AS EXTERNAL NAME a.xxxxxx;

GO

drop ASSEMBLY a;

Msg 6512, Level 16, State 27, Procedure prLoadOptionContracts, Line 1

Failed to initialize the Common Language Runtime (CLR) v2.0.50727 with HRESULT 0x80131522. You need to restart SQL server to use CLR integration features.

I guess we have to restart the server again?

|||

This is interesting - this error means that the SQL failed to bind to the CLR host on your server. This is usually due to a bad installation of either the CLR or SqlServer, but in very rare cases it can be a result of memory pressure on the machine when the CLR tries to load. So, if after the server restarts the CLR is able to load, that means it was a memory pressure problem, but if it persists then it is an installation one. The DMV sys.dm_clr_properties may also contain some additional information about what state the CLR is in. Is your server running under WOW?

I'm really not sure if these problems are related. You're the only customer I'm aware of that has hit either of them (a search engine check for both of your error messages returns this thread only). So either you are extremely unlucky or there is some underlying cause for the failures.

Steven

|||

Steven Hemingray - MSFT wrote:

The DMV sys.dm_clr_properties may also contain some additional information about what state the CLR is in.

dm_clr_properties actually gives information:

select * from sys.dm_clr_properties

name value

directory

version

state CLR initialization permanently failed

Steven Hemingray - MSFT wrote:

Is your server running under WOW?

I'm not the sysadmin / DBA so I don't actually know. Is there a simple way to check this?

The CLR stored procedures have been working well inside the SQL server, but there definitely has been other problems with the SQL server installation previously. Some of the issues still are unresolved.

I'll provide you with more details:

Last week, on the same day this "CLR crash" occured the server got somehow "stuck". This happened after these CLR problems. The symptoms were that if I tried to open stored procedures "leaf" in Management Studio, it just didn't open. Additionally the CLR stored procedures didn't seem to finish at all. They consumed CPU, but never finished (or at least we didn't want to wait > 15 minutes for a procedure that normally finishes in < one minute). We had to restart the SQL server procedure. After this restart I get this "you need to restart"-message.

There also are performance / availability problems with the server. I don't know the details of these problems, but I've heard from the others who are using the server that occasionally the server gets jammed "for a while" (15 minutes, let's say) and it doesn't seem to respond to anything. This issue is just for background information, I know there's not a lot you can do with the problem with this ambiguous problem statement. Everything just seems to point at there's something wrong with the SQL Server installation.

|||Today we restarted the SQL server. Now CLR gets initialied:

select * from sys.dm_clr_properties
directory C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\
version v2.0.50727
state CLR is initialized

I installed all the CLR stored procedures, log entry:

Common language runtime (CLR) functionality initialized using CLR version v2.0.50727 from C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\.

I tried to run one of the stored procedures -> SQL server crash with message:"A fatal error occurred in .NET Framework runtime. The server is shutting down."

I filed a bug report (266911) to connect.microsoft.com about the issue. It's private, since I uploaded the server log which may contain sensitive information. Let's hope I get some answers from there.|||

Thanks for filing the bug. Just to confirm, this stored procedure you run is still the erroneous stored procedure with the error causing stack overflow, correct? And with the fixed stored procedure, you do not see the errors? If you continue to have these severe problems on your production server even with the fixed stored procedures, then you should escalate your problem through PSS and that is the only channel that can issue a hotfix.

Steven

|||Actually the stored procedure is now fixed, i.e. it doesn't cause a stack overflow anymore. However, CLR stored procedures seem still crash the server. This has happened once. The error message in the stack dump of the SQL server logs says:"A fatal error occurred in .NET Framework runtime.". I'm not able to try the stored procedure on the server anymore, because it's our production server. I know that the stored procedure as such works OK, because it is run on many times a day on another server without problems.

All this should be said in the bug report a filed.|||

We installed a new server with SQL Server 2005 SP1 (let's call it X) and tried the CRL stored procedures there. The results was the same, the SQL Server immediatelly on X crashed when the stored procedure was run the first time. We updated X to SP2. After that we haven't been able to reproducude the crash on X. After a while we updated the original server to SP2. The problem hasn't occurred there either since the update.

We use ADOMDclient in the CLR stored procedures. The ADOMD DLL has been installed as an assembly in our SQL Server. When we updated the SQL Server to SP2, the ADOMDclient in GAC was updated and we had to update the same version to the assembly in SQL Server (the GAC must have the same version of the library in order the assembly to work inside of SQL Server). I wonder if this problem has something to do with ADOMDClient inside SQL Server....

CLR stored procedure crashing SQL Server

I had the following erroneous code in a SQL Server stored C# procedure:

class P

{

private DateTime? e;

public P(

DateTime? e)

{

this.e= e;

}

public DateTime? E

{

get

{

return E; // correction return e;

}

set

{

E= value; // correction e = value;

}

}

}

Calling the getter of E of the class P creates an infinite number of method calls. This causes the .NET stack overflow. This sometimes caused our SQL crash. Here's the log:

29.3.2007 9:46:08 A fatal error occurred in .NET Framework runtime. The server is shutting down.

29.3.2007 9:46:10 Microsoft SQL Server 2005 - 9.00.2153.00 (X64)

May 9 2006 13:58:37

Copyright (c) 1988-2005 Microsoft Corporation

In my opinion an error in SQL server CLR stored procedure must not be able to crash the whole SQL Server, as it seems to do. Could someone verify this?

What makes finding problems like this problematic is that the only error is like ".NET stack overflow". No pointer to where in the code the error occured. It took hours for me to find the problem

Hi JM_F,

This type of coding error certainly should not cause a shutdown in SQL Server, as SQL should be resiliant to stack overflow issues within the CLR. When I run your repro on my machine (x86) I get the expected behavior:

Msg 6538, Level 16, State 49, Procedure sp, Line 0

.NET Framework execution was aborted because of stack overflow.

It's likely that you are hitting a bug in the CLR. Can you describe your specific repro scenario that causes SQL to crash? You mention that SQL only crashes sometimes when you call this SP, do you know of anything that is different between when it causes SQL to crash, and when it does not?

Can you file this as a bug on connect.microsoft.com with any extra information you have? This will make it easier to investigate. If there is a dump file located in your MSSQL\LOG directory, please include that in the bug or email them to me directly at stevehem at microsoft dot com.

Thanks,

Steven

|||

Thank you for your quick reply.

We have two SQL servers installed on two physical servers.

A: a 64-bit Windows server. SQL Server 2005 SP1. The production server.

B: a 64-bit Windows server. SQL Server 2005 SP1. The test server.

The problem in the C# code causes the error message you sent when I run it on B. I've never managed to reproduce the crash on B. Because A is our production server, I can't try to reproduce the problem there anymore. Yesterday I run the erroneuos code maybe ten of times in A and it crashed two times (that I can see from the server log).

I'll send next week a message to connect.microsoft.com with more detailed information that I don't want to put here in the discussion forum.

I don't know whether this is related to the CLR problem, but yesterday evening and today morning the SQL server A got somehow jammed. For example, we couldn't open Management Studio and open Programmability/Stored procedures. It just didn't open. Also the CLR stored procedures just didn't work, they never seemed to finish. We had to restart the SQL server A (I guess this was done by starting and stopping the windows service, don't know for sure, because I didn't do this). Now we have a new problem with registering CLR stored procedures - both of the following commands produce an error:

CREATE PROCEDURE [dbo].prA AS EXTERNAL NAME a.xxxxxx;

GO

drop ASSEMBLY a;

Msg 6512, Level 16, State 27, Procedure prLoadOptionContracts, Line 1

Failed to initialize the Common Language Runtime (CLR) v2.0.50727 with HRESULT 0x80131522. You need to restart SQL server to use CLR integration features.

I guess we have to restart the server again?

|||

This is interesting - this error means that the SQL failed to bind to the CLR host on your server. This is usually due to a bad installation of either the CLR or SqlServer, but in very rare cases it can be a result of memory pressure on the machine when the CLR tries to load. So, if after the server restarts the CLR is able to load, that means it was a memory pressure problem, but if it persists then it is an installation one. The DMV sys.dm_clr_properties may also contain some additional information about what state the CLR is in. Is your server running under WOW?

I'm really not sure if these problems are related. You're the only customer I'm aware of that has hit either of them (a search engine check for both of your error messages returns this thread only). So either you are extremely unlucky or there is some underlying cause for the failures.

Steven

|||

Steven Hemingray - MSFT wrote:

The DMV sys.dm_clr_properties may also contain some additional information about what state the CLR is in.

dm_clr_properties actually gives information:

select * from sys.dm_clr_properties

name value

directory

version

state CLR initialization permanently failed

Steven Hemingray - MSFT wrote:

Is your server running under WOW?

I'm not the sysadmin / DBA so I don't actually know. Is there a simple way to check this?

The CLR stored procedures have been working well inside the SQL server, but there definitely has been other problems with the SQL server installation previously. Some of the issues still are unresolved.

I'll provide you with more details:

Last week, on the same day this "CLR crash" occured the server got somehow "stuck". This happened after these CLR problems. The symptoms were that if I tried to open stored procedures "leaf" in Management Studio, it just didn't open. Additionally the CLR stored procedures didn't seem to finish at all. They consumed CPU, but never finished (or at least we didn't want to wait > 15 minutes for a procedure that normally finishes in < one minute). We had to restart the SQL server procedure. After this restart I get this "you need to restart"-message.

There also are performance / availability problems with the server. I don't know the details of these problems, but I've heard from the others who are using the server that occasionally the server gets jammed "for a while" (15 minutes, let's say) and it doesn't seem to respond to anything. This issue is just for background information, I know there's not a lot you can do with the problem with this ambiguous problem statement. Everything just seems to point at there's something wrong with the SQL Server installation.

|||Today we restarted the SQL server. Now CLR gets initialied:

select * from sys.dm_clr_properties
directory C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\
version v2.0.50727
state CLR is initialized

I installed all the CLR stored procedures, log entry:

Common language runtime (CLR) functionality initialized using CLR version v2.0.50727 from C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\.

I tried to run one of the stored procedures -> SQL server crash with message:"A fatal error occurred in .NET Framework runtime. The server is shutting down."

I filed a bug report (266911) to connect.microsoft.com about the issue. It's private, since I uploaded the server log which may contain sensitive information. Let's hope I get some answers from there.|||

Thanks for filing the bug. Just to confirm, this stored procedure you run is still the erroneous stored procedure with the error causing stack overflow, correct? And with the fixed stored procedure, you do not see the errors? If you continue to have these severe problems on your production server even with the fixed stored procedures, then you should escalate your problem through PSS and that is the only channel that can issue a hotfix.

Steven

|||Actually the stored procedure is now fixed, i.e. it doesn't cause a stack overflow anymore. However, CLR stored procedures seem still crash the server. This has happened once. The error message in the stack dump of the SQL server logs says:"A fatal error occurred in .NET Framework runtime.". I'm not able to try the stored procedure on the server anymore, because it's our production server. I know that the stored procedure as such works OK, because it is run on many times a day on another server without problems.

All this should be said in the bug report a filed.|||

We installed a new server with SQL Server 2005 SP1 (let's call it X) and tried the CRL stored procedures there. The results was the same, the SQL Server immediatelly on X crashed when the stored procedure was run the first time. We updated X to SP2. After that we haven't been able to reproducude the crash on X. After a while we updated the original server to SP2. The problem hasn't occurred there either since the update.

We use ADOMDclient in the CLR stored procedures. The ADOMD DLL has been installed as an assembly in our SQL Server. When we updated the SQL Server to SP2, the ADOMDclient in GAC was updated and we had to update the same version to the assembly in SQL Server (the GAC must have the same version of the library in order the assembly to work inside of SQL Server). I wonder if this problem has something to do with ADOMDClient inside SQL Server....

Thursday, March 8, 2012

CLR procedure calling webservice

Hi, I want to create following procedure to call a webservice. build ok
execution not ok.
When i do it in a seperated program it works. in the clr procedure not.
It always end with 'System.InvalidOperationException' occurred in
System.Xml.dll
Can some one help me.
Ludo
SQL code:
exec dbo.SendStatusToWebservice 'SQL2K5','TEST Ludo','GREEN'
.Net code
using System;
using System.Data;
using System.Data.Sql;
using System.Data.SqlTypes;
using System.Data.SqlClient;
using Microsoft.SqlServer.Server;
using System.Diagnostics;
public partial class CLR_Procedures
{
[Microsoft.SqlServer.Server.SqlProcedure]
}
public static void SendStatusToWebservice(SqlString MyAppl, SqlString
MyMessage, SqlString MyStatus)
{
string log;
// Connect to webservice and add logging to it
SQL_UDP.bgc.wss.Library wlib = new SQL_UDP.bgc.wss.Library();
wlib.Credentials = System.Net.CredentialCache.DefaultCredentials;
log = wlib.WSScreateLog(MyAppl.Value);
wlib.WSSwriteLog(log, MyMessage.Value);// + " at @. " +
DateTime.Now.ToString);
wlib.SetBatchStatus(MyStatus.Value, log);
}
};
Debug result:
Auto-attach to process '[3068] [SQL] bgc-mikmxeue486' on machine
'bgc-mikmxeue486' succeeded.
Debugging script from project script file.
The thread 'bgc-mikmxeue486 [61]' (0xd60) has exited with code 0 (0x0).
The thread 'bgc-mikmxeue486 [61]' (0xd60) has exited with code 0 (0x0).
The thread 'bgc-mikmxeue486 [61]' (0xd60) has exited with code 0 (0x0).
'sqlservr.exe' (Managed): Loaded
'C:\WINNT\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll',
Skipped loading symbols. Module is optimized and the debugger option 'Just M
y
Code' is enabled.
Auto-attach to process '[3068] sqlservr.exe' on machine 'bgc-mikmxeue486'
succeeded.
'sqlservr.exe' (Managed): Loaded 'C:\Program Files\Microsoft SQL
Server\MSSQL.1\MSSQL\Binn\SqlAccess.dll', Skipped loading symbols. Module is
optimized and the debugger option 'Just My Code' is enabled.
'sqlservr.exe' (Managed): Loaded
'C:\WINNT\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.
dll',
Skipped loading symbols. Module is optimized and the debugger option 'Just M
y
Code' is enabled.
'sqlservr.exe' (Managed): Loaded
'C:\WINNT\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll',
Skipped loading symbols. Module is optimized and the debugger option 'Just M
y
Code' is enabled.
'sqlservr.exe' (Managed): Loaded
'C:\WINNT\assembly\GAC_32\System.Transactions\2.0.0.0__b77a5c561934e089\Syst
em.Transactions.dll',
Skipped loading symbols. Module is optimized and the debugger option 'Just M
y
Code' is enabled.
'sqlservr.exe' (Managed): Loaded
'C:\WINNT\assembly\GAC_MSIL\System.Security\2.0.0.0__b03f5f7f11d50a3a\System
.Security.dll',
Skipped loading symbols. Module is optimized and the debugger option 'Just M
y
Code' is enabled.
'sqlservr.exe' (Managed): Loaded
'C:\WINNT\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.
dll',
Skipped loading symbols. Module is optimized and the debugger option 'Just M
y
Code' is enabled.
'sqlservr.exe' (Managed): Loaded 'SQL_UDP', No symbols loaded.
'sqlservr.exe' (Managed): Loaded
'C:\WINNT\assembly\GAC_MSIL\System.Web.Services\2.0.0.0__b03f5f7f11d50a3a\Sy
stem.Web.Services.dll', No symbols loaded.
'sqlservr.exe' (Managed): Loaded
'C:\WINNT\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\S
ystem.Configuration.dll', No symbols loaded.
'sqlservr.exe' (Managed): Loaded 'WebserviceCLR', Symbols loaded.
A .NET Framework error occurred during execution of user defined routine or
aggregate 'CallWebservice':
System.InvalidOperationException: Cannot load dynamically generated
serialization assembly. In some hosting environments assembly load
functionality is restricted, consider using pre-generated serializer. Please
see inner exception for more information. --> System.IO.FileLoadException:
LoadFrom(), LoadFile(), Load(byte[]) and LoadModule() have been disabled by
the host.
System.IO.FileLoadException:
at System.Reflection.Assembly.nLoadImage(Byte[] rawAssembly, Byte[]
rawSymbolStore, Evidence evidence, StackCrawlMark& stackMark, Boolean
fIntrospection)
at System.Reflection.Assembly.Load(Byte[] rawAssembly, Byte[]
rawSymbolStore, Evidence securityEvidence)
at Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch(CompilerParameters
options, String[] fileNames)
at
Microsoft.CSharp.CSharpCodeGenerator.FromSourceBatch(CompilerParameters
options, String[] sources)
at
Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.C
ompileAssemblyFromSourceBatch(CompilerPa
rameters options, String[] sources)
at
System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromSource(CompilerPa
rameter
..
System.InvalidOperationException:
at System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns,
CompilerParameters parameters, Evidence evidence)
at System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[]
xmlMappings, Type[] types, String defaultNamespace, Evidence evidence,
CompilerParameters parameters, Assembly assembly, Hashtable assemblies)
at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings,
Type[] types, String defaultNamespace, String location, Evidence evidence)
at System.Xml.Serialization.XmlSerializer.FromMappings(XmlMapping[]
mappings, Type type)
at System.Web.Services.Protocols.SoapClientType..ctor(Type type)
at System.Web.Services.Protocols.SoapHttpClientProtocol..ctor()
at WebserviceCLR.wsslib.Library...
No rows affected.
(0 row(s) returned)
Finished running sp_executesql.
A first chance exception of type 'System.InvalidOperationException' occurred
in System.Xml.dll
The thread 'bgc-mikmxeue486 [61]' (0xd60) has exited with code 0 (0x0).
The program '[3068] [SQL] bgc-mikmxeue486: bgc-mikmxeue486' has exited with
code 0 (0x0).
The program '[3068] sqlservr.exe: Managed' has exited with code 259 (0x103)."examnotes" <Ludo@.discussions.microsoft.com> wrote in
news:825F081A-11D6-4D36-8C9A-F8B4AEA96CE5@.microsoft.com:

> Hi, I want to create following procedure to call a webservice. build
> ok execution not ok.
> When i do it in a seperated program it works. in the clr procedure
> not. It always end with 'System.InvalidOperationException' occurred
> in System.Xml.dll
> Can some one help me.
>
[snip]

> In some hosting
> environments assembly load functionality is restricted, consider using
> pre-generated serializer. Please see inner exception for more
> information. --> System.IO.FileLoadException: LoadFrom(), LoadFile(),
> Load(byte[]) and LoadModule() have been disabled by the host.
> System.IO.FileLoadException:
As the error says, SQLCLR doesn't allow you to load a dynamically
generated assembly (which happens when you do web-services). You need to
sgen the proxy code into a dll and catalogue that assembly in SQL
Server.
Niels
****************************************
**********
* Niels Berglund
* http://staff.develop.com/nielsb
* nielsb@.no-spam.develop.com
* "A First Look at SQL Server 2005 for Developers"
* http://www.awprofessional.com/title/0321180593
****************************************
**********

CLR Configuration option problem

Hai,
I develope one application using .Net framework 2.0 and sql server
2005.Some time the following message displayed
Exceution of user code .Net framework is disabled .Enabled 'clr' emabled
configuration option
how to redtify the error
Regards
T.A.Krishna
Hi
"Krishna" wrote:

> Hai,
> I develope one application using .Net framework 2.0 and sql server
> 2005.Some time the following message displayed
> Exceution of user code .Net framework is disabled .Enabled 'clr' emabled
> configuration option
>
This error normally refers to the 'CLR Integration' setting, which you can
set by using the Surface Area Configuration (SAC) tool. If you choose to set
the option by feature then under Database Engine you can see 'CLR
Integration' and the Enable CLR Integration checked box should be checked.

> how to redtify the error
> Regards
> T.A.Krishna
John
|||Krishna wrote:
> Hai,
> I develope one application using .Net framework 2.0 and sql server
> 2005.Some time the following message displayed
> Exceution of user code .Net framework is disabled .Enabled 'clr' emabled
> configuration option
CLR integration is disabled by default.
You must change the configuration option:
EXEC sp_configure 'clr enabled', 1;
RECONFIGURE;
Best regards,
Marcin Guzowski
http://guzowski.info

Wednesday, March 7, 2012

CLR Configuration option problem

Hai,
I develope one application using .Net framework 2.0 and sql server
2005.Some time the following message displayed
Exceution of user code .Net framework is disabled .Enabled 'clr' emabled
configuration option
how to redtify the error
Regards
T.A.KrishnaHi
"Krishna" wrote:
> Hai,
> I develope one application using .Net framework 2.0 and sql server
> 2005.Some time the following message displayed
> Exceution of user code .Net framework is disabled .Enabled 'clr' emabled
> configuration option
>
This error normally refers to the 'CLR Integration' setting, which you can
set by using the Surface Area Configuration (SAC) tool. If you choose to set
the option by feature then under Database Engine you can see 'CLR
Integration' and the Enable CLR Integration checked box should be checked.
> how to redtify the error
> Regards
> T.A.Krishna
John|||Krishna wrote:
> Hai,
> I develope one application using .Net framework 2.0 and sql server
> 2005.Some time the following message displayed
> Exceution of user code .Net framework is disabled .Enabled 'clr' emabled
> configuration option
CLR integration is disabled by default.
You must change the configuration option:
EXEC sp_configure 'clr enabled', 1;
RECONFIGURE;
Best regards,
Marcin Guzowski
http://guzowski.info

CLR Configuration option problem

Hai,
I develope one application using .Net framework 2.0 and sql server
2005.Some time the following message displayed
Exceution of user code .Net framework is disabled .Enabled 'clr' emabled
configuration option
how to redtify the error
Regards
T.A.KrishnaHi
"Krishna" wrote:

> Hai,
> I develope one application using .Net framework 2.0 and sql server
> 2005.Some time the following message displayed
> Exceution of user code .Net framework is disabled .Enabled 'clr' emabled
> configuration option
>
This error normally refers to the 'CLR Integration' setting, which you can
set by using the Surface Area Configuration (SAC) tool. If you choose to set
the option by feature then under Database Engine you can see 'CLR
Integration' and the Enable CLR Integration checked box should be checked.

> how to redtify the error
> Regards
> T.A.Krishna
John|||Krishna wrote:
> Hai,
> I develope one application using .Net framework 2.0 and sql server
> 2005.Some time the following message displayed
> Exceution of user code .Net framework is disabled .Enabled 'clr' emabled
> configuration option
CLR integration is disabled by default.
You must change the configuration option:
EXEC sp_configure 'clr enabled', 1;
RECONFIGURE;
Best regards,
Marcin Guzowski
http://guzowski.info

Closest Time in SQL Table

Hi. I have 2 tables which have the following formats:
TABLE A
PLC_TIME TAGNAME STATUS LOCATION
-- -- -- --
TABLE B
PLC_TIME PCVUE_TIME TAGNAME STATUS LOCATION
-- -- --
-- --
Both tables will be inserted with records by a software continuously
with the PLC_TIME of Table B null, ie
PLC_TIME is not inserted with records. For eg,
TABLE_A
PLC_TIME TAGNAME STATUS LOCATION
-- -- -- --
07-05-2007 1:00:32pm TAG.A ON SITEA
07-05-2007 1:40:11pm TAG.A OFF SITEA
07-05-2007 1:10:31pm TAG.A ON SITEA
07-05-2007 2:10:11pm TAG.B NORMAL SITEB
TABLE_B
PLC_TIME PCVUE_TIME TAGNAME STATUS LOCATION
-- -- --
-- --
null 07-05-2007 1:00:39pmTAG.A ONSITEA
null 07-05-2007 1:41:22pmTAG.A OFF SITEA
null 07-05-2007 2:10:12pm TAG.B NORMAL SITEB
I'm required to update PLC_TIME of TABLE B with the PLC_TIME from
table A
which both of them have the same TAGNAME and STATUS and the PLC_TIME
from table A must be
the CLOSEST to the PCVUE_TIME in table b. PLC_TIME is also always
earlier than PCVUE_TIME.
I have used the following SQL command in my VB program to update the
CLOSEST PLC_TIME of TABLE_B:
UPDATE TABLE_B SET PLC_TIME = (SELECT MAX(PLC_TIME) FROM TABLE_A WHERE
TAGNAME = TABLE_B.TAGNAME AND STATUS = TABLE_B.STATUS
AND PLC_TIME<TABLE_B.PCVUE_TIME AND
ABS(DATEDIFF(MINUTE,PLC_TIME,PCVUE_TIME))<31)
(Note: 31 is just an estimation of the maximum difference of PLC_TIME
and PCVUE_TIME in normal case.)
Since both TABLE_A and TABLE_B are updated randomly and the timing may
not be in order, i.e. Some earlier records may be inserted into
TABLE_A and TABLE_B
by the software, my VB program needs to "update TABLE_B set PLC_TIME"
constantly until the CLOSEST PLC_TIME is updated.
What i can think of is DATEDIFF() but DATEDIFF has a limitation that
it only compares the specific MINUTE of
PCVUE_TIME and PLC_TIME if i use DATEDIFF(minute,PLC_TIME, PCVUE_TIME)
and this will have a problem for 1:59pm and 2:00pm in which 2:00pm
will be treated
as earlier than 1:59pm. Also i may need to have multiple DATEDIFF
which compares YEAR, MONTH, DAY, HOUR and so on... which is not
feasible.
What correct SQL command can i use to update TABLE_B until the CLOSEST
PLC_TIME is updated into TABLE_B?
You can try something like this:
UPDATE TABLE_B SET PLC_TIME = A.PLC_TIME
FROM TABLE_B B
INNER JOIN
(SELECT MAX(TABLE_A.PLC_TIME) PLC_TIME, TABLE_A.TAGNAME, TABLE_A.STATUS
FROM TABLE_A
INNER JOIN TABLE_B
ON TABLE_A.TAGNAME = TABLE_B.TAGNAME AND TABLE_A.STATUS = TABLE_B.STATUS
WHERE TABLE_A.PLC_TIME<TABLE_B.PCVUE_TIME
GROUP BY TABLE_A.TAGNAME, TABLE_A.STATUS) A
ON A.TAGNAME = B.TAGNAME AND A.STATUS = B.STATUS
"albertleng" <albertleng@.gmail.com> wrote in message
news:1180449709.930509.45380@.r19g2000prf.googlegro ups.com...
> Hi. I have 2 tables which have the following formats:
> TABLE A
> PLC_TIME TAGNAME STATUS LOCATION
> -- -- -- --
> TABLE B
> PLC_TIME PCVUE_TIME TAGNAME STATUS LOCATION
> -- -- --
> -- --
> Both tables will be inserted with records by a software continuously
> with the PLC_TIME of Table B null, ie
> PLC_TIME is not inserted with records. For eg,
> TABLE_A
> PLC_TIME TAGNAME STATUS LOCATION
> -- -- -- --
> 07-05-2007 1:00:32pm TAG.A ON SITEA
> 07-05-2007 1:40:11pm TAG.A OFF SITEA
> 07-05-2007 1:10:31pm TAG.A ON SITEA
> 07-05-2007 2:10:11pm TAG.B NORMAL SITEB
>
> TABLE_B
> PLC_TIME PCVUE_TIME TAGNAME STATUS LOCATION
> -- -- --
> -- --
> null 07-05-2007 1:00:39pm TAG.A ON SITEA
> null 07-05-2007 1:41:22pm TAG.A OFF SITEA
> null 07-05-2007 2:10:12pm TAG.B NORMAL SITEB
> I'm required to update PLC_TIME of TABLE B with the PLC_TIME from
> table A
> which both of them have the same TAGNAME and STATUS and the PLC_TIME
> from table A must be
> the CLOSEST to the PCVUE_TIME in table b. PLC_TIME is also always
> earlier than PCVUE_TIME.
> I have used the following SQL command in my VB program to update the
> CLOSEST PLC_TIME of TABLE_B:
> UPDATE TABLE_B SET PLC_TIME = (SELECT MAX(PLC_TIME) FROM TABLE_A WHERE
> TAGNAME = TABLE_B.TAGNAME AND STATUS = TABLE_B.STATUS
> AND PLC_TIME<TABLE_B.PCVUE_TIME AND
> ABS(DATEDIFF(MINUTE,PLC_TIME,PCVUE_TIME))<31)
> (Note: 31 is just an estimation of the maximum difference of PLC_TIME
> and PCVUE_TIME in normal case.)
> Since both TABLE_A and TABLE_B are updated randomly and the timing may
> not be in order, i.e. Some earlier records may be inserted into
> TABLE_A and TABLE_B
> by the software, my VB program needs to "update TABLE_B set PLC_TIME"
> constantly until the CLOSEST PLC_TIME is updated.
> What i can think of is DATEDIFF() but DATEDIFF has a limitation that
> it only compares the specific MINUTE of
> PCVUE_TIME and PLC_TIME if i use DATEDIFF(minute,PLC_TIME, PCVUE_TIME)
> and this will have a problem for 1:59pm and 2:00pm in which 2:00pm
> will be treated
> as earlier than 1:59pm. Also i may need to have multiple DATEDIFF
> which compares YEAR, MONTH, DAY, HOUR and so on... which is not
> feasible.
>
> What correct SQL command can i use to update TABLE_B until the CLOSEST
> PLC_TIME is updated into TABLE_B?
>
|||Hi
"Quentin Ran" wrote:

> You can try something like this:
> UPDATE TABLE_B SET PLC_TIME = A.PLC_TIME
> FROM TABLE_B B
> INNER JOIN
> (SELECT MAX(TABLE_A.PLC_TIME) PLC_TIME, TABLE_A.TAGNAME, TABLE_A.STATUS
> FROM TABLE_A
> INNER JOIN TABLE_B
> ON TABLE_A.TAGNAME = TABLE_B.TAGNAME AND TABLE_A.STATUS = TABLE_B.STATUS
> WHERE TABLE_A.PLC_TIME<TABLE_B.PCVUE_TIME
> GROUP BY TABLE_A.TAGNAME, TABLE_A.STATUS) A
> ON A.TAGNAME = B.TAGNAME AND A.STATUS = B.STATUS
>
You should also have
WHERE B.PLC_TIME IS NULL
to both the derived table and update statement to eliminate records already
updated
i.e.
UPDATE B
SET PLC_TIME = A.PLC_TIME
FROM TABLE_B B
JOIN (SELECT MAX(C.PLC_TIME) AS PLC_TIME, C.TAGNAME, C.STATUS
FROM TABLE_A C
JOIN TABLE_B D ON C.TAGNAME = D.TAGNAME AND C.STATUS = D.STATUS
AND C.PLC_TIME< D.PCVUE_TIME AND D.PLC_TIME IS NULL
GROUP BY C.TAGNAME, C.STATUS) A
ON A.TAGNAME = B.TAGNAME AND A.STATUS = B.STATUS
WHERE B.PLC_TIME IS NULL
John

Closest Time in SQL Table

Hi. I have 2 tables which have the following formats:
TABLE A
PLC_TIME TAGNAME STATUS LOCATION
-- -- -- --
TABLE B
PLC_TIME PCVUE_TIME TAGNAME STATUS LOCATION
-- -- --
-- --
Both tables will be inserted with records by a software continuously
with the PLC_TIME of Table B null, ie
PLC_TIME is not inserted with records. For eg,
TABLE_A
PLC_TIME TAGNAME STATUS LOCATION
-- -- -- --
07-05-2007 1:00:32pm TAG.A ON SITEA
07-05-2007 1:40:11pm TAG.A OFF SITEA
07-05-2007 1:10:31pm TAG.A ON SITEA
07-05-2007 2:10:11pm TAG.B NORMAL SITEB
TABLE_B
PLC_TIME PCVUE_TIME TAGNAME STATUS LOCATION
-- -- --
-- --
null 07-05-2007 1:00:39pm TAG.A ON SITEA
null 07-05-2007 1:41:22pm TAG.A OFF SITEA
null 07-05-2007 2:10:12pm TAG.B NORMAL SITEB
I'm required to update PLC_TIME of TABLE B with the PLC_TIME from
table A
which both of them have the same TAGNAME and STATUS and the PLC_TIME
from table A must be
the CLOSEST to the PCVUE_TIME in table b. PLC_TIME is also always
earlier than PCVUE_TIME.
I have used the following SQL command in my VB program to update the
CLOSEST PLC_TIME of TABLE_B:
UPDATE TABLE_B SET PLC_TIME = (SELECT MAX(PLC_TIME) FROM TABLE_A WHERE
TAGNAME = TABLE_B.TAGNAME AND STATUS = TABLE_B.STATUS
AND PLC_TIME<TABLE_B.PCVUE_TIME AND
ABS(DATEDIFF(MINUTE,PLC_TIME,PCVUE_TIME))<31)
(Note: 31 is just an estimation of the maximum difference of PLC_TIME
and PCVUE_TIME in normal case.)
Since both TABLE_A and TABLE_B are updated randomly and the timing may
not be in order, i.e. Some earlier records may be inserted into
TABLE_A and TABLE_B
by the software, my VB program needs to "update TABLE_B set PLC_TIME"
constantly until the CLOSEST PLC_TIME is updated.
What i can think of is DATEDIFF() but DATEDIFF has a limitation that
it only compares the specific MINUTE of
PCVUE_TIME and PLC_TIME if i use DATEDIFF(minute,PLC_TIME, PCVUE_TIME)
and this will have a problem for 1:59pm and 2:00pm in which 2:00pm
will be treated
as earlier than 1:59pm. Also i may need to have multiple DATEDIFF
which compares YEAR, MONTH, DAY, HOUR and so on... which is not
feasible.
What correct SQL command can i use to update TABLE_B until the CLOSEST
PLC_TIME is updated into TABLE_B?You can try something like this:
UPDATE TABLE_B SET PLC_TIME = A.PLC_TIME
FROM TABLE_B B
INNER JOIN
(SELECT MAX(TABLE_A.PLC_TIME) PLC_TIME, TABLE_A.TAGNAME, TABLE_A.STATUS
FROM TABLE_A
INNER JOIN TABLE_B
ON TABLE_A.TAGNAME = TABLE_B.TAGNAME AND TABLE_A.STATUS = TABLE_B.STATUS
WHERE TABLE_A.PLC_TIME<TABLE_B.PCVUE_TIME
GROUP BY TABLE_A.TAGNAME, TABLE_A.STATUS) A
ON A.TAGNAME = B.TAGNAME AND A.STATUS = B.STATUS
"albertleng" <albertleng@.gmail.com> wrote in message
news:1180449709.930509.45380@.r19g2000prf.googlegroups.com...
> Hi. I have 2 tables which have the following formats:
> TABLE A
> PLC_TIME TAGNAME STATUS LOCATION
> -- -- -- --
> TABLE B
> PLC_TIME PCVUE_TIME TAGNAME STATUS LOCATION
> -- -- --
> -- --
> Both tables will be inserted with records by a software continuously
> with the PLC_TIME of Table B null, ie
> PLC_TIME is not inserted with records. For eg,
> TABLE_A
> PLC_TIME TAGNAME STATUS LOCATION
> -- -- -- --
> 07-05-2007 1:00:32pm TAG.A ON SITEA
> 07-05-2007 1:40:11pm TAG.A OFF SITEA
> 07-05-2007 1:10:31pm TAG.A ON SITEA
> 07-05-2007 2:10:11pm TAG.B NORMAL SITEB
>
> TABLE_B
> PLC_TIME PCVUE_TIME TAGNAME STATUS LOCATION
> -- -- --
> -- --
> null 07-05-2007 1:00:39pm TAG.A ON SITEA
> null 07-05-2007 1:41:22pm TAG.A OFF SITEA
> null 07-05-2007 2:10:12pm TAG.B NORMAL SITEB
> I'm required to update PLC_TIME of TABLE B with the PLC_TIME from
> table A
> which both of them have the same TAGNAME and STATUS and the PLC_TIME
> from table A must be
> the CLOSEST to the PCVUE_TIME in table b. PLC_TIME is also always
> earlier than PCVUE_TIME.
> I have used the following SQL command in my VB program to update the
> CLOSEST PLC_TIME of TABLE_B:
> UPDATE TABLE_B SET PLC_TIME = (SELECT MAX(PLC_TIME) FROM TABLE_A WHERE
> TAGNAME = TABLE_B.TAGNAME AND STATUS = TABLE_B.STATUS
> AND PLC_TIME<TABLE_B.PCVUE_TIME AND
> ABS(DATEDIFF(MINUTE,PLC_TIME,PCVUE_TIME))<31)
> (Note: 31 is just an estimation of the maximum difference of PLC_TIME
> and PCVUE_TIME in normal case.)
> Since both TABLE_A and TABLE_B are updated randomly and the timing may
> not be in order, i.e. Some earlier records may be inserted into
> TABLE_A and TABLE_B
> by the software, my VB program needs to "update TABLE_B set PLC_TIME"
> constantly until the CLOSEST PLC_TIME is updated.
> What i can think of is DATEDIFF() but DATEDIFF has a limitation that
> it only compares the specific MINUTE of
> PCVUE_TIME and PLC_TIME if i use DATEDIFF(minute,PLC_TIME, PCVUE_TIME)
> and this will have a problem for 1:59pm and 2:00pm in which 2:00pm
> will be treated
> as earlier than 1:59pm. Also i may need to have multiple DATEDIFF
> which compares YEAR, MONTH, DAY, HOUR and so on... which is not
> feasible.
>
> What correct SQL command can i use to update TABLE_B until the CLOSEST
> PLC_TIME is updated into TABLE_B?
>|||Hi
"Quentin Ran" wrote:
> You can try something like this:
> UPDATE TABLE_B SET PLC_TIME = A.PLC_TIME
> FROM TABLE_B B
> INNER JOIN
> (SELECT MAX(TABLE_A.PLC_TIME) PLC_TIME, TABLE_A.TAGNAME, TABLE_A.STATUS
> FROM TABLE_A
> INNER JOIN TABLE_B
> ON TABLE_A.TAGNAME = TABLE_B.TAGNAME AND TABLE_A.STATUS = TABLE_B.STATUS
> WHERE TABLE_A.PLC_TIME<TABLE_B.PCVUE_TIME
> GROUP BY TABLE_A.TAGNAME, TABLE_A.STATUS) A
> ON A.TAGNAME = B.TAGNAME AND A.STATUS = B.STATUS
>
You should also have
WHERE B.PLC_TIME IS NULL
to both the derived table and update statement to eliminate records already
updated
i.e.
UPDATE B
SET PLC_TIME = A.PLC_TIME
FROM TABLE_B B
JOIN (SELECT MAX(C.PLC_TIME) AS PLC_TIME, C.TAGNAME, C.STATUS
FROM TABLE_A C
JOIN TABLE_B D ON C.TAGNAME = D.TAGNAME AND C.STATUS = D.STATUS
AND C.PLC_TIME< D.PCVUE_TIME AND D.PLC_TIME IS NULL
GROUP BY C.TAGNAME, C.STATUS) A
ON A.TAGNAME = B.TAGNAME AND A.STATUS = B.STATUS
WHERE B.PLC_TIME IS NULL
John

Closest Time in SQL Table

Hi. I have 2 tables which have the following formats:
TABLE A
PLC_TIME TAGNAME STATUS LOCATION
-- -- -- --
TABLE B
PLC_TIME PCVUE_TIME TAGNAME STATUS LOCATION
-- -- --
-- --
Both tables will be inserted with records by a software continuously
with the PLC_TIME of Table B null, ie
PLC_TIME is not inserted with records. For eg,
TABLE_A
PLC_TIME TAGNAME STATUS LOCATION
-- -- -- --
07-05-2007 1:00:32pm TAG.A ON SITEA
07-05-2007 1:40:11pm TAG.A OFF SITEA
07-05-2007 1:10:31pm TAG.A ON SITEA
07-05-2007 2:10:11pm TAG.B NORMAL SITEB
TABLE_B
PLC_TIME PCVUE_TIME TAGNAME STATUS LOCATION
-- -- --
-- --
null 07-05-2007 1:00:39pm TAG.A ON SITEA
null 07-05-2007 1:41:22pm TAG.A OFF SITEA
null 07-05-2007 2:10:12pm TAG.B NORMAL SITEB
I'm required to update PLC_TIME of TABLE B with the PLC_TIME from
table A
which both of them have the same TAGNAME and STATUS and the PLC_TIME
from table A must be
the CLOSEST to the PCVUE_TIME in table b. PLC_TIME is also always
earlier than PCVUE_TIME.
I have used the following SQL command in my VB program to update the
CLOSEST PLC_TIME of TABLE_B:
UPDATE TABLE_B SET PLC_TIME = (SELECT MAX(PLC_TIME) FROM TABLE_A WHERE
TAGNAME = TABLE_B.TAGNAME AND STATUS = TABLE_B.STATUS
AND PLC_TIME<TABLE_B.PCVUE_TIME AND
ABS(DATEDIFF(MINUTE,PLC_TIME,PCVUE_TIME)
)<31)
(Note: 31 is just an estimation of the maximum difference of PLC_TIME
and PCVUE_TIME in normal case.)
Since both TABLE_A and TABLE_B are updated randomly and the timing may
not be in order, i.e. Some earlier records may be inserted into
TABLE_A and TABLE_B
by the software, my VB program needs to "update TABLE_B set PLC_TIME"
constantly until the CLOSEST PLC_TIME is updated.
What i can think of is DATEDIFF() but DATEDIFF has a limitation that
it only compares the specific MINUTE of
PCVUE_TIME and PLC_TIME if i use DATEDIFF(minute,PLC_TIME, PCVUE_TIME)
and this will have a problem for 1:59pm and 2:00pm in which 2:00pm
will be treated
as earlier than 1:59pm. Also i may need to have multiple DATEDIFF
which compares YEAR, MONTH, DAY, HOUR and so on... which is not
feasible.
What correct SQL command can i use to update TABLE_B until the CLOSEST
PLC_TIME is updated into TABLE_B?You can try something like this:
UPDATE TABLE_B SET PLC_TIME = A.PLC_TIME
FROM TABLE_B B
INNER JOIN
(SELECT MAX(TABLE_A.PLC_TIME) PLC_TIME, TABLE_A.TAGNAME, TABLE_A.STATUS
FROM TABLE_A
INNER JOIN TABLE_B
ON TABLE_A.TAGNAME = TABLE_B.TAGNAME AND TABLE_A.STATUS = TABLE_B.STATUS
WHERE TABLE_A.PLC_TIME<TABLE_B.PCVUE_TIME
GROUP BY TABLE_A.TAGNAME, TABLE_A.STATUS) A
ON A.TAGNAME = B.TAGNAME AND A.STATUS = B.STATUS
"albertleng" <albertleng@.gmail.com> wrote in message
news:1180449709.930509.45380@.r19g2000prf.googlegroups.com...
> Hi. I have 2 tables which have the following formats:
> TABLE A
> PLC_TIME TAGNAME STATUS LOCATION
> -- -- -- --
> TABLE B
> PLC_TIME PCVUE_TIME TAGNAME STATUS LOCATION
> -- -- --
> -- --
> Both tables will be inserted with records by a software continuously
> with the PLC_TIME of Table B null, ie
> PLC_TIME is not inserted with records. For eg,
> TABLE_A
> PLC_TIME TAGNAME STATUS LOCATION
> -- -- -- --
> 07-05-2007 1:00:32pm TAG.A ON SITEA
> 07-05-2007 1:40:11pm TAG.A OFF SITEA
> 07-05-2007 1:10:31pm TAG.A ON SITEA
> 07-05-2007 2:10:11pm TAG.B NORMAL SITEB
>
> TABLE_B
> PLC_TIME PCVUE_TIME TAGNAME STATUS LOCATION
> -- -- --
> -- --
> null 07-05-2007 1:00:39pm TAG.A ON SITEA
> null 07-05-2007 1:41:22pm TAG.A OFF SITEA
> null 07-05-2007 2:10:12pm TAG.B NORMAL SITEB
> I'm required to update PLC_TIME of TABLE B with the PLC_TIME from
> table A
> which both of them have the same TAGNAME and STATUS and the PLC_TIME
> from table A must be
> the CLOSEST to the PCVUE_TIME in table b. PLC_TIME is also always
> earlier than PCVUE_TIME.
> I have used the following SQL command in my VB program to update the
> CLOSEST PLC_TIME of TABLE_B:
> UPDATE TABLE_B SET PLC_TIME = (SELECT MAX(PLC_TIME) FROM TABLE_A WHERE
> TAGNAME = TABLE_B.TAGNAME AND STATUS = TABLE_B.STATUS
> AND PLC_TIME<TABLE_B.PCVUE_TIME AND
> ABS(DATEDIFF(MINUTE,PLC_TIME,PCVUE_TIME)
)<31)
> (Note: 31 is just an estimation of the maximum difference of PLC_TIME
> and PCVUE_TIME in normal case.)
> Since both TABLE_A and TABLE_B are updated randomly and the timing may
> not be in order, i.e. Some earlier records may be inserted into
> TABLE_A and TABLE_B
> by the software, my VB program needs to "update TABLE_B set PLC_TIME"
> constantly until the CLOSEST PLC_TIME is updated.
> What i can think of is DATEDIFF() but DATEDIFF has a limitation that
> it only compares the specific MINUTE of
> PCVUE_TIME and PLC_TIME if i use DATEDIFF(minute,PLC_TIME, PCVUE_TIME)
> and this will have a problem for 1:59pm and 2:00pm in which 2:00pm
> will be treated
> as earlier than 1:59pm. Also i may need to have multiple DATEDIFF
> which compares YEAR, MONTH, DAY, HOUR and so on... which is not
> feasible.
>
> What correct SQL command can i use to update TABLE_B until the CLOSEST
> PLC_TIME is updated into TABLE_B?
>|||Hi
"Quentin Ran" wrote:

> You can try something like this:
> UPDATE TABLE_B SET PLC_TIME = A.PLC_TIME
> FROM TABLE_B B
> INNER JOIN
> (SELECT MAX(TABLE_A.PLC_TIME) PLC_TIME, TABLE_A.TAGNAME, TABLE_A.STATUS
> FROM TABLE_A
> INNER JOIN TABLE_B
> ON TABLE_A.TAGNAME = TABLE_B.TAGNAME AND TABLE_A.STATUS = TABLE_B.STATUS
> WHERE TABLE_A.PLC_TIME<TABLE_B.PCVUE_TIME
> GROUP BY TABLE_A.TAGNAME, TABLE_A.STATUS) A
> ON A.TAGNAME = B.TAGNAME AND A.STATUS = B.STATUS
>
You should also have
WHERE B.PLC_TIME IS NULL
to both the derived table and update statement to eliminate records already
updated
i.e.
UPDATE B
SET PLC_TIME = A.PLC_TIME
FROM TABLE_B B
JOIN (SELECT MAX(C.PLC_TIME) AS PLC_TIME, C.TAGNAME, C.STATUS
FROM TABLE_A C
JOIN TABLE_B D ON C.TAGNAME = D.TAGNAME AND C.STATUS = D.STATUS
AND C.PLC_TIME< D.PCVUE_TIME AND D.PLC_TIME IS NULL
GROUP BY C.TAGNAME, C.STATUS) A
ON A.TAGNAME = B.TAGNAME AND A.STATUS = B.STATUS
WHERE B.PLC_TIME IS NULL
John

Friday, February 24, 2012

Client unable to establish connection Encryption not supported on SQL Server. (Microsoft SQL Nat

On Windows XP systems I get the following issue when trying to browse the MSDB folder in SSIS

Client unable to establish connection
Encryption not supported on SQL Server. (Microsoft SQL Native Client)

I have noticed another post where several others have noticed the same issue. It appears to only occur on Windows XP installations. Is there a workaround or fix for this?

Is the SQL 2005 instance the default or named instance? If it is named instance you need to edit SSIS service configuration file to point to appropriate instance. The process is described in SQL Books Online.|||It is the default instance.