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

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 


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



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

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

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.

Timeout error while creating an index on heap

$
0
0
Hi Experts,

While trying to create a clustered idx on a HEAP Table, we are seeing below error. How to avoid this error. This Table is originally a HEAP and now we wanted to remove fragmentation (~25Gb), so tried creating clustered on this table using SSMS. It is throwing Timeout error. How to fix this? Kindly help.



Thanks,

Sam


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

error while adding db back to Always on

$
0
0
Hi,

we configured alwayson with 15 dbs in sql 2014. we configured full,diff and log backups. due to some reason the yesterday all log backups failed. due to this the logs grown hugely. i fixed the log backup drive.after taking continuous log backups and shrinking the log files three of the dbs logs were huge still. after trying many times as log space is not reducing i removed the dbs from always and made the recovery model simple and tried shrinking the log files. After this log space reduced and L drive came back to normal. Till here everything fine. again i made the dbs recovery mode to full. 

To add those two dbs back in alwayson setup took full backup and log backup freshly in primary replica.And restored them with no recovery mode in Secondary and DR Replica. When i tried to add the dbs in always everything was success in the validation but at the end i got a below error.

------------------------
Failed to join the database 'xyz' to the availability group 'ABCSQL2014' on the availability replica 'Replica2'. (Microsoft.SqlServer.Smo)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=12.0.5000.0+((SQL14_PCU_main).160617-1804)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&LinkId=20476

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

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

------------------------------

The mirror database, "xyz", has insufficient transaction log data to preserve the log backup chain of the principal database.  This may happen if a log backup from the principal database has not been taken or has not been restored on the mirror database. (Microsoft SQL Server, Error: 1478)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&ProdVer=12.00.5223&EvtSrc=MSSQLServer&EvtID=1478&LinkId=20476

------------------------------

