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

Shrink Index filegroup

$
0
0

Hi,

I understand that shrinking data files is not a good thing.  However is it good idea to shrink Index file-group?  Is it also as hazardous as shrinking data files? We have separate files groups for data and indexes.

I'm using SQL Server 2008 R2.

Thanks



question

$
0
0

Hi all,

 Do sql server Roles are copied into secondary server when a manual failover is done in Log shipping?

How to move sql server 2000 master database to sql server 2005 server

data selecting between two dates with respect to date column

$
0
0

Hi Experts, 

I have one requirement.

the data is stored in data base in the following way

id        vechicleDATE           TIME                    24fomat     date             stats  ignition

dev4   2/21/2011   2:24:00 PM 14:23:35   02/21/2011OFF 1                            dev5   2/21/2011   2:24:00 PM 14:23:36   02/21/2011 OFF 1

dev4   2/21/2011   2:24:00 PM 14:23:37   02/21/2011OFF 1

dev4   2/21/2011   2:24:00 PM 14:23:38   02/21/2011OFF 1

dev4   2/21/2011   2:24:00 PM 14:23:39   02/21/2011OFF 1

dev4   2/21/2011   2:24:00 PM 14:23:40   02/21/2011OFF 1

dev4   2/21/2011   2:24:00 PM 14:23:41   02/21/2011OFF 1

dev4   2/21/2011   2:24:00 PM 14:23:42   02/21/2011OFF 1

dev4   2/21/2011   2:24:00 PM 14:23:43   02/21/2011OFF 1

dev4   2/21/2011   2:24:00 PM 14:23:44   02/21/2011OFF 1

dev4   2/21/2011   2:24:00 PM 14:23:45   02/21/2011OFF 1

dev4   2/21/2011   2:24:00 PM 14:23:46   02/21/2011OFF 1The issue is how to select the data to specfic date

and between two dates with respect to vechicleDATE only

Thanks and regards,

Dhayanand

Event 9001 - log is not available during backups

$
0
0

I've got a 2008 server that has a recurring issue with backups related the the SQL Server VSS writer.

The errors seem to start with Event 9001

The log for database 'xm8_27' is not available. Check the event log for related error messages. Resolve any errors and restart the database.

Followed up with 3041

BACKUP failed to complete the command BACKUP DATABASE xm8_27. Check the backup application log for detailed messages.

Event 1 from SQL VDI

vssadmin 1.1 - Volume Shadow Copy Service administrative command-line tool

SQLVDI: Loc=TriggerAbort. Desc=invoked. ErrorCode=(0). Process=3684. Thread=13492. Server. Instance=XACTWARE. VD=Global\{B9E65BDC-0508-4D73-BF4E-E639004C000D}9_SQLVDIMemoryName_0.

Event 8193:

SQL writer error: Unexpected error calling routine IClientVirtualDevice::GetCommand.  hr = 0x80770004.

I reboot, all is fine for a few days, backups work fine and then Boom, I start getting these errors again. I can't keep rebooting every few days, I need backups to be reliable. VSS in general seems to be fatally flawed, with a single minor error killing the entire system until a reboot, and not allowing ANY part of a backup to proceed due to one minor subsystem failure.

Here is the output of vssadmin list writers:

(C) Copyright 2001-2005 Microsoft Corp.

Writer name: 'ASR Writer'
   Writer Id: {be000cbe-11fe-4426-9c58-531aa6355fc4}
   Writer Instance Id: {9b661b56-738d-4853-8512-ab60bfe6d40e}
   State: [1] Stable
   Last error: No error

Writer name: 'SqlServerWriter'
   Writer Id: {a65faa63-5ea8-4ebc-9dbd-a0c4db26912a}
   Writer Instance Id: {88029c64-f3aa-4e57-8542-77da948300f4}
   State: [8] Failed
   Last error: Non-retryable error

Writer name: 'System Writer'
   Writer Id: {e8132975-6f93-4464-a53e-1050253ae220}
   Writer Instance Id: {b091ada8-f28b-49b1-b3e3-572227ddea8c}
   State: [5] Waiting for completion
   Last error: No error

