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

What data is transmitted when running SQL against a linked server

$
0
0

Good Afternoon

Can you please help with following question.

If I running a select except statement against a table on a linked server and a table on a server on which the SQL resides how much data is transferred between the two servers?

For example

Select *

from linked_server_table

where type = 'A'

except

Select *

from local_server_table

where type = 'A'

Are the records from linked_server_table where type = 'A' sent or are all rows sent and the local server filters these rows ?

Hope this makes sense and thank you in advance for any reply.

Cheers VS


can not be reached or does not exist "Database Mirroring"

$
0
0

Dear Friends,

I am trying to configure mirroring between two servers without witness server. Both servers have configured default instance

(MSSQLSERVER). I am configuring the mirroring settings but when clicking to start its giving me this one error:

================================================

TITLE: Database Properties
------------------------------
An error occurred while starting mirroring.
------------------------------
ADDITIONAL INFORMATION:
Alter failed for Database 'JI-TFS-Warehouse'.  (Microsoft.SqlServer.Smo)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1600.1+((KJ_RTM).100402-1539+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Alter+Database&LinkId=20476

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

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

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

The server network address "TCP://MIRROR.corp.aaj.com:5022" can not be reached or does not exist. Check the network address name and that the ports for the local and remote endpoints are operational. (Microsoft SQL Server, Error: 1418)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1600&EvtSrc=MSSQLServer&EvtID=1418&LinkId=20476

################################################################3

I can see this error in event viewer window as follow:

Database mirroring connection error 4 'An error occurred while receiving data: '10054(An existing connection was forcibly closed by the remote host.)'.' for 'TCP://MIRROR.corp.aaj.com:5022'.

From principle: If connecting with server (mirror) without instance name then its connecting but if mentioning instance name like mirror\MSSQLSERVER then its not connecting.

Regards

SQL 2008 R2 standard reports - question about server dashboard and what it refers to as "adhoc" queries

$
0
0

So I have started looking at some of the standard reports available with SSMS and in particular, the "server dashboard".   One thing that caught my attention were the charts that referred to "adhoc" queries.  I wondered how those were being defined, and as I expected, they are most likely those statements not in a stored procedure.  This was answered inthis thread.  

On a particular server Im interested in, this % value is well over 50% and the primary applications that interact with the databases on this system are Microsoft based products such as Dynamics and another commercial application which I know uses hundreds of stored procedures.  Now, Im sure there are some sql statements being used, possibly "dynamic" type sql, by these applications, but would the metrics really be skewed this far?

What these charts tell me, with the "adhoc" statement types pushing CPU and Disk I/O %  this far, is that there is a BUNCH of these statements being run against the various databases.  The disk I/O might be a bit off since I only recently added dozens of missing indexes, but my question is this:

With the "adhoc" type statements taking up this much of the CPU and Disk resources, can we say that there are likely a lot of these going on ?  I suppose one way to find out is to launch profiler and listen in while there is moderate to heavy user activity.

Thoughts?


Analyzing profiler data - why would event class 15 (audit logout) cause high reads ?

$
0
0

Im doing some performance checking on one of my systems and the top trace records by duration and reads are those with an event class of 15.  Why would simply closing the connection(s) cause such high read values - which implies a lot of i/o?

Can't turn off vardecimal storage on user database

$
0
0
There are no objects that has TableHasVarDecimalStorageFormat enabled. The below query returns nothing. 
Tried everything as per BOL. 

SELECT name, OBJECT_ID, type_desc, OBJECTPROPERTY(OBJECT_ID, N'TableHasVarDecimalStorageFormat')
FROM sys.objects  
WHERE OBJECTPROPERTY(OBJECT_ID, N'TableHasVarDecimalStorageFormat') = 1 
order by 3,1

EXECUTE sp_db_vardecimal_storage_format 'DB','OFF';

EXECUTE sp_db_vardecimal_storage_format 'DB'; Still show the db has vardecimal storage. 
Trying to migrate from SQL Server 2008 R2 Ent to 2012 Standard, and not able to restore this database to target. 

Pleas let me know 

Suman

sql 2012 - Error: 26073, Severity: 16

$
0
0

Hi,

we are getting the 26073 TCP error on SQL 2012 Enterprise (64 bit) SP1 running on Windows 2008 R2 (SP1).I understand that this is a bug in SQL 2008/2008 R2. Has anyone seen this error in SQL 201? Please advise how to resolve this issue in SQL 2012.

TCP connection closed but a child process of SQL Server may be holding a duplicate of the connection's socket.  Consider enabling the TcpAbortiveClose SQL Server registry setting and restarting SQL Server.

Thank you

CDC Designer Creating Primary Keys Column Order Different from Source Oracle Database

$
0
0

The order of my primary key columns appear to be in column name order, rather than the original order in my Oracle database.

See the following Oracle Create Table command, with the primary key column order PK1, PK3, and PK2:

  CREATE TABLE "TESTSCHEMA"."TEST" 
   ("PK2" VARCHAR2(20 BYTE) NOT NULL ENABLE, 
"COL2" VARCHAR2(20 BYTE), 
"COL3" VARCHAR2(20 BYTE), 
"PK1" VARCHAR2(20 BYTE) NOT NULL ENABLE, 
"PK3" VARCHAR2(30 BYTE) NOT NULL ENABLE, 
CONSTRAINT "PK_TEST" PRIMARY KEY ("PK1", "PK3", "PK2")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS"  ENABLE
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS" ;

See the CDC Instance Deployment Script for the same table, noticing that the order of the primary key columns are now PK1, PK2, and PK3.

IF NOT EXISTS (SELECT 1 FROM [sys].[tables] WHERE SCHEMA_NAME([schema_id]) = N'TESTSCHEMA' AND [name] = N'TEST') 
CREATE TABLE [TESTSCHEMA].[TEST] ( 
[PK2] nvarchar(20), 
[COL2] nvarchar(20), 
[COL3] nvarchar(20), 
[PK1] nvarchar(20), 
[PK3] nvarchar(30), 
CONSTRAINT [PK_TEST] PRIMARY KEY CLUSTERED (
PK1 ASC, 
PK2 ASC, 
PK3 ASC 
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY] 
) ON [PRIMARY];

I ran the following, and got these results:

SELECT i.name AS index_name
    ,ic.index_column_id
    ,key_ordinal
    ,c.name AS column_name
    ,TYPE_NAME(c.user_type_id)AS column_type 
    ,is_identity
FROM sys.indexes AS i
INNER JOIN sys.index_columns AS ic 
    ON i.object_id = ic.object_id AND i.index_id = ic.index_id
INNER JOIN sys.columns AS c 
    ON ic.object_id = c.object_id AND c.column_id = ic.column_id
WHERE i.is_primary_key = 1 and i.name = 'PK_TEST'
order by index_name, column_name

index_nameindex_column_idkey_ordinalcolumn_namecolumn_typeis_identity
PK_TEST  3 PK1 nvarchar 0
PK_TEST  2 PK2 nvarchar 0
PK_TEST  1 PK3 nvarchar 0

This has to be a bug in CDC Designer.  Can I hope for a quick fix?




Tracking the Table

$
0
0

Hello,

I would like to track the table if any changes(insert, update, delete etc) done, like how we track using Change Tracking or Change Data Capture, but i can not use these 2 feature because i dont have primary key in a table.

Please help me out on tracking the table without having primary key.

Thanks in advance.

Regards,

Praveen


How to validate performance before and after turn on Trace Flag 2371

$
0
0
Hi Friends
I have 5 TB DB for AX.
What homework I am supposed to follow to collect some evidence of performance improvement after I turn on -T2371

Regards,
Anjan

Trace flag 4136 vs Trace Flag 2371

$
0
0
Hi Friends
I have 5 TB DB for AX.
Auto create stat and auto update stat are ON
We have update stat job for few identified table .
If I turn on 4136 ,do we really need to turn on 2371 ?
Regards,
Anjan

Trace flag 4136 can improve the performance in Dynamics AX--How to test that before and after the change

$
0
0
Hi Friends
I have 5 TB DB for AX.
And I know parameter sniffing default behavior may cause seek to scan for parametrized stored procedures.
And now I want to use T4136 flag to prevent this as per AX best practice.
How do I test it in production server to show customers before and after the change.

Regards,
Anjan

Calculating Opening Balance

$
0
0

Dear All,

I need to calculate opening balance for the following table structure:

G/L Account NoPosting date AmountOpening  Closing

002 12/31/20121000  01000

00312/31/201220000 2000

00412/31/201230000 3000

00301/01/2013150020003500

00401/01/201350030003500

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

00201/01/2013-1000 1000

The GL Account No 002 doesn't have an entry for 01/01/2013 but still if user wants to see its opening he should be able to see it.

With the logic of the a.posting date <b.posting date and a.GL Account No=b.GL Account No I do get required opening Balance but the result we get skips the 002 GL Account No which is due to the join on GL Account No.

Can anybody please help?


Thanks, Franco.

SQL 2005 x64 poor performance after migration from SQL 2005 x86

$
0
0

Recently We've migrated SQL 2005 x86 SP1 Enterprise running on Windows 2003 Enterprise to new hardware where is running Windows 2008 SP2 and SQL 2005 x64 SP4 with CU3.

In the work day, there are sometime SQL excpetions like this below. On other hand i can also tell that we already found some queries which has some inner joins and where clauses on nvarchar fileds, because of the nature of application. Such a query is running for about 11 seconds on old SQL server, and about 6 minutes on new SQL server. My main question if is this possible just with a change to new architecture of SQL and more last patches and updates for SQL 2005. Is there any way how to get this queries running faster, without rewritng them with new ones? Is this also possible this could be also cause for SQL exceptions, which we are facing on SQL server?

About new hardware, for now we can't find it something wrong. There is basic configuration:

Cisco UCS  C220 M3S (1U server)

32GB RAM

Intel(R)Xeon® CPU E5-2630@2.30GHz, 6 core

Disk system: 4xSAS 300GB in RAID5 (OS and DATA) and 2xSATA 1TB in RAID1 (SQL backup)

RAID controller: LSI MegaRAID SAS 9271-8i (with latest driver and firmware)

Part of log of dump file:

2014-05-09 08:30:07.08 spid86      Error: 17311, Severity: 16, State: 1.
2014-05-09 08:30:07.08 spid86      SQL Server is terminating because of fatal exception c0000264. This error may be caused by an unhandled Win32 or C++ exception, or by an access violation encountered during exception handling. Check the SQL error log for any related stack dumps or messages. This exception forces SQL Server to shutdown. To recover from this error, restart the server (unless SQLAgent is configured to auto restart).
2014-05-09 08:30:07.08 spid86      Using 'dbghelp.dll' version '4.0.5'
2014-05-09 08:30:07.08 spid86      **Dump thread - spid = 86, PSS = 0x0000000132A67ED0, EC = 0x0000000132A67EE0
2014-05-09 08:30:07.08 spid86      ***Stack Dump being sent to D:\MSSQL.1\MSSQL\LOG\SQLDump0087.txt
2014-05-09 08:30:07.08 spid86      * *******************************************************************************
2014-05-09 08:30:07.08 spid86      *

Thanks for any help,

Matjaž

Calculating Opening Balance

$
0
0

Dear All,

I need to calculate opening balance for the following table structure:

G/L Account NoPosting date AmountOpening  Closing

002 12/31/20121000  01000

00312/31/201220000 2000

00412/31/201230000 3000

00301/01/2013150020003500

00401/01/201350030003500

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

00201/01/2013-1000 1000

The GL Account No 002 doesn't have an entry for 01/01/2013 but still if user wants to see its opening he should be able to see it.

With the logic of the a.posting date <b.posting date and a.GL Account No=b.GL Account No I do get required opening Balance but the result we get skips the 002 GL Account No which is due to the join on GL Account No.

Can anybody please help?


Thanks, Franco.

How to move a DB in a recovering state from one server to another?

$
0
0

I have a server with many DBs in a "recovering" state (log shipping secondary). There is a hardware failure and the server needs to be recreated.

How do I keep the DBs so that I'll be able to attach them to the new server?

I tried to backup the DBs but I get this message:

Msg 927, Level 14, State 2, Line 2

Database 'DBName' cannot be opened. It is in the middle of a restore.


I can't bring fresh backups from the main site as the sites are far from each other and moving the backups will be too expensive.


sql server is using 98% of RAM

$
0
0

Hi ,

I have a database server for data warehouse, when we start running packages the RAM utilization reach to the 98%. so at the same time when we try to access data through my .net application , sometime its giving time out error.

I have tested from backend side I find that even after data loading completed still task manager is showing 98% RAM utilization. for test purpose I have excited Checkpoint still I find so many pages are cached in buffer. finally I have released the   DROPCLEANBUFFERS , I found all the cached pages got clean. but I surprised when I looked task manager I found still RAM is 98% full and sqlsrvr.exe is occupied all the ram space.


Regards Vikas Pathak

SQL Server Assertion error

$
0
0

A SQL Server 2008 R2 Enterprise with SP2 reported SQL Server Assertion error.  it is acting as a subscriber. Page compression is applied to some tables.  A search the forum did not yield similar error being report.   DBCC CheckDB will be performed over the weekend.  I did not see any patches released for this particular problem.

SQL Server Assertion: File: <pageref.cpp>, line=922 Failed Assertion = 'IS_OFF (BUF_MINLOGGED, m_buf->bstat) || pageModifyType != PageModifyType_Contents || GetPagePtr ()->IsTextPage ()'. This error may be timing-related. If the error persists after rerunning the statement, use DBCC CHECKDB to check the database for structural integrity, or restart the server to ensure in-memory data structures are not corrupted.


Can I get in mail the reports

$
0
0

Hi,

When right click on instance  get reports.I want to get those reports on mail on daily basis.

Is it possible?


Thanks

SQL server management studio

$
0
0
hi I would like to ask, how to change the data as whole column or row in on shot?

SQL Server 2008R2 Active-Active cluster with standard edition?

$
0
0

Hi all,

can I have a 2 node cluster (Windows Server 2008R2 Datacenter Edition: node_1 and node_2) forming a failover cluster with 2 instances of SQL Server 2008R2 Standard Edition (instance_A and instance_B) with:

instance_A running on node_1

instance_B running on node_2

Viewing all 12554 articles
Browse latest View live


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