Quantcast
Channel: SQL Server Database Engine forum
Viewing all 12963 articles
Browse latest View live

sys.index_columns.key_ordinal versus index_column_id

$
0
0

http://msdn.microsoft.com/en-us/library/ms175105.aspx

What is the difference between key_ordinal and index_column_id?

One one table where there is no PK indicated by there is a clustered unique index with four fields, the key_ordinal values reflect the order of the fields in the index, the index_column_id has 3-4 reversed.

So I mainly wonder what the purpose of index_column_id is?

Thanks.

Josh

ps - SQL 2008 64-bit enterprise.



TRACE FLAG 1906

$
0
0

Dear Experts

Recently we are evaluating the product ChangeAuditor for SQL Server from company Quest

One is the requirements is to switch on the trace flag -T1906  on the monitored SQL Server if the version is  SQL Server 2008 R2 or SQL Server 2012. Our SQL Server's version is 2008 R2 SP2 and it is deployed on Windows Server 2008 R2 SP1

Could you help with information , is it safe switching on that flag?

Thanks 

OutOfMemory Error when exporting SSIS package

$
0
0

Hi all,

I hope you can help.

I get an Out of memory error when I try to export SSIS package from SSIS storage to file system. It stops and after some seconds error comes as pop up window.

I rebooted the server, same problem.

Its on 10.0.2531->> Updated to sp3. now 10.0.5500 but same problem.

and framework 2.0.50727

Any Ideas? Updating it tp latest SP will fix something?


Using ring buffers and per counters to see memory pressure ?

$
0
0

Look at a few different ways to identify memory pressure

(1) Ring buffers

http://thesqldude.com/tag/ring-buffer/

Which values of the returned results should I look at and how to compare them?

(2)

SELECT *
FROM sys.[dm_os_performance_counters] 
where 
 counter_name in('Page life expectancy','Memory Grants Pending')
 and [object_name] like '%Manager%' 

Same question - how to inprepet the results as good/bad

Causes for "Snapshot isolation transaction failed"???

$
0
0

What are the possible  causes of a "Snapshopt isolation transaction failed...DDL" message?

I have a production database of 250 million row that has been running very well for years.

We do use snapshot isolation,  and  I understand how that works and it's impact on tempdb.

Intermittently, but now with increasing regularity, we see a message: "Snapshot isolation transaction failed in database 'tempdb' because the object accessed by the statement has been modified by a DDL statement in another concurrent transaction since the start of this transaction.  It is disallowed because the metadata is not versioned.  A concurrent update to metadata can lead to inconsistency if mixed with snapshot isolation.'

I understand what the error message means, but nothing in the transaction is executing DDL statements.

I can reproduce this error by beginning a snapshot transaction, creating a temp table, and then trying to create an index:  this fails as expected, with this same message.  That makes perfect sense.  But I cannot determine the cause of the intermittent error.

I see in the last paragraph of this post that an out-of-space condition will also result in this same error message...which kind of makes sense,  although in that case the error is somewhat misleading.

We have 20 gig of tempdb space in 6 files, and almost all of it is available at any time  I inspect it.  It seems unlikely that even a large snapshot transaction would consume 20 gig of tempdb  space.

What are other things I could look for that could be causing this  "Snapshot isolation transaction failed" message?

tempdb - lots of old local temp tables still hanging around, some ove 30 days old???

$
0
0

I was having an issue with a query that uses temp tables (which I tend to stay away from).  I rewrote the procedure using a CTE and it works much faster.  However, I still need to analyze why the older procedure is bogging down, as there is a 3rd party system that uses similar procedures with temp tables.  

So I started to investigate tempdb for issues

- tempdb is not full
- server memory not an issue
- far too many local #temp tables in tempdb, some over 30 days old ???

select * from tempdb.sys.objects where type='U' and name like '#%'
ORDER BY modify_date DESC

Im guessing that whatever procedures or statements that were generating those local #temp tables, they might have ran into an error, and the temp tables were not dropped?  I thought that local temp tables got dropped after the statement or procedure completed or went out of scope???

Coping backup files from one location to another location of a particular date

$
0
0

Hi,

I have a folder contains last 5 days backup, I'm using the below command for copying 

use master

EXECUTE [dbo].[xp_cmdshell] 'Copy C:\commandTestCopy\*.BAK C:\commandTestPaste','NO_OUTPUT';

The command works fine for copying all files in the folder. Is there any condition to copy only one day or the present backups to other location.

Thanks,


From Harish

Login failed message via SQL server account....

$
0
0

Hi, everyone.

An error message as follow has come to me when I logged in SQL server via web server.

The message;

Server: Msg 18456, Level 14, State 1, Line 1
Login failed for user 'os login account'.

I dose not understannd what has happed to me. Anyone let me know how to solved this issue or how to survey what caused the issue.

Best regard.


exe called in SP

$
0
0

Hi,

I have an exe that is been called from an SP using

EXEC master..xp_cmdshell  m_Command.exe.

when i execute this command Shell on my server that is a SQl Server 2005 Ent x64 machine

