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

How to increase row size in SQL 2008

$
0
0
Hi,
While altering my table in sql 2008 standard. It throws error

Warning: The table "t1_Data" has been created, but its maximum row size exceeds the allowed maximum of 8060 bytes. INSERT or UPDATE to this table will fail if the resulting row exceeds the size limit.
Msg 511, Level 16, State 1, Line 1
Cannot create a row of size 14510 which is greater than the allowable maximum row size of 8060.
The statement has been terminated.

Help me how to increase row size

How to recover a database when log file is deleted

$
0
0

Hi,

Please I need your help.

It happened that there is a friend who is new to SQL server committed a fatal mistake. He was trying to fix a problem but made ​​a bigger one.  The problem was that the log file is full and consumed all of the available space on the hard drive so he stopped SQL services and delete the database log file manually and addition to that no back up is there for the database.

I tried to help him to recover the database by using the following

sp_attach_single_file_db

DBCC REBUILD_LOG

 

I'm still unable to fix the problem and I don't know which steps needed to recover the database.

Getting the First Dataset from a Multi-Dataset Stored Procedure

$
0
0

I can get all the datasets with SQLCMD execution (ugly).  Is there a better programmatic way? Thanks.

CREATE TABLE #Space ( DB sysname, dbsize varchar(50), freespace varchar(50));

INSERT #Space
EXEC sp_spaceused;
/*  expecting the second dataset definition
Msg 213, Level 16, State 7, Procedure sp_spaceused, Line 128
Column name or number of supplied values does not match table definition
*/
/*
database_name	database_size	unallocated space
AdventureWorks2012	3118.38 MB	443.70 MB

reserved	data	index_size	unused
361776 KB	241704 KB	110352 KB	9720 KB
*/


Kalman Toth Database & OLAP Architect sqlusa.com
Paperback / Kindle: Pass SQL Exam 70-461 & Job Interview: Programming SQL Server 2012


Cannot read SQL Server 2008 database ,it is version 661. This server supports version 655 and earlier

$
0
0


used to have sql 2005 then i uninstall it , and install sql 2008

now Im trying to open a visual studio project , when i want to open the DB included with

i get :

Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
Common reasons for this problem include that the server is not installed, the service is not started or the server is upgrading your database.  If an upgrade is in process, you will be able to connect to the database when the upgrade is complete.

then i get : 

The database 'C:\USERS\BSH\DESKTOP\IREAD\IREAD\APP_DATA\IREAD.MDF' cannot be opened because it is version 661. This server supports version 655 and earlier. A downgrade path is not supported.
Could not open new database 'C:\USERS\BSH\DESKTOP\IREAD\IREAD\APP_DATA\IREAD.MDF'. CREATE DATABASE is aborted.
An attempt to attach an auto-named database for file C:\Users\bsh\Desktop\iRead\iRead\App_Data\iread.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

** the DB i want to open is SQL 2008


I get an error while trying installing SQL Server 2008 R2 on Windows Server 2008 R2

$
0
0

I get the following error while trying installing SQL Server 2008 R2 on Windows Server 2008 R2

The following error has occurred:

Attempted to perform an unauthorized operation.

Click 'Retry' to retry the failed action, or click 'Cancel' to cancel this action and continue setup.

For help, click: http://go.microsoft.com/fwlink?LinkID=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=10.50.1600.1&EvtType=0x88792597%25400xBB814387

------------------------------
BUTTONS:

&Retry
Cancel
------------------------------

      

Is SQL logon password encrypted during transmission?

$
0
0

Hi:

If I do not turn on any encryption feature for SQL server (2000, 2005, 2008),  when I logon to SQL server using a SQL logon (for example sa account),  is the password transmitted through network in plain text, or encrypted?

SQL Server Agent Job And Database Mail - Error formatting query, probably invalid paramters

$
0
0

We have a stored procedure that we are trying to call with a SQL Server Agent Job. The stored procedure calls Database Mail. This is SQL 2008. The execute task is simply:

 

USE [Production]
GO

EXEC [dbo].[JOB_EMAIL_SCHEDULED_REPORTS]

GO

 

When the job runs, it is erroring out immediately, with the error:

Execute as user: NT AUTHORITY\NETWORK SERVICE. Error formatting query, probably invalid paramters [SQLSTATE 42000] (Error 22050). The step failed.

When we go into SQL Server Manager and just execute the SQL query, it works though. Something within the SQL Server Agent job,  and Database Mail is causing problems. Any ideas? Thanks.

 

 