I tried in both ways for adding dbs in always back. 
1. I restored freshly fulL backup and t-Log backup with no recovery mode in 2ndary and DR Node. while adding dbs in alwayson selected the "Join" option in Data synchronization. -got error.
2. without restoring dbs in secondary and dr node i selected "Full" option in Data synchronization by giving the network backup folder-Still got the error.:(

I tried creating the test db with one table. with above two trails i am able to add db in two replicas without errors. But why i am not able to add those dbs which i removed yesterday and add them back now?? i already restored log backup with no recovery mode. then why it is showing still needs to restore t-log backup in secondary?

Am i doing anything wrong? These are production dbs. Please help me to add them back in Always on setup.. 

Thanks
Jo

pols

Waiting queries

$
0
0
Do waiting queries increase CPU load ? How to reduce wait time of waiting queries ? 

Migrate SQL 2017

$
0
0

currently we are in   sql 2016,  (windows Server)

shall we migrate to SQL 2017?  is this SQL 2017 provides more  stability and speed ?  compare to SQL 2016.

Or wait to update SQL 2019?

sp_send_dbmail sends *.csv.txt instead of *.csv

$
0
0

The following code sends files with the extension *.csv.txt. Is there a way to send it as *.csv?

The query is executed on Microsoft SQL Server 2012 - 11.0.7462.6 (X64).

declare @sep char(1) = char(9);

exec msdb.dbo.sp_send_dbmail  @profile_name =  'DBMail', 
                     @recipients =  'mail@mail.com' ,
                    @subject =  'A subject',
                    @body =  'A body',
                    @query ='select * from [view]',
                    @execute_query_database = 'dbname' ,
                    @attach_query_result_as_file = 1,
                    @query_attachment_filename =  'vendors.csv',
                    @query_result_separator =  @sep,
                    @query_result_width = 2048

Restoring the Database mdb.bak file

$
0
0

Hi,

I am restoring the mdb.bak file from MS SQL 2012 server named 'ITASM' to  MS SQL 2016 server named 'ibntest002063'. But While restoring the file I am getting the error whose image is below. I have created database named 'mdb' similar to database named 'mdb'  in ITASM server.  Do let me know what other consideration I have to follow. Also restoring database backup of MS SQL 2012 to MS SQL 2016 is ok ?

Connecting a local AD Client App to a hosted Azure SQL database using Azure AD.

$
0
0

Background. I have a client that wants to move the database that they connect to from their local network to their Azure cloud server. They have purchased a few companies and they will not be able to link all of the local domains but want to have a few people access the app from the new companies they purchased. The app is used within a windows network. Its a clickonce app that uses SQL as the database and AD security group for single sign on.  Their local AD is not connected to the Cloud Azure AD or linked as this is a one off type app only used by a few users.

QUESTIONS:

How can I get each user to authenticate to the hosted Azure SQL database using the local windows credentials linked to the SQL logins?

Any help or guidance or direction on how to get this to work would be great.

Thanks


is WITH(READPAST) affected by readlocks

$
0
0

If a transaction calls a SELECT using the table hint WITH(READPAST)... will it skip rows that are locked by other SELECT statements that are in READ COMMITTED mode and are issuing shared locks?

ie. Does READPAST skip rows that are locked by SELECT statements, not just UPDATE and INSERT statements?

Determining the size of Buffer Pool

$
0
0

Hello!

I'm trying to figure out the size of SQL Server memory buffer pool on my server - this can be done by 1) using thesys.dm_os_buffer_descriptors view or 2)  the sys.dm_os_performance_counters view.

According to MS the buffer pool size "determines the maximum number of pages that can be cached in the buffer pool at any time in the running instance" so I think the buffer size can be found by counting all (distinct) pages returned by the sys.dm_os_buffer_descriptors view:

select distinct page_id INTO #PAGES FROM sys.dm_os_buffer_descriptors
select COUNT(*) AS cached_pages_count, COUNT(*)*8/1024 as BufferSIZEinMB from #PAGES
DROP TABLE  #PAGES;

But the sys.dm_os_performance_counters view displayes the values that differ from the one above:

Q1: Is it the Total pages counter that satisfies MS definition?

Q2: Why the number of distinct pages from the sys.dm_os_buffer_descriptors view is three times smaller than that from the sys.dm_os_performance_counters\Total pages ?

Thank you for advance,
Michael


Alwayson error

$
0
0

Hi,

We configured the Ag for 15 dbs in SQL 2014. Primary,seconadry and DR node.
Morning i found that the databases are not sync in DR Node. When i tried to join the db to AG (Resume data movement) i got the below error.

Failed to resume data movement in database 'abc', which resides on the availability replica 'DRnodeServer' in the availability group 'SQL2014'. (Microsoft.SqlServer.Smo)

Could not process the operation. AlwaysOn Availability Groups replica manager is waiting for the host computer to start a Windows Server Failover Clustering (WSFC) cluster and join it. Either the local computer is not a cluster node, or the local cluster node is not online. If the computer is a cluster node, wait for it to join the cluster. If the computer is not a cluster node, add the computer to a WSFC cluster. Then, retry the operation. (Microsoft SQL Server, Error: 35220)

When i checked the WSFC in Primary server all the nodes are up. Please help to resolve the issue.

Thanks,


pols

logs were not shriking

$
0
0
Hello,

I am trying to shrink  my production log file as its occupying lot of space in L drive. Its in Alwayson setup. two days back i already removed the db from alwayon and made it simple recovery mode and shrinked the log file.After this i added the db back to Ag.  Now again the logs were growing. I checked any open transactions. No open transactions. I checked the log_reuse_wait_desc. Its showing AVAILABILITY_REPLICA.

i tried below commands also. 

USE[abc]
GO
CHECKPOINT
GO
CHECKPOINT

DBCC SHRINKFILE('abc_log', 1024, TRUNCATEONLY)
go

Took  t-log backups also.tried shrinking log files. Nothing helping me to reduce the size. Infact after running the above commands the log space increased surprisingly. .
I can not remove this db from alwayson and make simple ,shrink. Please help me to reduce the log space..:(  


Thanks,

pols



Copying and moving latest backup

$
0
0

Hi guys, 

I take a backup of my databases every night and the name of the backup is the follow:

Pippo_backup_2019_10_07_20126_5563527.bak

Pippo_backup_2019_10_08_20114_3255228.bak

.....

It means, nameDB_Backup_Year_Month_Date_??????_??????.bak

Now, I've been asked to copy and move overnight the latest backup for each database. I ma wondering how can I determine the latest backup taken?

Many Thanks

Viewing all 15872 articles
Browse latest View live


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