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

SQL Server Job Help

$
0
0

Hi All,

I have a maintenance  job In PROD server which execute on every Sunday and it will take almost 7 to 8 hours or sometime more than it  (depending upon index fragmentation) to complete
I have to execute maintenance job in Reporting server after completing the prod server maintenance job

Till now I am manually executing maintenance job in Reporting server, when I got job completion mail from PROD server - I want to do it Automated please suggest.



How SQL Server Utilizes Memory (RAM) while Index Rebuild.

$
0
0

Hello,

I had a conversation with one of the SQL Server DBA today regarding Memory/Cache utilization while SQL is re-building indexes. Could someone please help me to understand how SQL Server uses memory while rebuilding index on tables of a database. 

1) How SQL Server uses memory while rebuilding indexes ?

2) Will re-indexing will SQL server save/cache all the data pages associated to that table in memory ? If so what are the chances this will get flushed from memory?

3) Also, How long a data page will stay in memory if there are no reads/writes on it ?

3) Appreciate if you can post any articles or analysis related to this.

Thank you for your help.



Restoring from a network drive

$
0
0

Using SQL Server 2008R2, I am trying to restore a .bak-file from a network folder (on a NAS)

I keep getting the following error:

Msg 3634, Level 16, State 1, Line 2

The operating system returned the error '1317(failed to retrieve text for this error. Reason: 15105)' while attempting 'CreateFileW' on '\\<IP HIDDEN>\rppt\backup\myDB.ndf'.

Msg 3013, Level 16, State 1, Line 2

RESTORE DATABASE is terminating abnormally.

According to my Google searches, error Message 1317 means 'There is no such user'

I have set the SQL Server service account to a domain user. The user has also full privileges to the network folder I am trying to access

Join hint ignored - very bad query plan results

$
0
0

I'm trying to get a query that's being generated by SSAS to perform acceptably. Because this query is (at least partially) generated by SSAS, I don't have complete control over the query text.

The problem - The query looks roughly like this:

select -- a bunch of columns from T1 -- table with ~40,000,000 rows inner loop join T2 on T2.t2id = T1.t2id -- table with ~16,000 rows inner loop join T3 on T3.t3id = T1.t3id -- table with ~200,000 rows

inner loop join T4 on T4.t4id = T1.t4id -- table with ~200,000 rows left loop join T5 on T5.t3id = T1.t3id and T5.t6id = T4.t6id -- table with 0 rows where -- some uninteresting conditions

T1 is a Fact (or Measure) table, T2, T3 and T4 are Dimension tables, T5 and T6 are involved in the filtering of the query.  Every row of T1 WILL match exactly one row in each of T1, T2 and T3.

