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

Degraded query performance after UPDATE STATISTICS WITH FULLSCAN

$
0
0

Hi Team,

I've tried unsuccessfully researching how the execution of UPDATE STATISTICS (no options) against one statistic can have a massive impact on query execution vs running UPDATE STATISTICS (WITH FULLSCAN) against the same statistic.
Scenario: A specific tab selection within an application UI (when performing as expected), can return data within 1 sec. Over time the same tab selection degrades to the extent that data is returned after approx. 30secs. After extracting the associated TSQL using profiler, the code was run with using SET STATISTICS IO ON. The output (which completed in approx. 30sec.), revealed several 100s of thousands of logical reads for most of the involved tables. We chose to run UPDATE STATISTICS (without options) against the smallest table's key statistic followed by running the same TSQL. To our good luck and amazement, the results returned in 2 secs and with logical reads down to singe-digit values against ALL the associated tables involved in the query. Then we ran UPDATE STATISTICS WITH FULLSCAN against the same table stat and re-executed the same TSQL. Error! The execution returned back to its poor runtime of approx. 30secs AND the logical reads were back to 100s of thousands for each of the involved tables in the query!! If I then re-run UPDATE STATISTICS (without options), and then re-run the TSQL it completes again in approx. 2secs!!
No research to-date can explain 'WHY'. If I run UPDATE STATISTICS (against the one target stat) WITH FULLSCAN and then SHOW_STATISTICS I get the same results as using ALTER INDEX (to REBUILD the index associated with the target stat) followed by SHOW_STATISTICS. ie the total rows vs rows sampled are the same. For the TSQL that completes in approx. 2secs. running UPDATE_STATISTICS (without options) against the target stat and then running SHOW STATISTICS against the target stat reveals rows sampled is about 1% of the total rows with a much lower 'All Density' value.
can you explain or direct me to some esoteric MS doco that details why query performance is optimized after running UPDATE STATISTICS (no options) and not after running UPDATE STATISTICS WITH FULLSCAN?

Thanks in Advance.
John


Including login information in the SQL mail

$
0
0
I am working on SQL Server 2008. I have created a trigger on a table which will send a notification mail if the records are updated. I have included what is getting updated in body of the mail. Along with that I also want to include who has updated the records. Some information like login name. Is it possible? And if yes, how can I do that? Please help.

Regional setting in MSSQL server

$
0
0
I have an asp.net application which connects to MSSQL server. I have a table column of type smalldatetime and while inserting a date it is inserting in my  local sql server but when I deployed my app in cloud server it is showing that string was not a valid datetime. In my local system it is accepting any type of date format suppose dd/MM/yyyy , dd-MM-yyyy , yyyy-MM-dd etc but in cloud sql server it is not inserting. How to resolve this problem please help.

Log shipping issue,

$
0
0

Hi TEAM,

we are configuring logshipping successfully but when ever run the backup job we getting bellow error message



SQL Cluster Issue

$
0
0

Hi All,

There seems to be an issue with a database in a cluster(the cluster is accessed from a separate server).

Last week, I had loaded some data on Monday,Tuesday and Wednesday. There was also some access issue(to the server and cluster) on Tuesday which was resolved on Wednesday after which I did some loads.

This week I observed that the data loaded on Wednesday is not available in the database. However, the data loaded on Monday and Tuesday is present. The log entries are also missing from my tables.

It may be a case of cluster rollover to Tuesday’s backup. Could you let us know if you have any idea on what may be causing the issue?  The internal sys tables are emptied every day so this history cannot be checked for my databases. How can i check if the cluster rolled over?

Regards,

Sumit

You could be September's TechNet Guru! Turbo charge your CV with awards and interviews! Get noticed!

$
0
0

TechNet Wiki is partnering with... YOU!

Give us some juicy technical content and we might big you up!

It really is that simple!

 

Show us your forum solutions or drop us some nifty snippets and become MICROSOFT TECHNOLOGY GURU OF THE MONTH!

This is an official Microsoft TechNet recognition, where people such as yourselves can truly get noticed!

 

If you spend any amount of time crafting an awesome answer to a forum question, or just learnt something new, then why not get the most back for your efforts, by posting it to TechNet Wiki.

 

1) Please copy over any solutions and revelations to TechNet Wiki.

2) Add a link to it on THIS WIKI PAGE, so we know you've contributed

3) Every month, we will highlight your contributions, and select a "Guru of the Month" in each technology.

 

