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

Different size values on this query

$
0
0

Hi all of you,

if you compare FO.size and f.size are totally different. What is it FO.size for?

TIA,

select d.name, f.size, f.filename, d.database_id, FO.size
 from sys.databases D
inner join sys.sysaltfiles F
on d.database_id = f.dbid
inner join sys.sysfiles FO
on F.fileid = FO.fileid
where database_id > 4
order by f.size desc


What causes an async_network_io wait, is there a threshold?

$
0
0

I know it occurs if the network is slow or the client is not reading, but is there some threshold that has to be met, some number of milliseconds?

We have some mysterious "stalls" where a stored procedure runs for say 30 seconds, but uses only two seconds of CPU and does only 20k reads - of data that is certainly already in buffers.  And no blocks I can see even with a probe, and no wait states that seem to explain it.

On one or two of these we get some async_network_ios but on many others we do not, so I'm wondering if others are just below some threshold.  I know that some of our app framework does not scale well and sometimes gets overwhelmed consuming even moderate amounts of data.

Thanks.

Josh

A possible infinite recompile......

$
0
0

Hi all,

In one of my development servers (SQL2k14 SP1) this week got several times this message:

A possible infinite recompile was detected for SQLHANDLE 0x020000007314F005E2471E46DE8C00D9B9385F8DC2F283220000000000000000000000000000000000000000, PlanHandle 0x060060007314F00560A6BF050B00000001000000000000000000000000000000000000000000000000000000, starting offset 210, ending offset 1432.  The last recompile reason was 2.

This server has 100 development databases. Any clue ?

TIA

Deadlock occurred, why no blocked process report?

$
0
0

We had just one deadlock yesterday, so I assume the detector was on its default 30 second (?) timing.

I have the blocked process threshold set to 30 seconds and a trace running to catch block reports - it catches others just fine.

So, apparently the deadlock detector fired before the blocked process report, and it doesn't report to both in such cases?

Should I set my blocked process threshold to 29 seconds?

Thanks,

Josh

Buffer Pool Extension 2014 in an Always On configuration

$
0
0

Hi all of you, I want to set up a BPE file in my primary replica node. I wonder if it is necessary to create same file and size on the read-only replica node.

In failover case, could we create on the fly the second BPE file? Or is it a big silliness?

AFAIK, this BPE must be created on the SSD volumes, is it so? 

I've though put it on the same SSD Lun's where we have .MDF and .NDF files.

Thanks for your comments and hints,

Correlating sys.dm_tran_session_transactions transaction id to the fn_dblog

$
0
0
Hi,
I ran the following script in SSMS:

BEGIN TRAN 
insert into [dbo].[TST01] values(7,'G')

Please note i have not committed or rolled back.


In another session on SSMS, i ran the following DMV:

Select * from sys.dm_tran_session_transactions with (nolock)
THis DMV returns the transaction id of the above transaction as 572857.

I then try to dig into the transaction log using the function fn_dblog to try and locate the entries
in the log that the above transaction has made.

i tried this first:
select *  from fn_dblog(NULL,NULL)
where [Transaction ID]= 572857

this returned an error:Conversion failed when converting the nvarchar value '0000:00000000' to data type int.

Then I tried  this :

select *  from fn_dblog(NULL,NULL) where AllocUnitName= 'dbo.TST01'

this returnes the Transaction ID as 0000:00018b55.

I am bit confused here. I was expecting to see 572857 in the transaction log transaction id.
Is there any way to correlate the transaction id returned by the DMV to the one seen in the transaction log?

thanks
MS

Table Import & Export

$
0
0

Hi,

we have 2 TB database in production env. In dev server we created one new DB. 

App team request to do import & export some table in prod to dev. total table size is 220 GB. My question is import & export will work from prod to dev. SQL version is 2005

How to track all the Integration Services running around my network?

$
0
0

Dear all, using this cmdlet you can search for all the servers and its instances running (on the condition SqlBrowser service is up)

[System.Data.Sql.SqlDataSourceEnumerator]::Instance.GetDataSources()

How can we achieve the same with Integration Services? I've got IS in my local box but I'd like to know who else in other floors own similar schema

Thanks in advance for any input,