Writer name: 'SharePoint Services Writer'
   Writer Id: {c2f52614-5e53-4858-a589-38eeb25c6184}
   Writer Instance Id: {d863ec1e-fbc5-4b2a-8465-556e421c6c82}
   State: [1] Stable
   Last error: No error

Writer name: 'FSRM Writer'
   Writer Id: {12ce4370-5bb7-4c58-a76a-e5d5097e3674}
   Writer Instance Id: {51005bbd-02f3-4aea-9aab-ee18b9c06a44}
   State: [5] Waiting for completion
   Last error: No error

Writer name: 'NPS VSS Writer'
   Writer Id: {35e81631-13e1-48db-97fc-d5bc721bb18a}
   Writer Instance Id: {739f2abd-c9ac-4343-a653-581753c7ffbd}
   State: [5] Waiting for completion
   Last error: No error

Writer name: 'Microsoft Exchange Writer'
   Writer Id: {76fe1ac4-15f7-4bcd-987e-8e1acb462fb7}
   Writer Instance Id: {c37f45ae-9710-4171-91f6-eea6468172da}
   State: [5] Waiting for completion
   Last error: No error

Writer name: 'SPSearch VSS Writer'
   Writer Id: {57af97e4-4a76-4ace-a756-d11e8f0294c7}
   Writer Instance Id: {21eda2e6-c571-4a7f-8c1a-8b50bb3d2c0c}
   State: [5] Waiting for completion
   Last error: No error

Writer name: 'WMI Writer'
   Writer Id: {a6ad56c2-b509-4e6c-bb19-49d8f43532f0}
   Writer Instance Id: {7bf2f68d-a6ec-47c4-a63f-3de29dc25a61}
   State: [5] Waiting for completion
   Last error: No error

Writer name: 'BITS Writer'
   Writer Id: {4969d978-be47-48b0-b100-f328f07ac1e0}
   Writer Instance Id: {9c90973f-517c-44b8-ba69-e608a191bbe9}
   State: [1] Stable
   Last error: No error

Writer name: 'Shadow Copy Optimization Writer'
   Writer Id: {4dc3bdd4-ab48-4d07-adb0-3bee2926fd7f}
   Writer Instance Id: {c3aeffb3-c2e6-4670-b853-b041c368d745}
   State: [1] Stable
   Last error: No error

Writer name: 'TS Gateway Writer'
   Writer Id: {368753ec-572e-4fc7-b4b9-ccd9bdc624cb}
   Writer Instance Id: {52efe6fe-6286-481b-8af6-8ad470e97f55}
   State: [5] Waiting for completion
   Last error: No error

Writer name: 'FRS Writer'
   Writer Id: {d76f5a28-3092-4589-ba48-2958fb88ce29}
   Writer Instance Id: {476a7ae6-8864-4e1d-ad25-0c4b48f3f70b}
   State: [5] Waiting for completion
   Last error: No error

Writer name: 'Registry Writer'
   Writer Id: {afbab4a2-367d-4d15-a586-71dbb18f8485}
   Writer Instance Id: {714d824b-87b6-4ed8-ad13-c20a8a101e08}
   State: [1] Stable
   Last error: No error

Writer name: 'NTDS'
   Writer Id: {b2014c9e-8711-4c5c-a5a9-3cf384484757}
   Writer Instance Id: {0cf69da9-cc30-4211-b479-105b54d7f554}
   State: [5] Waiting for completion
   Last error: No error

Writer name: 'COM+ REGDB Writer'
   Writer Id: {542da469-d3e1-473c-9f4f-7847f01fc64f}
   Writer Instance Id: {97dbb7fb-49af-4257-8fd5-0fbeb810e86f}
   State: [1] Stable
   Last error: No error

Writer name: 'IIS Config Writer'
   Writer Id: {2a40fd15-dfca-4aa8-a654-1f8c654603f6}
   Writer Instance Id: {d2762ea3-1814-4658-8138-d5f9b7d1ff71}
   State: [5] Waiting for completion
   Last error: No error

