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

Unable to import Package

$
0
0
TITLE: Microsoft SQL Server Management Studio
 
Could not import package.
Warning SQL72012: The object [WebPortal-Data] exists in the target, but it will not be dropped even though you selected the 'Generate drop statements for objects that are in the target database but that are not in the source' check box.
Warning SQL72012: The object [WebPortal-Data-Log] exists in the target, but it will not be dropped even though you selected the 'Generate drop statements for objects that are in the target database but that are not in the source' check box.
Error SQL72014: .Net SqlClient Data Provider: Msg 12824, Level 16, State 1, Line 5 The sp_configure value 'contained database authentication' must be set to 1 in order to alter a contained database.  You may need to use RECONFIGURE to set the value_in_use.
Error SQL72045: Script execution error.  The executed script:
IF EXISTS (SELECT 1
           FROM   [master].[dbo].[sysdatabases]
           WHERE  [name] = N'$(DatabaseName)')
    BEGIN
        ALTER DATABASE [$(DatabaseName)]
            SET CONTAINMENT = PARTIAL 
            WITH ROLLBACK IMMEDIATE;
    END
 

Error SQL72014: .Net SqlClient Data Provider: Msg 5069, Level 16, State 1, Line 5 ALTER DATABASE statement failed.
Error SQL72045: Script execution error.  The executed script:
IF EXISTS (SELECT 1
           FROM   [master].[dbo].[sysdatabases]
           WHERE  [name] = N'$(DatabaseName)')
    BEGIN
        ALTER DATABASE [$(DatabaseName)]
            SET CONTAINMENT = PARTIAL 
            WITH ROLLBACK IMMEDIATE;
    END

Table partitioning for huge table

$
0
0

Hi All,

I am not a database guru, but I am interested in partitioning an existing table, and I would appreciate some advice.

I have SQL Server 2019 (Developer Edition) on Windows 10 and plan on getting a dedicated machine for the production release.

I read this article, and partitioning jumped out at me.

https://www.freelancer.com/articles/web-development/how-to-make-your-sql-queries-faster

I have one table with about 20 GB of data. I have read about partitioning, and I think this would be an excellent way to speed up queries. This table is read-only, and I want to create partitions for the table by state (two-letter abbr represented by one field in this table). Is there a procedure to step-by-step guide me through partitioning an existing table? I have seen a few tutorials, but they are not recent, and I am a little leary about following those procedures.

Currently, a query will take about 20 seconds for the first query and about 5 seconds with subsequent requests.

Any suggestions would be helpful.

Best Regards,

Tom

Memory leak on Bound tree (CACHESTORE_PHDR) MS SQL 2014

$
0
0

Hello everybody.

I have problem on one of my test SQL Server 2014 Dev edition (12.0.2495.0 (X64)) on Windows server 2012 standard. It is memory leak on CACHESTORE_PHDR clerk and my query completes  with following error: 

Msg 701, Level 17, State 123, Line 14
There is insufficient system memory in resource pool 'default' to run this query.

In trace I have the same error for 'internal' resource pool.

Before  I got this error , I've checked memory clerks using sys.dm_os_memory_clerks and saw  CACHESTORE_PHDR consumed about 5500MB ('max server memory (MB)' is 6144). I have two different queries with this problem and both of them got error only on one server and one database.

I tried to repeat this error on the same database (backup/restore) on different instance/server but it didn't repeated :( 

How can I find out whatexactly in my tsql code causes memory leak?

Both queries have many self left joins (second one have more than 20 self joins)

Update statistics

$
0
0

Once the statistics are manually updated with fullscan the rows_sampled is equal to the no. of rows but the automatic statistics update overwrites and rows_sampled is reduced to far few rows.

Can I disable the automatic update and run manual update once everyday?

Database '' already exists. Choose a different database name. But it doesn't!

$
0
0

When I try create a database I get:

Msg 1801, Level 16, State 3, Line 1
Database 'XXXX' already exists. Choose a different database name.

I then try drop the database but get:

Msg 3701, Level 11, State 11, Line 8
Cannot drop the database 'XXXX', because it does not exist or you do not have permission.

The database did exist previously. It's not currently listed in sys.databases.
Microsoft SQL Server 2017 (RTM-CU16) (KB4508218) - 14.0.3223.3 (X64)

I've had this before and was able to create the database after restarting SQL but I cannot keep restarting the server.

SQL Server 2012 Database engine failed to install everytime

$
0
0

Hi,

I am trying to install SQL Server 2012 -64 bit in our dev server running Windows Server 2012. Everytime, Database engine fails to install. I've checked the event logs it shows.

Operating system error 2(The system cannot find the file specified.) occurred while creating or opening file 'e:\sql11_main_t.obj.x86release\sql\mkmastr\databases\objfre\i386\modellog.ldf'. Diagnose and correct the operating system error, and retry the operation.

