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

Question on Edition

$
0
0

Hello,

I know SQL Server 2016 Dev edition is free. For use of non prod env (Dev, staging and preprod) can we use the downloaded copy from my technet account? This account was created by the IT team.

Thanks 


Backup Device Failed to Open. Operating System Error 2

$
0
0

Hello,

Every 2 hours, I have a SQL Maintenance plan run that creates a differential backup, as well as cleans up .bak files older than 23 hours. Recently, we have been seeing an error in the event viewer stating:

BackupDiskFile::OpenMedia: Backup device 'X:\Differential\live_backup_2018_03_20_163003_3924419.bak failed to open. Operating System error 2(The system cannot find the file specified.).

Looking in X:\Differential, the backup gets created successfully, however its labeled 'live_backup_2018_03_21_163003_7732180.bak', and no file named 'live_backup_2018_03_20_163003_3924419.bak' is in the folder.

The SQL Server Log shows Error: 18204, Severity: 16, State: 1. at 4:30:02, and then at 4:30:03, the differential completes fine. The SQL Server Agent Log shows no errors. The domain account running the SQL Server Agent has full access to the drive. Any pointers in the right direction would be much appreciated!

DB Mail : finding unsent and invalid email id

$
0
0

Hello All ,

I have a small procedure which send bulk emails to users , but i need to know that whether email has really sent to users or if any invalid email is there and i need to know that information in SQL server.

eg;

sp_send_dbmail 
@profile_name = 'db mail',
@recipients = 'Chetan.Vishwakarma@gmail.com;Chetan.Vishwakarma@gmaidfbskf.com',
@body ='Test mail',
@subject = 'Test mail'

If you see above code 1st email id is correct but the second one is invalid , where can i found the error message for second email id as its invalid?

SQL Server Services Random Crash

$
0
0

hi my SQL server Services Random crash problem have I'm waiting for help

sorry for my bad english

Crash Log Windows+SQL server

https://mega.nz/#!DBI0mQiY!I3geBlTakrC9GrDrTLE5uN-Ep_eZlaCIGPJAZU2NsMU


Rollback a transaction in another session

$
0
0

Hi Guys,

Is there a way to rollback an active transaction running in another session without killing the process.

Thanks!


me

Lock a table till a field changes

$
0
0

Hi guys,

Is there a way to lock a table when a field changes to a certain value and unlock it when it changes to another value.

Say: If a field Status changes to In-progress lock the table and then unlock it when it changes tocompleted.

Thanks!


me

is it possible ----DBCC Shrinkfile after full backup restoration but before differential restoration?

$
0
0

My database full backup file size is 760 GB and differential would be around 20 GB but the database size is around 2TB. As it is a production database, so want to apply only a minimum downtime, i want to run DBCC SHRINKFILE with TRUNCATEONLY before restoring differential backup.

  1. Please advise if i can run the command DBCC SHRINKFILE with TRUNCATEONLY after full backup restored and then can restore differential backup.

SQL Server: Page Life Expectancy (PLE) sits at zero from 8am until midnight

$
0
0

I am struggling to understand SQL Server memory handling.

SQL Server is set to take maximum memory of 8GB    PLE is around 3000 at 8am when the users get on the system.   PLE then takes a nose dive to zero and stays at zero until midnight (a bunch of batch jobs are running until then)  It then recovers back to around 3000 for 8am next day

The thing is, I can't see what is causing PLE to drop and stay at zero - it's not even lumpy, it just stays at zero from 8am until midnight !   The "Database pages" stat starts around 200'000 at 8am and slowly degrades to around 70'000.  Other stats look OK,  there are some Lazy writes, but maximum is 6 writes/sec   Checkpoint pages/sec average is 9, Total Server Memory is flat at 1.6GB   Buffer cache dips from 95% to 75% but doesn't go below that

CPU usage is tiny, overall memory usage is flat and the disk usage is tiny, so apart from users complaining about performance and the PLE I would say everything looked ok

I thought there may be an issue with the PLE stat itself, but all the known issue indicate it would just show as zero all the time, which isn't happening here.

Should I just ignore PLE and not let it distract me ?


