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

DBCC CheckDB on tempdb

$
0
0

Does Microsoft advise to run DBCC CHECKDB on tempdb? If not and if it is advisable, WHY should I perform that and what is the impact of corruption in tempdb on data in other databases? These are basically my questions.

I have done some research, but I cannot find a statement from Microsoft itself. Brent Ozar (MVP) says you should perform it, but doesn't really go into the details of the impact. Ola Halengren (also an MVP...) doesn't check tempdb by default, but gives the option to do so, because Microsoft supposably does not perform DBCC CHECKDB on tempd themselves. If so, is that still the case?

I know that CHECKDB cannot use a snapshot to perform the CHECKDB, so it uses table locks to check it. What I basically want to know is what the official statements are if there are any and what the impact of corruption in tempdb can be. For example with a temp table; i wouldn't think that corruption can be transferred to another db, because reading it from tempdb and insert it in another db would cause an error message that the data is corrupt. I also don't think that corrupt data can be read and 'transferred' to another db or table. Or am I wrong. Really curious on how this works exactly.


performance issue.

$
0
0
we are seeing performance issue on our database server. Most of the queries are running slow. its a newly configured server. I want to check if data files /tempdb files are being accessed by anti-virus software. Our admin says mdf/ldf files are by default ignored by this tool. Tool name is Cylance. I would like to check that again to see if thats happening, is there any way to do it?

SQL Server detected a logical consistency-based I/O error

$
0
0

We started receiving these error messages suddenly

Error: 824, Severity: 24, State: 2.

Message
SQL Server detected a logical consistency-based I/O error: invalid protection option. It occurred during a read of page (7:8192) in database ID 2 at offset 0x00000004000000 in file 'X:\tempdb\tempdb_mssql_6.ndf'.  Additional messages in the SQL Server error log or system event log may provide more detail. This is a severe error condition that threatens database integrity and must be corrected immediately. Complete a full database consistency check (DBCC CHECKDB). This error can be caused by many factors; for more information, see SQL Server Books Online.

SQL Server detected a logical consistency-based I/O error: incorrect checksum (expected: 0x31333637; actual: 0x9c88f38a). It occurred during a read of page (7:8216) in database ID 2 at offset 0x00000004030000 in file 'X:tempdb\tempdb_mssql_6.ndf'.  Additional messages in the SQL Server error log or system event log may provide more detail. This is a severe error condition that threatens database integrity and must be corrected immediately. Complete a full database consistency check (DBCC CHECKDB). This error can be caused by many factors; for more information, see SQL Server Books Online.

An error occurred while processing the log for database 'tempdb'.  If possible, restore from backup. If a backup is not available, it might be necessary to rebuild the log.
During undoing of a logged operation in database 'tempdb', an error occurred at log record ID (239:1702646:104). Typically, the specific failure is logged previously as an error in the Windows Event Log service. Restore the database or file from a backup, or repair the database.

SQL Server must shut down in order to recover a database (database ID 2). The database is either a user database that could not be shut down or a system database. Restart SQL Server. If the database fails to recover after another startup, repair or restore the database.

------

After these messages, i had to start SQL services manually, however the errors continued

Error while allocating extent for a worktable.  Extent (6:16248) in TEMPDB may have been lost.

-------

I ran DBCC CHECKDB(tempdb)  --- no results.....

Checked with storage team for health checks, they say no issue.

However, i see many suspect_pages recorded for this DB and it even got recorded before the server crash too.

database_idfile_idpage_idevent_typeerror_count
27404401106
244044014759
2451123211
27821621
27819211
261617611935
278088118

then i had to manually delete the tempdb files and restart SQL services. Errors stopped and DB health is OK.

Trying to investigate the root cause, any pointers/advise is really appreciable. Thanks in advance.

Microsoft.ACE.OLEDB.16.0 provider is not registered on the local machine. (System.data)

$
0
0

Trying to import data from Excel is giving this message.

Office365 64-bit

Here's what I tried:

1) I installed the 64-bit Access database engine 2016

2) I tried the 2010 & 2007 versions as well

3) I reinstalled Office365

I'm out of ideas. What else could be going on here?

How to get Schedule History and not Job History?

$
0
0

Hi all,

I am building a report to show the Job all Scheduled details and Last Run Date time as well as Status.

When I go to msdb.dbo.sysjobhistory I can find history about Job and there is no way I can link this to each schedule within a Job. 

