Showing posts with label hii. Show all posts
Showing posts with label hii. Show all posts

Friday, March 30, 2012

Problems installing MSDE

Hi

I've recently downloaded and installed MSDE. I used the instructions from the Microsoft website that makes it as an instance of VSDOTNET. When I rebooted after installing it, there was absolutely no service for the SQL Server Service Manager to do anything with - the icon was in my tray with a blank circle, not a green Play or a red Stop symbol. So I uninstalled it, with an aim to reinstalling it as I had done before - without specifying an instance name.

Only trouble is, I'm now trying to reinstall it using:

setup SAPWD=<pword> SecurityMode=SQL

and I'm getting an error message that says "Setup failed to configure the server. Refer to the serveer error logs and setup error logs for more information." when the progress bar is about 2-thirds of the way along. It does this when I try to install as an instance of VSDOTNET again. It just won't play, and I don't know how to get at the logs to see what's up.

I'm running Win2K SP3, with .NET 1.1. Anyone able to help me?

Thanks
JonCheck to see if you are installing SP3a. If so include the DISABLENETPROTOCOLS=0 in the setup command line. This will ensure that you have enabled the network protocols for a new install. You also don't have to create an instance at installation time.sql

Monday, March 26, 2012

problems executing a SELECT inside a TRAN against other computer

Hi
I have a problem executing a SELECT inside a TRAN against other computer

For example:
IN THE SQL Query Analizer of the COMPUTER2
1) this runs OK
BEGIN TRAN
SELECT * FROM COMPUTER2.DATABASE.DBO.TABLE
COMMIT TRAN
2) this runs OK
SELECT * FROM COMPUTER2.DATABASE.DBO.TABLE
3) this runs OK
SELECT * FROM COMPUTER1.DATABASE.DBO.TABLE
4) this runs bad
BEGIN TRAN
SELECT * FROM COMPUTER1.DATABASE.DBO.TABLE
COMMIT TRAN

The problem is that TABLE locks and it does not finish.

I've been looking for similar ERRORS in Microsoft Support but I found nothing
I've uninstall and install de SQL server 2000 SP4 and the problems continues the same

Please, someone could help me, thanks

Assanta:

A couple of things: (1) make sure that DTC is on and (2) maybe try using BEGIN DISTRIBUTED TRAN instead of BEGIN TRAN when you know you will be explicitly involving an external machine.

Dave

|||What do you mean when you say "this runs bad"? Does the statement take a long time to execute? Are you getting any errors? What is the exact behavior? Can you just isolate the case where it doesn't work and specify what you are doing? Are you running #4 from Computer2 and so on?|||

Hi

Thanks for your answers

MUGAMBO

Yes, I have the DTC STARTED

Yes, I've also try with de DISTRIBUTED and the problem is the same

UMACHANDAR

you have all the answers in my first mail

What do you mean when you say "this runs bad"? The problem is that TABLE locks and it does not finish.

Does the statement take a long time to execute? The problem is that TABLE locks and it does not finish.

Are you getting any errors? The problem is that TABLE locks and it does not finish, so the aren't ERRORS

What is the exact behavior? The problem is that TABLE locks and it does not finish.

Can you just isolate the case where it doesn't work and specify what you are doing?

4) IN THE SQL Query Analizer of the COMPUTER2
BEGIN TRAN
SELECT * FROM COMPUTER1.DATABASE.DBO.TABLE
COMMIT TRAN

Are you running #4 from Computer2?

IN THE SQL Query Analizer of the COMPUTER2

BEGIN TRAN
SELECT * FROM COMPUTER1.DATABASE.DBO.TABLE
COMMIT TRAN

If I try a TRAN on other computer all is OK, so the problem is only on this two computers, there must have something diferent on the configuration, but I can't know what it is.

Any help please?

|||You are not changing data. There is no reason to run a transaction around a SELECT statement.|||

Hi Tom, thanks for the response

Yes, of course. But is for doing the statement more simple, what you use inside the TRAN is the same, always i use a TRAN it blocks, with a select inside, or with a insert, or......

|||