I followed the link- https://serverfault.com/questions/447808/sql-server-express-service-is-not-starting to resolve the issue. I opened command prompt and run the command - NET START MSSQL$SQLEXPRESS /f /T3608

But it throws the error - The service name is invalid.

Has anyone gone through this issue. Please suggest a solution for this issue.

Thanks,


Kunal

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.

2019 Ent TDE backup compression

$
0
0

hi all:

  I understand If your database has virtual log files (VLFs) larger than 4GB then do not use backup compression with TDE for your log backups. 

Here is the situation. I have a  database and they VLF size is over 20G. But active VLF size is around 60MB

Total of VLF count is 244 but inactive VLF is 243. 

questions:

1. Can I use backup compression with TDE for this DB (VLF size over 20G but active VLF size is 60MB? 

2. What is the consequence of using backup compresison with TDE for DB with active VLF size over 4GB? 

thanks


 Hui



--Currently using Reporting Service 2000; Visual Studio .NET 2003; Visual Source Safe SSIS 2008 SSAS 2008, SVN --


[Help]: Delete OR Detech Database on SQL Server Management Studio !

$
0
0

Hi Everyone!

I have a PROJECT database

The drive that contains the PROJECT database is deleted from the virtual machine.

So, when i trying delete or detech the PROJECT database on SQL Server Management Studio error: 

The operating system returned error 21(The device is not ready.) to SQL Server during a read at offset 0x00000000836000 in file 'D:\Data\PROJECT.MDF'. Additional messages in the SQL Server error log and system event log may provide more detail. This is a severe system-level 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. (.Net SqlClient Data Provider)

Please guide me delete or detech this database on SQL Server Management Studio

Thank!

Avoid SQL Login from being deleted

$
0
0

Hi, 

Is there any way to stop a SQL authentication from being accidentally delete by any other DBA 

Taking database offline takes long time...

$
0
0

In SQL Server Management Studio  when I try to take a database offline,  why does it take so long?

Do I need to put the Database into restricted user mode first before attempting to take it offline?

Sum of all Memory Clerks and Total Server Memory (KB)

$
0
0

I am trying to understand the memory management of SQL Server. I have a Windows Server 2019 on virtual environment with 64 GB of RAM. I also have SQL Server 2019 installed with Max Server Memory 59776 MB. By using the following query I found the list of all memory clerks:

SELECT  [type] AS [ClerkType], SUM(pages_kb) / 1024 AS [SizeMb]
FROM sys.dm_os_memory_clerks WITH (NOLOCK)
GROUP BY [type]
ORDER BY SUM(pages_kb) DESC

Total sum of all memory clerks was equal to 23523 MB.

Value for MEMORYCLERK_SQLBUFFERPOOL memory clerk is 18387 MB.

I also checked some performance counters:

Total Server Memory (KB) = 32262 MB.
Database Cache Memory (KB) = 18387 MB.

Please correct me if any of the below statements are wrong,

Max Server Memory for SQL Server 2019 = Buffer Pool Memory + Non-Buffer Pool Memory.

Total Server Memory (KB) - The committed memory from the Buffer Pool.

Data Cache Memory (KB) performance counter is equivalent to MEMORYCLERK_SQLBUFFERPOOL memory clerk and both represents data cache used size.

Above query shows all memory clerks for both Buffer Pool Memory and Non-Buffer Pool Memory.

My question related to this subject:

If Total Server Memeory (KB) is related to Buffer Pool memory, then why its size (32262 MB) is bigger than Total sum memory clerks altogether (23523 MB) which represents both Buffer Poll Memory and Non-Buffer Pool Memory?

EDIT: Result of select * from sys.dm_os_process_memory

physical_memory_in_use_kb = 38065556

large_page_allocations_kb = 333824

locked_page_allocations_kb = 37424380

total_virtual_address_space_kb = 137438953344

virtual_address_space_reserved_kb = 114125108

virtual_address_space_committed_kb = 38942228

virtual_address_space_available_kb = 137324828236

page_fault_count = 473391

memory_utilization_percentage = 100

available_commit_limit_kb = 33175136

process_physical_memory_low = 0

process_virtual_memory_low = 0

OPENQUERY giving wrong result on linked server

$
0
0

I have setup linked servers on my SQL Server and choose Oracle as a linked server.

SOMETIMES, When I run the query below under the SA username, I get different result. However when I run under my own username I get correct result. I Can't understand this anomaly. The below query returns only one row. The difference occurs in ORGANIZATION_FULL_NAME column only.

SELECT*FROMOPENQUERY(HR_ORACLE,'
            SELECT e.CHILD_ORG_IND_MGR_POS_PER_ID,e.CURRENT_EMPLOYEE_FLAG,e.EMAIL_ADDRESS,
            e.ENTERPRISE_MANAGER_PERSON_ID,e.ENTERPRISE_MANAGER_POSITION_ID,e.FIRST_NAME,e.LAST_NAME,e.FULL_NAME,e.GENDER,e.JOB_CATEGORY_CODE,e.JOB_CATEGORY_NAME,
            e.JOB_ID,e.JOB_NAME,e.JOB_SUBCATEGORY_CODE,
            e.JOB_SUBCATEGORY_NAME,e.MOBILE_PHONE_NUMBER,ltrim(rtrim(e.NATIONAL_IDENTIFIER)) NATIONAL_IDENTIFIER,e.ORG_CURATOR_PERSON_ID,e.ORG_STR_DEDUCTED_MGR_PERSON_ID,e.ORGANIZATION_FULL_NAME,e.ORGANIZATION_ID,
            e.ORGANIZATION_SHORT_NAME,e.PARENT_ORG_IND_MGR_POS_PER_ID,e.PARENT_ORG_IND_MGR_POSITION_ID,e.PATRONYMIC,e.PERSON_ID,e.PERSON_IS_CURATOR_FLAG,e.PERSON_IS_ENTERPRISE_MGR_FLAG,
            e.POS_ORG_MGR_POSITION_FLAG,e.POSITION_ID,e.L3_PARENT_ORGANIZATION_ID
            FROM XXRCR.XXRCR_CUR_EMPS_EVER_V e
            WHERE e.EMAIL_ADDRESS like (''%EMAIL@EMAIL.COM'')  ')

These are my linked server settings:

Collation Compatible = False

Data Access = True

RPC = False

RPC Out = True

Use Remote Collation = True

Collation Name = Null

Connection Timeout = 0

Query Timeout = 0

Distributor = False

Publisher = False

Subscriber = False

Lazy Schema Validation = False

Enable Promotion of Distributed Transactions = True

Mission Impossible - Run Service in Gov AWS without Log On As A Service

$
0
0

Government sites on AWS, because they are more Linux shops than Microsoft shops, block the Log On As A Service.

Are there alternative methods for service accounts where "Log On As A Service" is not a requirement?


R, J

Stalled Dispatcher

$
0
0

I recently got the error below in the logs. Right now no user with sysadmin rights can perform any action. Getting an error that 'user does not have permission to perform this action'.  Any help will be appreciated<o:p></o:p>

<o:p> </o:p>

<o:p> </o:p>

***Stack Dump being sent to C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\LOG\SQLDump0003.txt<o:p></o:p>

     * *******************************************************************************<o:p></o:p>

<o:p> </o:p>

      * BEGIN STACK DUMP:<o:p></o:p>

      *   05/28/20 05:05:05 spid 2036<o:p></o:p>

      *<o:p></o:p>

      * Stalled Dispatcher<o:p></o:p>

      *<o:p></o:p>

      * *******************************************************************************<o:p></o:p>

      * -------------------------------------------------------------------------------<o:p></o:p>

      * Short Stack Dump<o:p></o:p>

      Stack Signature for the dump is 0x0000000000000257<o:p></o:p>

<o:p> </o:p>

      [INFO]          Identity             Begin               End |        State                 Result     Error  Speculate   Prepared LazyCommit   ReadOnly |      Transaction         Database         ThreadId |   ReadSet  WriteSet   ScanSet Savepoint LogSizeRq | CommitDep TotalComm       Dependent 0       Dependent 1       Dependent 2       Dependent 3       Dependent 4       Dependent 5       Dependent 6       Dependent 7 |            Area  Location |<o:p></o:p>

     External dump process return code 0x20000001.<o:p></o:p>

External dump process returned no errors.<o:p></o:p>

<o:p> </o:p>

      Dispatcher (0x1d0c) from dispatcher pool 'XE_Engine Dedicated dispatcher (00000000E73B8E88)' Worker 0x00000002A26AE160 appears to be non-yielding on Node 0. Approx CPU Used: kernel 0 ms, user 0 ms, Interval: 240370.<o:p></o:p>

      Dispatcher (0x1d0c) from dispatcher pool 'XE_Engine Dedicated dispatcher (00000000E73B8E88)' Worker 0x00000002A26AE160 appears to be non-yielding on Node 0. Approx CPU Used: kernel 0 ms, user 0 ms, Interval: 302765.<o:p></o:p>


Bulk Insert error for exponential values during import in sqlserver

$
0
0

We got the following error during bulk insert in SQL server 

Microsoft SQL Server 2014 (SP1-GDR) (KB4019091) - 12.0.4237.0 (X64) 
Web Edition (64-bit) on Windows NT 6.3 <X64> (Build 9600: ) (Hypervisor)

BULK INSERT ABC

FROM ‘D:\Dump001.csv’

WITH (FIELDTERMINATOR = '|',ROWTERMINATOR = '\n', FIRSTROW=2)

Msg 4864, Level 16, State 1, Line 3

Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 552612, column 148 (column_amt).

Msg 4864, Level 16, State 1, Line 3

Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 635686, column 148 (column_amt).

Msg 4864, Level 16, State 1, Line 3

Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 657871, column 148 (column_amt).

Msg 4864, Level 16, State 1, Line 3

Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 675625, column 148 (column_amt).

Msg 4864, Level 16, State 1, Line 3

Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 675628, column 148 (column_amt).

Msg 4864, Level 16, State 1, Line 3

Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 699484, column 148 (column_amt).

Msg 4864, Level 16, State 1, Line 3

Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 898948, column 148 (column_amt).

Msg 4864, Level 16, State 1, Line 3

Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 997300, column 148 (column_amt).

Msg 4864, Level 16, State 1, Line 3

Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 1214311, column 148 (column_amt).

Msg 4864, Level 16, State 1, Line 3

Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 1494400, column 148 (column_amt).

We found the exponential values in those columns like 1.0001666E7.

Please help us to resolve this issue or any way for this. 


rajesh

Database performance

$
0
0

Hi Experts,

Is there a way to assign resources , memory/cpu to individual database so if an instance is assigned 32 gb , out of 10 databases on that instance , assign 4 gb and 1 vcore to one of the databases.

Thanks

Error: 9019, Severity: 21, State: 1 Error

$
0
0

Has anyone experienced an error 9019 on SQL Server 2019? This error occurred on the forwarder in a distributed availability group configuration. Nothing was connected or executing anything against this instance, but index maintenance was executing against the primary node of the primary availability group. 

There are no indications that the replication of data got behind and the health of all of the AGs is good. 

I can see that the 9019 error was an issue corrected in SQL2012, but this one seems to be different.

SQL Server 2019 CU3 (15.0.4023.6) Enterprise Edition

Error: 9019, Severity: 21, State: 1

The virtual log file sequence 0x000539c6 at offset 0x0000000037f92000 bytes in file 'L:\MSSQL\XXXXXXX' is active and cannot be overwritten with sequence 0x000539f6 for database 'XXXXXXX'.


Ed Mlynar

SQL Server 2016 SP2 CU4 update failed for sql tool extension

$
0
0

I have already a SQL Server 2016 SP2 (with CU KB4458621) and would like to install CU4 however seems that the patch sequencer didn't detect SP2 was installed for  sql_tools_extensions

sql_tools_extensions_Cpu64_1.log

SOFTWARE RESTRICTION POLICY: C:\965cbc8e038e3\x64\setup\sql_tools_extensions.msp is permitted to run at the 'unrestricted' authorization level.
SequencePatches starts. Product code: {AB765DC7-7642-4D1C-BEDC-035516CCD224}, Product version: 13.0.1601.5, Upgrade code: {BB3795F0-6ECF-450B-8D03-2A264C5F95DF}, Product language 1033
PATCH SEQUENCER: verifying the applicability of QFE patch C:\965cbc8e038e3a2d191fea70aca95a\x64\setup\sql_tools_extensions.msp against product code: {AB765DC7-7642-4D1C-BEDC-035516CCD224}, product version: 13.0.1601.5, product language 1033 and upgrade code: {BB3795F0-6ECF-450B-8D03-2A264C5F95DF}
PATCH SEQUENCER: QFE patch C:\965cbc8e038e3\x64\setup\sql_tools_extensions.msp is not applicable.
 SequencePatches returns success.
Final Patch Application Order:
 Other Patches:
Unknown\Absent: {D16C247A-EE4D-4709-ACB7-10799D13BA42} - C:\965cbc8e038e3\x64\setup\sql_tools_extensions.msp
Product: SQL Server 2016 Client Tools Extensions - Update '{D16C247A-EE4D-4709-ACB7-10799D13BA42}' could not be installed.

Windows Installer installed an update. Product Name: SQL Server 2016 Client Tools Extensions. Product Version: 13.0.1601.5. Product Language: 1033. Manufacturer: Microsoft Corporation. Update Name: {D16C247A-EE4D-4709-ACB7-10799D13BA42}. Installation success or error status: 1642.

 Note: 1: 1708
Product: SQL Server 2016 Client Tools Extensions -- Installation failed.

Windows Installer installed the product. Product Name: SQL Server 2016 Client Tools Extensions. Product Version: 13.0.1601.5. Product Language: 1033. Manufacturer: Microsoft Corporation. Installation success or error status: 1642.

any hints ?

Planning database growth for 2 years

$
0
0

Hello,

I'm not sure how to go about planning database growth over a 2 year span.

My sys admin is asking me to for resource needs ( memory, disk , cpu) and I'm not sure how to go about this.

Please advise.

Viewing all 12963 articles
Browse latest View live


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