If you win, we will sing your praises, similar to the weekly contributor awards, however once "on our radar" and making your mark, you will probably be interviewed for your greatness, and eventually even invited into other TechNet/MSDN circles!

 

Either way, winning this award in your favoured technology can only be very good for your career! ;)

 

Feel free to ask any questions below.

 

Thanks in advance!
Pete Laker


#PEJL Got a good solution? If you invest your time in coding an elegant/novel or large answer on these MSDN forums, why not copy it over to our belovedTechNet Wiki, for future generations to benefit from!

restoring error

$
0
0

Hi All,

         I have three instances running on my sql 2008 r2 enterprise.

I have taken full backup of one database from default instance.

I login both the instances thru sa account.

Now when I try to restore that backup on another instance it gives me the following error....

 

 

TITLE: Microsoft SQL Server Management Studio

Restore failed for Server 'WRCP2F1CWS315\TEJA'.  (Microsoft.SqlServer.SmoExtended)

System.Data.SqlClient.SqlError: The operating system returned the error '32(The process cannot access the file because it is being used by another process.)' while attempting 'RestoreContainer::ValidateTargetForCreation' on 'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\fcms.mdf'. (Microsoft.SqlServer.Smo)

 

 

Please let me what does this error mean........

what can be done to restore bakup in another instance ......

please help............

Disable Error 3197 "I/O is frozen on database %ls. No user action is required." in SQL Error Log

$
0
0

Hi Experts,

I have a MS SQL Server 2008 R2 Server with plenty of shared point databases. MS DPM (Data Protection Manager) configured for the databases backup. Every time the backup initiated it logs info "I/O is frozen on database %ls. No user action is required." I want to avoid that info in the log file. Is there any way to disable error messages 3197,3198 in error log file.

UsafUnas


database corrupt

$
0
0

Hi all,

what the reason database is goes in suspect mode..?

what the reason database is corrupted?

how can i resolve this issues?

SQL query timeout error

$
0
0

I am using vb6 application with Sql Server 2012. Very often I get timeout error.

I have 700+ tables in the database. Some tables i am using in query have 20K + rows (some have very few records also).

I use begin transaction and commit transaction.

I have several small small queries in the transaction. 

Just for example,

Suppose i am saving invoice created for customer, after i click SAVE button,

 first I go to 1 or 2 other forms to calculate totals and get accounts etc  etc. so load those forms and get the data.

Then checking dates and some other data in other tables.

Then i delete existing invoice first, then insert new invoice in say 4/5 tables.

I get timeout error [odbc sql server driver]timeout expired. I have give commandtimeout = 600 and connectiontimeout=600 already. I am using ADODB.Connection. My tables are not indexed.

How can i eliminate or atleast minimise this error.


h2007

Moving ONLINE databases into another drive...

$
0
0

Suppose I have one live databases name as 'GBAccount'...

I have to move the database file and log file to another drive without any down time..because database can't be OFFLINE for a single minute...

That's why we can't use backup and restore process and database Detach\Attach method...

Then How can I do that??

Please help...

Thanks in Advance...

recovery model

$
0
0

Hi,

What should be (recomended)  Recovery model for master,msdb and model databases?

Regards


Problem with backup MS SQL 2008 when database has 2 or mare logs

$
0
0

 Hello!