Time-out occurred while waiting for buffer latch type 3 for page (1:203), database ID 2.

$
0
0

Strange effect when running a manual checkpoint in TEMPDB (don't ask me why I did this).

It took 5min to complete and finally failed generating error: Time-out occurred while waiting for buffer latch type 3 for page (1:203), database ID 2.

After inspecting waittime, it appeared it was waiting for a PAGELATCH_UP on page 2:1:203.

FYI: this is a SQL2008R2 server that has databases with read_committed_snapshot and allow_snapshot_isolation ON

It turn out that this only occurs when there are records in the version store. If version store is empty, checkpoint runs subsecond


Geert Vanhove DCOD ------ http://geertvanhove.wordpress.com/ ----------- Please click the Mark as Answer or Vote As Helpful if a post solves your problem or is helpful!




Returns alot of rows instead of few

$
0
0
Hello, I am using SQL server mgmt studio 2008 r2 and I have a situation where I joined two views to get just one field where it is calculation based on conditions. 
I have the following sample SQL statement where I get red squiggly syntax error underlined to get the field from the other view: 

In the select, I got this:
Isnull((CASE WHEN bsd.StatusID= 01 AND bsd.TypeID = 10 THEN  bsd.Amt * bsd.Qty ELSE  0 END ),0) as TotalLineItemAmt,

In the from statement, I got this:
INNER JOIN dbBillsAndInvoices..StatementDetails bsd ON bsd.StatementID = b.StatementID

The view, which is the using the inner join above, returns 49 rows which I know for sure the StatementDetails table returns 9 rows that are confirmed as true known fact. 

How would I make the statement above define only 9 rows and not 49 rows using a similar Count Distinct or something valid?


SQL server Conversion failed when converting date and/or time from character string.

$
0
0

Hello i  have  a problem in Sql and VS C# application coding when it begin to save...

this is the code i typed in c# windows application

SqlCommand Cmd = new SqlCommand("insert into table_4 values('" + tb_iTemCode.Text + "','" + tb_iDesc.Text + "','" + tb_iPrice.Text + "','"+tb_Uom.Text+"','" + cB_Config.SelectedItem+ "','"+LblTimer_Date+"')", Con);

and code in SQL server

when i debugg with this codings ... i receive error"Conversion failed when converting date and/or time from character string."

how i do overcome this problem.....

Transaction context in use by another session.

$
0
0

Hello all,

I am having this error in my system; I have SQL Server 2005 SP4 installed on a failover cluster active / passive.

I DO not have or use linked server approach in my system at all

More details:

Transaction context in use by another session.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Transaction context in use by another session. Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SqlException (0x80131904): Transaction context in use by another session.]

   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +925466

   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +800118

   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +186

   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1932

   System.Data.SqlClient.TdsParser.TdsExecuteTransactionManagerRequest(Byte[] buffer, TransactionManagerRequestType request, String transactionName, TransactionManagerIsolationLevel isoLevel, Int32 timeout, SqlInternalTransaction transaction, TdsParserStateObject stateObj, Boolean isDelegateControlRequest) +666

   System.Data.SqlClient.SqlInternalConnectionTds.PropagateTransactionCookie(Byte[] cookie) +40

   System.Data.SqlClient.SqlInternalConnection.EnlistNonNull(Transaction tx) +496

   System.Data.SqlClient.SqlInternalConnection.Enlist(Transaction tx) +801124

   System.Data.SqlClient.SqlInternalConnectionTds.Activate(Transaction transaction) +795159

   System.Data.ProviderBase.DbConnectionInternal.ActivateConnection(Transaction transaction) +30

   System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +1205

   System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +82

   System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105

   System.Data.SqlClient.SqlConnection.Open() +111

   Microsoft.Practices.EnterpriseLibrary.Data.Database.OpenConnection()+196

   Microsoft.Practices.EnterpriseLibrary.Data.Database.ExecuteReader(DbCommand command) +53

   **.**.**.**.**.**(Int32 xx) +13237

   U**.R***.D**.Eg**.FDAL**.***(Int32 **) +18373

   U**.R***.BusinessLogic.Eg**.**.**.**(Eg**** **) +555

   U**.R***.**.Eg**.Eg**AppBaseBL.SubmitNewApp(Eg*** *) +244

   U**.R***.UI.*.**.*(* *) +22

   U**.R***.UI.Web.***.*.*.Submit(Object sender, Int32 e)+6026

   U**.R***.UI.Web.***.*.*.butSubmit_Click(Object sender, EventArgs e) +65

   System.Web.UI.WebControls.Button.OnClick(EventArgs e)+105

   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107

   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7

   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11

   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +177

   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746