Writer name: 'Dhcp Jet Writer'
   Writer Id: {be9ac81e-3619-421f-920f-4c6fea9e93ad}
   Writer Instance Id: {53d8ce60-9a60-42d6-aa29-48f8d534fc9b}
   State: [5] Waiting for completion
   Last error: No error

Writer name: 'Certificate Authority'
   Writer Id: {6f5b15b5-da24-4d88-b737-63063e3a1f86}
   Writer Instance Id: {86fedb23-3064-4a9e-9c38-be44dfb448b6}
   State: [5] Waiting for completion
   Last error: No error

Writer name: 'IIS Metabase Writer'
   Writer Id: {59b1f0cf-90ef-465f-9609-6ca8b2938366}
   Writer Instance Id: {9a4d6a02-8a2f-4e21-8498-f469d87eba7b}
   State: [5] Waiting for completion
   Last error: No error

Regarding the specific database listed, I was able to offline / online the DB which "fixed" the log referenced, and could then perform a manual BACKUP DATABASE successfully, but when I ran my full script that backs up all my databases, a different database had that exact same log error - a database that previously worked successfully a few minutes before. Offlining and onlining that one and I could run the database backup script successfully on all databases to completion, but the VSS writers are still Failed and I can't do a full server backup. This whole issue seems to hinge on something going wonky with the transaction log file - but I can't see exactly what.what could be wrong with SQL Server or the databases themselves that would cause the transaction logs to become randomly "unavailable?" The ONLY event log errors regarding SQL Server and the log occur during backups.

The filesystem has been checked for errors, and the storage subsystem is all reporting fine with no errors.


DBCC - anyone done this? Connect to server, backup and restore on another server

$
0
0

I have not used DBCC but I knew of it and roughly what it would let me do.  I have 4 or 5 databases that exist in two different environments, one live for users and one for development.

So now Im thinking about building a script that does the following for each of the DB's I want restored on my testing server.

- Connect to DB server (live)
- Perform a "copy only" backup
- Copy the backup to a dev server folder
- Connect to dev DB server and do a restore using the backup we just took

Anyone done something like this and care to share some tips?

indexes

$
0
0

Hi all,

how much percentage  is need for indexes in ms sql server ..?

Package Migration Wizard

$
0
0

Hi  all..

I am trying to migrate some 2000 DTS package to 2008 R2.

When i try to connect to SQL 2000 in the wizard, there is an error:

"The Package Migration Wizard requires the SQL 2000 Data Transformation Services Runtine"

So where I can get the source to install ?
from 2000 or from 2008 / or from web ?

memoryclerk consumes a lot of memory

$
0
0

Hi  guys,

Could you explain me why memoryclerk_sqloptimizer consumes a lot of memory and how to solve it (release memory)?

Please have a look reports below.

1. Before

2. After 5 days

So we can  see that sqloptimizer became to consume about 1.9Gb instead of 1Gb  initially (in 1 day after server restart this value was just about 700Mb).

After some days this behavior will lead to server  to be almost unavailable for application.

Please suggest what can be a cause and how I can change this situation.

Max memory 8Gb (server 32Gb).

Microsoft SQL Server 2008 R2 (RTM) - 10.50.1600.1 (X64)


Number of Deadlocks/sec reached to 1200

$
0
0
Hi All,

We have a SQL Server 2005 (SP4) instance, recently we have received alert saying Number of Deadlocks/sec: 1200, this is a critical alert. I have verifyed this using 

SELECT cntr_value AS NumOfDeadLocks,*
  FROM sys.dm_os_performance_counters
 WHERE object_name = 'SQLServer:Locks'
   AND counter_name = 'Number of Deadlocks/sec'
   AND instance_name = '_Total'

I am new to performance tuning, Could you please suggest how to resolve this.

Thanks in advance,

KR


To many _WA_Sys statistics

$
0
0

I am running Ola Hallengren's maintenance script on a nightly basis and found that it is running 5 to 6 hours on a medium sized set of databases.  When I looked into it, I found that it was due to the UPDATE STATs process.  Looking at the stats it was updating I found that 90% were system created _WA_Sys stats.  There are 82,000 _WA_Sys stats across my 10 databases.  Some tables had one for every column.