It is still not clear what you mean when you say the table locks. This can mean several things. One, the query you are trying is taking a long time or the query is getting blocked by other transactions on the server. Also, I was looking for the exact error message you are receiving from the server? Are you simply cancelling the command since it is taking a long time? Are you getting error# 7391? Did you look at sp_lock output for example to see if this is due to locks on the table due to other transactions in the server? Next, you need to check the waitstats using DBCC SQLPERF (see MSKB) to determine if the wait is related to MSDTC for example. Here the configuration of the MSDTC on computer1 needs to be checked (what is the coordinator, does it have network setting enabled, did you check the MSDTC statistics from the MSDTC console - this will show how long each distributed transaction is taking and if anything got committed or aborted). Lastly, your first query in your original post does not start a distributed transaction because the server part is a local server (you are using 4-part name on the same server - loopback) so you can't compare the two. Below is a KB article that has some steps for troubleshooting the MSDTC connection part:

http://support.microsoft.com/default.aspx/kb/306212

|||"Explicit" transactions, using BEGIN TRAN/COMMIT, are very special and should not be used "generically" for every command. They should only be used in the case where you have multiple update statements which depend on each other.

Bascially, what you are doing in the select statement is causing a table lock (for no reason). This is probably causing a deadlock situation. Look at your activity log and see if something is blocking.|||

Hi Umachandar, thanks for the reply

Nobody use this server, only me and i use for test, so there are no more transactions on the server

I mean with block that the table is "IX" during 30 minutes, then i cancel the command. Without the TRAN the select lasts 1 second