As we know that one Job can have multiple schedules and so I am looking history for each schedule to find last run date time as well as Status. 


Thanks Shiven:) If Answer is Helpful, Please Vote

SqlPS Invoke-SqlCmd stops all output if the first SELECT in a batch returns now rows

$
0
0

I just lost half my day chasing this insane bug.  I tried upgrading to the recommended SqlServer powershell module to see if it fixes it, but all that seemed to do was break both SqlPS and SqlServer modules.

In the case where you have a script that contains multiple PRINT and SELECT statements, and the first SELECT returns no rows, all following SELECTs and PRINTs are silently ignored.

For example:

>> Invoke-Sqlcmd -ServerInstance . -Database 'pureprod' -query "
>>  PRINT 'firstprint'
>>  SELECT 'firstselect' where 0 = 1
>>  PRINT 'secondprint'
>>  SELECT 'secondselect'
>>  PRINT 'thirdselect'
>>  SELECT 'thirdselect'
>>  PRINT 'fourthprint'
>>  " -verbose

gives just

VERBOSE: firstprint

SQL Server Memory related question

$
0
0

Hi All,

We have a QA environment where we have bunch of databases(18+) but with limitied RAM. After having some disussions with Application teams,  we came to know some databases are READONLY and some they don't use it because the have not been refreshed from Prod. So, actually there are only 2-4 databases in use.

My question is, I wanted to know whether we can release some memory from buffer pool so that the portion of memory can be used for Active databases which are accessed heavily for that sprint testing.

1. Can we clear contents of buffer pool of specific database? if so, how can we clear the data pages of that database which are not in use?
2. Can we clear plan cache of specific database ? If so, How to do it ?
3. Can we measure using a query how much memory was taken before and released after doing clearing cache.

Environment : SQL 2012+ EE

I know some of you might come back at me and ask, why cant you increase the memory on the server. But, it's the management decision and they want to invest more on that server. In future, they want to move it Azure.

Thanks,

Sam

Do you want to be acknowledged as SQL Server Database Engine Guru? Submit your work to Oct 2019 competition!

$
0
0

What is TechNet Guru Competition?

Each month the TechNet Wiki council organizes a contest of the best articles posted that month. This is your chance to be announced as MICROSOFT TECHNOLOGY GURU OF THE MONTH!

One winner in each category will be selected each month for glory and adoration by the MSDN/TechNet Ninjas and community as a whole. Winners will be announced in dedicated blog post that will be published in Microsoft Wiki Ninjas blog, a tweet from the Wiki Ninjas Twitter account, links will be published at Microsoft TNWiki group on Facebook, and other acknowledgement from the community will follow.

Some of our biggest community voices and many MVPs have passed through these halls on their way to fame and fortune.

If you have already made a contribution in the forums or gallery or you published a nice blog, then you can simply convert it into a shared wiki article, reference the original post, and register the article for the TechNet Guru Competition. The articles must be written in October 2019 and must be in English. However, the original blog or forum content can be from beforeOctober 2019.

Come and see who is making waves in all your favorite technologies. Maybe it will be you!


Who can join the Competition?

Anyone who has basic knowledge and the desire to share the knowledge is welcome. Articles can appeal to beginners or discusse advanced topics. All you have to do is to add your article to TechNet Wiki from your own specialty category.


