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

SQL Server 2012: NUMA node shown as offline without special affinity settings

$
0
0

My main production server has four NUMA nodes with two SQL Server 2012 instances on it. One of the instances has the CPU affinity set to use only one NUMA node, and sys.dm_os_nodes reflects that correctly. The other instance has no affinity settings, so it should show all 4 NUMA nodes as online, I would think, but it shows Node 3 as offline, which happens to be the node that's online for the other instance. Is there a bug in SQL Server 11.0.3128 (Enterprise)?


How to tell when all records are committed and Record commit time instead just getdate()

$
0
0

We have several processes  inserting records for one Batch.

Recently we’ve had some long blocking so some of the inserts for a batch were blocked while the select statement to get a count of this batch ran ( we use read_committed_snapshot) and returned an incorrect count because it was missing the blocked inserts.

Additionally the time_updated is using getdate() and that stores the time the record is parsed not the time it is finally written to the database so it is not correct.

Is there any way to store the time the record is actually saved?

Is there any method to ensure all records for a batch are committed before we run the select of the count? This is a very busy process and we need correct counts.  We’ve thought of using some sort of separate queuing when inserting and then making sure the number of records in the queue match the database. Is there a better way?


KD

Possible solution to avoid deadlock when two inserts happen on same table from two different machines.

$
0
0

Possible solution to avoid deadlock when two inserts happen on same table from two different machines.

Below are the details from deadlock trace.

Deadlock encountered .... Printing deadlock information
Wait-for graph
NULL
Node:1

KEY: 8:72057594811318272 (ffffffffffff) CleanCnt:3 Mode:RangeS-S Flags: 0x1
 Grant List 2:
   Owner:0x00000013F494A980 Mode: RangeS-S Flg:0x40 Ref:0 Life:02000000 SPID:376 ECID:0 XactLockInfo: 0x000000055014F400
   SPID: 376 ECID: 0 Statement Type: INSERT Line #: 70
   Input Buf: RPC Event: Proc [Database Id = 8 Object Id = 89923542]
Requested by: 
  ResType:LockOwner Stype:'OR'Xdes:0x0000002AA53383B0 Mode: RangeI-N SPID:238 BatchID:0 ECID:0 TaskProxy:(0x00000027669B4538) Value:0x10d8d500 Cost:(0/38828)
NULL
Node:2

KEY: 8:72057594811318272 (ffffffffffff) CleanCnt:3 Mode:RangeS-S Flags: 0x1
 Grant List 2:
   Owner:0x0000000B3486A780 Mode: RangeS-S Flg:0x40 Ref:0 Life:02000000 SPID:238 ECID:0 XactLockInfo: 0x0000002AA53383F0
   SPID: 238 ECID: 0 Statement Type: INSERT Line #: 70
   Input Buf: RPC Event: Proc [Database Id = 8 Object Id = 89923542]
Requested by: 
  ResType:LockOwner Stype:'OR'Xdes:0x000000055014F3C0 Mode: RangeI-N SPID:376 BatchID:0 ECID:0 TaskProxy:(0x000000080426E538) Value:0x30614e80 Cost:(0/41748)
NULL
Victim Resource Owner:
 ResType:LockOwner Stype:'OR'Xdes:0x0000002AA53383B0 Mode: RangeI-N SPID:238 BatchID:0 ECID:0 TaskProxy:(0x00000027669B4538) Value:0x10d8d500 Cost:(0/38828)
deadlock-list
 deadlock victim=process5daddc8
  process-list
   process id=process5daddc8 taskpriority=0 logused=38828 waitresource=KEY: 8:72057594811318272 (ffffffffffff) waittime=2444 ownerId=2994026815 transactionname=user_transaction lasttranstarted=2014-07-25T12:46:57.347 XDES=0x2aa53383b0 lockMode=RangeI-N schedulerid=43 kpid=14156 status=suspended spid=238 sbid=0 ecid=0 priority=0 trancount=2 lastbatchstarted=2014-07-25T12:46:57.463 lastbatchcompleted=2014-07-25T12:46:57.463 clientapp=pa hostname=pa02 hostpid=1596 loginname=myuser isolationlevel=serializable (4) xactid=2994026815 currentdb=8 lockTimeout=4294967295 clientoption1=671088672 clientoption2=128056
    executionStack
     frame procname=mydb.dbo.SaveBill line=70 stmtstart=6148 stmtend=8060 sqlhandle=0x03000800d61f5c056bd3860170a300000100000000000000
