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

OPENROWSET and csv file

$
0
0

All,

The link shows how to create a format file using BCP. This assumes that the data is always extracted from a SQLServer table.

We receive lot of csv files from our business partners for which we cannot generate the format file and we plan to use them using OPENROWSET with the csv files being placed in Azure Blob Storage. Does anyone know how to generate the format file for a given csv file other than creating one manually?

In the below script, I manually created the format file currency.fmt for the csv data file currency.csv

Thanks,

rgn

 CREATE EXTERNAL DATA SOURCE pocBlobStorage
WITH (	TYPE = BLOB_STORAGE, 
		LOCATION = 'https://eventhubstore.blob.core.windows.net/datasets', 
		CREDENTIAL= sqlblob);

-- 2.4. Query remote file 
SELECT *
FROM OPENROWSET(BULK 'currency.csv',
				DATA_SOURCE = 'pocBlobStorage',
				FORMATFILE='currency.fmt',
				FIRSTROW=2,
				FORMATFILE_DATA_SOURCE = 'pocBlobStorage') as D
Inner Join [dbo].[State] C
On C.[id] = D.CurrencyKey



restore ms sql server reportserver database error

$
0
0

Dear,

When I restore reportserver database on ms sql server, there is error[database in use].

But I checked the service, there is no reportserver service.

Please tell me how to restore this special database. Thanks!

Installing CU for SQL 2016

$
0
0

Hi,

I need suggestions from you for below requirememnt. 

we are having two production SQL Servers. 

Version: SQL 2016

Productlevel: SP1

Edition: Enterprise, Core based licensing 64 bit

Product version: 13.0.4224.16 

Productupdatelevel: null

As per the requirement now we need to install latest CU on this server.  I searched the microsoft website for latest CU. I am little confused about finding the correct latest CU to download and install. 

Can you please guide what exactly to download so production sql server will be upto date with all updates?

Actually my current production is SP1.But in Microsoft website i see already sp2 released and latest CU are there for sp2. So shall i go ahead with downloading latest CU for SP1? OR download SP2 with latest CU? 

Which one i need to install ?Please share the exact link to download. 

How to consider which one i need to install the latest CU?

Thanks

Jo


pols


SQL Agent Job

$
0
0

Hi All,

How can i schedule a SQL job, which should not run on first 6 days of every month.


Vinai Kumar Gandla

Agent job failing with string or binary data truncated, proc runs successful from SSMS

$
0
0
have a monthly sql agent job that executes a stored proc and it started failing a month ago with string or binary data would be truncated error. It has been running for years with no issues, no server changes or db changes related to this process for years. I restore the database and log files to a dev machine to get back to the point in time when the failure happens and the proc runs successful from SSMS. I have dealt with these errors in the past by putting a timestamp on the table being updated to locate the row, but since the proc runs I can't seem to find what is wrong. Is it something in the agent job itself possibly? I set the agent job up on the dev machine and it runs successfully. The proc is not complex, it is doing some value calculations, I don't see anywhere a string length could exceed any of the variables. 

Any ideas would be appreciated

Connection failed when running automated script in SQL

$
0
0

Hi, 

I have a batch script that calls for winscp.com with a script parameter and if I restart SQL server solves the matter for a couple of week and then it starts to connection fail even if I try to restart SQL services still doesn't help only reboot SQL VM, also when I try to connect from winscp GUI I did not see any problem

thank you for your help


