HD Crash SQL server -> DBCC - consistency errors in table 'sysindexes' - sql-server

Hello A client of mine has had an HD crash an a SQL DB got corrupt :
They did not make backups so they have a big problem.
When I tried (an ultimate measure) to DBCC-repair I got the following message.
Can anybody help me with this ?
Server: Msg 8966, Level 16, State 1, Line 1
Could not read and latch page (1:872) with latch type SH. sysindexes failed.
Server: Msg 8944, Level 16, State 1, Line 1
Table error: Object ID 2, index ID 0, page (1:872), row 11. Test (columnOffsets->IsComplex (varColumnNumber) && (ColumnId == COLID_HYDRA_TEXTPTR || ColumnId == COLID_INROW_ROOT || ColumnId == COLID_BACKPTR)) failed. Values are 2 and 5.
The repair level on the DBCC statement caused this repair to be bypassed.
CHECKTABLE found 0 allocation errors and 1 consistency errors in table 'sysindexes' (object ID 2).
DBCC execution completed. If DBCC printed error messages, contact your system administrator.

Paul Randal's blog has a really good article on CHECKDB.
http://www.sqlskills.com/BLOGS/PAUL/category/CHECKDB-From-Every-Angle.aspx

Related

SQL Server 2000 Error Creating Function

