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

Why Tempdb log file size are different on disk (file system) & in SQL server

$
0
0

Most wired thing, I observed in my SQL DBA job in last >5 years.

Today, I found that my tempdb disk space is runing low & when I logged on to check, I found that log file is using most of the space around 30GB.

But when I check in SQL Server tempdb is using <4 GB.

In screen shot, We can see that at SQL Server tempdb is showing around of 3839 MB & at NTFS file system ldf file is aorund 30 GB.

Please let me know, how I can reclaim the space at disk space level or make both size equal.


Regards,
Rohit Garg
(My Blog)
This posting is provided with no warranties and confers no rights.
Please remember to click Mark as Answer and Vote as Helpful on posts that help you. This can be beneficial to other community members reading the thread.


Do I need Fusion IO? How much performance gain can I get?

$
0
0

Hi experts,

  I saw a few reference sites from Fusion IO and I saw a few experts ran SQLIO and long running queries on Fusion. The result is amazing.

  However, some experts suggest the customers should analyze the workload first. If wait events do not show huge wait time in PAGEIOLATCH_SH and WRITELOG, it does not make senses to solve performance issue using Fusion IO.

  The perfmon info lists below. My IOPS is about 3,066 on average(The system has 1TB DRAM. I drive is the first LUN for database file). My disk transfers per second on transaction log file is about 262. It seems that there is no IO issue in my system.

   But I still find there are many long running queries(more than 10 hours and 90% are database time. In SAP, database time includes network time to transfer data to client) in my system.(I use 10GbE network)

  It is impossible to borrow a 15TB Fusion capacity to run POC. So the questions are: 1. "Is it possible to eliminate all IO latencies ex: 0.007 and 0.008 to 0.000?"

2. "Is it possible to reduce a long running queries, ex: 10 hours(It might select more than 1 billion records), to ex: 2 hours or less? Even if my storage performance seems good."

QUOTED_IDENTIFIER is a parse time setting but what if there are two in the batch?

$
0
0

BOL for this setting (2005-2012) hasn't changed.  It says it is a parse time setting which happens before any lines are executed.