ERROR: (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

$
0
0

we have serverA  (sql box),   

server B  (application server)

server C  (IIS server, application servr)

Server D  (application server)


getting error from Server C  - ERROR: (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) 

no other server throw this msg...

when restart IIS @ server C  issue solved.   


i do't see any longrunning, blocking issue on sql server , & i configured Replication ( act as publication& distribution)  do't see any replication command pileup in distribution.

-------

i thought , network may down between Server C to Server A

 or any IIS issue happen on Server C ?  how to check this?

SQL Server 2017 CU

$
0
0

May I know if I install CU18 will also include the previous GDR ??Or I need to install CU14+GDR and CU18 ?? Thanks


SQL 2016 Ent migrate to SQL 2019 Ent

$
0
0

Hi

we have serverA (windows 2019 , sql 2016 ent) as publication ,

server B (windows 2019 , sql 2016 ent ) subscriber 1, 

server c (windows 2016 , sql 2016 std) subscriber 2, 

now we are going to migrate sql 2019 for all servers.  

  • how to accomplish this ? 
  • In-place upgrade ? possible?
  • Replication need to stop or remove before migration?

Problem with XML parser memory leak

$
0
0

We're using xml parameters to send a collection of data to stored procedure.
Typical (little simplified) use case would look like:

DECLARE @Values varchar(max) = '<Root><S>1</S><S>2</S><S>3</S></Root>', @h int
DECLARE @Val TABLE(ID smallint)

EXEC    sp_xml_preparedocument @h OUTPUT, @Values
INSERT INTO @Val(ID)
SELECT DISTINCT ID FROM OpenXML(@h,'Root/S',8)  WITH (ID smallint 'text()')
EXEC sp_xml_removedocument @h

SELECT * FROM @Val

We know we have to properly "pair" sp_xml_preparedocument /sp_xml_removedocument to avoid memory leaks.
Normally, our server works for months without any problems.

(I have to use external image because your portal is giving me "Body text cannot contain images or links until we are able to verify your account." error message)    https://imgpile.com/i/I5kAUR

At some point in time we're able to observe a constant growth of xml parser memory usage.
Our system still works, but it appears as if no document is being properly "removed", so our memory
usage graph begins to steadily grow.

(I have to use external image because your portal is giving me "Body text cannot contain images or links until we are able to verify your account." error message)    https://imgpile.com/i/I5kLYg

In the graph above 1.5K represents 1500MB. The only way to stop this endless growth is to restart
SQL Server service. After that it starts working just fine.

Is there a way to reclaim back all memory (some kind of overall xml parser memory "reset") without
rebooting the whole service?
Since our stored procedures are running pretty quickly (few seconds max.) is there a way to reclaim
all memory allocated by sp_xml_preparedocument which execution moment is older then some predefined time
(that would simply deallocate all "old" memory used by "old" xml documents)?

Any help would be very useful.

We're using version: Microsoft SQL Server 2014 (SP3-CU4) (KB4500181) - 12.0.6329.1 (X64)   Jul 20 2019 21:42:29   Copyright (c) Microsoft Corporation Standard Edition (64-bit) on Windows NT 6.2 <X64> (Build 9200: )

We also had identical problem with SQL Server 2012.

Indexes are not used

$
0
0
We have massive performance issues with a SQL Server. The system is fast in the morning and will be slow in the afternoon.
It could be determined that indexes over several tables are no longer used from a certain point in time and therefore table / index scans were executed, which burden the whole system.
The statistics are up-to-date, index fragmentation is low (-1%).
Only after all indexes are recreated will the better execution plan be selected again.
That happened yesterday and the day before yesterday.
The problem is expected to re-appear today.
A SQL Server 13.0.4001.0 is used.

Kiran

Restore from SQL managed instance

$
0
0

Hi all,

With the recent updates to SQL server 2019 versions we have encountered an issue with the version compatibility to Azure managed instance SQL versions.

I am getting this error message when trying to restore a backup file created from a DB on the managed instance - 

database was backed up on a server running version 15.00.2000. That version is incompatible with this server, which is running version 15.00.4003. Either restore the database on a server that supports the backup, or use a backup that is compatible with this server.

On the local server i have the latest CU1 installed and still it is not working although the version is higher.

The DBs are from an older instance so mostly compatibility level 110 (SQL server 2012).

Unfortunately the Data-tier export is also failing due to different reasons so i cant use that approach until fixing those.

Any idea on how to complete a restore with the new versions?

Before Azure went to version 15.00.2000 the normal restore process on the SSMS went without any issues when restoring the bak file.

Any help would be appreciated.

Thanks in advance

SQL database VSS differential backup API returns huge partial range when no data changed

$
0
0

I am calling VSS APIs to do a differential backup on a database (mdf file is ~16GB, log is ~15GB), which runs on SQL server 2014 sp 1. The partial range returned by IVssComponent::GetPartialFile() shows ~5GB data change in total, but I did not do any modification operations (insert, delete, etc) on the db after a full backup (which happened ~10min before). The native differential backup shows only ~2MB data backed up. The db has no index.

The partial ranges are small when the db file is small (< 8GB), that makes sense. For a large db, how the differential range is so big? 

Reading rows from the sys.sysobjvalues system table for a database - SQL Server 2016

$
0
0

Hi,

I need to verify the data inside the system table named sys.sysobjvalues for a my database: does it exist the corresponding system view to do it, please?

Thanks

Get Currency Conversion Rates

$
0
0

Hi 

I am working on one project wherein "Sales" amount is there in fact table and the currency like USD, GBP and there is also one column "Date" available. I am looking for any option available that can provide currency exchange rate for each day because we do not store exchange rates.


Create Database in Azure Blob Storage Error

$
0
0

SQL Server Version:  2019 (15.0.2070.41)

OS Version: Ubuntu: 16.04

Followed instructions to create:

- Azure Storage account

- Storage Account Container 

- Access Policy/Permissions

- Generated Shared Access Signature (SAS)

When attempting to create database receive the following error:

Msg 1802, Level 16, State 4, Line 12
CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
Msg 5159, Level 24, State 5, Line 12
Operating system error (null) on file "https://<storage_account_name>.blob.core.windows.net/data/testdb_log.ldf" during MakePreviousWritesDurable.
Msg 596, Level 21, State 1, Line 11
Cannot continue the execution because the session is in the kill state.
Msg 0, Level 20, State 0, Line 11
A severe error occurred on the current command.  The results, if any, should be discarded.

I receive this error through SSMS and SQLCMD directly on the Ubuntu server.

Note:  I am able to backup my a DB to this newly created storage account successfully.

Best place to start learning Sql Server Internals?

$
0
0
I am looking for online resources for SQL DBA to learn sql server internals. Any suggestions please? 

SQL 2019 Upgrade

$
0
0

Team,

we have SQL 2016 running on our environment.

  • can you pls share Pros & cons to upgrade sql 2019 environment?
  •  recently SQL 2019 release with CU1, shall we wait for first quarter to fix some bugs in sql 2019?
  • apart from analytics, is this gives sqlengine  Performance compare with sql 2016.
  • in-place upgrade / side-by-side upgrade which one best & safe ( in production).
  • we have SSRS (native) running on production. during in-place upgrade this existing SSRS removed . and we need to install SSRS feature alone & setup SSRS using restore encriptionkey/db backup.
  • & we have Transcational Replication ServerA (pub+distribution) to Subscriber.  So first update Publication then Subscriber is possible?  ( we cannot upgrade subscriber then publisher? )


capture SP historic metrics running report

$
0
0

need to create report for all SP running metrics,

  SP (historic ) running time start ,end time , duration, with parameters.

  

monthly report need to create for above requirement.  

how to capture SP  with above metrics into  physical Table.  ( profiler will cause some Resource)

  • Xevent ?
  • DMV?

SQL Server 2017 CU18 Python Update Failure

$
0
0

We keep receiving the error of "Unable to connect to remote server" when trying to run the Python portion of the CU18 update for SQL Server 2017.  I've copied all CAB files over to the server, and specify the directory they are in each time the update is run.

This server is offline and my team does not want to open this up to the internet.  Has anyone else experienced the issue with this update and found a work around without simply opening it up to the internet?

I'm retrieving the CAB files from this link:  https://docs.microsoft.com/en-us/sql/advanced-analytics/install/sql-ml-cab-downloads?view=sql-server-2017  It does not have any CAB files for CU 17 or 18 yet, so I'm using what is listed for CU16.

We are on RSetup.exe version: 9.2.0.58.  

Here's a short section of the log in RSetup from one of my attempts.  I've specified the file location before this run, and previously, I'd tried simply copying the files to this location, but that still failed with the same "Unable to connect to the remote server" error.

2020-01-10T18:43:04INFO        Using default cache directory: C:\Users\username\AppData\Local\Temp\
2020-01-10T18:43:05WARNError making request: Unable to connect to the remote server
2020-01-10T18:43:05INFO        Error caught on attempt 1 - will retry after 2 second delay.
2020-01-10T18:43:08WARNError making request: Unable to connect to the remote server
2020-01-10T18:43:08INFO        Error caught on attempt 2 - will retry after 4 second delay.
2020-01-10T18:43:13WARNError making request: Unable to connect to the remote server
2020-01-10T18:43:13INFO        C:\Users\username\AppData\Local\Temp\SRO_3.3.3.1400_1033.cab: cache file found

Viewing all 15889 articles
Browse latest View live


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