How can you win?

  1. Please copy/Write over your Microsoft technical solutions and revelations to TechNetWiki.
  2. Add a link to your new article on THIS WIKI COMPETITION PAGE (so we know you've contributed)
  3. (Optional but recommended) Add a link to your article at the TechNetWiki group on Facebook. The group is very active and people love to help, you can get feedback and even direct improvements in the article before the contest starts.

Do you have any question or want more information?

Feel free to ask any questions below, or Join us at the official MicrosoftTechNet Wiki groups on facebook. Read More about TechNet Guru Awards.

If you win, people will sing your praises online and your name will be raised as Guru of the Month.


PS: Above top banner came from Rajeesh Menoth.

Disk IO/ Latency

$
0
0

I am having the following figure of my disks in my environment

Avg. Disk sec/Transfer ~ 0.4s

Avg Disk Queue Length : 10

Avg Disk Write bytes /sec 11040 bytes

Avg. Disk Bytes/Transfer 11040 bytes

Avg. Disk Bytes/Read = 0 ( I suppose in that moment should be a write process )

Is it bad to have these figure/ and how to improve ?

 

Can't see AutoGrow/AutoShrink Information

$
0
0
Normally, when I right-click the database icon in Object explorer of SSMS, then click 'Reports > Standard Reports > Disk Usage' I get a couple pie charts showing disk usage, plus two expandable nodes; one with disk usage by data files and one with the autogrow/autoshrink info.

However, in our production DB, the node that normally has the AutoGrow/AutoShrink info is replaced by an message that says 'No entry found for autogrow/autoshrink event for [DBName] database in the trace log.  I know for a fact it has grown.  Can anyone help me resolve this?  Is there another way to see autogrow/autoshrink events?.

It's gonna be hard to plan for future growth if we can't see past growth...

Thanks in advance.
Clint

How to change auto growth and auto shrink information path in sql server

$
0
0

Hi,<o:p></o:p>

When I right click the database icon in Object explorer of SSMS, then click 'Reports > Standard Reports > Disk Usage'  then I see 'No entry found for autogrow/autoshrink event for test database in the trace log' ,<o:p></o:p>

Disk usage report is empty,but   I know that it has grown.  However default trace is enabled and default trace file is log_758.trc and I can read autogrowth information from log_758.trc  with sql query, but I think that DISK USAGE report read from log.trc because in our other instances,information is in  log.trc file and default trace is another file. 

Can I change the  auto growth and auto shrink information path? Or What should you recommend for this situation?<o:p></o:p>

Thanks in advance.

Logon failed for login due to trigger execution.

$
0
0

I have the following issue for a SQL Server 2016 instance. 

Usually everything works fine but form time to time we are getting Error 17892 followed by error 18056. This is a selection form the error log of the instance:

2019-03-20 16:38:19.90 Logon       Login succeeded for user <<User Name 1>>. Connection made using Windows authentication. [CLIENT: 10.xxx.xxx.xxx]
2019-03-20 16:38:40.96 Logon       Error: 17892, Severity: 20, State: 1.
2019-03-20 16:38:40.96 Logon       Logon failed for login <<User Name 1>> due to trigger execution. [CLIENT: 10.xxx.xxx.xxx]
2019-03-20 16:38:40.96 spid76      Error: 18056, Severity: 20, State: 1.
2019-03-20 16:38:40.96 spid76      The client was unable to reuse a session with SPID 76, which had been reset for connection pooling. The failure ID is 1. This error may have been caused by an earlier operation failing. Check the error logs for failed operations immediately before this error message.
2019-03-20 16:38:45.36 Logon       Error: 17892, Severity: 20, State: 1.

......

2019-03-20 16:38:49.19 Logon       Login succeeded for user <<User Name 1>>. Connection made using Windows authentication. [CLIENT: 10.144.227.204]

As you can see the same user is first able to login without any problem and then the logon fails for some time and then start to work again! This goes on and off for some time and then start to work again.

We do have a logon trigger that uses APP_NAME() to check the application name and write to a log table if a certain condition are met. The user rights should be alright as it is able to insert records into the logging table. For this user that the error is occurring for there should not be any logging. The trigger is created with 'WITH EXECUTE AS SELF'.

On request here is the trigger code

CREATETRIGGER[tr_sasLogon]ONALL SERVERWITHEXECUTEAS SELFFOR LOGONASBEGINIF(APP_NAME()like'SOMETHING%')BEGININSERTINTO tkadmin.dbo.audit_login (date, login, program_name)VALUES(GETDATE(), ORIGINAL_LOGIN(),APP_NAME())ENDEND

Anyone got some ideas what can be the issue causing this behavior?

Thanks,
Peter



SQL Server 2014 SP3 CU4 and Security Update KB4505422

$
0
0

Hello

We have latest CU4 installed for SQL Server 2014 SP3,

but Vulnerability scan engine warns about missing security update KB4505422.

Do we need to uninstall CU4 and install security update on CU3, then after updating to CU4 again ?

or there is not need for applying security update if it is already CU4 ?

Thanks 

Change uppercase characters to lowercase in database name - AlwaysON

$
0
0

think i know the answer already but will ask anyway..

At customer site and they have a database with a mix of uppercase and lowercase characters in the database name. 

They have a new Vendor application who insist on having lower case only for connect string and the connect string is hardcoded somewhere we dont know. 

So rather than get the vendor to change something on their side, ive been asked to keep the db name but change the db name to lowercase.  Problem is its 500GB, PROD and in an AlwaysOn Availibility Group and they dont want to remove it from the AG and add it again (internal politics between different teams here and im a consultant)  

Is there anyway to change uppercase characters to lowercase in the db name without removing from AG and re-adding it again ?

dont think so... 


ilikefondue

estimating how much my tran log can handle on one transaction

$
0
0

Hi we run 2017 std. where I used to work we had a dashboard that would not only show the available space in the tran log but also how much and how fast it was filling up when we were monitoring the impact of special adhoc one time tasks.  Here, I don't have that luxury but I just ran sys.dm_db_log_stats and suspect 3 numbers i'm seeing are of interest... total log size mb, active log size mb , log recovery size mb.  Unfortunately I don't know which tells me what.  This is a test system.  I can lessen the risk of filling up the tran log by running  my massive insert under ssis (it has a commit size) but would prefer ssms if its safe.   Total log size is gigantic 103167.867187 mb which if its the magic number seems more than sufficient to handle 30 million inserts of 500 byte records.  but the other two are in the 30 million byte range which would never work if I was to insert 20 million records under ssms.

when I run this query SELECTfile_id,name,type_desc,physical_name,size,max_sizeFROMsys.database_files

, I get size of the ldf is 13,205,488 and max size is 268,435,456.  That seems contradictory to the 1st dmv's results.


setting up 3rd party job scheduling userids that can execute sp start job

$
0
0

Hi. We run 2017 std. We have to attach an exec windows userid to our 3rd party job scheduling software. The plumbing basically involves 3rd party-> powershell (via script file) -> exec sp start job -> sql agent-> ssis catalog.

Beside the permission the userid will have on the file system where the powershell script resides, does the community believe that exec on that off the shelf proc is all we need?

Another way to ask this is will permissions beyond/underneath executing that sp (eg writing to the data mart table that pkg a inserts to) carry thru as long as the userid has exec on the sp? 

MDF & LDF file got deleted when ctll C and ctrl V. Not able to recover

$
0
0
MDF & LDF file got deleted when ctll C and ctrl V. Not able to recover

Identity Columns Randomly Regress to a Lower Value

$
0
0

Hello,

We have an in-house developed database application that uses SQL Server 2016 (13.0.5101.9) for backend data storage. Numerous tables have identity columns configured as the key field. This week two of these identity columns randomly changed to substantially lower numbers. 

In one case the identity column changed from 20200954 to 20160296. In the other case the identity column changed from 20200000 to 20120046. In both cases the identity column was configured as an INT value with an increment step of 1. 

We had previously encountered the better known issue where identity values can skip by 1000 during a server restart. We took the prescribed measures to eliminate this.

Anyhow, in approximately ten years of use of this application (using two or three versions of SQL Server over this time), I don’t ever recall experiencing identity values randomly regressing to a lower value. I am wondering…

1.)   If anyone else has experienced this?

