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

UNABLE TO SETUP MSSQL ON LINUX

$
0
0

After mssql-server package install trying to set up server.

it's failing with below message

Configuring SQL Server...

sqlservr: The configuration file '/var/opt/mssql/mssql.conf' failed to load (error: The INI file could not be opened. Errno [2] Filename [mssql.conf]).
Initial setup of Microsoft SQL Server failed. Please consult the ERRORLOG

No log files are generated.

Installed Packages
Name        : mssql-server
Arch        : x86_64
Version     : 14.0.3048.4
Release     : 1
Size        : 894 M
Repo        : installed


deadlock count increase

$
0
0

how to reduce this deadlock.. it happen very frequently.

<deadlock><victim-list><victimProcess id="processd4fe015848" /></victim-list><process-list><process id="processd4fe015848" taskpriority="0" logused="1219420" waitresource="PAGE: 7:17:384615 " waittime="3550" ownerId="42364946100" transactionname="UPDATE" lasttranstarted="2018-12-31T16:30:37.147" XDES="0xd4f7c13a50" lockMode="IX" schedulerid="1" kpid="17264" status="suspended" spid="123" sbid="0" ecid="0" priority="0" trancount="2" lastbatchstarted="2018-12-31T16:30:00.253" lastbatchcompleted="2018-12-31T16:30:00.253" lastattention="1900-01-01T00:00:00.253" clientapp="SQLAgent - TSQL JobStep (Job 0x845F2BC7C95158469B934457A3F40B0E : Step 1)" hostname="server-1" hostpid="3236" loginname="NT SERVICE\SQLSERVERAGENT" isolationlevel="read committed (2)" xactid="42364946100" currentdb="7" currentdbname="ecommerce" lockTimeout="4294967295" clientoption1="671088672" clientoption2="128056"><executionStack><frame procname="ecommerce.dbo.sp_ecommerce_maintenance_pricing_amazon" line="71" stmtstart="3222" stmtend="3548" sqlhandle="0x030007004af05643ace4bb0021a9000001000000000000000000000000000000000000000000000000000000">
UPDATE d
	SET price = t.price
	FROM product_details d
	JOIN (
		SELECT *
		FROM #tmp AS T1
		WHERE IdentityID BETWEEN @StartID and @EndID
	) t ON d.id = t.i    </frame><frame procname="adhoc" line="10" stmtstart="426" stmtend="514" sqlhandle="0x01000700e8b7a908603e2ce81701000000000000000000000000000000000000000000000000000000000000">
exec sp_ecommerce_maintenance_pricing_amazo    </frame></executionStack><inputbuf>
         exec sp_ecommerce_maintenance_pricing_amazon;</inputbuf></process><process id="processd50e057848" taskpriority="0" logused="8871956" waitresource="KEY: 7:72057983830851584 (1d7e35ee8c1d)" waittime="3528" ownerId="42364945781" transactionname="UPDATE" lasttranstarted="2018-12-31T16:30:36.900" XDES="0x11863c46040" lockMode="U" schedulerid="8" kpid="13720" status="suspended" spid="102" sbid="0" ecid="0" priority="0" trancount="2" lastbatchstarted="2018-12-31T16:30:30.300" lastbatchcompleted="2018-12-31T16:30:30.300" lastattention="1900-01-01T00:00:00.300" clientapp="SQLAgent - TSQL JobStep (Job 0x769B7731D4C93E42A5C2D0804B6FB1DE : Step 1)" hostname="server-1" hostpid="3236" loginname="NT SERVICE\SQLSERVERAGENT" isolationlevel="read committed (2)" xactid="42364945781" currentdb="7" currentdbname="ecommerce" lockTimeout="4294967295" clientoption1="673185824" clientoption2="128056"><executionStack><frame procname="ecommerce.dbo.usp_ecommerceFileBulkProcess_Inventory_Batch_Process" line="362" stmtstart="43748" stmtend="44460" sqlhandle="0x03000700684e776dacbebd00a6a9000001000000000000000000000000000000000000000000000000000000">
UPDATE T1
                   SET
                       last_inventory_update = GETDATE()
                 FROM product_details AS T1
                      JOIN [ecommerce_BulkProcess].[dbo].staging_Inventory_Batch_Process AS T2 ON T1.id = T2.id
                 WHERE isnull(vendor_id, 0) IN (@vendorid, 0)
                 AND BatchUID = @batchGUI    </frame><frame procname="ecommerce_BulkProcess.dbo.usp__ecommerce_BulkProcess_Inventory_Batch_Process" line="91" stmtstart="10074" stmtend="10702" sqlhandle="0x03000f00f358af6290c913011ca9000001000000000000000000000000000000000000000000000000000000">