thanks for the article, but I continue with the same problem. also I have tried to Add Value TurnOffRpcSecurity (http://support.microsoft.com/default.aspx/kb/827805) although are in the same domain

Executing DBCC SQLPERF (waitstats) there are 77 types of names but noone about MSDTC, there is one lock, is the type "LCK_M_S" and has the values "Requests=1", "Wait time=78" and "Signal Wait Time=16"

Executing DBCC SQLPERF (SpinLockStats) "LOCK_HASH" with 2 Collisions and 132 Spins

More info I hadn't said until now:

The instalation is made from an image, after the instalation i changed the server and SQL name, now the SQL and the Server name is the same, and uniques in the domain, but maybe the image installation could have any problem with the name of any low level thing?

I've been looking for any soft to test the MSDTC communication between 2 machines, I've readed in a forum something about the "DTCPing.exe", I've executed the file and I thing the problem is this "RPC server is ready WARNING:the CID values for both test machines are the same while this problem won't stop DTCping test"

The solution like I read in a forum (http://cogitativemind.homeip.net/archive/2005/08/01/487.aspx) is "For enabling your MSDTC service, you go to command prompt type: msdtc -uninstall , you'll not get any feedback that this has completed so just wait for a bit, then type: msdtc -install, again wait for a bit. I then rebooted my server and everything came up roses"

but this didn't works ok, so I tried (http://forums.asp.net/thread/1192335.aspx)

Run MSDTC -uninstall

Go into the registry and remove the MSDTC keys in HKLM/Software/Microsoft/MSDTC and

HKLM/System/CurrentControlSet/Services/MSDTC

Reboot

Run MSDTC -install

An this yes, this makes my distributed transctions works ok!!!

|||Glad you got it working. You need to be careful using imaging software since there is lot of metadata used by various applications that can be incorrectly handled. And this can differ from different releases of Windows / Service Pack / Software too. For SQL Server, you said you changed the server and SQL name - so did you use sp_dropserver & sp_addserver with 'local' option. Apart from this one, there are other places in MSDB that can reference server names - like master servers in SQLAgent configuration and so on. And you should actually run SQL Server SETUP again to ensure that the machine change is handled correctly. I believe that SETUP detects the name change and performs some actions. Note that you still need to do the sp_dropserver/sp_addserver part since the @.@.SERVERNAME value is stored & obtained from the system catalog. Search in MSKB for articles that may help the imaging process or name change of machine.

problems displaying images

Hi
I have a query that returns a companyname eg. "ACD". This info is then saved in a parameter.
On the logo (which depends on company), I use this parameter value to the pick up the right picture like this:

=Parameter!.company.Value &"_logo.jpg"

The image is there on the server an the path is correct, but the image is not displayed!
What is wrong?

Hi,

Under what account does your reporting services run? Have you checked that the account has the correct permissions to browse to the location. You can test it by setting a static image on your report and set its url to the location you want.

Greetz,

Geert

Geert Verhoeven
Consultant @. Ausy Belgium

My Personal Blog

|||

Yes, if i for example sets the path ACD_logo.jpg it works.
Dynamically it doesn't work. Neither in client or on the web.

|||I've had similar problems. Have you tried hosting the images on a website and using a URL to access the images instead of a local windows path?|||

No, i have not tried that.
Maybe I should.

Is there any way to get the base URL to the report?

Ex rs.base.url ?

|||

I think you're misunderstanding. Use a URL to access the LOGOs (not the report). In other words, host your images on a website and access them from there instead of from windows.

If you don't have a website, set up an account at http://photobucket.com/ and host your images there. It's quick and simple.

|||

Hi

It worked to put the images on a webserver.

I still though wonder why it doesn′t work when the image is an local external link e.g "ACD_logo.jpg" instead of ′the webserversolution eg. http://localhost:4000/reportimgs/ACD_logo.jpg

Thanks for the help!

/A

Friday, March 23, 2012

problems creating a datatable within a UDF in C#

Hi!

I'm having a lot of difficulty in creating a user defined function in vs2005.

why I'm doing it in c# instead of vb or tsql is that I know C# better than the others (that and tsql won't let you make temp tables in functions

But as far as this goes, I can't seem to get this working.

I' trying to execute a simple select statement and get a datatable variable before I run it through the creative algorithm I have planned.

But I can't seem to get the data into a table.

I get this exception when I execute the function on the server:

System.InvalidOperationException: Data access is not allowed in this context. Either the context is a function or method not marked with DataAccessKind.Read or SystemDataAccessKind.Read, is a callback to obtain data from FillRow method of a Table Valued Function, or is a UDT validation method.

This is the code I use to get the data:

using(SqlConnection sqlcnct = new SqlConnection("Context Connection=true"))
{ SqlCommand sqlcmd = new SqlCommand(sqlstrng, sqlcnct);

sqlcnct.Open();
SqlDataReader sqldr = sqlcmd.ExecuteReader();

while (sqldr.Read())
{
//inserts into datatable here (I don't yet have code here because i've been trying to figure out how to get it to read first. )
}
}

But unfortunately SQL server 2005 doesn't like that.

Can anyone point me in the right direction or shoot down my hopes right here?

I'm trying to use a function to avoid having to run a sproc on every employee on the employee table and storing it in an actual field /table every time I need to run this function.Two things:

1. In order to access database data from a CLR UDF you need to set the DataAccess and SystemDataAccess properties of the SqlFunction attribute to DataAccessKind.Read, and SystemDataAccessKind.Read:
[SqlFunction(DataAccess=DataAccessKind.Read, SystemDataAccess.SystenDataAccessKind.Read)]
your method name

2. You can not update/insert/delete data from an UDF

HTH

Niels
|||Thanks! It works perfectly now. I'm new to writing functions for sqlserver in visual studio so I had no idea i needed to do that. Fortunately I didn't need to update/insert/delete any data. =)

The reason I needed to do this was because the data I need to work with needs to be picked out of a table and sorted and then calculated from but sqlserver wasn't letting me make a temporary table in a function.

Friday, March 9, 2012

Problem: DTS parallel tasks running sequentially

Hi

I have a SQL Server 2000 instance running on a Windows Server 2003 box with 4 processors. SQL Server is configured to use all 4 processors, and use all available processors for parallelism.

I have created a simple DTS package which has 2 "execute external process" tasks with no precedence constraints between them. There are no connections required or defined for the two tasks (sequential
processing is forced on tasks sharing connections). The DTS package
properties have the "limit the number of tasks to execute in parallel"
set to 4.

However, despite the above configuration, the two steps are never executed in parallel, but always sequentially.

Does anyone have any ideas as to why these tasks are not being executed in parallel?

Any suggestions welcome.

Thanks.My first guess would be that you've established a precedence between the tasks by creating either a success or a failure connector between them. This forces DTS to complete the first task in order to know if it succeeds or fails before it can start the second task. Remove the presedence, and they ought to run in parallel.

-PatP|||Pat

Thanks for the reply but as I stated in my original post, there are no precedent constraints in place.

I have subsequently done further testing and it seems related to the task type. I can successfully run external commands in parallel via the ActiveX script task shelling out to call the executables, but cannot acheive parallel running using the "Execute External Process" task type.

Wednesday, March 7, 2012

problem with xp_sendmail

Hi
I had the xp_sendmail working the other day, but when I now try to send an
email using the xp_sendmail proc, I get the following error message:
xp_sendmail: Procedure expects parameter @.user, which was not supplied.
What does that mean? I can't even see that there's a @.user parameter to set
for the xp_sendmail proc. Is it just me that are missing something here?
Regards
Steen
Hi
You may want to check the mail profiles, by logging in as the service
account and making sure it exists and is working.
John
"Steen Persson" <SPE@.REMOVEdatea.dk> wrote in message
news:ux9r1XCZEHA.2432@.tk2msftngp13.phx.gbl...
> Hi
> I had the xp_sendmail working the other day, but when I now try to send an
> email using the xp_sendmail proc, I get the following error message:
> xp_sendmail: Procedure expects parameter @.user, which was not supplied.
> What does that mean? I can't even see that there's a @.user parameter to
set
> for the xp_sendmail proc. Is it just me that are missing something here?
> Regards
> Steen
>
|||arghhh...stupid me... The account that runs the SQLServer service needs to
be the one that has the mailbox setup for it to work from TSql. In my case
it was still the local system account on some servers but the SQLServer
Agent service is all set to the mailbox user - that was why it worked when
testing an operator setup but not when running the xp_sendmail.
Steen
"John Bell" <jbellnewsposts@.hotmail.com> skrev i en meddelelse
news:%23ofKcfCZEHA.1152@.TK2MSFTNGP09.phx.gbl...[vbcol=seagreen]
> Hi
> You may want to check the mail profiles, by logging in as the service
> account and making sure it exists and is working.
> John
> "Steen Persson" <SPE@.REMOVEdatea.dk> wrote in message
> news:ux9r1XCZEHA.2432@.tk2msftngp13.phx.gbl...
an
> set
>

problem with xp_sendmail

Hi
I had the xp_sendmail working the other day, but when I now try to send an
email using the xp_sendmail proc, I get the following error message:
xp_sendmail: Procedure expects parameter @.user, which was not supplied.
What does that mean? I can't even see that there's a @.user parameter to set
for the xp_sendmail proc. Is it just me that are missing something here?
Regards
SteenHi
You may want to check the mail profiles, by logging in as the service
account and making sure it exists and is working.
John
"Steen Persson" <SPE@.REMOVEdatea.dk> wrote in message
news:ux9r1XCZEHA.2432@.tk2msftngp13.phx.gbl...
> Hi
> I had the xp_sendmail working the other day, but when I now try to send an
> email using the xp_sendmail proc, I get the following error message:
> xp_sendmail: Procedure expects parameter @.user, which was not supplied.
> What does that mean? I can't even see that there's a @.user parameter to
set
> for the xp_sendmail proc. Is it just me that are missing something here?
> Regards
> Steen
>|||arghhh...stupid me... The account that runs the SQLServer service needs to
be the one that has the mailbox setup for it to work from TSql. In my case
it was still the local system account on some servers but the SQLServer
Agent service is all set to the mailbox user - that was why it worked when
testing an operator setup but not when running the xp_sendmail.
Steen
"John Bell" <jbellnewsposts@.hotmail.com> skrev i en meddelelse
news:%23ofKcfCZEHA.1152@.TK2MSFTNGP09.phx.gbl...
> Hi
> You may want to check the mail profiles, by logging in as the service
> account and making sure it exists and is working.
> John
> "Steen Persson" <SPE@.REMOVEdatea.dk> wrote in message
> news:ux9r1XCZEHA.2432@.tk2msftngp13.phx.gbl...
an[vbcol=seagreen]
> set
>

Problem with writting a Report (SQL slow running)

Hi

I am trying to write a report that calculates the average number of sales
over 7, 14, 31 and 365 days for each hourly period of the day. the problem
is it takes over 4 minutes to run.

e.g.
Average Xactions per Hour
7 Days 14 Days 31 Days 365 Days
00:00 - 01:00 1,141.6 579.2 261.6 28.8
01:00 - 02:00 1,298.0 649.6 293.4 30.0

The report was use to be purely ASP running SQL Statements.
I then changed it to ASP Running a SP 24 times - this reduced running time
by about 1 minute.
I then changed it so that the stored proc looped internally 24 times and
returns the data.

I have ran the Index Tuning Wizard on the SQL and Implemented the indexes
suggested - this actually increase execution time by 20 seconds.

Below is the stored procedure I am currently using that loops internally 24
times and returns the data.

Can anyone suggest a better way / any improvements I could make ?

Many Thanks

Steve

-----------------------
--------

CREATE procedure ams_RPT_Gen_Stats
@.strResult varchar(8) = 'Failure' output,
@.strErrorDesc varchar(512) = 'SP Not Executed' output,
@.strTest varchar(1),
@.strCurrency varchar(3),
@.strVFEID varchar(16)
as
declare @.strStep varchar(32)

set @.strStep = 'Start of Stored Proc'

/* start insert sp code here */

create table ##Averages (
TheHour varchar(2),
Day7Avge float ,
Day14Avge float ,
Day31Avge float ,
Day365Avge float
)