I have database, that has 2 ldf. I try to do backup log via a program  that uses ODBC Driver (SQL Server Native Client 10.0 ODBC ).  But the backup file is not created. And application doesn't catch exception. Application  connects to MS SQL Server using information of user, that has all roles to do backup. Database has FULL RECOVERY model. When I performed a command that is used in the application, MS SQL Server does backup log and backup log is created. My application uses the this connection string: 


   oss << "DRIVER={" << MSSQLDriver.c_str() << "};"
            << "Server="<<address.c_str()<<";" 
            << "Network=DBMSSOCN;"
            << "Initial Catalog=my_database_1;"
            << authTypeString.c_str();
        if (port > 0) {
            oss << "Port = " << port << ";"
                << "Address="<<address.c_str()<<"," <<port<<";";

 , where address is IP adress

Application use this command: 

BACKUP LOG [my_database_1]   TO  
DISK = N'C:\mssql_backup_via_idr\my_database_1_log_backup_1374.bak' 

This command is performed successfully via MSSQL Managment Studio, but unsuccessfully via application that uses a driver SQL Server Native Client 10.0 ODBC.

I don't understand why backup log isn't created. Does problem depend on the driver?  

Thanks

sql server 2012 - cluster and non cluster indexes

$
0
0

Cluster indexes and non cluster indexes takes extra space right?

Is it ok to have only 5/6 non-cluster indexes on tables (not a single cluster index) ?? Will it take more extra space?

I have columns e.g. Invoice no, doc no, customer_id, customer_name, transactionDate etc.

Many times program does cheque with all these columns.  (e.g. where invno = '' and docno='' or refno = '' and customer_id='')

Big reports go by date (that's why date column). 

So coluld't decide which one to make index???

Any suggestions???


h2007

Data copy across Linked Server much slower than expected

$
0
0

I'm trying to retrieve data from a SQL Server at a remote site running SQL2008. There is a query involved, but to isolate the issue I've materialised the data, so all subsequent tests are now doing a  SELECT * from a materialised table. The data is about 80MB if saved as csv.

If I run the query in SSMS (local-remote site), all of the data is returned in 8 seconds.

If I run the query through a linked server (local-remote site) using SQLNCLI or SQLOLEDB it takes 8 minutes (to select the data into a temp table)

If I run the query using a linked server setup using ODBC (local-remote site)it takes 1 minute.

Intrasite copy of the same dataset takes about 5 seconds. (local-local or remote-remote)

It isn't a stats permissions issue since I have sa access to all servers involved.

Anyone have any ideas what's happening here? I'm a bit puzzled.

Thanks

Ewan


If you have found this post helpful, please click the 'Vote as Helpful' link (the green triangle and number on the top-left).

If this post answers your question, click the 'Mark As Answered' link below. It helps others who experience the same issue in future to find the solution.



BACKUP Detected Corruption in the database log

$
0
0

The logshipping backup job failed with the following error:


***Error: Error occured while executing the transact-SQL statement or Batch

***Error: BACKUP Detected Corruption in the database log

what could be the reason for this?

expecting a quick response.

please find the below screenshot.

Best RAID configuration for my SQL Server 2005

$
0
0

I have SQL SERVER 2005 database running on windows server 2008 with following configuration SERVER:HP Proliant ML380 G7 CPU: 1 RAM: 10 GB of RAM HHD: 3*300 GB HHDs with RAID 5 configuration

It has 10 live databases and 10 history databases with different sizes from 500MB to 6GB. These databases have around 100 users who will read and write.

There are a lot of reads than writes per second, I don't have the exact statistics.

Now We're trying to upgrade our server and thinking of better RAID configuration one for the data files and the other for OS ,log files and tempdb.

Can anybody suggest me which will be the best RAID for my system?

RAID1 or RAID5 or RAID10?.

Should I go for two RAIDs?

From my search i found RAID 10 is nice, but also somebody is saying 'advantage of RAID 10 is myth',refer below article.

www.zdnet.com/blog/ou/comprehensive-raid-performance-report/484


backup files confusion..

$
0
0

HI,

 we have no.of backup files like a,b,c,d.bak like that,

here problem is we are restoring c.bak file instead a.bak file, c.bak file restore that database now it's use how to resolve this problem with out drop the database.

HOW TO FIND THE WHICH "BACKUP FILE" ARE RESTORED WHY BECAUSE WE HAVE NO.OF BACKUP FILES THAT'S WHY I AM ASKING HOW TO FIND THE RESTORE BACKUP FILE. 

azman + SQL Server 2008 : Access Denied

$
0
0

Hi,

I am trying to create a new Authorization store with Azman with SQL Server 2008 R2 on Windows Server 2008 Server machine. However, when i try to do that, i get an error from Azman : 

"Can not create an authorization store. The following problem occured : Access is Denied".

I then looked into the SQL Server logs which said : 

Error: 18456, Severity: 14, State: 38.

Login failed for user 'servername\Administrator'. Reason: Failed to open the explicitly specified database. [CLIENT: <local machine>]

However, my connection string was : mssql://Driver={SQL Server};Server={servername};User=sa;Password=pws;/AzDB/AzStore

I dont understand why the SQL server is trying to connect using "Administrator" even though i have specified the user as 'sa'.

Can somebody help me with this ?


Kulvinder Singh

Find unused databases

$
0
0

Hi Experts,

I know this is a question asked before. We need to figure out the databases in our servers that arenot being used. We could check from audit logs, profiler trace and some DMV's. But is there any useful tool or any easy method by which we could get it for all the databases (100s of them) for all servers. Please provide your suggestions ?


MM

Viewing all 15889 articles
Browse latest View live


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