EXEC ecommerce.dbo.[usp_ecommerceFileBulkProcess_Inventory_Batch_Process]
                              @batchGUID = @pBatchGUID,
                              @vendorid = @vendorid,
                              @removemissing = @removemissing,
                              @processQueueID = @processQueueI    </frame><frame procname="adhoc" line="1" stmtend="110" sqlhandle="0x01000f00d936563380bca144e300000000000000000000000000000000000000000000000000000000000000">
EXEC usp__ecommerce_BulkProcess_Inventory_Batch_Proces    </frame></executionStack><inputbuf>
EXEC usp__ecommerce_BulkProcess_Inventory_Batch_Process   </inputbuf></process></process-list><resource-list><pagelock fileid="17" pageid="384615" dbid="7" subresource="FULL" objectname="ecommerce.dbo.product_details" id="lockd1298eaf00" mode="U" associatedObjectId="72058013127409664"><owner-list><owner id="processd50e057848" mode="U" /></owner-list><waiter-list><waiter id="processd4fe015848" mode="IX" requestType="wait" /></waiter-list></pagelock><keylock hobtid="72057983830851584" dbid="7" objectname="ecommerce.dbo.product_details" indexname="cx_product_details_id_pid" id="lock100d50dc180" mode="X" associatedObjectId="72057983830851584"><owner-list><owner id="processd4fe015848" mode="X" /></owner-list><waiter-list><waiter id="processd50e057848" mode="U" requestType="wait" /></waiter-list></keylock></resource-list></deadlock>




sp_reset_connection - What and When it should be used

$
0
0

"sp_reset_connection"

Can you please help me understand this "sp_reset_connection" and when it should be used and anything to be taken care before using it.


Raghavendra Narayana

SQL SERVER RESTART - what commands / programs / others called internally before and after?

$
0
0
When SQL SERVER is restarted - what commands / programs / others called internally before and after please?

Raghavendra Narayana

"SQL Native Client xx.0 Configuration" vs. "SQL Server Network COnfiguration"

$
0
0

In SSCM, I want to know the differences of "SQL Native Client xx.0 Configuration" vs. "SQL Sever Network Configuration".

Let's assume the SSCM installed on the same server as SQL Server Engine installed. Does the "SQL Native Client xx.0 Configuration"only work for applications installed on the machine that has SSCM? For the applications connecting to SQL remotely, does the "SQL Native Client" has any impact on it?

Thanks.

Find Table usage

$
0
0

need to find table usage (DML)... we can get this by sys.dm_db_index_usage_stats  ( by user scan,seek..)

but need to find who or which host hit this tables.  ( with out sql profiler)



I have a table that keeps getting used (select ), and no one can figure out where the statement are coming from. I suspect they are coming from Entity Framework, but I want to capture the SELECT and associated information via an Extended Event to prove this theory.

How to move msdb database from one physical server to another physical server ?

$
0
0
How to move msdb database from one physical server to another physical server ?

sunnybabu

Idea regarding index creation on an existing table

$
0
0

Dear All,

I want to create an non clustered index on two columns of a table . Any of the column can contain null values . The table has an existing row count of 50 crores. Will it be feasible to create the index on exsiting table or  create a new table, create index on it and then populate data from existing tables and rename it as per old table .

Version is SQL server 2016 Standard Edition .

Which approach will be better ?

Best Regards,
Sandy



Extended Event sqlserver.error_reported não traz o SQLText

$
0
0

Pessoal, boa tarde. 

Estou com uma dificuldade com a ação sqlserver.error_reported do Extended Events, onde 95% dos erros capturados não informam o valor do SQL_Text, que retorna NULL. 

O comando para iniciar o XE é esse:

CREATE EVENT SESSION RelatorioErros ON SERVER  
   ADD EVENT sqlserver.error_reported   
   (ACTION ( sqlserver.sql_text  
            ,sqlserver.username  
            ,sqlserver.database_name  
            ,sqlserver.client_app_name  
            ,sqlserver.session_id  
            ,sqlserver.query_hash
            ,sqlserver.query_plan_hash
            ,sqlserver.tsql_stack
            ,package0.last_error)   
     WHERE ([severity]> 10))  
   ADD TARGET package0.asynchronous_file_target (set filename = 'Y:\Ferramentas\RelatorioErros.xel')  
WITH (MAX_MEMORY=4096 KB,  
      EVENT_RETENTION_MODE=ALLOW_SINGLE_EVENT_LOSS,  
      MAX_DISPATCH_LATENCY=10 SECONDS,  
      MAX_EVENT_SIZE=0 KB,  
      MEMORY_PARTITION_MODE=NONE,  
      TRACK_CAUSALITY=ON,  
      STARTUP_STATE=ON)  

