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

Read portion of Transaction Log inculded in Full Backup.

$
0
0

Hello,

 I am wondering if there is any way we can read the 'transaction log' part from the full backup.
 A Full backup backup contains some part of the transaction log - minimum(oldest active transaction,replication txn)
 
 So, is there any native way to read the portion of the 'transaction log' inculded in the full backup.
 
 Using fn_db_dumplog we can read the log backups and using fn_dblog we can read the logs.
 
 but i am curious to see if there is anyway to read the 'transaction log' that was inculded in the full backup.
 
 
 Thank you. 
 
 

Hope it Helps!!


why Sort operation on clustered columstore index insert?

$
0
0

Looking at the execution plan for a clustered columnstore index insert I noticed a Sort operation. My T-SQL has no sort and I understand that the clustered columnstore is not a sorted index. Why would there be a Sort operation in the execution plan?

This is running on:

Microsoft SQL Server 2014 - 12.0.2000.8 (X64)
 Feb 20 2014 20:04:26
 Copyright (c) Microsoft Corporation
 Enterprise Edition: Core-based Licensing (64-bit) on Windows NT 6.3 <X64> (Build 9600: ) (Hypervisor)


Lock Escalation settings

$
0
0

Hi All,

In one of my production server Deadlock issue happened, for that issue we are planning to change lock escalation  to table.

Will it make any impact to other tables or objects in database apart from a single table.

Please suggest anyone it would be great helpful for me.

Thanks in Advance...

Trending database sizes, is there a tool to do this?

$
0
0

Hi, 

Was wondering if there's a tool for monitoring database file growth.  I've been reading up on a number of user created solutions to collect data on a daily basis but wondered if there was any professional software solution for this.  I've a number of RedGate tools but none seem to cover this.  

Thanks 

Database in Emergency Mode

$
0
0

Hi All.. i have had one database was in suspect mode and i have changed the status to Emergency Mode and  i have run the DBCC checkdb and command didn't gave any error.. after this i have tried to change database to Single_user mode, but command running successfully, but database status is still showing as Emergency mode only.. i have tried for multi_user mode too..

Also, i have tried to run the command to bring online, but command running for long time with Suspended status..

Could anyone help me on this??

daily job performance improved by sql service restart - why?

$
0
0

We have a daily job which generally takes around 12 hours. After a couple of weeks the duration starts to creep up and we are able to restore it to its normal duration by restarting the sql server service.

Why does restarting the service seem to speed up the job? seems a little like using a bulldozer to crack a nut. Would like to understand what exactly is happening when we restart to improve the duration. Any ideas?

SPID stuck in KILLED/ROLLBACK state

$
0
0

Hi All,

SQL Server 2008R2 (10.50.4279) I've noticed a process that hungs, the wait type was "PREEMPTIVE_OS_PIPEOS" and the process itself was a SQL Server Agent job.

First thing is that in Job Activity monitor I could not see any job running.

I've tried to kill the spid from Activity monitor but now the SPID is stuck in "KILLED/ROLLBACK" state, and the wait is always "PREEMPTIVE_OS_PIPEOS".

I've checked that the job executes a stored procedure that invokes sp_send_dbmail with an attachment, I've tried to restart the SQL Server Agent, but the spid is always there.

How can I kill the process?

SQL DB Migration

$
0
0

Hi,

In my infra i have an instance with 10 Databases. And i am going to migrate 4 of them to new hardware.

I am planning to use Backup/Restore method to move the DBs to new hardware.

I will put the DBs in old server to SINGLE_USER mode. 

Can you please tell me how to check the complete data is migrated to new server ?

I dont want to miss any transactions (data) from application.

And also how to compare the data between the old and new DBs ?

Regards,


Vinodh Selvaraj


Change SQL server instance collation after Sharepoint installation

