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

Can I manually adjust memory grant for my query?

$
0
0

Hi everybody,

I have a query with not optimally estimated cardinalities which results in large tempdb spills (sys.dm_exec_query_memory_grants says the query gets 1,8 Gb. After query is run in a separate session dm_db_session_space_usage says, the query required 18,5 Gb in the tempdb).

I would like to estimate what would happen (in terms of running time) if you could give the query more memory.

Is there some dirty way to do this? (trace flag or something like that)

And no, "updating statistics" doesn't help ;). See http://social.msdn.microsoft.com/Forums/en-US/sqldatabaseengine/thread/5cf8e3f9-b112-433d-9aa6-7b1454f49a76 for details.


mm

$
0
0
which datatype is better to store an image in sql server 2008 ???  

SQL Server Agent fails to start

$
0
0

Hi,

My SQL server (box) is mostly rebooted every weekend.

I have a SQL server 2005 running on this box with below details:

Enterprise Edition 8.00.760 SP3 

Most of the times after reboot, the SQL agent does not start due to below error(latest error):

Event Type: Error
Event Source: SQLAgent$Servername
Event Category: Service Control
Event ID: 103
Date:  3/13/2011
Time:  1:20:39 PM
User:  N/A
Computer: HOSTNAME
Description:
SQLServerAgent could not be started (reason: Unable to connect to server 'SERVERNAME\INSTANCE'; SQLServerAgent cannot start).

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

(ACTUAL SERVER AND INSTANCE NAMES HAVE BEEN REPLACED)

One more point, there are some other SQL instances running on this server, the SQL Agent for those server almost always comes up fine.

The SQL agent is running under a Domain account, the password for the login is correct.

What can be the reason for the above error???

Thanks in advance,
mandar

 

Problem with two jobs affiliated with a sql script

$
0
0

Hello --

I am testing a script called dbWarden on our 2008R2 standard server. The URL for the script in question is the following:

http://sourceforge.net/projects/dbwarden/

I have executed the script, and it appears to have successfully completed its installation. There is a database as well as several created the jobs. The problem that I am having is that two of the jobs: dba_CheckFiles and dba_HealthReport fail when they are run. The error message that I am getting in both cases is the following:

Executed as user: NT AUTHORITY\NETWORK SERVICE. Arithmetic overflow error converting expression to data type int.

[SQLSTATE 22003] (Error 8115)  The statement has been terminated. [SQLSTATE 01000] (Error 3621).  The step failed.

Has anyone seen this message, know what it means, and what can be done to correct it?

Thanks.

Page size, block size and network packet size

$
0
0

Hello,

Does anyone have any links to documentation regarding the relationship between SQL Server page size, network packet size and storage block size.

I know that SQL works with 8KB pages, does having a block size og 64KB affect how SQL can read/write data?

How does the network packet size affect read/writes to/from disk?

Any advice would be most appreciated.

Andrew

Database snapshot cannot be created in multi user mode but in single user mode works fine (trying to dbcc checkdb)

$
0
0

Msg 1823, Level 16, State 2, Line 1

A database snapshot cannot be created because it failed to start.

Msg 5123, Level 16, State 1, Line 1

CREATE FILE encountered operating system error 5(Access is denied.) while attempting to open or create the physical file 'D:\Databases\demo_app.Mdf:MSSQL_DBCC42'.

Msg 7928, Level 16, State 1, Line 1

The database snapshot for online checks could not be created. Either the reason is given in a previous error or one of the underlying volumes does not support sparse files or alternate streams. Attempting to get exclusive access to run checks offline.

Msg 5030, Level 16, State 12, Line 1

The database could not be exclusively locked to perform the operation.

Msg 7926, Level 16, State 1, Line 1

Check statement aborted. The database could not be checked as a database snapshot could not be created and the database or table could not be locked. See Books Online for details of when this behavior is expected and what workarounds exist. Also see previous errors for more details.

Split existing Partition - Grows log file in GBs and take hours to run

$
0
0

Hi,

I have an existing table with around 200 Million rows and couple of partitions.

I would like to split the partitions

e.g. the Latest partition hold the data where date >= '2012-01-01' and I want to create more partitions which holds the data for each quarter of 2012 and 2013... so roughly the highest partition will be split into 7 partitions i.e. 6 partitions to hold data for each quarter up to 06/2013 and 7 will be empty partition.