You'll note that I've hinted all of the joins - according to the documentation, using join hints forces join order (which is consistent with the plan that's produced).  There's no mention that join hints can be transparently ignored by the optimizer, but that seems to be precisely what's happening.

In the plan that results, the join to T4 is done as a hash join, with T1*T2*T3 (40,000,000 rows) on the "top", so it ends up trying to build a hash table with 40,000,000 rows, resulting in very high tempdb activity and very poor performance (I don't know how poor - I've never let it finish).

I can see part of the reason why it's making this join choice - the estimate of T1*T2*T3 is only 35,000 rows, even though T1 has 40,000,000 rows and the join will hit on every row.

Questions:

1. What can I do to the query or the database to improve the estimate on the join to T3?

2. What can I do to the query to force the optimizer to use a loop join like I asked? 

Version is SQL Server 2008 R2 SP2 Developer Edition X64.

OS is Windows 2008 R2

Machine is dual-quad-hyper-threaded CPU with 96Gb of RAM and several Tb of disk spread over 8 spindles and SSDs.

I've seen this query perform well before - I've been tuning this query for going on 7 years now and I've never seen it perform this badly that I can recall.  Not sure if it's something that's changed in SP2, or something about the distribution of data in this particular database that's changed, but something's sure changed.


-cd Mark the best replies as answers!





Unexplained sql join statement error

$
0
0

I have 3 tables having this unique id one of them has a different type of data type.

The following is the data type in the 4 tables representing the same column :

users : userid(varchar(20))
finewaiver : Requester(int)
loanstudents : student(int) 

This statement works without the where criteria, but when I tried adding the search criteria there was some error. Although this is not the correct as it is a long way to produce the same result below and it might affect performance by joining too many redundant tables. I just want to know the logic of why it did failed. Loanstudents was never needed in the first place as the finewaiver already holds the necessary info for loans and the requester table. Its either I change the whole statement to the one in the workaround or I needed to cast the @userid to a varchar(20) type.

Select * from fineswaiver fw 
join loans l on l.ID = fw.LoanID 
join LoanStudents ls on ls.LoanID = l.ID 
join Users u on u.ID = ls.student
where  u.userid =@userid 

This was my workaround and it works :

Select * from fineswaiver fw 
join Users u on u.ID = fw.Requester
join loans l on l.ID = fw.LoanID 
join LoanStudents ls on ls.LoanID = l.ID 
Where  u.userid =@userid 



memory utilization

$
0
0

Hi All,

There was stackdump which occurred on 29th July, and I want to find out memory utilization at that time on that instance, and I do not have complete dump in the log, I only have as BEGIN STACK DUMP and Non-yeilding scheduler in the error logs.

Now how to find out memory utilization on 29th July at 12:52 am?

Thanks.

Unable to drop filegroup; The filegroup cannot be removed because it is not empty

$
0
0

SQL 2008R2SP2 Standard Edition 64-Bit on Windows 2008R2 Enterprise.

I have an empty file group (no files assigned) that is not the default file group. I have never setup or tried to set up "Partitioning" (it is Standard Edition).

When I try to "Remove" the FG via SSMS GUI or T-SQL I get the error message.

Based on another (very old post) I checked sys.Indexes and found two indexes for one table still assigned to the file group.  (The table has 0 rows.)  Select * from the table did not generate an error!! and returned an empty result set as expected.

I Dropped the two indexes (one is PK the other is a Unique Constraint) and recreated them on different file groups.  This was successful and sys.Indexes shows the changes.

Now I can drop the File Group.

Why would the system let me

  1. Shrink (empty) a file that contained indexes for a table?
  2. Drop  a File that contained indexes for a table?
  3. Access a table in a file that does not exist?
  4. Drop Indexes from a file that does not exist

Seem like I should have gotten an error message somewhere around Step 1. :)

Thanks,


Ray

Fill Factor and Too Much Space Used

$
0
0

Okay, I am on sql server 2012 sp2.  I am doing a simple update on some large tables where there is an int column that allows nulls and I am changing the null values to be equal to the values in another integer column in the same table.  (Please don't ask why I am doing dup data as that is a long story!)  

So it's a very simple update and these tables are about 65 million rows I believe and so you can calculate how much space it should increase by.  Basically, it should increase by 8 bytes * 65 million = ~500Mbytes, right?

However, when I run these updates the space increases by about 3 G per table.  What would cause this behavior?

Also, the fill factor on the server is 90% and this column is not in the PK or any of the 7 nonclustered indexes.  The table is used in horizonal partitioning but it is not part of the constraint.

Any help is much appreciated...


sql server 2012 evaluation edition expired

$
0
0

Hi Gurus,

 sql server 2012 evaluation edition expired,

Here i don't have any backups and when i browsed few blogs suggest to upgrade to another edition from Evaluation edition.

1)Do upgrading the edition keeps all  the user databases the same and how about the logins and jobs and other data in system databases.

2) Am having a developer edition 2012 can i attach the data files ( .mdf ) to the instance using attach database method from Evaluation Edition Instance 2012   to    Developer Edition 2012.

3)If i uninstall the Evaluation edition 2012 can i have any loss of data.

4)Please suggest me the best practice if any thing available.

Thanks in advance..

migrate vCenter Server Database

$
0
0

Hi,

I have vCenter database on SQL Server 2008 R2 SP1 CU1. Now I have installed SQL Server 2012 on new server. I need to migrate the Database to this new server SQL Server 2012.

Please give KB note.

Regards


Bilal

to be NULL or NOT NULL is here the question

$
0
0

Hi!

I have a task about analyzing data to generate some metadata about Products having values for specific measures or not. (Severalproducts of different types are stored in same table, but not all columns are relevant to allproducts, e.g a situation suitable for sparse columns)

That is to help users in avoiding selection of measures (100+) and getting disappointed when no values are present.