I can't create a function in SQL Server 2000 in my database. So, I tried to use the example in the help (F1), but I have the same error.
CREATE FUNCTION CubicVolume
-- Input dimensions in centimeters
(#CubeLength decimal(4,1),
#CubeWidth decimal(4,1),
#CubeHeight decimal(4,1)
)
RETURNS decimal(12,3) -- Cubic Centimeters.
AS
BEGIN
RETURN ( #CubeLength * #CubeWidth * #CubeHeight )
END
Errors:
Msg 170, Level 15, State 1, Line 2 Line 2:
Incorrect syntax near 'FUNCTION'.
Msg 137, Level 15, State 1, Line 9
Must declare the variable '#CubeLength'.
I run this script for Database Northwind and it didn't have problem, so I don't understand what the problem is.
thank you for your answers.
The problem was resolved.
The problem was compatibility on the level as Aaron Bertrand said.
Click Right on Database -->Properties-->Options-->Compatibility Level
(Needs 80 or high)
enter image description here

SQL 2016 error : Unable to launch runtime for 'R' script. Please check the configuration of the 'R' runtime

I started to explore R on SQL 2016 but running into errors. I resolved a few starting errors but can't get through with this one:
exec sp_execute_external_script
#language =N'R',
#script=N'OutputDataSet<-InputDataSet',
#input_data_1 =N'select 1 as hello'
with result sets (([hello] int not null));
go
Error:
Msg 39021, Level 16, State 1, Line 1
Unable to launch runtime for 'R' script. Please check the configuration of the 'R' runtime.
Msg 39019, Level 16, State 1, Line 1
An external script error occurred:
Unable to launch the runtime. ErrorCode 0x80070490: 1168(Element not found.).
Msg 11536, Level 16, State 1, Line 1
EXECUTE statement failed because its WITH RESULT SETS clause specified 1 result set(s), but the statement only sent 0 result set(s) at run time.
I found answers to set the Working Directory for R in Rlauncher.config.
But there is no Rlauncher.config on below path on my machine. Not Sure why?
C:\Program Files\Microsoft SQL Server 2016\MSSQL13.SQL2016\MSSQL\Binn
When I check the error log I see the following errors:
2016-11-13 19:41:14.131 Security Context Manager is initialized successfully.
2016-11-13 19:41:14.132 Satellite Session Manager is initialized successfully.
2016-11-13 19:41:14.133 Launcher DLL RLauncher.dll not loaded! Error: 126
2016-11-13 19:41:14.133 Failed to load the launcher RLauncher.dll and check satellite version
2016-11-13 19:41:14.133 No Launcher dlls were registered!
Please help.
Please make sure you have installed the R Services (In-Database) in the SQL Setup Feature selection page. Please note this is different from the R Server option. See here for details.

Database page-level restore seemingly ineffective

Background
SQL Server Enterprise 2012
Disk IO errors have occurred, causing two table errors:
DBCC CHECKDB(dbname)
GO
--Output:
--Msg 8939, Level 16, State 98, Line 1
--Table error: Object ID 0, index ID -1, partition ID 0, alloc unit ID 0 (type Unknown), page (3:7432269). Test (IS_OFF (BUF_IOERR, pBUF->bstat)) failed. Values are 133129 and -6.
--Msg 8939, Level 16, State 98, Line 1
--Table error: Object ID 0, index ID -1, partition ID 0, alloc unit ID 0 (type Unknown), page (3:7434265). Test (IS_OFF (BUF_IOERR, pBUF->bstat)) failed. Values are 133129 and -6.
The faulty disk has been replaced, with all files successfully copied to the replacement disk.
Problem
Having replaced the disk, subsequently carrying out a page-level restore from a full backup fortunately taken one day before the errors occurred results in 0 pages processed:
USE MASTER
RESTORE DATABASE dbname PAGE = '3:7434265, 3:7432269' FROM DISK = 'P:\MSSQL_BACKUPS\dbname\dbname\dbname_backup_2016_02_27_050001_8076562.full.bak' WITH NORECOVERY
GO
--Output:
--Processed 0 pages for database 'dbname', file 'dbname_pt0b' on file 1.
--RESTORE DATABASE ... FILE=<name> successfully processed 0 pages in 398.710 seconds (0.000 MB/sec).
Running CHECKDB again confirms the errors are still present. As far as I'm aware this is the correct method to recover from database corruption where only a small number of pages are affected. I know this won't get me to a stage where the database is fully restored - I need to restore the subsequent logs for that - but it should at least be in a state where the table errors have been fixed. What am I missing?
Thanks

DBCC - consistency errors

I have a error like Table error: Object ID 3, index ID 1, Page is missing a reference from previous page.
DBCC results for 'RKB'.
Msg 8978, Level 16, State 1, Line 1
Table error: Object ID 3, index ID 1, partition ID 196608, alloc unit ID 196608 (type In-row data).
Page (1:452) is missing a reference from previous page (1:16153).
Possible chain linkage problem.
CHECKDB found 0 allocation errors and 1 consistency errors in table 'sys.sysrscols' (object ID 3).
Msg 7995, Level 16, State 1, Line 1
Database 'RKB': consistency errors in system catalogs prevent further DBCC checkdb processing.
CHECKDB found 0 allocation errors and 1 consistency errors in table '(Object ID 99)' (object ID 99).
CHECKDB found 0 allocation errors and 2 consistency errors in database 'RKB'.
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
I am try with DBCC CHECKDB (RKB, REPAIR_ALLOW_DATA_LOSS) WITH ALL_ERRORMSGS but my consistency errors not solved. How can I fix this error? can anyone help me?
You can try recreating or reloading the table. You can have more info on this link
http://www.sqlsoldier.com/wp/sqlserver/introductiontointegritychainlinkageproblems
But if you see frequent errors like this, you should check you I/O sub system.

SQL Server error

I am getting a fatal error on following code.
exec [sp_ExternalApp_UPDATEUSER] 'ZZZ', XXXXX','DDDDD','DDDFFDD','EREE', 'EREWWWWW',1,1,'QWEW#DFEE.DER','DEFF','XXXX','DDDD'
Following error occurred:
Location: memilb.cpp:1624
Expression: pilb->m_cRef == 0
SPID: 79
Process ID: 2256
Msg 3624, Level 20, State 1, Procedure sp_ExternalApp_UPDATEUSER, Line 32
A system assertion check has failed. Check the SQL Server error log for details
Msg 0, Level 20, State 0, Line 0
A severe error occurred on the current command. The results, if any, should be discarded.
Thank you
I got the solution.
I have used UPPER() function. As I removed that function, my problem solved
Like the message said, check your error log, there might be more detail in there..what does this proc do does it use sp_OACreate or calls xp_cmdshell? Post the proc code
You might want to check the database for corruption. Try
DBCC CHECKDB
(before doing so, read the documentation on that command! See http://msdn.microsoft.com/en-us/library/ms176064.aspx )

Resources