2.)   Is this a known issue?

3.)   Is there a known remedy?

It’s very unsettling having identity values randomly change.

Thank You,

Dale

Use SQL Graph table in PowerBI - SQL Server 2019 RC1

$
0
0

Hi,

I'm trying to do build a dashboard in Power BI to visualize graph data stored in SQL Server graph tables.   If I directly import the graph table Power BI will give an error saying failed to access internal graph columns.  In SQL Server 2017,  I can build a view excluding the internal graph columns, then I can use it in Power BI.  But in 2019 RC1 version, when I build a view from a graph table,  the internal graph columns are automatically included regardless if I included them in the view or not.  This makes it impossible to use the database in Power BI.   Is this a bug in SQL Server 2019?

Running the same create view statement results in different results in 2019 RC1 compare to 2017.

Question on Heaps rebuild's

$
0
0

Hi Experts,

One of the HEAP table rebuild operation is failing in one of our dev env. Have some few questions, kindly help.

>ALTER TABLE HeapTbl REBUILD;

There is a HEAP table which has 88% fragmentation and it is around ~25GB. The table also contains LOB datatypes columns as well. When we try to rebuild the HEAP , it is throwing transaction log full error.

Questions
1. How much disk space (in .mdf or .ndf) is required for the rebuild operation to complete successfully?
2. How much Tempdb space is required for the rebuild operation to complete successfully?
3. How much Transaction log file space is required for rebuild operation to complete successfully?

Thanks,

Sam

Viewing all 15694 articles
Browse latest View live


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