INSERT INTO [dbo].[Prod1] .....
inputbuf
Proc [Database Id = 8 Object Id = 89923542]    
   process id=process5d84988 taskpriority=0 logused=41748 waitresource=KEY: 8:72057594811318272 (ffffffffffff) waittime=2444 ownerId=2994024748 transactionname=user_transaction lasttranstarted=2014-07-25T12:46:57.320 XDES=0x55014f3c0 lockMode=RangeI-N schedulerid=39 kpid=14292 status=suspended spid=376 sbid=0 ecid=0 priority=0 trancount=2 lastbatchstarted=2014-07-25T12:46:57.440 lastbatchcompleted=2014-07-25T12:46:57.440 clientapp=pa hostname=pa01 hostpid=1548 loginname=myuser isolationlevel=serializable (4) xactid=2994024748 currentdb=8 lockTimeout=4294967295 clientoption1=671088672 clientoption2=128056
    executionStack
     frame procname=pa.dbo.SaveBill line=70 stmtstart=6148 stmtend=8060 sqlhandle=0x03000800d61f5c056bd3860170a300000100000000000000
INSERT INTO [dbo].[Prod1]....
    inputbuf
Proc [Database Id = 8 Object Id = 89923542]    
  resource-list
   keylock hobtid=72057594811318272 dbid=8 objectname=pa.dbo.prod1 indexname=PK_a id=lock1608ee1380 mode=RangeS-S associatedObjectId=72057594811318272
    owner-list
     owner id=process5d84988 mode=RangeS-S
    waiter-list
     waiter id=process5daddc8 mode=RangeI-N requestType=convert
   keylock hobtid=72057594811318272 dbid=8 objectname=pa.dbo.prod1 indexname=PK_a id=lock1608ee1380 mode=RangeS-S associatedObjectId=72057594811318272
    owner-list
     owner id=process5daddc8 mode=RangeS-S
    waiter-list
     waiter id=process5d84988 mode=RangeI-N requestType=convert

Unicode: issue with representation of Devanagari character (U+0940 and U+0947)

$
0
0

Hello,

I observe issue with representation of Devanagari  characters (U+0940 and U+0947) :

U+0940e0 a5 80DEVANAGARI VOWEL SIGN II
U+0947e0 a5 87DEVANAGARI VOWEL SIGN E

In SQL server database I think DEVANAGARI VOWEL SIGN E is represented as less than to DEVANAGARI VOWEL SIGN II. 

I think it is a bug in SQL Server database, and should be represented in other way round i.e, U+0947 should be represented as >  from U+0940.

The steps to reproduce with T-SQL :

   create table test (c1 int, c2 nvarchar(50))

insert values:

   insert into test(c1, c2) values (1,N'पीपे का सबसे चौड़ा भाग') 
   insert into test(c1, c2) values (2,N'पी') 
   insert into test(c1, c2) values (3,N'पे') 

Fetch records:

sql1: select * from test where c2 > N'पे' order by c2;

2पी
1पीपे का सबसे चौड़ा भाग

// it should not return any row as no row is having value > 'पे'

sql2: select * from test where c2 > N'पी' order by c2;

1पीपे का सबसे चौड़ा भाग

// it should return one more row as 'पे' should be greater than 'पी'.

Thanks,

Mukesh


Multiple servers backing up on tape

$
0
0

Hi all,

We have tens of SQL Server instances and currently they perform regular log backup every 15 minutes.

So far we have been using disk based backups, for example on local disks of servers or shared storage on SAN.

Recently we decided to buy a tape.

My question is that what happens if for example 10 jobs on different servers try to write backup to tape?

Because on disk based backup, the disks of destination will become slow but never reject the backupset. Does the same thing happen for tape or the tape will reject the write operation if requests are too high?

Thanks in advance,

Leila

How to know information about drivers

$
0
0
Hi Everyone,

As a sql server dba how would one can identify or tell drives are not been updated (BIOS, firmware, network, storage ...) on your server.

Is there any command using which I can confirm drivers are not up to date?
Also, where can I find all the drivers information.

Any suggestions would be a great help.

Thanks.

relationships between tables, and diagrams