Currently there is no source for this type of meta data, so the solution is to read data from last month partition (until “today”)

Maybe you can suggest an smarter (faster) solution using DMV’s or something else?

It’s not difficult to generate some dynamic sql code like this:

SELECT ProductID

     ,CASE WHENmax(measure1)ISNOT NULLTHENconvert(bit, 1)elseconvert(bit, 0)end  as measure1

     ,CASE WHENmax(measure2)ISNOT NULLTHENconvert(bit, 1)elseconvert(bit, 0)end  as measure2

--  100+ other signals….

from fct.MyFactWithManyMeasureswhere t >= convert(smalldatetime,'2014-07-01', 121)groupby ProductID

I also considered creation of statiscs:

CREATESTATISTICSmystatson fct.MyFactWithManyMeasures(measure1, … measureN ) where t>=convert(smalldatetime,'2014-07-01', 121)withfullscan;

And then looking at histogram, but only 32 columns are allowed. And creating many stats instead to cover all measures would mean reading data several times

Having these feature in mind:

ALTER TABLE … ALTER COLUMN … NOT NULL - SQL server rejects creation of NOT NULL columns, if you try to alter columns and data not allow it

SPARSE COLUMNS

I was thinking: maybe there exists some DMV/feature that can help me to tell if there are non-null data or not; I’m not even interested in the actual values, only their existence…

Best regards

Bjorn


B. D. Jensen

SQL Issue Access Violation at address 09513DC9

$
0
0
Access violation at address 09513DC9 in module 'WDBHandler.dll'. Write of address 00000000

Transaction log issue

$
0
0
i am learning sql server 2008. I have created a database with full backup mode and made a transaction without commit. in the system database info the log_reuse_wait_desc column is still has the value 'NOTHING'. But the tutorial which i am following shows that the value changes to 'ACTIVE_TRANSACTION'. Am i missing any configuration changes?

Thanks
Prathap

disk io makes long response time badly at recovering

$
0
0

i'm using mssql 2008 r2 on RAID0+1 15K SAS disk.

it has heavy writing load and has 1 minute recovering(checkpoint) time.

while the recovering, disk io goes up to 100% about 10 seconds and back to normal condition like below 10%.

in the normal condition the response time is blow 500 ms but in the recovering time it sometimes goes up to over 6 seconds.

do i have any solution for reducing the maximum response time ? i could not find any solution to configure the recovering io bandwidth or something. 

i hope some solutions for it in mssql 2008 r2.



SQL Server Agent - Operators

$
0
0

Hi,

When I tried to configure an operator in SQL server job agent then i can't add more than 100 characters in "email name" field.

Any thoughts??


Distributed transactions not working

$
0
0

Hi.

Please read this post carefully as I believe this is going to be a complex issue to resolve and I trust we've eliminated all commonly known causes while troubleshooting. We've had two DBAs and two infrastructure analysts working on this problem for more than a week with no progress.

I've been having trouble running distributed transactions between a clustered (WSFC 2012) and a standalone instance of SQL Server 2012 Enterprise.

Both MSDTC services are running and with all those parameters enabled in component services (allow inbound/outbound connections, network access, no authentication required, etc etc etc). Both servers are able to resolve DNS and reverse DNS of each other, even though they are in different domains. Distributed transactions are able to run fine between instances belonging to the cluster.

In both the standalone and the clustered instances, the following error is returned when attempting to run a distributed transaction:

OLE DB provider "SQLNCLI11" for linked server <LINKED SERVER NAME> returned message "No transaction is active.".
The operation could not be performed because OLE DB provider "SQLNCLI11" for linked server <LINKED SERVER NAME> was unable to begin a distributed transaction.

When running a distributed transaction started from the clustered instance, the following error is generated in the sql server error log in the REMOTE, standalone instance:

"Recovery of any in-doubt distributed transactions involving Microsoft Distributed Transaction Coordinator (MS DTC) has completed. This is an informational message only. No user action is required."

This is NOT observed the other way around.

DTC Ping was returning the following message for either instances:

There are no more endpoints from the endpoint mapper

Acording to the link below, this sugests either a firewall problem OR the operating system running out of DCOM ports.

http://blogs.msdn.com/b/distributedservices/archive/2008/11/12/troubleshooting-msdtc-issues-with-the-dtcping-tool.aspx#Therearenomoreendpoints