RING_BUFFER_SCHEDULER_MONITOR reporting over 100% ProcessUtilization

$
0
0

I am using RING_BUFFER_SCHEDULER_MONITOR to get cpu history for the server. For some reason on our new intel box (system info below) we are experiencing above 100% (in the xml below it shows 129) ProcessUtilization. Is there any correction I need to be applying to this value or why would it be above 100 ever?

Thank you

<Record id="2835" type="RING_BUFFER_SCHEDULER_MONITOR" time="6535178385"><SchedulerMonitorEvent><SystemHealth><ProcessUtilization>129</ProcessUtilization><SystemIdle>32</SystemIdle><UserModeTime>30068412745</UserModeTime><KernelModeTime>988422336</KernelModeTime><PageFaults>604</PageFaults><WorkingSetDelta>1974272</WorkingSetDelta><MemoryUtilization>100</MemoryUtilization></SystemHealth></SchedulerMonitorEvent></Record>

SELECT  CAST(record AS XML), *
FROM    sys.dm_os_ring_buffers (NOLOCK)
WHERE   ring_buffer_type = N'RING_BUFFER_SCHEDULER_MONITOR'
        AND record LIKE N'%<SystemHealth>%'
AND record LIKE '%>129<%'
ORDER BY [timestamp] DESC
CounterNameCounterValue
InstanceUpTime1 days 22:47:31
ServerUpTime75 days 16:12:10
IsClusteredClustered
ClusterNodeCnt2
AuthenticationMode Mixed
Port1433
SystemManufacturer System Manufacturer: 'Dell Inc.', System Model: 'PowerEdge R910'.
ProcessorInfoIntel(R) Xeon(R) CPU E7- 4850  @ 2.00GHz
CpuCount80
HyperthreadRatio 20
TotalPhysicalMemoryMB 1,048,562.82
AvailablePhysicalMemoryMB28,388.65
MemInUseMB1,002,576.75
MemUtil%100
SystemMemoryState Available physical memory is high
MaxDegreeOfParallelism 4
ClrEnabled1
RemoteAdminConnections 1
OptimizeForAdHocWorkloads1
xp_cmdshell1
DefaultTraceEnabled 1
ProcessId35132
IsSingleUser0
ProductVersion11.0.2100.60
VersionMicrosoft SQL Server 2012 - 11.0.2100.60 (X64)  |  Feb 10 2012 19:39:15  |  Copyright (c) Microsoft Corporation |  Enterprise Edition: Core-based Licensing (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1) | 
ProductLevelRTM
ResourceLastUpdateDateTimeFeb 10 2012  9:09PM
ResourceVersion11.00.2100
IsIntegratedSecurityOnlyNot Integrated security
EngineEditionEnterprise Edition
LicenseTypeDISABLED
NumLicensesNULL
BuildClrVersionv4.0.30319
CollationSQL_Latin1_General_CP1_CI_AS
CollationID872468488
ComparisonStyle196609
ProductEditionNULL
IsFullTextInstalled Full-text is installed
SqlCharSet1
SqlCharSetNameiso_1
SqlSortOrderID52
SqlSortOrderName nocase_iso


Gokhan Varol

Full-Text Search and Norwegian

$
0
0

I have a very strange situation with full-text search. Looks like it also causes ft queries to get stuck. Happens on both SQL Server 2008 R2 and on SQL Server 2012. Examples below can be reproduced on SQL Server 2012 with AdventureWorks2012 database.

Consider following 3 queries:

1) SELECT [KEY], [Rank] FROM FREETEXTTABLE(Production.Document, DocumentSummary, 'SQL Server', LANGUAGE N'abcd',100)
2) SELECT [KEY], [Rank] FROM FREETEXTTABLE(Production.Document, DocumentSummary, 'SQL Server', LANGUAGE N'Norwegian',100)
3) SELECT [KEY], [Rank] FROM FREETEXTTABLE(Production.Document, DocumentSummary, 'SQL Server', LANGUAGE N'Norwegian (Bokmål)',100)

First query fails with following error:

Msg 7678, Level 16, State 12, Line 1
The following string is not defined as a language alias in syslanguages: abcd.

Qeries #2 and #3 both complete without errors. On a table with real data (I have such at my client's site) both return data (although different).

BUT! Query #2 causes following errors to be recorded in SQL Server Error log:

Error 2786, Level 16, State 1, Procedure sp_fulltext_load_thesaurus_file, Line 41, Message: The data type of substitution parameter 1 does not match the expected type of the format specification.