I know these stats are created by SQL Server for execution plan optimization, but this seems excessive.  Why is SQL Server creating so many of these and what can I do to get a handle on it?  I assume that if I delete them they will just be recreated.  I can't see creating an index for every column on the tables that have a _WA_Sys stat for every column.

Any suggestions?

Jim

Management Data Warehouse (MDW) Job failing on Mirrored Server

$
0
0

I am using SQL 2008 R2. I set up Management Data Warehouse (MDW). One of the servers has mirroring. When I setup MDW, one of the DBs (say DB1) was on principle server (say, Server 1). Now I failed over the mirror. So now the DB (say DB1) is on mirror server (Server 2). Now one of the jobs (e.g. collection_set_3_upload job which is for Query Statistics) is failing on Server1 with the following error:-

Message

Executed as user: REDMOND\*****. SSIS error. Component name: DFT - Find and save plan text, Code: -1071636471, Subcomponent: LKUP - Look up query plans on target server [1283], Description: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80040E14.   An OLE DB record is available.  Source: "Microsoft SQL Server Native Client 10.0"  Hresult: 0x80040E14  Description: "The database "DB1" cannot be opened. It is acting as a mirror database.".   .SSIS error. Component name: DFT - Find and save plan text, Code: -1071611309, Subcomponent: LKUP - Look up query plans on target server [1283], Description: OLE DB error occurred while fetching parameterized rowset. Check SQLCommand and SqlCommandParam properties.   .SSIS error. Component name: DFT - Find and save plan text, Code: -1073450974, Subcomponent: SSIS.Pipeline, Description: SSIS Error Code DTS_E_PROCESSINPUTFAILED.  The ProcessInput method on component"LKUP - Look up query plans on target server" (1283) failed with error code 0xC0208253 while processing input "Lookup Input" (1284). The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running.  There may be error messages posted before this with more information about the failure.   .The master package exited with error, previous error messages should explain the cause.  Process Exit Code 5.  The step failed.

 

At this moment I don’t want to failback my DB. Is there any way, I can fix this issue? Shouldn’t MDW be High Availability awareness? 

Statistics on Magic table(Triggers)

$
0
0

Are Auto statisitics also created on trigger's inserted and deleted tables?


Manish

Write conflict

$
0
0

I have an Access 2010 front end with SQL Server 2008 R2 Back End.  I have 1 Form for the user to enter data to 1 table.  The table has 17 yes/no fields that I use a checkbox for half of them work fine the other half generate the following error everytime I change any of those fields.

The other thing I've noticed is that I can't alter the structure of that table.  If I try to script the table structure Alter is grayed out I can only Create it???

Run a powershell in sql server

$
0
0

Hi guys,

I am tring to run a powershell in sql server like below:

exec xp_cmdshell 'powershell "Get-ChildItem D:\DBBAK  -Recurse -Include "*.bak" | foreach-object {$_.Fullname}"'


i got the result:
D:\DBBAK\distribution\distribution_Full_bak_compressio
n_20120731_223004.bak
D:\DBBAK\distribution\distribution_Full_bak_compressio
n_20120731_230002.bak
D:\DBBAK\distribution\distribution_Full_bak_compressio
n_20120731_233001.bak


but I want the result like this:
D:\DBBAK\distribution\distribution_Full_bak_compression_20120731_223004.bak
D:\DBBAK\distribution\distribution_Full_bak_compression_20120731_230002.bak
D:\DBBAK\distribution\distribution_Full_bak_compression_20120731_233001.bak

how should i do ? Thanks

Best regards,
nicofer

Test a single table's performance

$
0
0
I have a table that has 700 million records. I want to test performance of just that table as it is right now. Then I want to test the same scenario after compression. And then again after partitioning. Is there a script or something I can use?

Alan


Optimizer memory, memoryclerk_sqloptimizer memory very high and climbing

$
0
0

I have a SQL Server 2012 instance running higher and higher amounts of memory for the memoryclerk_sqloptimizer. We have logging for optimizer memory and it is at 13 GB and climbing, but we have seen it higher and previously had to restart to clear it up. 