I tried the following but it grows the log file to 40 GB and ran for hours for just 1 split .. and I have to do 7 splits.

ALTER PARTITION SCHEME fn_schemename
	NEXT USED [Primary];ALTER PARTITION FUNCTION fn_schemename()
	SPLIT RANGE(N'2012-03-31T00:00:00.000');

Is there any other way to avoid the log growth.

One I think of is:

  1. Create a new table Table_B. 
  2. Create the required partitions using the existing partition scheme and functions.
  3. Copy the data from Table_A  to Table_B
  4. Drop the Table_A.
  5. Rename the Table_B  to Table_A

Have I missed any step? Is there any other way to avid log file increase and reduce the split time.

Regards,

Zee Ash

Who knew a select could deadlock an insert

$
0
0

I guess I'm not the first to see this, mine looked like:

select x.* from keytable k inner join bigtable x on k.akey = x.akey;

--- insert into keytable select distinct akey from #somewhere;

Each statement running in a different spid.

They are fighting over pages in the index of keytable. an indexed heap, fwiw.

Josh


Temp db size is increasing not releasing space

$
0
0

Hi All

MS sql server 2008R2(RTM) STD 64 bit, Temp db size is continuously  increasing not releasing used up space , please suggest us what is the problem with my temp db ?

i  executed below query , please go through result.

DECLARE @runtime datetime
SET @runtime = GETDATE()

PRINT '-- sys.dm_db_file_space_used'
select CONVERT (varchar(30), @runtime, 121) AS runtime, SUM (user_object_reserved_page_count)*8 as usr_obj_kb,
SUM (internal_object_reserved_page_count)*8 as internal_obj_kb,
SUM (version_store_reserved_page_count)*8  as version_store_kb,
SUM (unallocated_extent_page_count)*8 as freespace_kb,
SUM (mixed_extent_page_count)*8 as mixedextent_kb
FROM sys.dm_db_file_space_usage
RAISERROR ('', 0, 1) WITH NOWAIT

ANS:

runtimeusr_obj_kb   internal_obj_kb version_store_kbfreespace_kbmixedextent_kb
2013-04-09 16:30:09.1871664956544384 11492736         4864

@@ When i restart the sql server services  temp db is minimal but with in few seconds again size is  growing high.

page life expanctancy low

$
0
0

We have a SQL server 2008, we are experiencing low performance these days, when a SSIS run, that copies data from one database to another, the server runs slow, and causing latency of other servers that share the same SAN.

The page life expectancy is quite low when the process run, it shows 8 or 9 , (when not running, it restores to 5000 ), and memory grant outstanding is showing 1.

How to troubleshooting this?

Thanks,


SQLFriend

Database restoration on different machiness

$
0
0
Hi All



MS SQL server 2008  Web edition , db size is 5 GB  has try to restored  on Dell machine(SAS ) its  completed  with in  One(<2) min.

Ms sql server edition and size also same ,   i am trying to restore on IBM machine(SAS) , it will take 8 min, Please suggest on this why there is difference  in time taken to restore? 

Network problem when connecting......

$
0
0

The error shown below:

TITLE: Connect to Server
------------------------------

Cannot connect to ADMIN-PC\SQLSERVER2008.

------------------------------
ADDITIONAL INFORMATION:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Shared Memory Provider, error: 40 - Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 2)

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

------------------------------
BUTTONS:

OK
------------------------------

How can I solve this?

Restore Database

$
0
0

Ideas on how to make a restore database faster? We have a huge database and we moved it to a slower drive due to budget constraints. I have the backup on 8 different files to make the backup faster; I am wondering if anybody knows any tricks on how to make the restore faster. I have played with threadcount but this did not seem to make the restore much faster. I have also heard of instant file initialization. Any other ideas?

Win Server 2008 R2 Ent latest SP

SQL Server 2005 Ent latest SP


Thanks.

Physical memory usage is very high..

$
0
0

HI All,

i am  going threw high physical memory usage in SQL Server. It always around 90%.When i reboot the server, it will initially good but end of the day it will around 90to 95% physical memory usage..

Can some one help me on this issue..

Thanks,

Chandu


How can I create a database connection (ODBC) from Windows 8 to a XP machine?

$
0
0