I've already opened bug for it:

https://connect.microsoft.com/SQLServer/feedback/details/779257/sys-sp-fulltext-load-thesaurus-file-fails-sometimes-due-to-error

The bug is in RAISERROR command (it expects 2 parameters for the particular error but only one is supplied - of a wrong data type). But codepath inside procedure indicates that invalid lcid (locale id or language id) has been supplied.

As I said, query #3 runs successfully.

If we query master..syslanguages (as error message from query #1 points us to), we can see row with the value "Norwegian" in "alias" column (lcid = 2068). If you're still following me, "Norwegian" is the value that has invalid lcid - at least it generates messages in error log.

When I queried sys.fulltext_languages, I received different results on my laptop with SQL Server 2012 (no rows with any sort of Norwegian) and at client's site with SQL Server 2008 R2 (lcid = 1044, language = "Norwegian (Bokmål)".

The interesting thing here is that with "Norwegian (Bokmål)" query succeeds on both machines without throwing error either to the client to the log. Even on mine that doesn't have "Norwegian (Bokmål)" - neither in syslanguages nor in sys.fulltext_languages. I guess, it has something internally or takes it from Windows.

Last thing - when I see large number of error messages in the log, entire system is stuck. I see lot's of FTS queries waiting on FT_IFTS_RWLOCK wait type. It is almost undocumented, some internal synchronization. I guess it is connected (can't do much more besides guessing - internal architecture is undocumented).

So... beware of the described strange behavior. And I'll be gratefull if anybody from Microsoft can shed some light on these issues.

SQL agent Job miss a schedule task

$
0
0

Hi all. Any body saw a problem that the schedule job not running on time.

I have check the  SQL Agent is started already on that time. 

Cardinality estimates on a parallel join are wrong

$
0
0

Hello everybody,

I'm having a problem with pretty simple query where the cardinality estimates seems to be off and usual methods that I knew for this kind of problem don't help.

The query:
SELECT COUNT(*) FROM
     dbo.FaktMVaR mvar
         INNER JOIN dbo.FaktSensitivitaet AS sen
                 ON mvar.DatumID = sen.DatumID
                    AND mvar.Risikofaktor1ID = sen.Risikofaktor1ID
                    AND mvar.Risikofaktor2ID = sen.Risikofaktor2ID         
         INNER JOIN dbo.DimDatum AS dd
                 ON mvar.DatumID = dd.DatumID
                    AND dd.LastVersion = 1
WHERE dd.DatumID >= 2012122700 and dd.DatumID < 2012122800 

As obviously seen in the execution plan, the join result contains actually 217Mio rows. The query optimizer expects for join of FaktSensitivitaet with FaktMVaR only 30Mio rows. Other estimates are fine.
I've already tried the following:
1. Created multi-column statistics WITH FULLSCAN for FaktSensitivitaet and FaktMVaR on 3 join columns (DatumID, Risikofaktor1ID, Risikofaktor2ID).
2. Instead of (1) created filtered indices with exactly the WHERE conditions on FaktSensitivitaet and FaktMVaR incliding (DatumID, Risikofaktor1ID, Risikofaktor2ID)
3. Updated statistics behind the clustered indices of both Fakt* tables WITH FULLSCAN.

I can provide DBCC SHOW_STATISTICS results for (1) and (2), and usually multicolumn statistics solved similar join issues.

FaktSensitivitaet (limited to date condition in where) has 723K rows, FaktMVaR - 548K rows. The 217Mio are produced through M2M relations between these tables (the result is expected and correct).

After all I've tried playing with MAXDOP query hints. They do provide positive results (MAXDOP 1 inserts a stream aggregate before huge join, MAXDOP 8 inserts a hash match aggregate), and the queries actually returned instantly (compared to 13 seconds before). Unfortunately this doesn't help in my real query which still runs slow and with wrong estimates.

I've looked at http://sqlblog.com/blogs/paul_white/archive/2011/12/06/sql-server-optimizer-bug-with-join-and-group-by.aspx
but I'm not sure whether this is my case.

I'm using SQL Server 2008 R2 SP1. Any help or hints whether the parallel execution is my problem and in what CU/Service Pack this issue could be solved is very appreciated.


SQL 2008 R2 - Starting SQL Causes 5178 error in log - Segment Size Different

$
0
0

The SQL Server 2008 R2 was running fine.
I cloned the 320 Gb harddrive to a 500 GB harddrive. The oriignal drive was 8/ 4096 structure. After the drive was cloned the new drive is 8/4096 structure

