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

un over partition with a group by

$
0
0

hello , please i need some help with min function and row number in same querry 

i have table that containt dirrent code , it happen that for the same code i have multple line so i want to have a row_number for each code 

here is my querry  in picture and almost the same written 

select compte, id_compte , min (id_code) , row_number ober () (partition by code order by code desc ) as num 

from table1 group by code,id_code 

but it doesn't work where what i got as result  i have only 1 as code for the same compte 


Partition switching -> Create staging table in SQL 2019

$
0
0

I using partition table and partition switching function to switch the partition between main table and staging table

previously we using managepartition.exe function but it seem not working in window 2016 as it require .net framework 3.5

How we create staging table now in partition without using managepartition.exe


DB trustworthy Impacts

$
0
0

Hi All,

Some app users sent the request-

1.They are creating a table first and creating index(NC)

2.Enabling trusty worthy on DB-


--changes the database to allow assemblies to execute with permission external access,
 we need this as the assembly needs access tables with its own connection into the database.

3.They are creating an assembly(seeing external access) and functions.

4.some delete and select too.

Dont know exact logic(they are improving to logging mechanism)-still going through it..

So wanted to understand in an point wise-

1.what is the impact on trustworthy  as they are using one account consider which has R/W only no DBowner(I know that db owner if it's 'sa' then external users gains access it -risk of security).

2.Why we have to avoid and what way they(apps) can use it i,e Alternative solutions.

3.Is there any performance issue and how it affects.

Need some broad information's on this,plz excuse the links posted from your end-as I need to understand in above point  of view so.

Appreciated!.



Regards, S_NO "_"

syspolicy_purge_history '[Reflection.Assembly]::LoadWithPartialName

$
0
0

Hello,

I have SQL Server 2016 Production instances. the sys_policy_purge_history is failing with below error.

Executed as user: Domain\AgentServiceAccount. The job script encountered the following errors. These errors did not stop the script:  A job step received an error at line 8 in a PowerShell script. The corresponding line is '[Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Management.Dac") | out-null  '. Correct the script and reschedule the job. The error information returned by PowerShell is: 'Cannot invoke method. Method invocation is supported only on core types in this language mode.  '  A job step received an error at line 1 in a PowerShell script. The corresponding line is 'SQLSERVER:'. Correct the script and reschedule the job. The error information returned by PowerShell is: 'The term 'SQLSERVER:' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.  '.  Process Exit Code -1.  The step failed.

Please help.





MSSQLSERVER service not found in the service list.

$
0
0

MSSQLSERVER service not found in the service list.

I tried for start with net start mssqlservice, getting error 

net start mssqlserver

The service name is invalid.

More help is available by typing NET HELPMSG 2185.

I installed Microsoft SQL onto my laptop having windows 10

SQL Server Management Studio15.0.18330.0

SQL Server Management Objects (SMO)16.100.37971.0
Microsoft Analysis Services Client Tools15.0.19040.0
Microsoft Data Access Components (MDAC)10.0.18362.1
Microsoft MSXML3.0 5.0 6.0 
Microsoft .NET Framework4.0.30319.42000
Operating System10.0.18363


SP intermittently changes its execution time.

$
0
0

One of the SP was running for around 10 hours we optimised by adding a index on temp tables  , after this  it is running around 2 hrs  but on some intermittent days  once again it is taking 10 hrs as like before.  Wondering if this is due to recompilation but there is no large number of DML , rebuild  operations observed. 

Can anyone explain what may be the cause ?

SQL Server version : SQL 2016 SP1

db compatability : 100

    

SANTHOSH KUMAR

Reusable assets on MS SQL Server for DBA

$
0
0

Hi

Can you please share few examples for creating reusable assets on MS SQL Server for DBA.

Reusable assets: - tasks that are common and repeated - maximize productivity through asset reuse.

Thanks in advance.

SQL Server 2019 vs SQL Server 2016 Performance .

$
0
0

I am using the HammerDB to perform stress test on 2019 and 2016 . However 2019 by default seems has around 15 % degradation base on the TPM

Here is the HammerDB setting

1 virtual user, 1 data warehouse. , test run for 2mins .

TPM 2019 : Avg 70000

TPM 2016: Avg 80000

Both are on VM and on the same drive on my computer. while WIN19-SQL19    vs WIN16-SQL16

I have tried to disable all the new database scope features in SQL 2019 , but no help . . Any tweak we have to do / or any one tried these kind of test ?


Database Perfomance Report for Management

$
0
0
Do you know any free tutorial available that would give all the steps required for database performance issue? I have done searches and follow through different scenario but it would be great if I can have a guideline of exact steps that I need to follow to send a report to the management on Database performance issue.

Want to create an empty Backup of databases Or Clone or just schema with no data.

$
0
0

Hi All,

I want to create 3 databases on another server.  My SQL Server Version is 2012

Database Names:

  1. Staging
  2. ODS
  3. EDW

These databases are currently on a server. I can generate the Database object scripts and create on another server but here we have Views, SPs and Functions referring objects from each other databases.  Example: 

Have a view created in Staging DB and It has a query which has 3 tables 1 from Staging DB, 2nd from ODS DB and 3rd from EDW DB. The time I try create Staging DB from script it will fail and will not create this view and ODS and EDW DBs are not yet created on new Server. 

To over come this issue, I thought of creating this DBS from backup and looking for options to create empty backup file (Just DB schema and No data).

I option i found is database cloninghttps://docs.microsoft.com/en-us/sql/t-sql/database-console-commands/dbcc-clonedatabase-transact-sql?view=sql-server-ver15.

This option is available starting with SQL Server 2014 (12.x) SP2 CU3 and SQL Server 2016 (13.x) SP1

Copy a SQL Server database with just the objects and no datahttps://www.mssqltips.com/sqlservertip/4664/copy-a-sql-server-database-with-just-the-objects-and-no-data/

I tried this and It is failing with objects which has reference to ODS and EDW:(

are there any other options? 


Thanks Shiven:) If Answer is Helpful, Please Vote




VSS Failed backup SQL

$
0
0

Hello,

We have one SQL Server which has 7 instances. We use Veeam to backup DBs and logs.

Since one month, we have a problem to backup this server. We have opened a ticket at Veeam support and it turns out that the problem doesn't come from Veeam but from Microsoft.

This issue comes up when only the "INST07" instance is backed up. We don't have problem to backup others instances.

We have used the Diskshadow Utility to manually test VSS operations (in Full Mode) on this instance.

Cmd :
set verbose on
set context volatile
add volume \\?\Volume{994b1aa7-634c-48bd-9664-2e6836c5693f}\      (First volume of INST07)
add volume \\?\Volume{f0043344-d077-4d88-bc73-876a617747c3}\      (Second Volume of INST07)
begin backup
create
end backup

Results :
Number of shadow copies listed: 2
Sqlserverwriter switch to : non-recoverable error

The VSS fails with this error:
Volume Shadow Copy Service error: Unexpected error calling routine GetVolumeNameForVolumeMountPoint is now failing on the volume, winerror 0x00000001. . hr = 0x80070001, Incorrecte function.

And is shortly followed with multiple DBs backup errors related to INST07

We have also this error at the end :

A Volume Shadow Copy Service Operation failed. Detailed Error: The volume shadow copy operation failed with error 0x800423F4.
Operation: 
PostSnapshot Event

We have the same error even when I disable our AV software. We have already tried to repair the seventh instance, same problem.

I can upload app event logs if you want.

Regards,

Fabien



tempdb files growth

$
0
0

Once I tried adding rowversion column in a big table in production db and I ran out of tempd drive space. But then I missed to see which of the data or log or both files increased. Now if I try to replicate the same case in local pc I cannot see any of the tempdb files growing but the data and log files of the db I am working grow.

What actually makes the tempdb files grow and how to replicate in local server?


There is insufficient system memory in resource pool 'internal' to run this query

$
0
0

Hello

I'm accesing a Microsoft SQL Server 2008 R2, SP1,2,3 and 4 are installed and the client server is unusaly slow.

At top hour we are receiving the error "There is insufficient system memory in resource pool 'internal' to run this query" at the most simple queries. 

Example: running the query "SELECT id AS ret FROM ORG_UNITS WHERE code = '...';" will give this error when the table has only 40 records.

Is there a software solution at the SQL server level? We read this article but it didn't help, we have all service packs installed.

Thank you.


Microsoft SQL Server 2008 R2 Express - service packs will not install, message "There are no SQL Server instances or shared features that can be updated on this computer"

$
0
0

Hello

I can't update a SQL server Express 2008 R2 to any service pack, the error is "There are no SQL Server instances or shared features that can be updated on this computer".

To check the server version I runned "

SELECT 
  SERVERPROPERTY('productversion') as 'Product Version',
  SERVERPROPERTY('productlevel') as 'Service Pack', 
  SERVERPROPERTY('edition') as 'Edition',
  SERVERPROPERTY('instancename') as 'Instance',
  SERVERPROPERTY('servername') as 'Server Name'

"

And the result is: 

Product VersionService PackEditionInstanceServer Name
10.50.1600.1RTMExpress EditionCNAS_SIUISERVER\CNAS_SIUI

The attached image shows the error.

Thank you.


SQL Server 2019 Installation Issues

$
0
0

I downloaded the https://www.microsoft.com/zh-cn/sql-server/sql-server-downloads This one's a developer.

After opening the program, he downloaded something for me.

图片

After downloading he told me the download was successful and then automatically closed and opened another program and then prompted

图片

What's wrong with that? I run the installer in administrator mode, and when I run the installer in normal mode, it won't install and open with this interface. How do you solve it?


is there any point of moving tempdb files into different disk drive if all LUNs are from the same RAID pool?

$
0
0

Hi everyone. I asked this question in dba.stackexchange.com but unfortunately I wasn't satisfied with answers so I decided to ask here.

Question:  is there any point of moving tempdb files into different disk drive if all LUNs are from the same RAID pool?

According to best practices, it is recommended to move all tempdb (not just tempdb) files into different physical disk. I have a virtual server which had originally 4 LUNs from the same RAID 10 pool. By the help of volume manager, I converted those 4 LUNs into 4 different volumes. Now the question is, will it make any difference in terms of performance by moving tempdb into separate volume, if those volumes are actually originated from the same raid pool?

DBCC shrinkdatabase not able to release allocated unused space

$
0
0

I am trying to release allocated free space from my database. Cuurent state of my database 



I was trying to run DBCC SHRINKDATABASE (N'DBName') command and it will end up with following message. I want to reduce this allocatedUnused Space to zero(almost). Any help appropriated. 

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

DBCC SHRINKDATABASE: Page 1:6914608 could not be moved because it is an off-row persistent version store page. Page holdup reason: Unknown. Page holdup timestamp: -1.


Let us TRY this |


My Blog :: http://quest4gen.blogspot.com/

Login failed for user 'DOM\ISQL1$'. Reason: Could not find a login matching the name provided

$
0
0

Hi,

I have configured the brand new server for dedicated ETL process with the service account as Microsoft virtual account NT Service\MSSQLSERVER and Sql AGENT ACCOUNT is NT SERVICE\SQLSERVERAGENT.

We have created SSIS package on ETL server and which is executing and inserting data into DW1 Server.

When i am running the SSIS package manually then i am getting following error:

Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'. Reason: Could not find a login matching the name provided(in DW server Error log)

Then I have created Agent job and made owner as 'DOM\ETL01' then i am getting following error:

Login failed for user 'DOM\ETL01$'. Reason: Could not find a login matching the name provided (in DW server Error log)

I also changed Job owner as 'SA', still same error

I have also tried to change the Sql service account from 'NT Service\MSSQLSERVER' to 'DOM\ETL01'but error remaining the same. I have restarted the sql services (MS Sql Server, Sql Agent and SSIS) after changing the service account.

In both the servers, all these accounts (DOM\ETL01, NT Service\MSSQLSERVER, NT SERVICE\SQLSERVERAGENT)

having Sysadmin role.  I have also added Permission into Database and Schema level. 

I have also added SSIS_Admin Role for these accounts into ETL server .

Thanks for your help!

SQL Server Agent job to import file from either local machine or from an SFTP folder

$
0
0

I have a file inside the SFTP folder which can be downloaded into the local machine. Is there any way, I can setup a SQL server agent job to pick that csv file and upload into the SQL sever automatically and periodically?.

FYI, picking up directly from the SFTP folder is much preferred option but even picking up from the local machine also works.

SQL login error 18470

$
0
0

I always used Windows Authentication to login SSMS.

Today it shows error 18470, user 'SERVER\Administrator' account is disabled.

Although I still use the sa to login, but how does it comes? and how to enable it again?

Thanks.

Viewing all 12963 articles
Browse latest View live


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