Tuesday, March 27, 2012
ATTACH DB ERROR
I try to attach a database and the following error occurs:
Server: Msg 644, Level 21, State 5, Line 1
Could not find the index entry for RID '16a5eed57f3000300' in index page
(1:29375), index ID 8, database 'mat'.
26 transactions rolled forward in database 'mat' (10).
Connection Broken
Can anyone help me?The database was most probably corrupt when you detached it. Search the new
updated Books Online for
specific recommendations for your particular error number. consider opening
a case with MS Support.
Also, you might want to check http://www.karaszi.com/SQLServer/in...br />
t_db.asp
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"koletsis theo" <koletsis theo@.discussions.microsoft.com> wrote in message
news:393BC089-3F37-4EBA-AA3D-66D51A6E9655@.microsoft.com...
> Hello
> I try to attach a database and the following error occurs:
> Server: Msg 644, Level 21, State 5, Line 1
> Could not find the index entry for RID '16a5eed57f3000300' in index page
> (1:29375), index ID 8, database 'mat'.
> 26 transactions rolled forward in database 'mat' (10).
> Connection Broken
> Can anyone help me?
>
>|||In addition , I'm sure you have last backup of the database.
"koletsis theo" <koletsis theo@.discussions.microsoft.com> wrote in message
news:393BC089-3F37-4EBA-AA3D-66D51A6E9655@.microsoft.com...
> Hello
> I try to attach a database and the following error occurs:
> Server: Msg 644, Level 21, State 5, Line 1
> Could not find the index entry for RID '16a5eed57f3000300' in index page
> (1:29375), index ID 8, database 'mat'.
> 26 transactions rolled forward in database 'mat' (10).
> Connection Broken
> Can anyone help me?
>
>
ATTACH DB ERROR
I try to attach a database and the following error occurs:
Server: Msg 644, Level 21, State 5, Line 1
Could not find the index entry for RID '16a5eed57f3000300' in index page
(1:29375), index ID 8, database 'mat'.
26 transactions rolled forward in database 'mat' (10).
Connection Broken
Can anyone help me?The database was most probably corrupt when you detached it. Search the new updated Books Online for
specific recommendations for your particular error number. consider opening a case with MS Support.
Also, you might want to check http://www.karaszi.com/SQLServer/info_corrupt_suspect_db.asp
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"koletsis theo" <koletsis theo@.discussions.microsoft.com> wrote in message
news:393BC089-3F37-4EBA-AA3D-66D51A6E9655@.microsoft.com...
> Hello
> I try to attach a database and the following error occurs:
> Server: Msg 644, Level 21, State 5, Line 1
> Could not find the index entry for RID '16a5eed57f3000300' in index page
> (1:29375), index ID 8, database 'mat'.
> 26 transactions rolled forward in database 'mat' (10).
> Connection Broken
> Can anyone help me?
>
>|||In addition , I'm sure you have last backup of the database.
"koletsis theo" <koletsis theo@.discussions.microsoft.com> wrote in message
news:393BC089-3F37-4EBA-AA3D-66D51A6E9655@.microsoft.com...
> Hello
> I try to attach a database and the following error occurs:
> Server: Msg 644, Level 21, State 5, Line 1
> Could not find the index entry for RID '16a5eed57f3000300' in index page
> (1:29375), index ID 8, database 'mat'.
> 26 transactions rolled forward in database 'mat' (10).
> Connection Broken
> Can anyone help me?
>
>
ATTACH DB ERROR
I try to attach a database and the following error occurs:
Server: Msg 644, Level 21, State 5, Line 1
Could not find the index entry for RID '16a5eed57f3000300' in index page
(1:29375), index ID 8, database 'mat'.
26 transactions rolled forward in database 'mat' (10).
Connection Broken
Can anyone help me?
The database was most probably corrupt when you detached it. Search the new updated Books Online for
specific recommendations for your particular error number. consider opening a case with MS Support.
Also, you might want to check http://www.karaszi.com/SQLServer/inf...suspect_db.asp
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"koletsis theo" <koletsis theo@.discussions.microsoft.com> wrote in message
news:393BC089-3F37-4EBA-AA3D-66D51A6E9655@.microsoft.com...
> Hello
> I try to attach a database and the following error occurs:
> Server: Msg 644, Level 21, State 5, Line 1
> Could not find the index entry for RID '16a5eed57f3000300' in index page
> (1:29375), index ID 8, database 'mat'.
> 26 transactions rolled forward in database 'mat' (10).
> Connection Broken
> Can anyone help me?
>
>
|||In addition , I'm sure you have last backup of the database.
"koletsis theo" <koletsis theo@.discussions.microsoft.com> wrote in message
news:393BC089-3F37-4EBA-AA3D-66D51A6E9655@.microsoft.com...
> Hello
> I try to attach a database and the following error occurs:
> Server: Msg 644, Level 21, State 5, Line 1
> Could not find the index entry for RID '16a5eed57f3000300' in index page
> (1:29375), index ID 8, database 'mat'.
> 26 transactions rolled forward in database 'mat' (10).
> Connection Broken
> Can anyone help me?
>
>
Sunday, March 25, 2012
Attach a database
database. I received the following message...
Server: Msg 9001, Level 21, State 3, Line 266
The log for database 'DB_ST' is not available.
Connection Broken
I found that there was no log file!!! I have no idea why not. So I decided
to try to detach the database and re-attach using sp_attach_single_file_db a
s
follows and received...
USE MASTER
EXEC sp_attach_single_file_db @.dbname = 'DB_ST',
@.physname = 'D:\Databases\DB_ST_DATA.mdf'
Server: Msg 5105, Level 16, State 4, Line 1
Device activation error. The physical file name
'D:\Databases\QUINN_ST_DATA.mdf' may be incorrect.
Now I am stumped with no database and log. I have just called the
applications manager who thinks we may need to restore from another
environment. I question whether he backed up the development environment!!!!
!
Is this the only option I have?Yes. sp_attach_single_file_db might is only guaranteed to work if you detach
properly the database with sp_detach_db first, that is with the log file
still there. In other situation, like the one you have, it might work
sometimes, but is far from guaranteed. In that case you need to restore from
a backup.
Jacco Schalkwijk
SQL Server MVP
"marcmc" <marcmc@.discussions.microsoft.com> wrote in message
news:EDB0B871-2BFD-4720-9896-395234B36662@.microsoft.com...
> Yesterday, I found I could not do a select into in my development staging
> database. I received the following message...
> Server: Msg 9001, Level 21, State 3, Line 266
> The log for database 'DB_ST' is not available.
> Connection Broken
> I found that there was no log file!!! I have no idea why not. So I decided
> to try to detach the database and re-attach using sp_attach_single_file_db
> as
> follows and received...
> USE MASTER
> EXEC sp_attach_single_file_db @.dbname = 'DB_ST',
> @.physname = 'D:\Databases\DB_ST_DATA.mdf'
> Server: Msg 5105, Level 16, State 4, Line 1
> Device activation error. The physical file name
> 'D:\Databases\QUINN_ST_DATA.mdf' may be incorrect.
> Now I am stumped with no database and log. I have just called the
> applications manager who thinks we may need to restore from another
> environment. I question whether he backed up the development
> environment!!!!!
> Is this the only option I have?|||Thanks Jacco... I thought that would be the case.
"Jacco Schalkwijk" wrote:
> Yes. sp_attach_single_file_db might is only guaranteed to work if you deta
ch
> properly the database with sp_detach_db first, that is with the log file
> still there. In other situation, like the one you have, it might work
> sometimes, but is far from guaranteed. In that case you need to restore fr
om
> a backup.
> --
> Jacco Schalkwijk
> SQL Server MVP
>
> "marcmc" <marcmc@.discussions.microsoft.com> wrote in message
> news:EDB0B871-2BFD-4720-9896-395234B36662@.microsoft.com...
>
>sql
Sunday, March 11, 2012
Assigning properties to variables
I can see how to assign properties from variables, but not the other way round.
Can anyone explain to me how to do this?
Many thanks
RudyHi,
i've done something like this with a Script Task in SSIS.
1. Create some Variables you need in the Variables Window
2. Create a Script Task and put you Readonly and Readwrite Varibales at the
Properties of the Script Task Editor.
3. Use the Design Scritp Button at this Task to define a Script.
4. My Script was designed to create dynamic SQL Statements:
Dim CreateTable, SelectTable, CreateIndex, CreateConstraint, DropConstraint As String
Dim Table As String = CStr(Dts.Variables("TSDES").Value)
Dim SB As New System.Text.StringBuilder(1024)
'Create Table
SB.Append("IF NOT EXISTS (SELECT * FROM sys.tables WHERE type ='U' and name = 'Dim" & CStr(Dts.Variables("TSDES").Value).Trim & "')" & vbNewLine)
SB.Append("BEGIN" & vbNewLine)
SB.Append(" BEGIN Transaction" & vbNewLine)
SB.Append(" CREATE TABLE baan.Dim" & CStr(Dts.Variables("TSDES").Value).Trim & vbNewLine)
SB.Append(" (" & vbNewLine)
SB.Append(" TDTYP numeric(38, 0) NOT NULL," & vbNewLine)
SB.Append(" TDIMX nvarchar(6) NOT NULL," & vbNewLine)
SB.Append(" TDESC nvarchar(30) NOT NULL," & vbNewLine)
SB.Append(" TPDIX nvarchar(6) NOT NULL," & vbNewLine)
SB.Append(" TEMNO numeric(38,0) NOT NULL" & vbNewLine)
SB.Append(" ) ON [PRIMARY]" & vbNewLine)
SB.Append(" COMMIT" & vbNewLine)
SB.Append("End" & vbNewLine)
SB.Append("ELSE" & vbNewLine)
SB.Append(" TRUNCATE TABLE baan.Dim" & CStr(Dts.Variables("TSDES").Value) & vbNewLine)
Dts.Variables("CREATETABLE").Value = SB.ToString
SB.Remove(0, SB.Length)
...
That's it.
I hope this could be helpfull for you.
Kind Regards
Andy L?wen
When you setup the script task, make sure you set the 'Read/Write Variables' property in the properties dialog, or the script code will fail.
Here is a sample of the script which should give you and idea how to set the value of a package level variable.
Public Sub Main()
Dim VarName As String = ""
Try
Dim varCurrent As Microsoft.SqlServer.Dts.Runtime.Variable
VarName = "User::ObjectName"
varCurrent = Dts.Variables.Item(VarName)
' Set the current value of the Variable
varCurrent.Value = "VTDW_PROD_CMS_AccountInstance"
VarName = "Completed"
Catch Ex As Exception
Dts.TaskResult = Dts.Results.Failure
Dts.Events.FireError(1, "Validate Variables", String.Format("Missing one of the following variables [User::Phase, User::ObjectName, User::ObjectType, User::StepName]. These Variables must be defined. Current Variable ='{0}'", VarName),Nothing, 0)
Return
End Try
' Found all variables. Let the Phase run
Dts.Events.FireInformation(0, "Valor DW DTS", String.Format("All step variables for Phase '{0}' and Step '{1}' have been set.", Phase, StepName), Nothing, 0, Nothing)
Dts.TaskResult = Dts.Results.Success
|||AndyCan you explain me what your script task exactly does
I'm searching for a script that changes the sql-commands
Thx
Assigning properties to variables
I can see how to assign properties from variables, but not the other way round.
Can anyone explain to me how to do this?
Many thanks
RudyHi,
i've done something like this with a Script Task in SSIS.
1. Create some Variables you need in the Variables Window
2. Create a Script Task and put you Readonly and Readwrite Varibales at the
Properties of the Script Task Editor.
3. Use the Design Scritp Button at this Task to define a Script.
4. My Script was designed to create dynamic SQL Statements:
Dim CreateTable, SelectTable, CreateIndex, CreateConstraint, DropConstraint As String
Dim Table As String = CStr(Dts.Variables("TSDES").Value)
Dim SB As New System.Text.StringBuilder(1024)
'Create Table
SB.Append("IF NOT EXISTS (SELECT * FROM sys.tables WHERE type ='U' and name = 'Dim" & CStr(Dts.Variables("TSDES").Value).Trim & "')" & vbNewLine)
SB.Append("BEGIN" & vbNewLine)
SB.Append(" BEGIN Transaction" & vbNewLine)
SB.Append(" CREATE TABLE baan.Dim" & CStr(Dts.Variables("TSDES").Value).Trim & vbNewLine)
SB.Append(" (" & vbNewLine)
SB.Append(" TDTYP numeric(38, 0) NOT NULL," & vbNewLine)
SB.Append(" TDIMX nvarchar(6) NOT NULL," & vbNewLine)
SB.Append(" TDESC nvarchar(30) NOT NULL," & vbNewLine)
SB.Append(" TPDIX nvarchar(6) NOT NULL," & vbNewLine)
SB.Append(" TEMNO numeric(38,0) NOT NULL" & vbNewLine)
SB.Append(" ) ON [PRIMARY]" & vbNewLine)
SB.Append(" COMMIT" & vbNewLine)
SB.Append("End" & vbNewLine)
SB.Append("ELSE" & vbNewLine)
SB.Append(" TRUNCATE TABLE baan.Dim" & CStr(Dts.Variables("TSDES").Value) & vbNewLine)
Dts.Variables("CREATETABLE").Value = SB.ToString
SB.Remove(0, SB.Length)
...
That's it.
I hope this could be helpfull for you.
Kind Regards
Andy L?wen
When you setup the script task, make sure you set the 'Read/Write Variables' property in the properties dialog, or the script code will fail.
Here is a sample of the script which should give you and idea how to set the value of a package level variable.
Public Sub Main()
Dim VarName As String = ""
Try
Dim varCurrent As Microsoft.SqlServer.Dts.Runtime.Variable
VarName = "User::ObjectName"
varCurrent = Dts.Variables.Item(VarName)
' Set the current value of the Variable
varCurrent.Value = "VTDW_PROD_CMS_AccountInstance"
VarName = "Completed"
Catch Ex As Exception
Dts.TaskResult = Dts.Results.Failure
Dts.Events.FireError(1, "Validate Variables", String.Format("Missing one of the following variables [User::Phase, User::ObjectName, User::ObjectType, User::StepName]. These Variables must be defined. Current Variable ='{0}'", VarName),Nothing, 0)
Return
End Try
' Found all variables. Let the Phase run
Dts.Events.FireInformation(0, "Valor DW DTS", String.Format("All step variables for Phase '{0}' and Step '{1}' have been set.", Phase, StepName), Nothing, 0, Nothing)
Dts.TaskResult = Dts.Results.Success
|||AndyCan you explain me what your script task exactly does
I'm searching for a script that changes the sql-commands
Thx
Thursday, March 8, 2012
Assigning database level db_owner permission to a SQL Server Login
I was hoping that somebody out there would be able to help me out
with this one. I am trying to assign a database level db_owner role
permission to a SQL server level login that I have created. I can
easily do this from enterpise manager but I need to be able to script
this process.
The way I do this from enterprise manager in SQL server 2000 is by
going inside the SECURITY FOLDER in the SQL server, then inside
SECURITY I click on LOGINS and within LOGINS I double click on the
login that I created. I get the SQL Server Login Properties which
contains three tabs - GENERAL, SERVER ROLES and DATABASE ACCESS. I
click on the DATABASE ACCESS tab and then select the appropriate
database and then check the db_owner role in the "Permit in Database
Role" window for the selected database.
I need to be able to do this via a script. Any help would be greatly
appreciated.
Thanks!!!(deepchopra1981@.gmail.com) writes:
> I was hoping that somebody out there would be able to help me out
> with this one. I am trying to assign a database level db_owner role
> permission to a SQL server level login that I have created. I can
> easily do this from enterpise manager but I need to be able to script
> this process.
> The way I do this from enterprise manager in SQL server 2000 is by
> going inside the SECURITY FOLDER in the SQL server, then inside
> SECURITY I click on LOGINS and within LOGINS I double click on the
> login that I created. I get the SQL Server Login Properties which
> contains three tabs - GENERAL, SERVER ROLES and DATABASE ACCESS. I
> click on the DATABASE ACCESS tab and then select the appropriate
> database and then check the db_owner role in the "Permit in Database
> Role" window for the selected database.
> I need to be able to do this via a script. Any help would be greatly
> appreciated.
Why not simply use Profiler to spy on Enterprise Manager?
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||On Apr 21, 1:30 pm, Erland Sommarskog <esq...@.sommarskog.se> wrote:
> (deepchopra1...@.gmail.com) writes:
> Why not simply use Profiler to spy on Enterprise Manager?
> --
> Erland Sommarskog,SQLServerMVP, esq...@.sommarskog.se
> Books Online forSQLServer2005 athttp://www.microsoft.com/technet/prodtechn
ol/sql/2005/downloads/books...
> Books Online forSQLServer2000 athttp://www.microsoft.com/sql/prodinfo/prev
iousversions/books.mspx- Hide quoted text -
> - Show quoted text -
Thats a brilliant idea. It helped. Thanks a ton.