I have SQL 2008 installed on an XP machine with Windows Authentication.  Today, I got a machine with Windows 8 in it.  Both have the same user name, but different passwords as Windows 8 requires a stronger password.

How can I create a database connection (ODBC) for the SQL Server from Windows 8 to the XP machine?


BI Analyst


SQL 2012 errors 3417, 18053, 701

$
0
0

First off let me make clear that I am -not- a dba. I'm a Windows server admin so I don't know anything about queries or other SQL specific stuff. So when people tell me to "check this" or "do that", it has to be simple and done via the SQL Server Management Studio.

The server is running Windows Server 2012. It's a VM running in Hyper-V and the VM has 4 CPUs and 16GB RAM. SQL is 2012 Enterprise. There are 3 databases or database instances (I don't know the difference) running on the server one of which is SharePoint and the other 2 are specific programs that probably no one has heard of (I wouldn't if this company wasn't one of my company's clients) but I don't think that matters.

We started having problems which I can't relate because frankly SQL has me confused from the word go. I can handle Windows just fine, but SQL is a beast all its own. It could be because the server was running 12GB of RAM and yet Task Manager shows memory usage constantly above 90%. So we upped the RAM to 16GB and then I found that the SQL memory can be limited so I went into the Management Studio and started capping the upper memory limit. For SQL itself I capped it at 12GB so the OS would have room. I then went into each db or instance, whatever, and capped them at something around 800MB. That probably wasn't the right thing to do but I looked in the Task Manager of the server and it showed each db consuming a certain amount of RAM so I put the cap above what the Task Manager showed.

Since then I've gone in to each db (or instance) and upped that upper memory limit to 8GB for 2 of them. However, I can't get connected to the third. The service for it isn't started and I can't start it. I get the error that "Windows couldn't start the SQL Server (db name) on Local Computer, see the System Event Log. If this is a non-MS service, contact the vendor and refer to code 3417". When I look in the System Log it says that the service terminated with the error "Warning: you have until SQL Server (db name) to logoff. If you have not logged off at this time, your session will be disconnected, and any open files or devices you have open may lose data."

In the Application Event log, I'm getting errors 701 (There is insufficient system memory in resource pool 'internal' to run this query.), 3417 (Cannot recover the master database. SQL Server is unable to run. Restore master...), and 18053 (Error: 912, Severity: 21, State: 2. (Params:). The error is printed in terse mode because there was error during formatting. Tracing, ETW, notifications etc are skipped.). I've looked them up but what I find doesn't help me, probably because it's in dba language.

In Management Studio when I try to connect to the db, I can't of course and the error indicates a problem with Named Pipes Provider, error: 40 - Could not open a connection to the SQL Server (Microsoft SQL Server, Error: 2).

What in the world am I supposed to do with this?


Jonathan


LPIM and minimum server memory

$
0
0

Hi

Worked with SQL for some years now but trying to make more of an effort to deepen my understanding of the product...

Can anyone give me a good explanation of what the difference is between LPIM and minimum server memory? Seems to me that they pretty much do the same thing - stop the OS coming along and reclaiming memory from SQL.

Thanks!

Failed to generate a user instance of sql server due to failure in starting the process for the user instance. The connection will be closed.

$
0
0

dear all,

i have visual web developer express on my system. the system is with windos 7 professional 64bit. i am developing a project and each time i try to create database, i get this error :

Failed to generate a user instance of sql server due to failure in starting the process for the user instance. The connection will be closed.

i can open SQL datababe outside the application but to add it or open it withing the application, the error pumps out.

this is seriously giving me issues. i have gone to google the error and yet still not be able to resolve it. I will appreciate if anyone can help.

thanks,

Victor

SQL server 2008 R2 SP2

$
0
0
HI, we have SQL server 2008 R2 SP1. We have installed SP2 and a tool we use to monitor versions says that it is a CTP version. The version number is 10.50.4000. I believe the tool is reporting this incorrectly. My question is, Is this version, 10.50.4000, a fully supported version of SP2?

Database connection error40

$
0
0
A network-related or instance-specific error occured while establishing a connection to sql server.The server was not found or was not accessible.Verify that the instance name is correct and that sql server is configuired to allow remote connections(Provider:Name pipes provider error:40-could not open a connection to sql server)
Viewing all 15872 articles
Browse latest View live