Change in MAXDOP

$
0
0

Hello, 

Is there anyway to see when a MAXDOP setting was changed on SQL 2008R2?

Thanks 

Snapshot isolation transaction aborted due to update conflict

$
0
0

Hi,

We are getting an error when deleting a set of data from a number of tables in a parent child relationship model:-

Snapshot isolation transaction aborted due to update conflict. 

You cannot use snapshot isolation to access table '<the-table>' directly or indirectly in database '<the-database>' to update, delete, or insert the row that has been modified or deleted by another transaction. Retry the transaction or change the isolation level for the update/delete statement.


This error happens intermittently, but luckily it happens constantly with one particular parent item so we can recreate it at will (at the moment). With others it is more of an intermittent nature. Much of the time, this delete works fine.
Snapshot isolation was turned on due to a large number of deadlocks occurring in readers-blocking-writers type scenarios and since it has been on, things have been much smoother with very few deadlocks occurring at all.
The delete of the parent and children occurs via a cascade i.e. a single delete statement is issued and the children are deleted automatically via the cascade.


I have been investigating (via Google!) why this error happens and, while there seems to be a lot of people who have suffered, it is not quite clear what could be the problem here.

One response I have read was to explain that, without correct indexing in the child tables, a table scan will result which will then result in this error if a single row of data is updated within the period of the transaction. I think the odds are high then that this will happen if a table scan is involved and if the table has a large number of rows.


I have had a look through the query plan for this delete and cannot see any table scans (I think all child FK indexes do exist), but I can see loads of index scans.
So i have a couple of questions on this problem:-

 - will an index scan have the same effect as the table scan and therefore cause the issue?
 - is there any need for a pure delete (or set of cascading deletes) to run under snapshot isolation?

(my understanding is that SI is effective for readers only)

I would like to understand the problem, so the answer to the first question is key I think. But as well as that, I want to understand SI a bit better, so knowing whether a delete is pointless under SI would be very useful as I can possibly lower the isolation just for the delete to read committed and hopefully avoid the issue altogether.

Thanks in advance!

  

Problems with Case Sensitivity

$
0
0

I expected case sensitive to be exactly that. Can anyone explain these results:

use master;

create database TEST_DB COLLATE Latin1_General_100_CS_AS
go

use TEST_DB
go

create table X1 (F1 varchar(50));
GO

insert X1 (F1) values ('WILLIAMWILLIAM');
insert X1 (F1) values ('williamwilliam');

select * from X1 where F1 between 'WILLIAM ' and 'WILLIAMz';
go

Result:

F1
WILLIAMWILLIAM
williamwilliam

Detecting Failed Mail using mdb.dbo.sysmail_faileditems

$
0
0

We use dmail for some critical outgoing application messages.  I have separate mail accounts/profiles for these applications, but each of these profiles uses our internal Exchange server as the outgoing mail server.  Also, this application does send a lot of external mail messages, but none outside of the US.

Lately our Exchange server has undergone a number of patches and upgrades.  When this occurs without our knowledge, application messages don't go out and that's very bad.

After the fact I can see these failures in [msdb].[dbo].[sysmail_faileditems] and I can detect that it was a handoff problem with our Exchange server. 

However, I would like to be notified as soon as possible when that happens without having to poll the logs myself at 1 minute intervals. 

At this point, the sending of the messages is embedded in the business logic contained within stored procedures.  To separate the construction of the messages from the sending of the messages would be nontrivial.

Can anyone help ?

What are your thoughts about using an external highly reliable 24x7 SMTP server from  a third party vendor like ... SMTP.com. 

If I go that route, can't I just plug that directly into the mail account that we use to send those critical messages? 

Even if we go that route I'd still like to be able to know if mail fails by pollingmdb.dbo.sysmail_faileditems.

If I have to create a job to poll the mail log for failed items can someone think of a polling interval guideline? 

Can polling interfere with sending messages?

thx very much



Failed to initialize log file during restore, key is corrupted

$
0
0

Hello,

I need some help on restoring a small sql database, which is tied to a server certificate, and no TDE is enabled.