$
0
0
Installed Sharepoint 2013 with the SQL Server 2012 db instance using the default collation Latin1_General_CI_AS. SQL is just used for Sharepoint 2013. the system is not released yet for production Run the installation and configurations and database attach for all content databases. all content dbs were created by SP with proper collation Latin1_General_CI_AS_KS_WS, as well as search, UP and all service applications.
Would like to change the SQL collation for the instance to Latin1_General_CI_AS_KS_WS(ashttps://support.microsoft.com/en-us/kb/2008668) . Steps that I see:
1. Stop IIS on SP
2. Script logins
3. recreate instance collation
setup /QUIET /ACTION=REBUILDDATABASE /INSTANCENAME=<Name> /SQLSYSADMINACCOUNTS=<Sysadmins> /SAPWD=PasswordSA /SQLCOLLATION=Latin1_General_CI_AS_KS_WS
4.recreate logins (including Sharepoint farm, portal and services service accounts) from previous scripts. Redeploy linked servers ,remote logins,endpoints, backup devices
4. attach all Sharepoint databases
5. since it is preproduction not need msdb also model can remain as recreated by setup
do you see any issue?

Needed transaction log space to create a clustered index.

$
0
0

On a database a number of indexes are missing. It is killing the performance of the SQL Server. I want to create a clustered index on the biggest table that has as size of 1TB. How much transaction log space is needed to create the clustered index?

Is it possible to reduce the amount of transaction log space that is needed?

Does the size of the selected fields make a difference?

How to Restore a DB that has multiple mdf's and Distribute new mdf's across drives

$
0
0

Hi,

I have a DB (600 GB) that I backed up and now I am restoring it on to a different server. None of the Individual drives in that server has enough space to hold it all in one drive. So, Can I split it in such a way that mdf files can be distributed across multiple drives? 

-- this is what i know I can do if I have enough space on drive P.

RESTORE DATABASE [ABC_BKP03312015]
FROM    
DISK = N'E:\test\ABC_Splitfile1.bak',
DISK = N'F:\test\ABC_Splitfile2.bak',
DISK = N'G:\test\ABC_Splitfile3.bak',
DISK = N'H:\test\ABC_Splitfile4.bak'
WITH FILE = 1,
MOVE N'ABC_Data' TO N'P:\test\ABC_BKP03312015_Data.mdf',
MOVE N'ABC_Log'  TO N'Q:\test\ABC__BKP03312015_Log.LDF',
NOUNLOAD,  STATS = 10
GO

-- this is what i need : can I do some thing like this ?
RESTORE DATABASE [ABC_BKP03312015]
FROM    
DISK = N'E:\test\ABC_Splitfile1.bak',
DISK = N'F:\test\ABC_Splitfile2.bak',
DISK = N'G:\test\ABC_Splitfile3.bak',
DISK = N'H:\test\ABC_Splitfile4.bak'
WITH FILE = 1,
MOVE N'ABC_Data' TO N'P:\test\ABC_BKP03312015_Data_SplitFile1.mdf',
MOVE N'ABC_Data' TO N'Q:\test\ABC_BKP03312015_Data_SplitFile2.ndf',
MOVE N'ABC_Data' TO N'R:\test\ABC_BKP03312015_Data_SplitFile3.ndf',
MOVE N'ABC_Data' TO N'S:\test\ABC_BKP03312015_Data_SplitFile4.ndf',
MOVE N'ABC_Log'  TO N'Q:\test\ABC__BKP03312015_Log.LDF',
NOUNLOAD,  STATS = 10
GO

Thanks,

Ramesh


Slow query compilation time

$
0
0
Hi all,

One of our client has a db server with about 10 production databases on.
The application issues jdbc queries that are not properly parametrized (although using prepared statements) resulting in a 5GB plan cache.
I noticed a lot of high compilation times for queries - 2 to 10 seconds. Sometimes the same query (with different parameters) will compile fast though.
The end users are complaining about performance issues and every time they will issue a dbcc freeproccache that will bring them back to decent performance for about an hour or so.
I have a perfmon trace running that collects most memory and other SQL specific events. Is this memory pressure? Stolen pages stays at about 10G.
I tried changing the "optimize for AdHoc" flag with no real improvements.
What should I check for?

Thanks

Facing problem in distributed queries over Oracle linked server

$
0
0

Hi,

I have a SQL Server 2005 x64 Standard Edition SP3 instance. On the instance, we had distributed (4 part) queries over an Oracle linked server running fine just a few hours back but now they have starting taking too long. They seem to work fine when OPENQUERY is used. Now I have a huge number of queries using the same mechanism and is not feasible for me to convert all queries to OPENQUERY, please help in getting this resolved.

Thanks in advance.


SQL Server 2012 CLR allocations problem

$
0
0

Hello everybody!

After upgrading from Microsoft SQL Server 2008 to Microsoft SQL Server 2012 we faced with CLR allocations problem. In earlier versions of SQL Server CLR allocations were in virtual address space (also known as "Memory-To-Leave"). In SQL Server 2008 you can configure max_server_memory for SQL server, prevent starting other processes on server and it will guaranty you that your CLR will not unload due memory pressure (use “lock pages in memory”)

In SQL Server 2012 there were big changes in memory management.  The key change for us was relocating (or splitting) CLR allocations from "Memory-To-Leave" to "max server memory (MB)". And now you can get “AppDomain 2 (work5nt.dbo[runtime].1) is marked for unload due to memory pressure.” message in server log  with future unloading AppDomain when “Query Execution Memory” grows fast.

During our stress tests of SQL server 2012 I had rapid growth of “Granted Workspace Memory (KB)” to more than 50% of max_server_memory (72GB). Top wait on server was RESOURCE_SEMAPHORE and «SQL Memory Manager:Memory Grants Pending»  growth up to 154 processes.

Information from log file about unloading:

2015-03-26 19:49:20.15 spid18s     AppDomain 13 (work5nt.dbo[runtime].82) is marked for unload due to memory pressure.

2015-03-26 19:49:20.15 spid18s     AppDomain 12 (mssqlsystemresource.dbo[runtime].81) is marked for unload due to memory pressure.

2015-03-26 19:49:20.15 spid19s     AppDomain 13 (work5nt.dbo[runtime].82) unloaded.

2015-03-26 19:49:20.15 spid18s     AppDomain 12 (mssqlsystemresource.dbo[runtime].81) unloaded.

2015-03-26 19:49:20.83 spid419     AppDomain 14 (work5nt.dbo[runtime].94) created.

2015-03-26 19:49:20.86 spid245     Unsafe assembly 'log, version=1.0.5498.27124, culture=neutral, publickeytoken=bb8adbf0186b255f, processorarchitecture=msil' loaded into appdomain 14 (work5nt.dbo[runtime].94).

2015-03-26 19:49:20.86 spid419     Unsafe assembly 'seed, version=1.0.5539.32591, culture=neutral, publickeytoken=4d4e4ff7fd85d31c, processorarchitecture=msil' loaded into appdomain 14 (work5nt.dbo[runtime].94).

2015-03-26 19:49:20.89 spid245     Unsafe assembly 'log, version=1.0.5498.27124, culture=neutral, publickeytoken=bb8adbf0186b255f, processorarchitecture=msil' loaded into appdomain 14 (work5nt.dbo[runtime].94).

2015-03-26 19:49:20.91 spid419     Unsafe assembly 'seed, version=1.0.5539.32591, culture=neutral, publickeytoken=4d4e4ff7fd85d31c, processorarchitecture=msil' loaded into appdomain 14 (work5nt.dbo[runtime].94).

 

Our product can get critical error after unloading CLR. (We are working on that problem but it’s not SQL server side problem.)

 

Main memory counters during stress test (perfmon):

Name

Average

Min

Max

Total Server Memory (KB)

75 783 960

75 774 432

75 880 536

ReservedServerMemory (KB)

18 474 365

9 028 744

35 325 584

GrantedWorkspaceMemory (KB):

27 173 700

16 992 392

51 791 136

Reserved/Granted Ratio

0.68

0.53

0.68

So we can see, that highest Reserved Server Memory more than 46% of Total Server Memory! And it is strange.

At the end I have several questions:

Here the first one: How can I avoid unloading CLR due memory pressure on SQL server 2012?

Second one: Can I configure “Reserved Server Memory” for query or server?

And the last one: Is there any extended events to reveal which query consumed a lot of memory? I found sort_memory_grant_adjustment but it does not work or I can’t configure it right.

 

About my system:

Servers HP Proliant BL620c G7

Duble 3PAR StoreServ Storage 7200 with remote copy “on” and adaptive optimization “on”

Virtualization:ESXi 5.5.0, 2302651

Software:

Microsoft Windows 2008 Server R2 Enterprise 7601

Microsoft SQL Server 2012 - 11.0.5058.0 Enterprise Edition (64-bit)  SP2

VM:

Xenon E7-2870 @2.40 GHz 16 cores (2 sockets, 8 cores), RAM 80GB.

SQL Server memory configure:

max server memory (MB) 74000

min memory per query (KB) 2048

minservermemory (MB)  128

sql server starts with  -T 1222 -T 1224 -g 512,

Using locked pages in the memory manager,

Large Page Allocated: 32MB,

CLR version v4.0.30319

  

If you need more information please feel free to contact with me.

round float to 2 decimal place in the table

$
0
0

Hi,

One field in a table in my DB has float datatype.

I insert some data into this table. The value read from a textbox I input as 0.02 for example. after insertion, I select the table and the field of the table shows the number as 0.0199999995529652

Where did I do a wrong thing? how can I make it exactly as 0.02 in the table?

Thanks.


can not turn off trace flag in sql server

$
0
0

Hi All,

I was notified for a Production deadlock, So I enabled the deadlock trace.. by below
DBCC TRACEON (3605,1204,1222,-1)
After a day we were able to get the deadlock details, so now I used the below script to turn off
DBCC TRACEOFF (3605,1204,1222,-1)
Also check the status it was 0, unfortunately Trace flag '1222' started by itself and again the flag is 1, So I turn off again but again in another 5 mins it turned on by itself.. When i googled they asked me to re-start, which is impossible in my environment. Please suggest a way to resolve this as sql logs are building like anything.

Thanks


Best Regards Moug

A temp table in a stored procedure , set a value to varchar(MAX)

$
0
0

Hi ,,

In stored procedure there is  a temp table and set a value to varchar(MAX) . What exactly is the different between setting it to varchar (MAX) instead of  varchar(n)

Thank You

Jeevan Vinay

There is already an object named 'id_pk' in the database.

$
0
0

Hi,

I have temp table like below.

CREATE TABLE #TempShashank
                (    
                    Id_PK INTEGER IDENTITY(1,1) CONSTRAINT id_pk PRIMARY KEY CLUSTERED,
                    ParentId INT ,  
                    CategoryName VARCHAR(100),
                    UnitsPotential DECIMAL(9,2)                 
                )

Above table created inside the stored procedure.

I am getting error  "There is already an object named 'id_pk' in the database."

I checked "select OBJECT_ID('tempdb..#TempShashank') " but it's returns null.

can any help me what is the problem.

Thanks


Unable to set up Maintenance Plan

$
0
0

Hi

I am using SQL Server 2008 R2 and I have several Maintenance Plans set up and these are all working okay.I am trying to set up a new Maintenance Plan and when i try to save it i keep getting the error shown below.

Can anyone help me to resolve this issue.

Thanks

John


TRN format

$
0
0

How can I write on TRN format ?

Thanks

Viewing all 12963 articles
Browse latest View live


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