NULL

Unhandled Exception: System.BadImageFormatException: Could not load file or assembly 'Oracle.DataAccess, Version=2.102.2.20, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. An attempt was made to load a program with an incorrect format.

File name: 'Oracle.DataAccess, Version=2.102.2.20, Culture=neutral, PublicKeyToken=89b483fxxxxxxx342'

   at XXX.DataLayer.DynamicTierDAO.GetXXXMessage(Int32 PersonID, String xxxMessageCode, String oracleConnectionString)

   at XXXTierUpdate.Program.GetXXXMessage(Int32 PersonID, String XXXMessageCode)

   at XXXXTierUpdate.Program.Main(String[] args)

NULL

WRN: Assembly binding logging is turned OFF.

To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.

Note: There is some performance penalty associated with assembly bind failure logging.

To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

NULL

NULL

 But if I execute the same exe in a SQl Server 2005 Ent x32 machine I get the result set as

 2~  58~  1657~ 88343~   2~  82~  1657~124343~   2~ 106~  1657~160343~~~TIER VALIDITY - 19NOV2013

Please let me know if you have come across such issue, and how can it be resolved.

SQL Agent - Error Authenticating Proxy

$
0
0

I am having an issue when scheduling an SSIS package on a Production environment (via SQL Agent, utilizing a Credential/Proxy). I have worked through the steps below in a Test environment and have not had any problems. Here's what I've done in Production (on a SQL Server 2008 R2 non-clustered environment):

- Copied SSIS package to file system (NTFS permissions are set properly)

- Created a Credential and Proxy (for a Windows user)

- Created SQL Agent job to execute the SSIS package

- Executed the job and receive the following error: 

"Unable to start execution of step 1 (reason: Error authenticating proxy DOMAIN/user, system error: Logon failure: unknown user name or bad password.).  The step failed."

Can someone help me work through this? I have tested the process above with a blank SSIS package, so I know it has nothing to do with access to the source systems. The issue resides specifically on the SQL Server box that is running SSIS and SQL Agent.

I have done some reading and found the following:

- Delegate permissions to SQL Agent account...

- Provide "Log on as a batch job" permissions to AD user

- Install a KB to fix...

Not sure what to puruse at this point. Also, the Job will run just fine using the SQL Agent service account; however, I need to run this user as a different account.

Please advise.


Always on

$
0
0

Hi ,

 I could like know whether  "ALWAYS on" Can be configured on Sql2012 Standard Edition ...

Please let me know .. 

Regards

K.Muthus

Change SQL Server Collation in SQL Server 2012

$
0
0

Hi

How to Change Server Level Collation in SQL Server 2012 Stan Edition after installation?

--

Ragu Thangavel


Ragu Thangavel

Attempted to read or write protected memory

$
0
0

Hello,

I'm getting the following error message intermittently when trying to execute SSIS packages. The SSIS packages are hosted on SQL server 2008,10.0.2531, X64 and 100GB f RAM and with more than 10GB available memory on the server.  The package is trying to transfer data from one server to other. The source server is SQL Server 2005,x64,SP3 and destination is SQL Server 2008,10.0.2531,x64.

when the restart the same SSIS package (SQLAgen job) it works fine.  I do not see any access voilation/memory assertions on the server. I would like to understand and know the root cause of this error message.  Is it related to SSIS or DB engine??. Any tools or troubleshooting techniques would help to isolate the issue..

I have posted the same question in SSIS forum and reason i posted here is because it is relaetd to memory issue and i'm hoping to get replies from DB engine/performance issues tuning experts..

any help highly appreciated.....

ERROR :

Error: 2013-07-05 1:55:10.77

  Code: 0xC002F210
   Source: SQL - Get Source Logic Execute SQL Task 
   Description: Executing the query "EXECUTE Control.GetSourceLogic ?, ? OUTPUT;" failed with the following error: "Attempted to read or write protected memory. This is often an indication that other memory is corrupt.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
End Error
DTExec: The package execution returned DTSER_FAILURE (1).
Started:  9:53:19 PM
Finished: 9:55:28 PM
Elapsed:  128.608 seconds

SysJobHistory - Step_Name - (Job outcome)

$
0
0

HI Sql Techies,

What is mean of (Job outcome) in Step_Name Column in System Table SysJobHistory, after job completed.

SQL 2012 SP1 CU4

$
0
0

Hi~ anyone knows the difference between the following downloads:


SQL Backup

$
0
0

We are backup SQL server 2008 R2 using  windows server network share. We never had any problem. My our company has installed NAS device. When running SQL backup now we are seeing error message " <%SQLSERVER%> calling non existence file share named filestream.hdr. Sometimes backup will continue but lately its failing a lot.

This is the only article I found out saying that its a bug and there should be fix coming but.

We are running SQL2008 R2 SP2.

http://connect.microsoft.com/SQLServer/feedback/details/591263/unable-to-perform-backups-to-server-that-has-network-share-filestream-hdr

Is there any way to configure SQLbackup so it will not check for filestream.hdr?

Performance Issue Using T4199 or T4126