I backed up the certificate, key and I restored it on the destination server (Sql server 2016, SP1)  I got a message that the certificate is expired. I then tried to restore the .bak file and I get error that the log file failure to initialize and that the key is corrupted.

Please advise,

Veena




Add database to availability group: Password required

$
0
0

Hello,

Password required when adding database to availability group, take.ms/QC9FA

This database is encrypted by database master key, you need to provide valid password when adding it to the availability group.

But "SELECT * FROM sys.dm_database_encryption_keys" shows nothing about it.

How is that possible?

Thanks.


Любовь долготерпит, ...


Troubleshooting Logshipping Latencies

$
0
0

Hi Folks,

Everyday I am facing issues with logshipping latency on one of our DB server. When I checked I found below errors in error log and eventviewer:

The operating system returned the error '64(failed to retrieve text for this error. Reason: 15105)' while attempting 'FlushFileBuffers' on '\\1.2.3.4\LogShipBackup\DB_20180728082131.trn'.

The operating system returned the error '87(failed to retrieve text for this error. Reason: 15105)' while attempting 'FlushFileBuffers' on '\\1.2.3.4\LogShipBackup\DB_20180728002531.trn'.

1.2.3.4 >> is the primary server 

Can anyone help me out how to resolve this. I asked to check Windows Team. They said it is memory issues, try to increase memory but I am not satisfied with their answers.

SQL Server Version: Microsoft SQL Server 2008 R2 (SP2) - 10.50.4042.0 (X64)   Mar 26 2015 21:18:04   Copyright (c) Microsoft Corporation  Enterprise Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1) (Hypervisor) 

Windows Version: Windows 2008 R2 Enterprise Edition 64-bit



How to Compare Two Tables with Image/Text/Ntext types?

$
0
0

Hi,

 

I have two tables containing image/text/ntext type columns. Now I want to compare them. I following the instructions in article https://www.mssqltips.com/sqlservertip/2779/ways-to-compare-and-find-differences-for-sql-server-tables-and-data/ to use “except” method, but get the following errors:

 

“The image data type cannot be selected as DISTINCT because it is not comparable”

“The text data type cannot be selected as DISTINCT because it is not comparable”

“The ntext data type cannot be selected as DISTINCT because it is not comparable”

 

How to solve the problem and make sure image/text/ntext fields still can be compared?

 

Thanks

How to BULK INSERT Data to Table with Timestamp Column?

$
0
0

Hi,

 

I am using SQL Server 2008. Today I try to use BULK INSERT command to import data from a Unicode file to a table. The table has a Timestamp column. In the data file, I put the Unicode hexidemical values for the Timestamp column.

 

But the command fails with the following error:

 

“Cannot insert an explicit value into a timestamp column. Use INSERT with a column list to exclude the timestamp column, or insert a DEFAULT into the timestamp column.”

 

Then I try to put the Unicode string “DEFAULT” as a placeholder for the timestamp column in the data file, and try again, but still fails.

 

In such a case, how to BULK INSERT data to a table with timestamp column?

 

Thanks

Consuming too much virtual memory

$
0
0

Hello,

 I have a SQL server with a minimal install (i.e. Management Tools, Database Engine).  I set the Max memory setting for 10GB.  The OS (Windows Server 2012R2) has 15GB physical memory installed and a max of 24 GB for Virtual memory.  My users are getting messages that the server is busy though to process requests.  I look at Task Manager Details pane and the SQLserver process is using almost all the virtual memory on the box.  Additionally it seems that no matter what I set the database Max memory to, the database still seems to use the same amount every time.  How can I prevent the database from consuming so much memory?

shrinking question

$
0
0

Hi experts,

I never ever shrink a database... But in this case, I have deleted two tables that are not longer going to be used, and both tables were quite big.

I tried first option, but is not shrinking anything, why? Shall I go ahead and do the 'reorganize pages before releaseing unsued space, and force the srhink to a value'? which value? :)

Deletion of Records

$
0
0
One of the user deleted a record in our database, but when I looked at deleted records it is displaying the user who initiated the deletion as well as the username with 'sa'.
Viewing all 15264 articles
Browse latest View live


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