Quantcast
Channel: SQL Server Database Engine Forum
Viewing all 15872 articles
Browse latest View live

Linked servers and ODBC/SQR

$
0
0

I am attempting to write an SQR (it will run from PeopleSoft) that updates a linked server.  It fails with the following error:

 

(SQR 5528) ODBC SQL dbexec: SQLExecute error 7412 in cursor 2:
   [Microsoft][SQL Native Client][SQL Server]OLE DB provider "SQLNCLI" for linked server "DUL41" returned message "No transaction is active.".
(SQR 5528) ODBC SQL dbexec: SQLExecute error 7391 in cursor 2:
   [Microsoft][SQL Native Client][SQL Server]The operation could not be performed because OLE DB provider "SQLNCLI" for linked server "DUL41" was unable to begin a distributed transaction.

Error on line 58:
   (SQR 3735) Could not execute SQL.

SQR for PeopleSoft: Program Aborting.

--------------------  Details ------------------------------

 

- The code is simply doing a delete right now.   delete from linkedserver.db.dbo.table where column = 1

- The SQL runs fine from Query Analyzer, so I think MSDTC must be setup correctly everywhere, and the linked servers must be defined correctly.  My QA test is using the same ID (sa) as my SQR.

- If I just write a select statement in the SQR, it works fine.

- in this example, SQR is connecting via ODBC, using SQL Native Client driver.

 

------------------  Environment --------------------------

 

- Main server:  Win2003, SQL2005sp2, active/passive cluster.  MSDTC is setup on the cluster.

- Linked server:  Win2003, SQL2000sp4, not a cluster.   (I also tried a SQL2005 server just to test)  This is the DUL41 server referenced in the error message.  MSDTC is running.

- Everything is running from a different Win2003 box, that connects to the main server using ODBC/SQL Native client

 

Thanks for any help or ideas.  Even any way to get better error messages, or a better way to test this.

 


SQL SERVER 2014 MSDB mdf need shrink

$
0
0

Hi,

Please help me on this  msdb mdf need shrink  because we running very low space on the drive ..Request you please advice me if we   shrink the msdb there is any issue further ?

what is better way to shrink msdb kindly  advice .


baskarlakshmi


Merge with too many indexes.

$
0
0

Hi experts,

I have a MERGE statement that it is taking too long… On the execution plan, this is 50% of the workload.

As you can see, I think the MERGE is taking long because it has to update every index… I created the indexes some time ago per requests of people complaining certain reports were slow… I created them as “test…” but never checked how much were they used.

How can I check if they are really used or they are wasting space/resources…?

 

I also noticed the difference between actual/estimated number of rows, but I don’t see outdated statistics, how come this happens???

Thanks in advance!!

SA Password changing automatically

$
0
0

Dear Experts,

'sa' password is changing everyday automatically. What would be the reason behind this ?

How can we stop this ? Kindly help.

Regards

Senthil.K


Senthil

SQL service terminated unexpectedly SQL 2012 Failover Cluster EventID 7034

$
0
0

Hi All,

I have notice that one of our clustered SQL servers has terminated unexpectedly twice this week. I've check the SQL Server Logs and there are no entries fro the time during the crash.

I have also check the event logs and the below events were logged:

evt1

evt2

evt3

evt4

evt5

is there any other logs I can check for this as I can't find the cause of the issue

Thanks for your help

Robert 

sql server 2008 automatically generate stack dump

"with recompile" versus "option(recompile)"

$
0
0

Is "option(recompile)" more efficient than "with recompile"?

Say you have a stored procedure about 700 lines long, maybe twenty big selects populating a temp table, with some logic to choose about half of them for any set of parameters.  If you say "with recompile" then all 700 lines are recompiled each call.  If you say "option(recompile)" on all the big statements then just about half the lines will be recompiled each time.

Right?

Or, is "with recompile" smart enough that it acts pretty much the same way?

Thanks,

Josh

SQL Server Service Repeatedly Crashes

$
0
0

Starting a few days ago, my local SQL Server 2016 Developer service regularly crashes and restarts (maybe once every 15 minutes or so). This happens even when I'm not actively doing anything with SQL. I've got plenty of disk space. The event logs don't show any problems (not even that the crash occurred...). All I get is a message box that pops up when it happens. Any ideas on what is going on or how I can diagnose this?

Thanks!

Ian


2012: spid active for hours. How do I automate monitoring for this?

$
0
0

Techies,

There's an application that gets executed through sql agent which works 95% of the time. The job completes within 10 minutes. The other 5% of the time, this same job stays active until its stopped.  The developers are working on a fix, however, in the meantime--the job will need to run as is with the current flaw.

Without a budget for tools, I need to find some way to monitor this job so that if it spins for more over 15 minutes, I'm at least alerted.  Any suggestions?

Adding up a secondary file

$
0
0
Hi guys, I added up a secondary file NDF to an existing db and it's taking age to do that. MDF 1TB , I added up the NDf with 100GB. Why it is taking age? Does it doing something like moving data?

Email notification when SP, Views, Functions gets created by users

$
0
0