Eu implantei o evento num servidor com 5 bancos de dados. Destes, 4 executam todas as instruções de aplicação via procedure, e apenas 1 envia comandos CRUD. Meu problema está nos 4 BDs que enviam procedures. Nenhuma delas é capturada. Mas todos os comandos CRUD do outro BD são capturados. Montei outro XE com error_reported e rpc_starting. E, neste caso, o RPC_starting capturou todas as procedures.

Pensei em deixar os 2 ligados para combiná-los e conseguir os comandos que geraram erro, mas o volume de informações para importação torna o processo inviável.

O servidor está com SQL 2014 Enterprise Edition: Core-based Licensing (64-bit) SP2.

Podem me ajudar?

Retrieve orphan record from S3 Bucket that does not exist in Database

$
0
0

Hello, 

I am trying to retrieve information from AWS S3 bucket, the way we have the setup right now EC2 for DBs. When file attachments are deleted using the Website UI only the database record is removed, the actual file in S3 record is orphaned, I am trying to find out those record and delete it later on. here is the snippet but keep getting <g class="gr_ gr_304 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar only-ins doubleReplace replaceWithoutSep" data-gr-id="304" id="304">error</g>:

Use master
declare @S3Bucket <g class="gr_ gr_320 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling" data-gr-id="320" id="320">nvarchar</g>(50), @S3rootfolder <g class="gr_ gr_321 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling" data-gr-id="321" id="321">nvarchar</g>(50), @filelocation  <g class="gr_ gr_322 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling" data-gr-id="322" id="322">nvarchar</g> (50)
Set @S3Bucket= 'BUcket name'
Set @S3rootfolder = 'Rootfolder name'
set @filelocation= 'E:\'-- connected to S3

set nocount on 
declare @directorylocation sysname= @filelocation 
drop table if exists #temp

--create temp table
Create Table #temp
(FAFilesID int , 
subdirctory varchar (50), 
depth int,
isfile int
)
-- inserting into the temp table 
insert into  #temp
(
FAFilesID,
subdirctory,
depth,
isfile
)

exec master..xp_dirtree
@filelocation, 1,1

select 
*
from #temp
where FAFilesID=1 
and @filelocation not in (select FAFilesID from sys.databases where name like 'database%')
order by FAFilesID ASC 

*****

Sometimes <g class="gr_ gr_358 gr-alert gr_tiny gr_spell gr_inline_cards gr_run_anim ContextualSpelling multiReplace" data-gr-id="358" id="358">i</g> get thisColumn name or number of supplied values does not match table definition. 

other time different error.

Backup throughput is not consistent in idle SQL Server

$
0
0

Hi Guys,

My SQL Server environment details

OS : Windows Server 2016 Standard 64 bit

SQL Server : SQL Server 2012 Web edition

Storage : SSD 

This is a dedicated DB server and Since its in POC , server is idle all the time. 

I am running SQL server full backup 

Backup database tpccnew to disk='F:\backup\tpccnew.bak' with stats=10

At the end of backup completion, I could see the throughput 

BACKUP DATABASE successfully processed 19708298 pages in 577.555 seconds (266.591 MB/sec)

And again when run the same statement, i am getting a lesser throughput

BACKUP DATABASE successfully processed 19708298 pages in 606.383 seconds (253.917 MB/sec)

Why is this behavior? The backup throughput comes down after the first backup and i am not getting the throughput that i got when i run the full backup for the first time

Thanks

MSSQLSERVER FAILS TO START

$
0
0

Good day

I am running MS SQL Server 2014 and the services will not start and asked to look at the event viewer or contacts administrator.

I cant start it on the configuration and tools folder as well.Please advice

Options to minimize performance impact caused by Row Level Security

$
0
0

Hello,

We have plans to implement Row Level Security in a table of size 1TB to control access to records. We are using
a function, security policy and a lookup table with the list of user groups to achieve this logic.
The logic seems to be working fine. However, we are observing a performance hit as the function is being called every time
for every row returned by the query. 

Please let us know if anyone of you have any recommendation/option to minimize the performance impact caused by the implementation of RLS.

SQL Server Version : SQL 2016 - SP2

Regards

MDW Data Collector Server Activity collection step 3 suddenly stopped working

$
0
0

For many weeks my data collections from my database instace have been uploading to my MDW server. Suddenly step 3 of the Server Activity Collector has stopped working giving the following error: Job Name                            DataCollector Server Stats Coll n Upload Step Name                         collection_set_3_noncached_collect_and_upload_upload Duration                              00:00:05 Sql Severity        0 Sql Message ID 0 Operator Emailed
Operator Net sent
Operator Paged
Retries Attempted          0