SET QUOTED_IDENTIFIER OFF; DBCC useroptions EXEC(" IF EXISTS (SELECT * FROM sys.procedures WHERE name = 'insert_into_asdf')

DROP PROCEDURE dbo.insert_into_asdf ;"); EXEC(" CREATE PROCEDURE dbo.insert_into_asdf @name varchar(10) , @deleted bit AS BEGIN DBCC useroptions; --INSERT INTO dbo.asdf (name, deleted) VALUES (@name, @deleted); END;"); SET QUOTED_IDENTIFIER ON; SELECT OBJECTPROPERTY(object_id,'ExecIsQuotedIdentOn'), * FROM sys.objects WHERE type IN ('P','TR','V','IF','FN','TF') AND name = 'insert_into_asdf'

Something else is going on during execution that BOL is either leaving out or assuming i know.  The above shows that the proc is created with QI setting on.  If you comment the final QI ON statement it will be created with it off.  If the setting is set at parse time there must be something else going on that allows the string execution.

SET QUOTED_IDENTIFIER ON;
EXEC("
DROP PROCEDURE dbo.insert_into_asdf ;");
EXEC("
CREATE PROCEDURE dbo.insert_into_asdf @name varchar(10) , @deleted bit
AS
BEGIN
	DBCC useroptions;
	--INSERT INTO dbo.asdf (name, deleted) VALUES (@name, @deleted);
END;");
SET QUOTED_IDENTIFIER OFF;

If you flip the settings around the SQL doesn't execute with an incorrect syntax error.

thoughts?


-- dan http://dnhlmssql.blogspot.com/

Getting the First Dataset from a Multi-Dataset Stored Procedure

$
0
0

I can get all the datasets with SQLCMD execution (ugly).  Is there a better programmatic way? Thanks.

CREATE TABLE #Space ( DB sysname, dbsize varchar(50), freespace varchar(50));

INSERT #Space
EXEC sp_spaceused;
/*  expecting the second dataset definition
Msg 213, Level 16, State 7, Procedure sp_spaceused, Line 128
Column name or number of supplied values does not match table definition
*/
/*
database_name	database_size	unallocated space
AdventureWorks2012	3118.38 MB	443.70 MB

reserved	data	index_size	unused
361776 KB	241704 KB	110352 KB	9720 KB
*/


Kalman Toth Database & OLAP Architect sqlusa.com
Paperback / Kindle: Pass SQL Exam 70-461 & Job Interview: Programming SQL Server 2012


Restricting the SQL Server license usage

$
0
0

Dear,

I have built a time-log application for my internal teams. This application has an ASP.NET web service on server and a mobile phone client (html / js). The web service is connected to an MS SQL Server 2008 standard database which is used as the data repository for the application. I have brought 5 CALs for this database. I am sure I will not need more than 3 to 4 people connecting at any given time -as each connection takes very little time within which the required data is supplied and the connection is closed.

In a typical operation:

1.  the client will send a request to server,

2. server will open a database connection and read / update necessary data and close connection

3. Send the results to client

Now, I did not see any settings in SQL server using which I can restrict the number of licenses used to 5. Can you help me figure out how do i restrict the number of licenses used to 5 in SQL server?

-Aju 

loading data after index is created

$
0
0

Hi All,

I have a table and it's loaded with data (around 10 lakh rows) and for performance, I have created a couple of indexes. This table gets populated every night and after 1 month the table has got 10 crore records. Will the already available index be effective or do i recreate the index or reindex it?

Kindly advice.

Thanks

Pad

named instance issue

$
0
0

I am currently having a named instance only hosting on my SQLServer. But I just verified that I am able to connect to it from SSMS without specifying the named instance name and by specifying the port number. Here is what I am talking.

I am connecting to SQLServer this way from SSMS: SQLServer\NamedInstance,portnum

But I realized I am able to connect to SQLServer from SSMS even in this way: SQLServer,portnum

Can anyone tell me how can I block the second way of connecting to SQLServer?

Thanks for your help in advance.

DBCC CHECKDB error - Write to sparse file failed due to lack of disk space

$
0
0

The situation:

  • 1900 GB data warehouse database. 10x 190 GB data files, located on the same (virtualized) drive.
  • About 30 GB free space left on that drive.
  • Running DBCC CHECKDB on this database (in the off-peak hours) eventually results in an error: "Write to sparse file XXXXXX failed due to lack of disk space." Running it with PHYSICAL_ONLY works ok.

So, I guess there's not enough space left for the internal database snapshot which is used by DBCC CHECKDB to run the checks? But, is there a way to getan estimate of how much space is needed to complete the check? ESTIMATE_ONLY option is intended for TEMPDB space usage estimation, correct? There are no problems with tempdb, so that doesn't help.

*** EDIT ***

The question is, is there any way to predict how much space is needed, given known DB size (or DB files' sizes) and the fact that it is done at a time when there isno other activity on the database?

*** EDIT ***

Thanks!




Does the partition key also have to be part of the primary key? What is Aligned and non-aligned Partition Index?

$
0
0
Does the partition key also have to be part of the primary key? What is  Aligned and non-aligned Partition Index?

CPU occupies 100 percentage on sql server

$
0
0

Hi All,

If sql server is consuming 100% cpu, generally the sever is responding slow so how can we trouble shoot? some times on my server cpu consumig 100% so i want to resolve this issue, incase if problem will be happen in future. Please respond.


Raveendra

Alert for SQL Agent job step STOP/Kill

$
0
0

Hi,

i want to configure an alert/ send of a notification to my team if some one is stopping my SQL Agent job step manually or if any other process is stopping my SQL Agent job step or if my job is killed..Here i'm not talking about the SQL Agent service failing due to some reason. I need an alert if my job is being STOPPED...I'm using SQL Server 2008 SP2.

any help highly appreciated.

-Pradeeep


When do #temp and @temp tables cause recompiles?

$
0
0

In olden days any temp table creation would cause a recompile of the entire SP.

However, I found that was already not the case even as early as SQL 2000, and I'm wondering what is the case in SQL 2008 and later.

Can anyone point me at a fairly current discussion of this?

My situation is that I have some existing and rather long (1000-3000 lines) SPs that use a lot of temp tables.  They *are* doing a lot of recompiles.  This is unfortunate because this is on an OLTP-ish system, and we want response times as fast as possible, and by my estimate the recompiles alone run about one second.  I'm not clear exactly what the current rules are.  Would using @temp tables avoidall recompilations (at some other semantic costs)?  I know they avoid statistics-triggered recompilations.

Thanks.

Josh

ps - for extra credit, does anyone have a way of estimating all the time the instance is spending on compilations?  perfmon offers counts, but not time.  I can calculate it from a full profiler trace, but it seems to require both compilation and statement start/end times to compute and that kind of trace is very expensive.  We can get it in SSMS with "set statistics time on" and adding up all the messages, but I'd like to get it monitoring the production box.


why does PLE ever go down when we still have untouched RAM?

$
0
0

We upgraded the server last weekend from 12gb to 32gb.

Part of the reason was low PLE numbers.

So now the target pages number has gone up - but only to about 10gb.  Well OK, maybe we have more RAM than we need.  Yet, PLE keeps getting hit back down below 300, and the target pages does not increase.

I don't understand that.  Apparently SQL Server is conservative about expanding its target.  I'd have guessed it would bloat right up to the limit (26gb) without much delay.  But the system has been quite busy all day, and the target pages does not increase.

Is there a simple explanation for that?

Like - is PLE decremented if a page is even dirty, even if it gets written and does not have to be reread?

Thanks.

Josh

*.MDF non-released version 607

$
0
0

I received from a client a MDF file to recover. There's no backup from it. When I try to attach it to SQL Server 2008 I get an error message. It seems it was attached to a Beta SQL Server 2008 cause that error message refers to 607 as a non-released version. I'll appreciate if someone can help me and confirm the exact version of SQL Server the number 607 refers to.

Thanks in advance.

Map temporary objects of temdb to sessions

$
0
0

Hi All,

Does anyone know where stores SQL Server tempdb object list. From this list you can determine which temporary object belongs to which session. tempdb.sys.objectsor tempdb.sys.sysobjects have two deficiency:

  • They don't show the spid of the creator session
  • They don't show the referenced object name (temp object name inside the session)

These two simple column or value would allow to determine the tempdb consumption of sessions.
There are two DMVs, sys.dm_db_session_space_usage and sys.dm_db_task_space_usagebut these views do not show correct values (sys.dm_db_session_space_usage do not calculate user object deallocations only internal object deallocations).

SQL Server must stores and use these mappings when a session wants to create or use temporary objects. I searched it in the tempdb data pages but I can not find. Does anybody know where would it be?

Thanks.


m@te


What the meaning of Dead Latches?

$
0
0

What the meaning of Dead Latches?

Site: http://www.sqlpassion.at/blog/CategoryView,category,SQLMCM.aspx

  • Dead Latches are possible
    • Bugs inside SQL Server
  • Dead Spins are not possible
    • You can't acquire a Spin, when it is already acquire


Manish

(type LOB data) with (type In-row data)

$
0
0

I have a couple of errors while running DBCC CHECKDB

Msg 8965, Level 16, State 1, Line 1

Table error: Object ID 530100929, index ID 1, partition ID 72057594062962688, alloc unit ID 72057594047168512 (type LOB data). The off-row data node at page (1:97527), slot 7, text ID 5329163255808 is referenced by page (1:104769), slot 12, but was not seen in the scan.

Msg 8929, Level 16, State 1, Line 1

Object ID 530100929, index ID 1, partition ID 72057594062962688, alloc unit ID 72057594121420800 (type In-row data): Errors found in off-row data with ID 5329163255808 owned by data record identified by RID = (1:496692:1)

unfortunatly there are no backups for a while (I took a backup and restored it to out of production)

I have ran DBCC updateusage(tempDPM) withno_infomsgs, then re-run DBCC CHECKDB and get the same pair of errors.

If I run

use tempDPM
select * from sys.objects where object_id in (530100929)

It does return a record, is there any way I can fix this without running a repair?

Authentication problems,pls help

$
0
0
Mvc 4 app using windows authentication. User.Identity.Name displays the expected user name and domain on development machine and writes the expected username to the database. Deployed app writes ntauthority\network service as the username in the database. Sql server on different server from web server. Added domain\machineName to sql server logins Gave active directory group permissions to read and execute inetpub\mySite folder If I set impersonation true the deployed app can not pull data, the website will come up but all the data is missing. What the heck do I need to do to be able to log the current user in the database?

Snapshot Isolation not Taking Affect

$
0
0

Although the stored procedure sets snapshot isolation to on with the following line:

SET TRANSACTION ISOLATION LEVEL SNAPSHOT;

The queries that are run in this stored procedure return data that was modified during the execution. The queries behave as if they were running under the read uncommitted isolation level.

The issue seems to be related to settings since in other environments, running the same schema and stored procedure code, we did not see this behavior. The database is a running SQL Server 2008 R2 with snapshot isolation enabled.

Any help on this will be much appreciated.

Thank you,

Ephraim Shurpin

Stored procedure execution Timeout

$
0
0

Hi,

We are running stored procedure to upload data through linked server to application server. Problem is that when we run stored procedure after some time it TimeOut. It happens once a while. I want to prevent this timeout issue, is there any way?

Thanks

Viewing all 15872 articles
Browse latest View live


Latest Images

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