HI Everyone,

 I am looking for the steps or script to set email notification when users create new SP or views or function within Database. If anyone can share knowledge would be great help.

Thank you.


Please Mark As Answer if it is helpful. \\Aim To Inspire Rather to Teach

Connect to Database between two computers without Internet

$
0
0

I want to connect my database on another computer without internet.

My application works offline. Please help me


Compatability between SQL 2008 & 2012

$
0
0

Hi all,

Apologies if this is the wrong forum. I have a view in a SQL database which was created in SQL 2012. I have since discovered that the "FORMAT" command is new in 2012 and not recognised in 2008. I need to use the same databases under SQL 2005 & 2008. Can someone help with alternative syntax to achieve the same end result? The query is:

SELECT        CleanerID, Cleaner, Added, status, rating, regHrs, SUM(Inactive) AS DNP, SUM(Canx) AS Cancelled, SUM(Inactive) + SUM(Canx) AS total,FORMAT(((SUM(Inactive) + SUM(Canx)) * 50000) / (regHrs * rating * (1 + DATEDIFF(Day, Added, { fn NOW() }))), '0.00') AS Quality
FROM            dbo.CleanerLossSummary
WHERE        reghrs > 0

GROUP BY CleanerID, Cleaner, Added, status, rating, regHrs

I'm just trying to present the output as a decimal


OPENQUERY with Variable/Parameter

$
0
0

Hi All,

I am following this article 

https://support.microsoft.com/en-us/kb/314520

1. Using "Pass Basic Value" I can fetch successfully required data from Oracle. This is what I executed

declare @MySql	varchar(500), @CustID varchar(10) = 102060
  set @MySql = 'select * from OPENQUERY (OracleDEVL, ''select * from customers where customer_id = ''''' + @CustID + ''''''')'
  execute (@MySql)

2. Using "Use the Sp_executesql Store Procedure" I am getting below error no matter what I do

<<

OLE DB provider "OraOLEDB.Oracle" for linked server "OracleDevl" returned message "Unspecified error".
Msg 7323, Level 16, State 2, Line 38
An error occurred while submitting the query text to OLE DB provider "OraOLEDB.Oracle" for linked server "OracleDevl".

>>

Here is how I am trying to execute this

DECLARE @CutomerID varchar(10) = 102060
EXECUTE  OracleDevl.master.dbo.sp_executesql
		N'select * from Customers where customer_id = @CustID',
		N'@CustID varchar(10)',
		@CutomerID

I cannot make is work using 2nd (sp_executesql) method. This method looks more cleaner but I cannot make it execute successfully. Please tell where is mistake.

Thanks in advance for your time.

snaseer - Houston

sql server edition

$
0
0

can I practice sql server 2012 dabase on 2016?

is it a good idea to practice in 2016 when I am preparing for 70-461 sql server 2012. I have 2016 developer version so I can practice my bi tools. I am trying to get 2012 evaluation version but its not there.

Please help


Update statistics for File Table

$
0
0

Hi, 

I have a Database with Filetable size of 20GB. The Update Statistics maintenance task is taking more than 4 hours without any result (no Success nor Failed) for updating the statistics of the FileTable. 

Why the Update statistics for filetable takes so long ? We are performing the Update Statistics for FileTable separately. Is there any recommendations for updating the Statistics for FileTable. 

Backup device name and size

$
0
0

Hi,

How to get all backup device names and size in an instance with T-SQL script?

Thanks

Cannot connect to localhost\SQLEXPRESS

$
0
0

My SQL 2014 Express has worked perfect for a number of month. Suddenly I can't connect with the SQL management tool.

I got the answer according to the Title above.  (Microsoft SQL Error: 2 (Named Pipes Provider, error:40).

The problem seems to be that the database engine has stopped. I had the same problem when using Windows 7, but at that time there was a utility/program which you could use manually start the database engine. I can't find this program in Window 10.

Has somebody any suggestion what I should do?

Says a desperate

Strangor (Sweden)

Linked server fails by using a login with SYSADMIN (Group)

$
0
0

Hi there,

I'm trying to set up a linked server but I get this message:

Login failed for user 'mydomain\Enric.vives'

However using impersonate I get another error:

Please, help, what am I missing here? My login 'Enric.vives' belong to a group with SYSADMIN role in both servers.

I don't understand why my login is not inheriting permissions from the group??

is it safe to rename index while DB is on-line?

$
0
0

Hi,

We need to replace one index with another. Both indexes are similar (index columns are the same) except new index has one  included column. System must remain on-line while index is replaced/recreated

Initial approach was to drop old index and create new one. That would take about 50 seconds. Objective is to decrease that time. New idea would be to create new index then drop old one and rename new one to have old one's name. Steps:

1) Create new index, let's call it MY_INDEX_1

2) Drop old index named MY_INDEX

3) rename MY_INDEX_1 to MY_INDEX

I suppose renaming will be done instantly but still have to check if any issues can be expected? For instance, once new index is created, some query uses it in exec plan and we rename index in that particular moment, can we expect some trouble?

Thanks in advance!

Viewing all 15872 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>