Message Executed as user: domain_svcAccount. SSIS error. Component name: DFT - Find and save sql text, Code: -1071636471, Subcomponent: LKUP - Look up query text on target server [2], Description: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80040E14.   An OLE DB record is available.  Source: "Microsoft SQL Server Native Client 11.0"  Hresult: 0x80040E14  Description: "The handle that was passed to dm_exec_sql_text was invalid.".   .  SSIS error. Component name: DFT - Find and save sql text, Code: -1071611309, Subcomponent: LKUP - Look up query text on target server [2], Description: OLE DB error occurred while fetching parameterized rowset. Check SQLCommand and SqlCommandParam properties.   .  SSIS error. Component name: DFT - Find and save sql text, Code: -1073450974, Subcomponent: SSIS.Pipeline, Description: SSIS Error Code DTS_E_PROCESSINPUTFAILED.  The ProcessInput method on component "LKUP - Look up query text on target server" (2) failed with error code 0xC0208253 while processing input "Lookup Input" (16). The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running.  There may be error messages posted before this with more information about the failure.   .The master package exited with error, previous error messages should explain the cause.  Process Exit Code 5.  The step failed.

Has anyone encountered this error before ? Thanks

Creating Distinct Top N records

$
0
0

Hello All,

I am trying to create a query to get distinct top n records in SQL.

Please can someone help?

Cheers,

s


Backup performance 4x slower than manual filecopy

$
0
0

Hi,

I noticed that when copying a file from a SAN volume to a network share on my Windows 2012 R2 server the speed is 400MB/s.  When SQL Server performs a backup of data from that same disk, it happens at about 100MB/s.  Running a Crystal Disk Mark benchmark of sequential read 5GB, I got 700MB/s.  Running BACKUP DATABASE MYDB TO DISK = 'NUL:', I also get 100MB/s. 

The SAN vendor reviewed the server configuration and doesn't see any issues.  This same server attached to storage from another vendor is getting near 400MB/s on backups - this is a different instance. Resource governor is not used, if that could even have an effect. The array is EMC.  Microsoft MPIO driver is being used, no special SAN software needed.

To summarize: 

  1. SQL backups are slow.
  2. SQL backup to NUL: is slow, indicating slow reads from SAN volume.
  3. Manual file copy through explorer is 4x faster.
  4. Sequential read test is 7x faster.

Does anyone have suggestions on how to improve this performance?

Thanks,

Sam

 


Hiding or masking sensitive information in the SQL Server audit log

$
0
0

I'm looking into auditing of who are accessing the data in all tables in a database. We do have the additional requirement that we in the log can't have any information that can be used to identify a person.

The first part can easily done using SQL Server audit to log all select, insert and delete statements for a specified database. It is the second part that I have problem with. The whole SQL statement including any personal information in e.g the where clause will be stored in the 'statement' column. This meaning that whoever that have access to the audit log will be able to see this information and identify the person in question. We do not need the information that are stored in the 'statement' column. The information stored in 'database_name', 'schema_name' and 'object_name' columns are enough for us.

My question is are there any way to prevent SQL Server audit to store the SQL statement at all or at least in clear text in the 'statement'column?

Error Number 825' occurred - Disk I/O

$
0
0

SQL Server Alert System: 'Error Number 825' occurred 

Error:

DESCRIPTION:    A read of the file 'G:\MSSQLDataFiles\ecommerce_amzn_items_2.ndf' at offset 0x00000097dae000 succeeded after failing 1 time(s) with error: 1117(The request could not be performed because of an I/O device error.). Additional messages in the SQL Server error log and system event log may provide more detail. This error condition threatens database integrity and must be corrected. Complete a full database consistency check (DBCC CHECKDB). This error can be caused by many factors; for more information, see SQL Server Books Online.

this DB is heavy production & used for Transactional replication as (publisher)

how to check by passing DBCC checkdb  ( is there possibility for replication corruption ? ) 


VS Just in time debugger alert

$
0
0

Hi guys, I am seeing this alert in one of my servers:

Any idea what is?

Thanks

How get data from Oracle in SQL Server with open Query in "where" Oracle.data = SqlServer.data

$
0
0

Hello i have a question please:

How can get data from Oracle in SQL SERVER with OpenQuery for compare data.. here my query:

 

SELECT TOP (1000) [TADIG]
      ,[TELEFONO]
      ,[ANEXO]
      ,[COD_CLIENTE]
      ,

  (CASE WHEN [CLIENTE] IS NULL

THEN  (select * from OPENQUERY(ALDM ,'select customer_legal_name from ODSDMP.CUSTOMER ')as A where A.subscriber_last_name = B.[SEGMENTO])

WHEN [CLIENTE] = LTRIM(RTRIM('.'))
THEN 'ACAA!!!!'
else 
[CLIENTE]

END

)  AS CLIENTE


      ,[FECHA_ALTA]
      ,[TIPO_CLIENTE]
      ,[SEGMENTO]

  FROM [NRTRDE].[dbo].[ESOTOP_HURS_3] B

Thanks a los for u answers!! :)


Viewing all 12644 articles
Browse latest View live