$
0
0
my question is ,, 
how to build a diagram, I don't understand that many to many , or one to many and about primary key and foreign key and etc..

here is my code. is about a hospital where i have ,

NURSES, WARD, PATIENTS, DOCTORS.


CREATE TABLE Nurses(
`idNurses` INT NOT NULL AUTO_INCREMENT,
`Fname` VARCHAR(45) NULL,
`Lname` VARCHAR(45) NULL,
`Speciality` VARCHAR(45) NULL,
PRIMARY KEY (`idNurses`))
ENGINE = InnoDB;


CREATE TABLE Doctors (
`idDoctors` INT NOT NULL AUTO_INCREMENT,
`Fname` VARCHAR(45) NULL,
`Lname` VARCHAR(45) NULL,
`Speciality` VARCHAR(45) NULL,
PRIMARY KEY (`idDoctors`))
ENGINE = InnoDB;



CREATE TABLE Ward(
`idWard` INT NOT NULL AUTO_INCREMENT,
`Name` VARCHAR(45) NULL,
`Location` VARCHAR(45) NULL,
`Nurses_idNurses` INT NOT NULL,
`Doctors_idDoctors` INT NOT NULL,
PRIMARY KEY (`idWard`, `Nurses_idNurses`, `Doctors_idDoctors`),
INDEX `fk_Ward_Nurses_idx` (`Nurses_idNurses` ASC),
INDEX `fk_Ward_Doctors1_idx` (`Doctors_idDoctors` ASC),
CONSTRAINT `fk_Ward_Nurses`
FOREIGN KEY (`Nurses_idNurses`)
REFERENCES `mydb`.`Nurses` (`idNurses`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_Ward_Doctors1`
FOREIGN KEY (`Doctors_idDoctors`)
REFERENCES `mydb`.`Doctors` (`idDoctors`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;

CREATE TABLE Patient (
`idPatient` INT NOT NULL AUTO_INCREMENT,
`Fname` VARCHAR(45) NULL,
`Lname` VARCHAR(45) NULL,
`DOB` DATE NULL,
`Phone_number` INT NULL,
`Ward_idWard` INT NOT NULL,
`Ward_Nurses_idNurses` INT NOT NULL,
`Ward_Doctors_idDoctors` INT NOT NULL,
PRIMARY KEY (`idPatient`, `Ward_idWard`, `Ward_Nurses_idNurses`, `Ward_Doctors_idDoctors`),
INDEX `fk_Patient_Ward1_idx` (`Ward_idWard` ASC, `Ward_Nurses_idNurses` ASC, `Ward_Doctors_idDoctors` ASC),
CONSTRAINT `fk_Patient_Ward1`
FOREIGN KEY (`Ward_idWard` , `Ward_Nurses_idNurses` , `Ward_Doctors_idDoctors`)
REFERENCES `mydb`.`Ward` (`idWard` , `Nurses_idNurses` , `Doctors_idDoctors`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;

My HDD has 6 partitions when I received it

$
0
0

This website is a joke. Couldn't find my answer if my life depended on it. I was given this laptop as is. Here are the pecs:

Computer
Computer TypeACPI x64-based PC  (Mobile)
Operating SystemMicrosoft Windows 8.1 Professional
OS Service Pack-
Internet Explorer11.0.9600.17207
DirectXDirectX 11.0
Computer NameMAYNARD (Derek's PC)
User NameOwner
Logon DomainMAYNARD
Date / Time2014-07-26 / 16:34

Motherboard
CPU TypeMobile DualCore Intel Pentium B980, 2400 MHz (24 x 100)
Motherboard NameAsus X401A1 Series Notebook
Motherboard ChipsetIntel Panther Point HM70, Intel Sandy Bridge
System Memory3979 MB  (DDR3-1600 DDR3 SDRAM)
DIMM1: Ramaxel RMT3160ED58E9W16004 GB DDR3-1600 DDR3 SDRAM  (11-11-11-28 @ 800 MHz)  (10-10-10-27 @ 761 MHz)  (9-9-9-24 @ 685 MHz)  (8-8-8-22 @ 609 MHz)  (7-7-7-19 @ 533 MHz)  (6-6-6-16 @ 457 MHz)  (5-5-5-14 @ 380 MHz)
BIOS TypeUnknown (08/20/2012)

Display
Video AdapterIntel(R) HD Graphics  (1841062 KB)
Video AdapterIntel(R) HD Graphics  (1841062 KB)
3D AcceleratorIntel HD Graphics 2000
MonitorSamsung LTN140AT20P01  [14" LCD]

Multimedia
Audio AdapterIntel Panther Point HDMI @ Intel Panther Point PCH - High Definition Audio Controller [C-1]
Audio AdapterRealtek ALC270 @ Intel Panther Point PCH - High Definition Audio Controller [C-1]

Storage
IDE ControllerRealtek PCIE CardReader
IDE ControllerStandard SATA AHCI Controller
Storage ControllerMicrosoft Storage Spaces Controller
Disk DriveHitachi HTS543232A7A384  (320 GB, 5400 RPM, SATA-II)
Disk DriveSeagate FreeAgent GoFlex USB Device  (1397 GB, USB)
SMART Hard Disks StatusOK

Partitions
C: (NTFS)287.8 GB (89.5 GB free)
Total Size287.8 GB (89.5 GB free)

Input
KeyboardHID Keyboard Device
KeyboardKeyboard Device Filter
MouseHID-compliant mouse
MouseSynaptics PS/2 Port Compatible TouchPad

Network
Primary IP Address
Primary MAC Address
Network Adapter802.11n Wireless LAN Card  (192.168.1.67)
Network AdapterMicrosoft Wi-Fi Direct Virtual Adapter
Network AdapterRealtek PCIe GBE Family Controller
Network AdapterTAP-Win32 Adapter OAS #2
Network AdapterTAP-Win32 Adapter OAS #3
Network AdapterTAP-Win32 Adapter OAS #4
Network AdapterTAP-Win32 Adapter OAS #5
Network AdapterTAP-Win32 Adapter OAS
Network AdapterTAP-Windows Adapter V9 #2
Network AdapterTAP-Windows Adapter V9 #3
Network AdapterTAP-Windows Adapter V9 #4
Network AdapterTAP-Windows Adapter V9 #5
Network AdapterTAP-Windows Adapter V9

Peripherals
PrinterFax
PrinterMicrosoft XPS Document Writer
PrinterSend To OneNote 2013
PrinterSnagit 12
USB2 ControllerIntel Panther Point PCH - USB 2.0 EHCI Controller #1 [C-1]
USB2 ControllerIntel Panther Point PCH - USB 2.0 EHCI Controller #2 [C-1]
USB3 ControllerIntel Panther Point PCH - USB 3.0 xHCI Controller [C-1]
USB DeviceGeneric USB Hub
USB DeviceGeneric USB Hub
USB DeviceGeneric USB Hub
USB DeviceHID-compliand device
USB DeviceUSB 2.0 UVC HD Webcam
USB DeviceUSB Composite Device
USB DeviceUSB Composite Device
USB DeviceUSB Input Device
USB DeviceUSB Input Device
USB DeviceUSB Mass Storage Device
BatteryMicrosoft AC Adapter
BatteryMicrosoft ACPI-Compliant Control Method Battery

DMI
DMI BIOS VendorAmerican Megatrends Inc.
DMI BIOS VersionX401A1.211
DMI System ManufacturerASUSTeK COMPUTER INC.
DMI System ProductX401A1
DMI System Version1.0
DMI System Serial NumberC9N0BC434262396
DMI System UUID51544358-4A314E30-46325046-5D2D46A0
DMI Motherboard ManufacturerASUSTeK COMPUTER INC.
DMI Motherboard ProductX401A1
DMI Motherboard Version1.0
DMI Motherboard Serial NumberBSN12345678901234567
DMI Chassis ManufacturerASUSTeK COMPUTER INC.
DMI Chassis Version1.0
DMI Chassis Serial NumberC9N0BC434262396
DMI Chassis Asset TagNo Asset Tag
DMI Chassis TypeNotebook

All I want to do is is take 6 partitions down to  2 partitions. At first I didn't think it would be such a hassle...boy was I wrong. Is this even possible? I've provided all the information that I know. Can anyone offer any type of assistance? Or am I stuck with it like this? The Sea Gate external hard drive isn't mine...I wish it where. I couldn't get Windows to register it even though the device manager could recognize it. So I have no clue whats up?


Manual Maintenance Plan

$
0
0

Hi All,

Using SQL Server 2008 R2 in multiple servers.

1. Any script (links) for creating a manual maintenance plan? I would like to manually run the script for some databases in multiple servers.

2. It is a way to collect the statistics before and after the maintenance? I would like to show the improvement after the plan running.

3. Am I missing anything in this maintenance plan steps?

- Full Backup of the database.

- Transaction Log Backup.

- Check DB integrity

- Cleanup Backups more than two months

- Rebuild Indexes

- Reorganize indexes

- Shrink databases

- Update Statistics

Thanks for your help in advanced.

Best,

Data file much size I can increase in any data file as per the available hard disk size.

$
0
0

FATAL : production-sql-server : ABEadobesqlpr1\lcstat db : lcstats - msg: data file space used 099%

Whenever I get such type of alert from Tivoli and I have to expand the data files.But you know multiple instance and multiple database with multiple data file and all are of restricted sizes. I want to make a query which gives the detail about  current usage of data files and log file in such a sense so that I can estimate how much size I can increase in any data file as per the available hard disk size.

Thanks

A chance for YOU to play for the SS DBE team, in the TechNet Guru World Cup!

$
0
0

The World Cup is here again!

Not balls... brains!

And YOU have been selected to play on our team!

Yes forum reader, step up and take a shot!

Slam some techie tips in the back of our nets!

No dribbling please, just lots of problem tackling.

So come on Gurus and use your head!

Show us your skills, wow us with your technique, and win the hearts of your nation!

All you have to do is add an article to TechNet Wiki from your own specialist field. Something that fits into one of the categories listed on the submissions page. Copy in your own blog posts, a forum solution, a white paper, or just something you had to solve for your own day's work today.

Drop us some nifty knowledge, or superb snippets, and become MICROSOFT TECHNOLOGY GURU OF THE MONTH!

This is an official Microsoft TechNet recognition, where people such as yourselves can truly get noticed!

HOW TO WIN

1) Please copy over your Microsoft technical solutions and revelations toTechNet Wiki.

2) Add a link to it on THIS WIKI COMPETITION PAGE (so we know you've contributed)

3) Every month, we will highlight your contributions, and select a "Guru of the Month" in each technology.

If you win, we will sing your praises in blogs and forums, similar to the weekly contributor awards. Once "on our radar" and making your mark, you will probably be interviewed for your greatness, and maybe eventually even invited into other inner TechNet/MSDN circles!

Winning this award in your favoured technology will help us learn the active members in each community.

Feel free to ask any questions below.

More about TechNet Guru Awards

Thanks in advance!
Pete Laker


#PEJL

Got any nice code? If you invest time in coding an elegant, novel or impressive answer on MSDN forums, why not copy it over to the one and onlyTechNet Wiki, for future generations to benefit from! You'll never get archived again!

If you are a member of any user groups, please make sure you list them in the Microsoft User Groups Portal. Microsoft are trying to help promote your groups, and collating them here is the first step.


To create such script which will fetch all this data in form of create command

$
0
0

Whenever I do a restore I always forget to reapply some database roles or application roles in post restore steps.We have one database of very different db roles,Grant permissions,Login and User permissions and they changes also frequently.

What dmv's I required to create  such script which will fetch all this data in form of create command and after restore I just have to run those create commands and all the rights should visible as before .


Thanks

Table Size Increased after Column Store Index Rebuild (even though partition size decreased)

$
0
0

Hi,

I have a large table (about 60GB) with a Clustered Column Store Index (156 columns). The table is alsopartitioned (using SQL Server 2014 Developer Edition).

After the table was being populated with data for a while, I wanted to test the effects of Index Rebuild on the space used by the table.

I performed the test on a single partition.

I executed the following query to get an idea on how the segments are set up and how much disk space they take:

select object_name(object_id), partition_number, segment_id
, COUNT(DISTINCT column_id) AS NumOfColumns
, SUM(cs.row_count) AS Total_row_count
, AVG(cs.row_count) AS Avg_row_count
, MIN(cs.row_count) AS Min_row_count
, MAX(cs.row_count) AS Max_row_count
, SUM(cs.on_disk_size) AS Total_on_disk_size
, AVG(cs.on_disk_size) AS Avg_on_disk_size
, MIN(cs.on_disk_size) AS Min_on_disk_size
, MAX(cs.on_disk_size) AS Max_on_disk_size
from sys.column_store_segments as cs
inner join sys.partitions as p
on
	p.partition_id = cs.partition_id
where 1=1
and object_id = object_id('MyTable')
and partition_number = 10
GROUP BY object_name(object_id), partition_number, segment_id
ORDER BY segment_id

I also executed sp_spaceused on the table and noted its total size.

Then I executed an Index Rebuild on the one partition only of the clustered column store index:

ALTER INDEX [cci_MyTable] ON MyTable REBUILD PARTITION = 10

Then I executed the query above and sp_spaceused again and noted the changes.

The result was:

  • Two new segments were created.
  • The number of row counts per segment shuffled up (but the grand total remained the same).
  • The grand total of on_disk_size became smaller by ~26 MB.
  • The table size (from sp_spaceused) became BIGGER by ~12MB.

So my question is:

Why, even though the total partition size became smaller, the total table size became bigger?

Here are the detailed results of sp_spaceused before and after the rebuild:

namerowsreserveddataindex_sizeunused
MyTable12958714560867096 KB60729232 KB
7240 KB130624 KB
namerowsreserveddataindex_sizeunused
MyTable12958714560879504 KB60741712 KB
7240 KB130552 KB


Note that I executed the index rebuild on a single partition only (partition 10 in this case), and I'm executing sp_spaceused at the table level; the total number of rows in the table remained the same. But the reserved and data used increased, while the index_size remained the same.

This is all rather strange to me.

I would figure that the index rebuild would require some additional space as a working area, but when finished, this space will be marked as unused. So I would expect maybe the reserved column to increase, but the data column to decrease (since at the partition level, the total partition size actually decreased).

Any explanations? What could cause this?

Thanks


Eitan Blumin; SQL Server Consultant - Madeira SQL Server Services; http://www.madeira.co.il/author/eitan/

How to Clean the SSISDB Size

$
0
0
Hi Experts,
 I have a SSISDB on server, which size is 93 GB when diagnosis this I found that the Contention values is 365, means this SSISDB is holding the log values of 365 days older. Now I have updated this values with 10 days, I invoke the job called "SSIS server maintenance job" which is cleaning this database. but it was running from last two days , its causing to slow down my DB server and also its just reduces 2 GB size. Is there any way to reduce the size of this SSISDB.

Regards Vikas Pathak

Excel Connection

$
0
0

Hi,

When I create an SQL connection from my workstation within an Excel file, other users are unable to refresh the data.

Error Message:

            “[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified”

The connection string being:

DRIVER=SQL Server Native Client 10.0;

SERVER=SQLSERVER;

UID=*ME*;

Trusted_Connection=Yes;

APP=Microsoft Office 2010;

WSID=0347;

But they are able to refresh the data if I create the connection from their own workstation.

The connection string being:

DRIVER=SQL Server Native Client 10.0;

SERVER=SQLSERVER;

UID=*OTHERUSER*;

Trusted_Connection=Yes;

APP=Microsoft Office 2010;

WSID=0348;

I can refresh any connection from my workstation regardless of who created it.


I need all users to be able to refresh files that I have created from my workstation.

Presumably the issue is the SQL Server credentials, but if someone is able to confirm this and offer a solution I’d be most grateful.



Recovery from sql server 2005

$
0
0

I am using sql server 2005.My database is increamental databse daily new tranctions are add in it.By mistake i have deleted some transaction from that database table.How can i recover it.I dont have any other database backup.plz help me.

Secondary XML Index not being used in query plans

$
0
0

I have a question regarding XML indexes.

We have a table OVERLAY_ITEM_SEARCH_XXX with almost 5 million rows. The table has 2 columns – an identity column (bigint) and a SEARCH_VALUES column (XML). The XML column has a primary XML index and secondary XML PATH index.

The SEARCH_VALUES XML column contains a number of fields under the ATTRIBUTES node, e.g. SECTION_REF, but these are variable, as they are derived from user configuration.

The elements c121 and o870 represent client_id = 121 and overlay_id = 870. There are several clients and overlays within the database.

So a typical SEARCH_VALUES XML value for a particular row may look like this:

<c101>

       <o777>

              <SECTION_REF>1/2/567</SECTION_REF>

              <NAME>FRED</NAME>

<POSTCODE>W1 21A</POSTCODE>

       </o777>

</c101>

Performing the following 2 queries, for which no rows are found

1. A TOP 1 query

selectTOP 1 * from overlay.OVERLAY_ITEM_SEARCH_XXX s

where s.SEARCH_VALUES.exist('c121/o870/ATTRIBUTES/SECTION_REF/text() [contains(.,"J1")]') = 1

2. A SELECT * query

select*from overlay.OVERLAY_ITEM_SEARCH_XXX s

where s.SEARCH_VALUES.exist('c121/o870/ATTRIBUTES/SECTION_REF/text() [contains(.,"J1")]') = 1

The  ‘SELECT *’ query utilises the secondary XML index and runs in 9s, whereas the ‘TOP 1’ query doesn’t use the secondary XML index an takes 100s.

Why does the TOP n query not utilise the secondary XML index? N.B. This is from the actual query plan.

It seems that any query we try other than "select *" fails to use the index, e.g. IF EXISTS(SELECT *...)

Does anyone have any similar feedback from using XML indexes on large tables?

Note that the search for the searchable value (e.g. in the example above ‘J1’), needs to be a ‘contains’ type search.

This is using SQL Server 2012 SP2

Any help/comments would be appreciated.


Column store index -min_data_id and max_data_idis null

$
0
0

Hi,

I have few column store in different table in DB. When I was analyzing the column store index  one  index have 12 segments ,When I looked into sys.column_store_segments for  all the 12 segments min_data_id and Max_data_id is "NULL".

In which scenarios these values become null? Will this cause a performance issue in queries?

Regards

Tom

PowerShell SMO Breaks With LocalDB 2014

$
0
0

Hi. I have a script that I've been using a while that does some SQL configuration.  I just got done with new elevation, UAC, and share access issues for my SQL install scripts.  Now I can't get the first configuration script to run.  Anyway, I have SQL 2012 developer install on my desktop along with VS 2012.  I use the following to load the assemblies I need. 

[reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") | Out-Null
[reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.SqlWmiManagement") | Out-Null

It still works with SQL 2008 R2 servers.  It stopped working with SQL 2012 servers.  I get he following error. 

The following exception was thrown when trying to enumerate the collection: "SQL Server WMI provider is not available on SQLSERVERNAME."

I tried running it from a new production server (Windows 2012 R2 and SQL 2012) and it worked.  I noticed that my localdb with VS 2012 is SQL 2014 and that I have share management object for 2014.  I have to wonder if this is the source of my issue.  Does anybody know how I fix this? 

Also, I tried to use http://msdn.microsoft.com/en-us/library/hh245202.aspx, but I have a different reg value.  Mine has a sqlps110 rather than sqlps.  Also, the SQLPS.exe and the SQLProvider.Format.ps1xml files are in different folders. 

D:\SQL2012 (x86)\110\Tools\Binn\SQLPS.exe

D:\SQL2012 (x86)\110\Tools\PowerShell\Modules\SQLPS\SQLProvider.Format.ps1xml

Thanks.


Randy in Marin

MSDTC cluster role in windows/sql 2012 cluster Failed to start

$
0
0

Hi 

  I just restated one server and started getting error from MSDTC and not able to bring online..IT has 2 node windows 2012 R2 cluster , SQL server 2012 is installed on it.

Cluster resource 'MSDTC' of type 'Distributed Transaction Coordinator' in clustered role 'MSDTC' failed.


Based on the failure policies for the resource and role, the cluster service may try to bring the resource online on this node or move the group to another node of the cluster and then restart it.  Check the resource and group state using Failover Cluster Manager or the Get-ClusterResource Windows PowerShell cmdlet.

Event ID 1069

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

Event ID 1205 

The Cluster service failed to bring clustered role 'MSDTC' completely online or offline. One or more resources may be in a failed state. This may impact the availability of the clustered role.

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

Event ID 1254

Clustered role 'MSDTC' has exceeded its failover threshold.  It has exhausted the configured number of failover attempts within the failover period of time allotted to it and will be left in a failed state.  No additional attempts will be made to bring the role online or fail it over to another node in the cluster.  Please check the events associated with the failure.  After the issues causing the failure are resolved the role can be brought online manually or the cluster may attempt to bring it online again after the restart delay period.

Any work around if anyone has solved this problem..?

Thanks


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

Viewing all 12963 articles
Browse latest View live


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