Chckdsk had no issues with original drive
Chckdsk has no issues with new cloned driver
When I try to start SQL, the below log shows the master db with issues regarding sector size. Any suggestions would be appreciated.


segment size: 2012-04-12 14:38:08.28 spid7s      Cannot use file 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MYSQL2008\MSSQL\DATA\master.mdf' because it was originally formatted with sector size 4096 and is now on a volume with sector size 3072. Move the file to a volume with a sector size that is the same as or smaller than the original sector size.
2012-04-12 14:38:08.28 spid7s      Error: 5178, Severity: 16, State: 1.
2012-04-12 14:38:08.28 spid7s      Cannot use file 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MYSQL2008\MSSQL\DATA\master.mdf' because it was originally formatted with sector size 4096 and is now on a volume with sector size 3072. Move the file to a volume with a sector size that is the same as or smaller than the original sector size.
2012-04-12 14:38:08.30 spid7s      Error: 5178, Severity: 16, State: 1.
2012-04-12 14:38:08.30 spid7s      Cannot use file 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MYSQL2008\MSSQL\DATA\mastlog.ldf' because it was originally formatted with sector size 4096 and is now on a volume with sector size 3072. Move the file to a volume with a sector size that is the same as or smaller than the original sector size.
2012-04-12 14:38:08.30 spid7s      Error: 5178, Severity: 16, State: 1.
2012-04-12 14:38:08.30 spid7s      Cannot use file 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MYSQL2008\MSSQL\DATA\mastlog.ldf' because it was originally formatted with sector size 4096 and is now on a volume with sector size 3072. Move the file to a volume with a sector size that is the same as or smaller than the original sector size.

GhostCleanup not working SQL 2005 Standard (9.0.5266)

$
0
0

I will be as detailed as possible.

We have a high OLTP Publisher (SQL 2005 Ent.) publishing to 5 subscribers (SQL 2005 Std.). The DB on one of the subscribers was 50GB more in size than other 4 DB's. After little bit of investigation found that one of the table alone which was 500MB in total size on all other servers was 50.5GB on one. Rebuild the index fixed the issue and the size came back to 500MB.

We are noticing that the size of this table increasing on a daily basis. Comparing the PK & NCIX indexes we found under INDEX PROPERTIES-FRAGMENTATION the ghost rows which is 0 in all servers is 40,000,000 on the effected server.

- Trace 661 is not turned to ON
- sp_configure compare is same on all servers
- MSFT has a fix for 2005 SP1 which does not apply in our case (http://support.microsoft.com/kb/932115)
- There are more than 2-3 million changes every hour
- The table has 5 INT & one DATETIME columns i.e. no BLOB or VARCHAR(max) columns
- The clustered index on this table is on a INT column i.e. all the 5 servers have the same schema (Table,PK,NCIX, FillFactor etc).

Updated Information: after referring to "http://www.sqlskills.com/blogs/paul/post/inside-the-storage-engine-ghost-cleanup-in-depth.aspx"

Running update stats on the table does help in decreasing the number of ghost rows, however its temporary i.e. the rowcount reduces by 100K from 40 million and then remains there. I tried running update stats again and it reduced by another 100K however remains at that number even after waiting for 30 minutes.

I will need to run update stats thousands of times to clear all the records which is not what i prefer. I also checked that auto update stats is enabled on the DB

Is Transparent Data encryption is FIPS 140-2 compliant.

$
0
0

Hello - I am planning to Implement TDE (Transparent Data Encryption) in our Environment. One of the question was asked that is TDE encryption is FIPS 140-2 compliant. I assume that it is but have no Microsoft or NIST article stating that the encryption is FIPS 140-2 compliant.

Please someone assist me in answering my question and provide me any article stating the TDE is compliant with FIPS 140 – 2 Compliant.

Thanks - Ad


Login Issue

$
0
0
I can able to login with Windows Authentication on my local SQL Server instance for Analysis Services, but not on the Database Services .. Any idea on the issue ?? thanks 

Cannot drop linked server login

$
0
0

Hi,

I tried to drop linked server login mentioned in linked server propeerties->security. When I clicked a login and selected delete, it process successfully. When I open again linked server properteis, this login is still there. I used both GUI and command line:
sp_droplinkedsrvlogin [ @rmtsrvname= ] 'rmtsrvname' ,
   [ @locallogin= ] 'locallogin'
GO

nothing works. There is no error. Any help.

Thanks

Viewing all 15872 articles
Browse latest View live


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