declare @.numHour varchar(2)
declare @.strSQL varchar(2000)
declare @.Wholesalers varchar(64)

declare MyHours cursor FORWARD_ONLY READ_ONLY for
select convert(char(2), timestamp,14) as TheHour
from xactions
group by convert(char(2), timestamp,14)
order by convert(char(2), timestamp,14)

if @.strTest = 'Y'
select @.Wholesalers = VALUE FROM BUSINESSRULES WHERE NAME =
'TEST_Wholesalers'

open MyHours

fetch next from MyHours into @.numHour

while @.@.fetch_status = 0

begin

set @.strSQL = 'insert into ##Averages (TheHour, Day7Avge) ( select ''' +
@.numHour + ''', ' +
'count(*) / 7.00 ' +
'FROM ' +
'XACTIONS INNER JOIN ' +
'RETAILER ON XACTIONS.RETAILERID = RETAILER.RETAILERID ' +
'WHERE ' +
'(DATEDIFF(DAY , xactions.timestamp , GETDATE() ) < 8) and ' +
'xactions.xactiontotal <> 0 and ' +
' convert(char(2) , timestamp, 14) = ''' + @.numHour + ''' '

if @.strTest = 'Y'
set @.strSQL = @.strSQL + ' and retailer.BillOrgID not in (' +
@.Wholesalers + ') '

if @.strCurrency <> '*'
set @.strSQL = @.strSQL + ' and xactions.XACTIONCURRENCY = ''' +
@.strCurrency + ''' '

if @.strVFEID <> '*'
set @.strSQL = @.strSQL + ' and xactions.VFEID = ''' + @.strVFEID + ''''
set @.strSQL = @.strSQL + ')'

exec ( @.strSQL )

set @.strSQL = 'update ##Averages set Day14Avge = ( select ' +
'count(*) / 14.00 ' +
'FROM ' +
'XACTIONS INNER JOIN ' +
'RETAILER ON XACTIONS.RETAILERID = RETAILER.RETAILERID ' +
'WHERE ' +
'(DATEDIFF(DAY , xactions.timestamp , GETDATE() ) < 15) and ' +
'xactions.xactiontotal <> 0 and ' +
' convert(char(2) , timestamp, 14) = ''' + @.numHour + ''' '

if @.strTest = 'Y'
set @.strSQL = @.strSQL + ' and retailer.BillOrgID not in (' +
@.Wholesalers + ') '

if @.strCurrency <> '*'
set @.strSQL = @.strSQL + ' and xactions.XACTIONCURRENCY = ''' +
@.strCurrency + ''' '

if @.strVFEID <> '*'
set @.strSQL = @.strSQL + ' and xactions.VFEID = ''' + @.strVFEID + ''' '

set @.strSQL = @.strSQL + ') where TheHour = ''' + @.numHour + ''' '

exec ( @.strSQL )

set @.strSQL = 'update ##Averages set Day31Avge = ( select ' +
'count(*) / 31.00 ' +
'FROM ' +
'XACTIONS INNER JOIN ' +
'RETAILER ON XACTIONS.RETAILERID = RETAILER.RETAILERID ' +
'WHERE ' +
'(DATEDIFF(DAY , xactions.timestamp , GETDATE() ) < 32) and ' +
'xactions.xactiontotal <> 0 and ' +
' convert(char(2) , timestamp, 14) = ''' + @.numHour + ''' '

if @.strTest = 'Y'
set @.strSQL = @.strSQL + ' and retailer.BillOrgID not in (' +
@.Wholesalers + ') '

if @.strCurrency <> '*'
set @.strSQL = @.strSQL + ' and xactions.XACTIONCURRENCY = ''' +
@.strCurrency + ''' '

if @.strVFEID <> '*'
set @.strSQL = @.strSQL + ' and xactions.VFEID = ''' + @.strVFEID + ''' '

set @.strSQL = @.strSQL + ' ) where TheHour = ''' + @.numHour + ''' '

exec ( @.strSQL )

set @.strSQL = 'update ##Averages set Day365Avge = ( select ' +
'count(*) / 365.00 ' +
'FROM ' +
'XACTIONS INNER JOIN ' +
'RETAILER ON XACTIONS.RETAILERID = RETAILER.RETAILERID ' +
'WHERE ' +
'(DATEDIFF(DAY , xactions.timestamp , GETDATE() ) < 366) and ' +
'xactions.xactiontotal <> 0 and ' +
' convert(char(2) , timestamp, 14) = ''' + @.numHour + ''' '

if @.strTest = 'Y'
set @.strSQL = @.strSQL + ' and retailer.BillOrgID not in (' +
@.Wholesalers + ') '

if @.strCurrency <> '*'
set @.strSQL = @.strSQL + ' and xactions.XACTIONCURRENCY = ''' +
@.strCurrency + ''' '

if @.strVFEID <> '*'
set @.strSQL = @.strSQL + ' and xactions.VFEID = ''' + @.strVFEID + ''' '

set @.strSQL = @.strSQL + ' ) where TheHour = ''' + @.numHour + ''' '

exec ( @.strSQL )

fetch next from MyHours into @.numHour

end -- while fetch

close MyHours
deallocate MyHours

select * from ##Averages order by TheHour

drop table ##Averages

/* end insert sp code here */

if (@.@.error <> 0)
begin
set @.strResult = 'Failure'
set @.strErrorDesc = 'Fail @. Step :' + @.strStep + ' Error : ' +
CONVERT(VARCHAR,@.@.Error)
return -1969
end
else
begin
set @.strResult = 'Success'
set @.strErrorDesc = ''
end

return 0

GOMany Thanks

I'll have a look at making those changes.

"Erland Sommarskog" <sommar@.algonet.se> wrote in message
news:Xns93E5F2C02272EYazorman@.127.0.0.1...
> Steve Thorpe (stephenthorpe@.nospam.hotmail.com) writes:
> > I am trying to write a report that calculates the average number of
> > sales over 7, 14, 31 and 365 days for each hourly period of the day.
> > the problem is it takes over 4 minutes to run.
>
> Troubleshooting performance problems over newsgroups is often difficult
> because, without access to the database it's not possible to test
> various scenarios. And without complete knowledge about the tables
> involved it is even more difficult. Just seeing the procedure code,
> may sometimes be sufficient, but not always.
> Anyway, I have two suggestions for your procedure, although none of
> them are likely to improve performance radically.
> The first is that you use a global temptable. Change this to a local
> temp table. This avoids problems if two users run this procedure
> simultaneously.
> The other is that you rewrite the procedure to not use dynamic SQL.
> As far as I can see, the only reason that you use dynamic SQL, is
> that you intended to have a comma-separated list in @.Wholesalers.
> I would suggest that you handle the list like this:
> CREATE TABLE #wholesalers (id int NOT NULL)
> INSERT #wholesalers (id)
> SELECT number FROM iter_intlist_to_table(@.wholesalers)
> You find the code for iter_intlist_to_table at
> http://www.algonet.se/~sommar/array...ist-of-integers.
> Armed with this temp table, you can, as far as I can see, rip out the
> dynamic SQL and replace it with static. This may give some performance
> benefit, but only some single second.
> However, once you have rewritten the code into static SQL, it will be
> more pleasant to take a look at it.
> It also helps if you post CREATE TABLE and CREATE INDEX statements
> for the involved table. Some hints about data sizes is also good.
>
> --
> Erland Sommarskog, SQL Server MVP, sommar@.algonet.se
> Books Online for SQL Server SP3 at
> http://www.microsoft.com/sql/techin.../2000/books.asp