However, we have already ruled out these options as there are no firewalls between these hosts and the server in which both SQL Server instances are running are dedicated to them, so there are no other running services which could cause port overlapping that i know of. Listing open sockets in command prompt confirms this. We have also tried to increase the port range for MSDTC manually, but that didn't change anything. The ONLY open socket, in both servers, that is documented for MSDTC is port 135, which is used for RPC so i believe its alright. There are no other open sockets for ports 1434 or 5100-5200.

After we installed a few aditional .net components on both servers, DTCPing test started to run successfully from the clustered instance to standalone, and clicking "run" in standalone did nothing. The error messages in SQL Server remained as they were.

One interesting remark, although I'm unsure wether this has anything to do with the problem, is that the physical machines in which the cluster nodes run have two MSDTC services, one local and one clustered. I've never seen this setup before. Strangely, the local, disabled MSDTC service displays a uniqueidentifier in services.msc that is listed as a clustered resource in regedit

This service wont start and will generate the following errors in event viewer:

MS DTC log file not found. After ensuring that all Resource Managers coordinated by MS DTC have no indoubt transactions, please run msdtc -resetlog to create the log file.

MS DTC Transaction Manager start failed. LogInit returned error 0x3. This is expected if the corresponding volume has been restored (search for kb article regarding the issue). In all other cases, contact product support.

OBS.: The clustered MSDTC service is running fine and DT works between two different active clustered instances, either on the same node or on distinct ones.

When running a distributed transaction from one of the clustered instances to the standalone instance, the transaction is listed as "active" for long period of time in the clustered server before timing out in SQL Server and aborting. It is NOT, at any time, listed as an in-doubt transaction.

Changing the server parameter "in-doubt xact resolution" to 1 in both instances didn't have any effect either.

Questions:

1. Could this problem be related to the presence of multiple MSDTC services in the clustered instance?
2. Why won't the MSDTC local service start in the clustered service?
3. Why is the in-doubt transaction message generated for the standalone instance, but not for the clustered one?
4. Does MSDTC even work between a clustered and a standalone SQL Server instance???
5. In the clustered instance, SQL Server resource is not dependant on MSDTC. Could this be interfering with transactions outside the clustered instances?

Two depended SQL server those running on different version can create any issue?

$
0
0

Two depended SQL servers are running on different version, one server is on SQL Server 2012 (SP1) - 11.0.3393.0 (X64) and other server is on SQL Server 2012 (SP1) - 11.0.3460.0 (X64) . Will that create any issue with respect to replication between servers or with respect to compatibility or any other way?


Rahul

Transaction log used 200GB unable to shrink

$
0
0

Hi All,

Currently I am facing diskspace(0 KB available) issue in one of my application server..

When I checked SQL server SMS_UDB (is our DB name) containing 70GB but SMS_UDB_LOG (Transaction log) Containing more than 200GB. When I checked the diskspace report 200GB space used (showing Green). I am unable to shrink the file. I am running 2008 SQL with simple recovery model. I taken bak to other server.   It's urgent Kindly help me to reduce the transaction log

'

thanks

Is "sp_purge_data" available only to datawarehouses or can it be used with both a normal database and Azure storage as well ?

$
0
0

Is "sp_purge_data" available only to datawarehouses or can it be used with both a normal database  and Azure storage as well ?



Rolling back after an Upgrade

$
0
0

Hello,

I am planning to upgrade from SQL 2008 R2 SE to SQL 2012 SE in our prod env. The upgrade will be an inplace upgrade to a cluster environment from standalone. I ran the upgrade advisor and I got no unresolved issues. I already did this on our staging and test environments and upgrade was successful. But the thing is I havent noticed any performance improvement. However after upgrading it from 2008 R2 SE to 2012 SE in our production environment and after a day/two of monitoring if we notice a decrease in performance and then if we decide to rollback I will have to rely on  restoring the full backups that I took before the upgrade process. But a day/two's worth of data is in the 2012 database and I will have to do a data compare and move over the new records to the 2008 R2 database. And the databases are almost a terabyte and this is going to be a slowprocess.

Can experts please share their inputs for a better rollback plan inplace of upgrade failure or upgrade rollback.

Thanks


Viewing all 12554 articles
Browse latest View live


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