SQL 2012, Two instances on same machine, different IPs, Same Port

$
0
0

I've read many posts on many forums that say you can do this.  But it's always an older version of SQL server.   (like this one https://social.msdn.microsoft.com/Forums/sqlserver/en-US/8d2a2fbb-f08e-4eba-84ea-00c0d9bc8efb/how-to-configure-2-instances-on-same-hardware-with-same-port?forum=sqldatabaseengine )

I've tried all this but still can't get the second instance to start.  The error I get is . . .

TDSSNIClient initialization failed with error 0x57, status code 0x1e. Reason: The SQL Server Network Interface found a duplicate IP address in the SQL Server TCP listening settings.  Remove the duplicate IP address by using SQL Server Configuration Manager. The parameter is incorrect. 

Was this only possible on SQL 2005?

blocking problem

$
0
0

Now and then, like every fortnight, we experience severe blocking problem (user experience as a total hang) in a production environment running SQL2012.

The blocking process always shows subtype BULKOP_BACKUP_DB and object tempdb (from betalockinfo)

Grateful for tips how to resolve this issue

SQL Server 2012 syspolicy_purge_history fails step 3 "Erase Phantom System Health Records."

$
0
0

I recently installed SQL Server 2012 Ent (x64). The install is a stand alone default instance.

The syspolicy_purge_history job fails on step three with the following error:

Executed as user: <DomainName>\sql_xxx_agt_svc. A job step received an error at line 1 in a PowerShell script. The corresponding line is 'set-executionpolicy RemoteSigned -scope process -Force'. Correct the script and reschedule the job. The error information returned by PowerShell is: 'Security error.  '.  Process Exit Code -1.  The step failed.

Here is the code that is in the step:

if ('$(ESCAPE_SQUOTE(INST))' -eq 'MSSQLSERVER') {$a = '\DEFAULT'} ELSE {$a = ''};
(Get-Item SQLSERVER:\SQLPolicy\$(ESCAPE_NONE(SRVR))$a).EraseSystemHealthPhantomRecords()

The domain user is the account that SQL Agent is running as.

What permissions need to be granted to this account?



Here is the link to the Connect post:

https://connect.microsoft.com/SQLServer/feedback/details/754063/sql-server-2012-syspolicy-purge-history-job-step-3-fails-with-security-error

Create backup using Credential permissions

$
0
0
Hello everyone

I read this from books online:

"A credential is a record that contains the authentication information (credentials) required to connect to a resource outside SQL Server"

https://msdn.microsoft.com/en-us/library/ms161950.aspx

 

I want to create a full database backup to a secured folder. I know with changing the user account running the SQL service that have write permission on folder I can do this but I have to  create backup on folder using Credentials. So I write this script but it doesn’t work. Because SQL Server try write to folder using user that running the SQL service.

 

 

--Create credential

CREATE CREDENTIAL MyCredential WITH IDENTITY = 'administrator',

      SECRET = 'P@ssw0rd';

  GO



--Create SQL Server login

CREATE LOGIN MyLogin WITH PASSWORD='MyStrongP@ssw0rd'



--Map login to credential

ALTER LOGIN MyLogin ADD CREDENTIAL MyCredential



--make login as sysadmin

ALTER SERVER ROLE [sysadmin] ADD MEMBER [MyLogin]



--set the execution context to MyLogin

EXECUTE AS LOGIN='MyLogin'



-- this command will be fail

BACKUP DATABASE master TO  DISK='C:\bak\master.bak'


--error:

Msg 3201, Level 16, State 1, Line 20

Cannot open backup device 'C:\bak\master.bak'. Operating system error 5(Access is denied.).

Msg 3013, Level 16, State 1, Line 20

BACKUP DATABASE is terminating abnormally.

 

 what's wrong??

thanks a lot...

Select top 1000 just keeps running

$
0
0
I hope this is the correct forum.  A SSIS package was running over 24 hours so I canceled it.  Now when I try to select top 100 in SSMS it just keeps running,  There is over a million records in the table, tried to truncate the table and again it just keeps running.  Any help will be appreciated.

Upgrade SQL Server 2014 to 2016 Failure

$
0
0

   Hi, I m trying to upgrade one of our Development servers (2014 Deveoper Edition) to SQL Server 2016 Developer edition and getting the below error. Anyone came across something similar? I couldn't find anything helpful in the online, i m doing in-place upgrade. Appreciate any advise! Thanks!

 Feature:                       Database Engine Services
  Status:                        Failed: see logs for details
  Reason for failure:            An error occurred for a dependency of the feature causing the setup process for the feature to fail.
  Next Step:                     The upgrade process for SQL Server failed. To continue the upgrade process, use the following information to resolve the error. Next, uninstall SQL Server by using this command line: setup /q /action=uninstall /instanceid=MSSQLSERVER /features=SQLENGINE,DQ,FULLTEXT,REPLICATION. Then, run SQL Server Setup again.
  Component name:                SQL Server Database Engine Services Instance Features
  Component error code:          0x851F947D
  Error description:             Failed to create Replication working directory E:\SQL\data\MSSQL12.MSSQLSERVER\MSSQL\repldata
  Error help link:               http://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=13.0.1601.5&EvtType=0xEC8F66F5%400xC652C608%401311%4038013&EvtType=0xEC8F66F5%400xC652C608%401311%4038013

Can we capture query timeout's using Extended event sessions ???

$
0
0
Hi,

Is there a way to capture Timeout errors using Extended Events.
Just incase if anyone had already worked on such issues, pl share an example on how to do that.

Errors : Unable to load data from Source table to Target table Timeout expired.The timeout period elapsed prior to completion of the operation or the server is not responding.

Thanks,

Sam

suser_name() always return NULL

$
0
0

Hello,

My version is SQL2k16

 SELECT suser_name(owner_sid) FROM sys.databases
 where database_id > 4

Does only system databases has non NULL sid? I've tested this query on differents servers getting same result.

Thanks for your time,

Read Only db after attach on sql 2008

$
0
0

Hi,

i have detach db from sql 2008 for some reason.

i attached the db again. now it shows read-only.

can anyone let me know why it shows read only?

how can fix this ?

Thanks!!!

 


Varinder Sandhu http://varindersandhus.blogspot.com/

Job history deleted?

$
0
0

Hello,

A few days ago I checked the history of one of my jobs seeing last execs and today I get nothing..

Other jobs have history but just few days. And then I can see one month or more for some jobs. I don't understand this point, why Agent keep more days for some of them.

select * from dbo.sysjobhistory
where job_id = '014A1BFA-4FE2-4926-8529-85A7876B42C6'

Online Index Rebuild causing locking

$
0
0

Hi

I am using Ola Hallengran's maintenance solution . I have SQL Server 2008 R2 Enterprise. I have a table with 1,750,000 rows and there is an index on one column that is NUMERIC(18,0). The rebuild of this index can take 2 hours and also causes blocking (downtime). Is there anything I can do to speed this up or prevent blocking?

Most nights the index is around 38-40% fragmented.

Regards

Sam

How can I prevent creation of the MDF file when logging in to an ASP web application

$
0
0

I have just published my ASP Web application which has been running quite happily. It has been configured for single user authentication which means it using LocalDB and an MDF file to store the login details. When I now try and log in to the website, I get the following error displayed in the browser:

Server Error in '/' Application.

Cannot create file 'C:\inetpub\wwwroot\App_Data\aspnet-WebApplication15-20160727045424.mdf' because it already exists. Change the file path or the file name, and retry the operation.
CREATE DATABASE failed. Some file names listed could not be created. Check related errors.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Cannot create file 'C:\inetpub\wwwroot\App_Data\aspnet-WebApplication15-20160727045424.mdf' because it already exists. Change the file path or the file name, and retry the operation.
CREATE DATABASE failed. Some file names listed could not be created. Check related errors

Why should sql server be trying to create a database when it is already there? My connection string in Web.config is:

    <add name="DefaultConnection" connectionString="Data Source=(localdb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|aspnet-WebApplication15-20160727045424.mdf;Integrated Security=True" providerName="System.Data.SqlClient" />

An answer to this extremely strange error would be much appreciated.




Viewing all 6624 articles
Browse latest View live


Latest Images

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