Version info: 

Microsoft SQL Server 2012 (SP1) - 11.0.3000.0 (X64) Enterprise Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1)

A few queries I ran to debug this: 

SELECT sum(mo.pages_in_bytes)/1024./1024./1024., mo.type, mc.type
FROM sys.dm_os_memory_objects mo
inner join sys.dm_os_memory_clerks mc on mo.page_allocator_address = mc.page_allocator_address
GROUP BY mo.type, mc.type, mc.type
ORDER BY 1 DESC;

select type, name, sum(pages_kb)
from sys.dm_os_memory_clerks
where pages_kb != 0
group by type, name 
order by 3 desc  

The first one has a top sum of 13GB and it is for the memory object type of "MEMOBJ_EXECCOMPILETEMP" and memory clerk "MEMORYCLERK_SQLOPTIMIZER" 

The second query has a top clerk of "MEMORYCLERK_SQLBUFFERPOOL" which is to be expected, and then "MEMORYCLERK_SQLOPTIMIZER". These are at 22768808 and 13747688 for the sum of pages_kb, respectively. 

I have turned on optimize for ad hoc workloads and that had no effect. Of course restarting the server gets us back to normal but eventually, after a week maybe, the optimizer memory gets back to up 10+GB and climbs until there is no memory left for anything else. We do have lots of ad hoc queries but this is nothing new --- we have had lots of ad hoc queries for a very long time and this optimizer memory issue is recent (past few weeks to a month or so ago). 

Comparing to a "normal" time period, our stats show optimizer memory at 0.002 GB while now it is much higher and climbing. Also, probably a victim of memory pressure, latch waits / sec are much higher, but also I noticed workfiles creates /sec and worktables created /sec are higher (300 more on avg and 100 more on avg, respectively). SQL compilations are also higher now. We noticed that when the optimizer memory gets very high, like in to 30GB+ range, even simple queries get compiled on every run, and parse and compile time is the longest time for the query. Again, likely due to less memory available for the buffer pool, we see much more page reads /sec (hard faults) and lower page life expectancy. 

The biggest difference between a "normal" time and now for wait stats is PAGELATCH_UP and PAGEIOLATCH_SH, then CXPACKET, SOS_SCHEDULER_YIELD, and EXECSYNC. The IO related ones are victims of the memory pressure and not a cause. 

Has anyone seen this behavior or does anyone have any ideas on how to get the optimizer to release its memory? We can tell that it gets more memory, releases a little bit, and overtime accumulates many GB of memory, which sets off all of the other high wait stats and counters. 

Thanks! 

Could not obtain information about Windows NT group/user

$
0
0

I have recently started getting this error an a scheduled SQL agent job:

Could not obtain information about Windows NT group/user 'domain\user.name', error code
0x6e.e 

Some web research led me to understand that this error message was the result of SQL trying to validate the job owner credentials against AD using the below SP.

exec xp_logininfo 'domain\user.name'

What I am trying to do is understand how to a> debug this process and\or b> how to resolve the issue without debugging the SP.

Thanks for any and all help!

Shawn


paged out

$
0
0

Hi all,

what is paged out in ms sql server memory?

How to create data dictionaries

$
0
0

Hi could any one tell me how do i create data dictionaries in sql server 2005 ?

Please help

`question about key-range lock

$
0
0
create table foo (c1 int)
go
insert into foo values (1)
insert into foo values (5)
insert into foo values (9)
create   clustered index foo_ci on foo(c1)
set tran isolation level serializable
begin tran
select * from foo where c1 = 5

for the above query, we know it would generate two RangeS-S,one for key 5 and the other is for key 9. that is to say it would prevent inserting values like 6,7,8 as there's a RangeS-S for key 9.

so my question is why SQL server needs the RangeS-S for key 9?  doesn't it enough just a RangeS-S for key 5 preventing the Phantom?

In other words, what will happen or the side effect if we remove the RangeS-S for key 9?



Please click the Mark as Answer button if a post solves your problem!



Viewing all 15872 articles
Browse latest View live


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