$
0
0

Hi, we migrated a database from a SQL Server 2008 server (production) to a SQL Server 2008 R2 server (test - version 10.50.4000).  The test server has the trace flag 4199 enabled.  The original production server does not use the trace flag.  One of the queries (with a complicated ON clause) became very slow.  As soon as I removed the trace flag and restarted, the query is fast again. 

With T4199: (takes 30 seconds)

Table 'complaint_data'. Scan count 12296800, logical reads 39196050, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

Table 'enhancement'. Scan count 4, logical reads 101956, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

Table 'charging_language_segment'. Scan count 9, logical reads 38, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

Table 'charge_filed'. Scan count 1, logical reads 3, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

Table 'defendant'. Scan count 1, logical reads 2, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

Without T4199: (takes less than second)

Table 'Worktable'. Scan count 0, logical reads 0, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

Table 'complaint_data'. Scan count 80, logical reads 320, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

Table 'charging_language_segment'. Scan count 9, logical reads 38, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

Table 'enhancement'. Scan count 3, logical reads 33, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

Table 'charge_filed'. Scan count 1, logical reads 3, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

Table 'defendant'. Scan count 1, logical reads 2, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

I did update the usage and statistics, but it made no difference.   I removed the T4199 flag from startup.  I was able to use DBCC TRACEON one at a time, usinghttp://support.microsoft.com/kb/974006, and isolate the issue to trace flag 4126 (http://support.microsoft.com/kb/959013).  I had to use "OPTION(RECOMPILE)" to insure I was getting a new plan each test.  This flag does not seem to have anything to do with this query.  I don't see any local publications or subscriptions. 

Here's the query.  (Yes, that's an ugly ON clause.  This is ancient code.  I did create a version that optimizes with or without the trace flag, but we have a lot of other code to worry about.  A developer just happened to notice this issue on this query.) 

DECLARE @case_sid int
SET @case_sid = 132970
SELECT COUNT(DISTINCT CAST(e.enhancement_number AS VARCHAR(10)) + CAST(c.segment_number AS VARCHAR(10)))
FROM charging_language_segment c
INNER JOIN enhancement e
ON c.offense_sid = e.offense_sid
	AND c.segment_type IN ('CITY', 'CNTY', 'CRTN', 'CRTP', 'FARM', 'JNDR', 
		'NAME', 'NAR', 'SEL', 'ST', 'VHCL', 'WPN')
	AND e.charge_sid IN (
		SELECT charge_sid 
		FROM charge_filed 
		WHERE defendant_sid IN (
			SELECT defendant_sid 
			FROM defendant 
			WHERE case_sid = @case_sid
			)
		)
	AND 'E' + CAST(e.enhancement_number as varchar(9)) + '_' + CAST(c.segment_number AS VARCHAR(9)) 
		NOT IN
		  (SELECT DISTINCT cd.count_number + '_' + CAST(cd.segment_number AS VARCHAR(9)) 
		  FROM complaint_data cd
		  INNER JOIN enhancement e2
		  ON cd.count_number = 'E' + CAST(e2.enhancement_number AS VARCHAR(9))
			  AND cd.case_sid = @case_sid
			  AND cd.complaint_data_value IS NOT NULL
			  AND cd.complaint_data_value <> '')
OPTION(RECOMPILE)	

Does anybody have any advice?  Perhaps T4199 is no longer an option once we have production code not using the flag? 

Thanks, Randy


Randy in Marin

Performance improvement in linked server-Disable data type check

$
0
0

Hi All,

I have two SQL serves one is SQL server 2005 and other SQL server 2008.I push data from SQL server 2005 to SQL server 2008 using Linked Server.I want to improve performance of data transfer. Few days back I cam across one article (I don't remember exact site name) which mentioned  while inserting data in remote server you candisable data type check which can improve performance.He had mentioned oneSet Command. I don't remember that command .Guys can you please help me to find out this command.I check with MSDN site but no help.

Also if you have any other performance improvement tricks please let me know.

Thanks in advance...


Banky

More instances of SQL Server in the same LAN

$
0
0

Hello everyone, just a quick question. I got Sql server 2008 r2 running in four different server, now I would like to build another instance to develop some stuff. I'm wondering if there can be any issue using another instance in one of the servers: I know that I must set the tcp port in a different way (probably I'm going to leave the tcp port free keeping the main instance with the port 1433). Moreover, do you thin can I use a simple desktop and not a server? I worked a lot in SSIS and SSAS recently but I don't have a lot of experience about DBA. I even thought to install a SQL 2012 Express edition but I dunno if there is any bad compatibility.

Any experience guys? 

How to set MAX degree of Parallellism

$
0
0

Hi experts

  Server have 8 core processor, In my database the max degree of parallelism value min is 0 and max is 64,but i always facing CXpacket wait type issue.

Please help me how to overcome.Is my max degree parallelism  setting is correct ?

thanks in advance.


Thanks - SelvaKumarSubramaniam.Please MARK AS ANSWER, if my answer is useful to U.


Viewing all 12963 articles
Browse latest View live