Showing posts with label select. Show all posts
Showing posts with label select. Show all posts

Tuesday, March 20, 2012

authentication failed

Hi.

I wrote a view command on server1 like ..

select dbo.ordr.docnum from Server2.SAP.dbo.ordr where dbo.ordr.docstatus ='o' and

system dispaly a error message is authentication failed. but I use administrator to logon

Server1. how to setup authentication between 2 SQL server?

Thanks

moved to security forum.

|||

I would suggest trying to find out a solution on BOL, here is a good staring point:

· Distributed Queries http://msdn2.microsoft.com/en-us/library/ms188721.aspx

· Distributed Queries Stored Procedures http://msdn2.microsoft.com/en-us/library/ms174359.aspx

Since it seems like you may be using Windows credentials to connect to the 2nd server, I would also strongly recommend reading the following topic:

· Configuring Linked Servers for Delegation http://msdn2.microsoft.com/en-us/library/ms189580.aspx

Please let us know if this information helped or if you have any additional questions.

Thanks,

-Raul Garcia

SDE/T

SQL Server Engine

|||

Thanks.

I found a topic is "How to create a linked server", so I resolved my problem.

sql

Authentication

I just wonder my office server setup:
In EM:
1) Right click the instance, select 'Edit SQL Server Registration
properties...'
2) The 'Use Windows authentication' radio button is selected
3) Right click to select the instance, select 'Properties'
4) Security tab
5) 'SQL Server and Windows' authentication radio button is selected
6) Then I created a SQL Server login, eg. username is 'Alan', password is
also 'Alan'
So is this SQL Server 'Windows only' or 'SQL Server and Windows'
authentication ?it's still 'windows authentication only'. your sql login is created/valid
but it will not allow you to connect to sqlserver.
-oj
"Alan" <alanpltseNOSPAM@.yahoo.com.au> wrote in message
news:eYzuHORkGHA.3512@.TK2MSFTNGP03.phx.gbl...
>I just wonder my office server setup:
> In EM:
> 1) Right click the instance, select 'Edit SQL Server Registration
> properties...'
> 2) The 'Use Windows authentication' radio button is selected
> 3) Right click to select the instance, select 'Properties'
> 4) Security tab
> 5) 'SQL Server and Windows' authentication radio button is selected
> 6) Then I created a SQL Server login, eg. username is 'Alan', password is
> also 'Alan'
> So is this SQL Server 'Windows only' or 'SQL Server and Windows'
> authentication ?
>
>|||Its mixed mode authentication enabled.
You have registered server using windows authentication but you can
connect also using sql server login.
Regards
Amish Shah
oj wrote:
> it's still 'windows authentication only'. your sql login is created/valid
> but it will not allow you to connect to sqlserver.
>
> --
> -oj
>
> "Alan" <alanpltseNOSPAM@.yahoo.com.au> wrote in message
> news:eYzuHORkGHA.3512@.TK2MSFTNGP03.phx.gbl...
> >I just wonder my office server setup:
> >
> > In EM:
> > 1) Right click the instance, select 'Edit SQL Server Registration
> > properties...'
> > 2) The 'Use Windows authentication' radio button is selected
> > 3) Right click to select the instance, select 'Properties'
> > 4) Security tab
> > 5) 'SQL Server and Windows' authentication radio button is selected
> > 6) Then I created a SQL Server login, eg. username is 'Alan', password is
> > also 'Alan'
> >
> > So is this SQL Server 'Windows only' or 'SQL Server and Windows'
> > authentication ?
> >
> >
> >|||Alan wrote:
> I just wonder my office server setup:
> In EM:
> 1) Right click the instance, select 'Edit SQL Server Registration
> properties...'
> 2) The 'Use Windows authentication' radio button is selected
> 3) Right click to select the instance, select 'Properties'
> 4) Security tab
> 5) 'SQL Server and Windows' authentication radio button is selected
> 6) Then I created a SQL Server login, eg. username is 'Alan', password is
> also 'Alan'
> So is this SQL Server 'Windows only' or 'SQL Server and Windows'
> authentication ?
>
>
The authentication mode specified in the Registration properties has
nothing to do with the authentication mode that the server is using, it
only tells Enterprise Manager what sort of authentication method to use
when connecting to the server.
In your case, your SERVER is setup for mixed-mode authentication,
meaning it will accept either Windows credentials, or a valid SQL
login/password combo.
When you connect to it using your current Enterprise Manager
registration, EM is passing your current Windows login credentials to
the server, your SQL login "Alan" isn't being used at all. You can
confirm this by looking at the sysprocesses table after connecting from
EM, you'll see your spid, along with the login name that you're
connected with.|||my bad (should have read your post carefully before answering)...>> 5) 'SQL
Server and Windows' authentication radio button is selected<<
means the server is setup for mixed mode. Under this mode, you can connect
to sqlserver with either windows acct or sql login.
If you have properly created "alan" sql login, you should be able to connect
to sqlserver with that acct. The easiest way to test is to open Query
Analyzer (from Tools menu) and use "alan" as the credential.
--
-oj
"oj" <nospam_ojngo@.home.com> wrote in message
news:u$4pxhRkGHA.1204@.TK2MSFTNGP02.phx.gbl...
> it's still 'windows authentication only'. your sql login is created/valid
> but it will not allow you to connect to sqlserver.
>
> --
> -oj
>
> "Alan" <alanpltseNOSPAM@.yahoo.com.au> wrote in message
> news:eYzuHORkGHA.3512@.TK2MSFTNGP03.phx.gbl...
>>I just wonder my office server setup:
>> In EM:
>> 1) Right click the instance, select 'Edit SQL Server Registration
>> properties...'
>> 2) The 'Use Windows authentication' radio button is selected
>> 3) Right click to select the instance, select 'Properties'
>> 4) Security tab
>> 5) 'SQL Server and Windows' authentication radio button is selected
>> 6) Then I created a SQL Server login, eg. username is 'Alan', password is
>> also 'Alan'
>> So is this SQL Server 'Windows only' or 'SQL Server and Windows'
>> authentication ?
>>
>|||So in 'registration properties' determines what mode is using to connect
when opening the 'EM' to connection SQL Server ?
Only the 'Properties' determine how the login connect the server ?
"Tracy McKibben" <tracy@.realsqlguy.com> wrote in message
news:%23tqJ3YUkGHA.5036@.TK2MSFTNGP04.phx.gbl...
> Alan wrote:
>> I just wonder my office server setup:
>> In EM:
>> 1) Right click the instance, select 'Edit SQL Server Registration
>> properties...'
>> 2) The 'Use Windows authentication' radio button is selected
>> 3) Right click to select the instance, select 'Properties'
>> 4) Security tab
>> 5) 'SQL Server and Windows' authentication radio button is selected
>> 6) Then I created a SQL Server login, eg. username is 'Alan', password is
>> also 'Alan'
>> So is this SQL Server 'Windows only' or 'SQL Server and Windows'
>> authentication ?
>>
> The authentication mode specified in the Registration properties has
> nothing to do with the authentication mode that the server is using, it
> only tells Enterprise Manager what sort of authentication method to use
> when connecting to the server.
> In your case, your SERVER is setup for mixed-mode authentication, meaning
> it will accept either Windows credentials, or a valid SQL login/password
> combo.
> When you connect to it using your current Enterprise Manager registration,
> EM is passing your current Windows login credentials to the server, your
> SQL login "Alan" isn't being used at all. You can confirm this by looking
> at the sysprocesses table after connecting from EM, you'll see your spid,
> along with the login name that you're connected with.|||Alan T wrote:
> So in 'registration properties' determines what mode is using to connect
> when opening the 'EM' to connection SQL Server ?
> Only the 'Properties' determine how the login connect the server ?
>
Correct
Tracy McKibben
MCDBA
http://www.realsqlguy.comsql

Monday, March 19, 2012

auditting select statement

We have triggers written for insert/update/deletes of data, now there is a
new requirement to audit select statements ran against the database.
I know SQL Profiler shows the select statements ran. I was wondering if
anyone has suggestions on how to somehow use that function(or any other idea
)
and incorparate it into tracking all select statements?Tracey wrote:
> We have triggers written for insert/update/deletes of data, now there is a
> new requirement to audit select statements ran against the database.
> I know SQL Profiler shows the select statements ran. I was wondering if
> anyone has suggestions on how to somehow use that function(or any other id
ea)
> and incorparate it into tracking all select statements?
We monitor everything that happens in our production databases, by
running server-side traces 24x7 into rotating trace log files. Easily
done using sp_trace_create, etc., providing you have the disk space to
store the accumulating trace log files.
You get the added benefit of being able to analyze your database
activity to look for poorly performing queries.|||SQL Server does not track this activity. Profiler can see it because it
views all commands going into the database. Some options:
(1) If you deny SELECT access to tables and views, and force all access
through stored procedures, it is trivial to log this.
(2) You can have a trace running all the time that dumps data into trace
table(s).
(3) Or you can look at 3rd party tools (in which case, you won't have to
write all of the reporting over the trace table(s)). For example,
Lumigent's Audit DB or Log Explorer. See
http://www.aspfaq.com/search.asp?q=lumigent
"Tracey" <Tracey@.discussions.microsoft.com> wrote in message
news:F7DB3821-3537-493A-A19F-8C17D5A44799@.microsoft.com...
> We have triggers written for insert/update/deletes of data, now there is a
> new requirement to audit select statements ran against the database.
> I know SQL Profiler shows the select statements ran. I was wondering if
> anyone has suggestions on how to somehow use that function(or any other
> idea)
> and incorparate it into tracking all select statements?|||Tracey
Take a look at Dejan's example
For example, lets say we want to follow selects on the Customers table of
the Northwind database. Create a trace with only the following settings:
- SP:StmtCompleted and SQL: StmtCompleted events
- EventClass, TextData, ApplicationName and SPID columns
- DatabaseID Equals 6 (DB_ID() of the Northwind database) and
TextData Like select%customers% filters
- Name the trace SelectTrigger and save it to a table with the same
name in the Northwind database.
Start the trace, and create the following trigger using Query Analyzer:
CREATE TRIGGER TraceSelectTrigger ON SelectTrigger
FOR INSERT
AS
EXEC master.dbo.xp_logevent 60000, 'Select from Customers happened!',
warning
Now check how trigger works by performing couple of selects:
SELECT TOP 1 *
FROM Customers
SELECT TOP 1 *
FROM Orders
SELECT TOP 1 c.CustomerID
FROM Customers c INNER JOIN Orders o
ON c.CustomerID=o.CustomerID
With Event Viewer, check whether you got two warnings in the Application log
for the 1st and the 3rd queries (the 2nd should be filtered out).
"Tracey" <Tracey@.discussions.microsoft.com> wrote in message
news:F7DB3821-3537-493A-A19F-8C17D5A44799@.microsoft.com...
> We have triggers written for insert/update/deletes of data, now there is a
> new requirement to audit select statements ran against the database.
> I know SQL Profiler shows the select statements ran. I was wondering if
> anyone has suggestions on how to somehow use that function(or any other
> idea)
> and incorparate it into tracking all select statements?|||Hi Uri,
Seems good.. But is it fool -proof.
what will happen if I query this way.. just for an arguement
SELECT TOP 1 [Customers List].Customer_ID
FROM Orders as [Customers List]
-Omnibuzz (The SQL GC)
http://omnibuzz-sql.blogspot.com/
"Uri Dimant" wrote:

> Tracey
> Take a look at Dejan's example
> For example, let’s say we want to follow selects on the Customers table
of
> the Northwind database. Create a trace with only the following settings:
> - SP:StmtCompleted and SQL: StmtCompleted events
> - EventClass, TextData, ApplicationName and SPID columns
> - DatabaseID Equals 6 (DB_ID() of the Northwind database) and
> TextData Like select%customers% filters
> - Name the trace SelectTrigger and save it to a table with the sa
me
> name in the Northwind database.
> Start the trace, and create the following trigger using Query Analyzer:
>
> CREATE TRIGGER TraceSelectTrigger ON SelectTrigger
> FOR INSERT
> AS
> EXEC master.dbo.xp_logevent 60000, 'Select from Customers happened!',
> warning
>
> Now check how trigger works by performing couple of selects:
>
> SELECT TOP 1 *
> FROM Customers
> SELECT TOP 1 *
> FROM Orders
> SELECT TOP 1 c.CustomerID
> FROM Customers c INNER JOIN Orders o
> ON c.CustomerID=o.CustomerID
>
> With Event Viewer, check whether you got two warnings in the Application l
og
> for the 1st and the 3rd queries (the 2nd should be filtered out).
>
> "Tracey" <Tracey@.discussions.microsoft.com> wrote in message
> news:F7DB3821-3537-493A-A19F-8C17D5A44799@.microsoft.com...
>
>|||Hi
This one will also be logged to the Apllication Viewer, however I agree that
this method is not perfect
"Omnibuzz" <Omnibuzz@.discussions.microsoft.com> wrote in message
news:499B5B18-A216-4732-BF8A-6B295C23D7D1@.microsoft.com...
> Hi Uri,
> Seems good.. But is it fool -proof.
> what will happen if I query this way.. just for an arguement
> SELECT TOP 1 [Customers List].Customer_ID
> FROM Orders as [Customers List]
> --
> -Omnibuzz (The SQL GC)
> http://omnibuzz-sql.blogspot.com/
>
> "Uri Dimant" wrote:
>

Sunday, March 11, 2012

auditing SELECT statements

Is there a way to audit SELECT statements on a table? A
database has a few hundred tables and I was asked to find
the tables which are not used in the application. The same
question for UPDATE, DELETE and INSERT (it is not
desirable to use triggers to trace DML statements).
Thanks in advance, GregYou can use SQL Profiler. You use SQL Profiler to define your trace/audit
first. In the definition, you can filter for SELECT and/or the table name.
Then, you can generate a T-SQL script, using the Script Trace ... option
under the File menu, to run on the server side without any GUI frontend.
Check out the following articles:
http://support.microsoft.com/default.aspx?scid=kb;en-us;283790&Product=sql2k
http://support.microsoft.com/default.aspx?scid=kb;en-us;283786&Product=sql2k
--
Linchi Shea
linchi_shea@.NOSPAMml.com
"Greg" <anonymous@.discussions.microsoft.com> wrote in message
news:04f001c39e76$54347780$a401280a@.phx.gbl...
> Is there a way to audit SELECT statements on a table? A
> database has a few hundred tables and I was asked to find
> the tables which are not used in the application. The same
> question for UPDATE, DELETE and INSERT (it is not
> desirable to use triggers to trace DML statements).
> Thanks in advance, Greg|||Hmmm...I've never seen that ability before -- that's very cool!
"Linchi Shea" <linchi_shea@.NOSPAMml.com> wrote in message
news:e$hF6CpnDHA.1072@.TK2MSFTNGP09.phx.gbl...
> You can use SQL Profiler. You use SQL Profiler to define your trace/audit
> first. In the definition, you can filter for SELECT and/or the table name.
> Then, you can generate a T-SQL script, using the Script Trace ... option
> under the File menu, to run on the server side without any GUI frontend.
> Check out the following articles:
> http://support.microsoft.com/default.aspx?scid=kb;en-us;283790&Product=sql2k
> http://support.microsoft.com/default.aspx?scid=kb;en-us;283786&Product=sql2k
> --
> Linchi Shea
> linchi_shea@.NOSPAMml.com
>
> "Greg" <anonymous@.discussions.microsoft.com> wrote in message
> news:04f001c39e76$54347780$a401280a@.phx.gbl...
> > Is there a way to audit SELECT statements on a table? A
> > database has a few hundred tables and I was asked to find
> > the tables which are not used in the application. The same
> > question for UPDATE, DELETE and INSERT (it is not
> > desirable to use triggers to trace DML statements).
> >
> > Thanks in advance, Greg
>|||If you have access to the source code of the application you can try
SQLClean by www.lockwoodtech.com . I haven't tried it myself though.
--
Jacco Schalkwijk
SQL Server MVP
"Greg" <anonymous@.discussions.microsoft.com> wrote in message
news:04f001c39e76$54347780$a401280a@.phx.gbl...
> Is there a way to audit SELECT statements on a table? A
> database has a few hundred tables and I was asked to find
> the tables which are not used in the application. The same
> question for UPDATE, DELETE and INSERT (it is not
> desirable to use triggers to trace DML statements).
> Thanks in advance, Greg|||Linchi, is there a way to get ObjectName in the trace?
When i define a trace definition i can add ObjectName,
ObjectID or OwnerName but they are always empty. Is there
a way to populate them? Thanks for your help. Greg
>--Original Message--
>You can use SQL Profiler. You use SQL Profiler to define
your trace/audit
>first. In the definition, you can filter for SELECT
and/or the table name.
>Then, you can generate a T-SQL script, using the Script
Trace ... option
>under the File menu, to run on the server side without
any GUI frontend.
>Check out the following articles:
>http://support.microsoft.com/default.aspx?scid=kb;en-
us;283790&Product=sql2k
>http://support.microsoft.com/default.aspx?scid=kb;en-
us;283786&Product=sql2k
>--
>Linchi Shea
>linchi_shea@.NOSPAMml.com
>
>"Greg" <anonymous@.discussions.microsoft.com> wrote in
message
>news:04f001c39e76$54347780$a401280a@.phx.gbl...
>> Is there a way to audit SELECT statements on a table? A
>> database has a few hundred tables and I was asked to
find
>> the tables which are not used in the application. The
same
>> question for UPDATE, DELETE and INSERT (it is not
>> desirable to use triggers to trace DML statements).
>> Thanks in advance, Greg
>
>.
>

Auditing Select Statements

Hello,
I need to find out if there is a way to audit selects against a certain
table. I know you can use triggers to monitor inserts, updates and
deletes but is there a way to monitor when someone selects specific
data? Thanks!
Rachael
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!Go to Lumigents web site... www.lumigent.com... I beleive they have an
auditing tool that does what you wish..
--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Rachael" <rachael_faber@.hotmail.com> wrote in message
news:eu0FLAVVEHA.584@.TK2MSFTNGP09.phx.gbl...
> Hello,
> I need to find out if there is a way to audit selects against a certain
> table. I know you can use triggers to monitor inserts, updates and
> deletes but is there a way to monitor when someone selects specific
> data? Thanks!
> Rachael
>
> *** Sent via Devdex http://www.devdex.com ***
> Don't just participate in USENET...get rewarded for it!

Auditing Select Statements

Hello,
I need to find out if there is a way to audit selects against a certain
table. I know you can use triggers to monitor inserts, updates and
deletes but is there a way to monitor when someone selects specific
data? Thanks!
Rachael
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Go to Lumigents web site... www.lumigent.com... I beleive they have an
auditing tool that does what you wish..
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Rachael" <rachael_faber@.hotmail.com> wrote in message
news:eu0FLAVVEHA.584@.TK2MSFTNGP09.phx.gbl...
> Hello,
> I need to find out if there is a way to audit selects against a certain
> table. I know you can use triggers to monitor inserts, updates and
> deletes but is there a way to monitor when someone selects specific
> data? Thanks!
> Rachael
>
> *** Sent via Devdex http://www.devdex.com ***
> Don't just participate in USENET...get rewarded for it!

Auditing Select Statements

Hello,
I need to find out if there is a way to audit selects against a certain
table. I know you can use triggers to monitor inserts, updates and
deletes but is there a way to monitor when someone selects specific
data? Thanks!
Rachael
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!Go to Lumigents web site... www.lumigent.com... I beleive they have an
auditing tool that does what you wish..
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Rachael" <rachael_faber@.hotmail.com> wrote in message
news:eu0FLAVVEHA.584@.TK2MSFTNGP09.phx.gbl...
> Hello,
> I need to find out if there is a way to audit selects against a certain
> table. I know you can use triggers to monitor inserts, updates and
> deletes but is there a way to monitor when someone selects specific
> data? Thanks!
> Rachael
>
> *** Sent via Devdex http://www.devdex.com ***
> Don't just participate in USENET...get rewarded for it!

Wednesday, March 7, 2012

audit select on a table?

Is there a way to audit 'select' on a given table;"Praim Sankar" <praimnath.sankar@.cogeco.com> wrote in message
news:329c4589.0410061037.5fda13d4@.posting.google.c om...
> Is there a way to audit 'select' on a given table;

See my reply to your previous post.

Simon

Sunday, February 19, 2012

Attempt to fetch logical page

After start SELECT DISTINCT.. FROM TABLE_NAME in Query
Analyzer server return:
Server: Msg 605, Level 21, State 1, Line 1
Attempt to fetch logical page (1:1031984) in
database 'Database_Name' belongs to object 'syscomments',
not to object 'Table_Name'.
Connection Broken
What does this mean ? What should I do to resolve this
problem ?
You have a corruption in your database. First, read below:
http://www.karaszi.com/SQLServer/inf...suspect_db.asp
Second, if you are on SQL Server 2000, check the specific recommendations for your error. Do this in
the *updated* version of Books Online. Here is the section for 605:
Error 605
Severity Level 21
Message Text
Attempt to fetch logical page %S_PGID in database '%.*ls' belongs to object '%.*ls', not to object
'%.*ls'.
Explanation
This error occurs when Microsoft SQL ServerT detects database corruption. The second object
specified in the text not to object '%.*ls' is probably corrupt. Because this error can mask the
existence of other errors, execute DBCC CHECKDB to determine the extent of the damage. If DBCC
CHECKDB does not report additional errors, the first object mentioned is not corrupt.
SQL Server detects database corruption when it traverses the pages of an object and finds a page in
the chain whose object ID does not match that of the object being accessed. There is probably a
damaged page chain, a corrupt Index Allocation Map (IAM), or an invalid entry in the sysobjects
system table for that object. A clustered table has one doubly-linked page chain for the table data
as well as one for each index level. A nonclustered index has a page chain for each level of the
index. Pages in a heap are not linked. The IAM is used to find the pages of a heap.
Although error 605 usually displays two object names, other variations can occur:
a.. If instead of an object name the error displays a number greater than 0, it means that an
attempt was made to reference an object ID that does not exist in a system table for that object.
b.. If the error reports the first object ID as 0, an unallocated page was probably encountered.
(There is no object ID equal to 0.)
c.. If the error states that a page belongs to object ALLOCATION, some of the allocation
structures used by the database might be corrupted.
Usually this error occurs after the corruption has been written to the database on disk, but it can
also occur entirely in the cache without the damage ever being written to the disk. This is known as
a transient 605 error and is not associated with data corruption. If error 605 occurs during data
access, but subsequent DBCC CHECKDB statements complete without error, the 605 error was probably
transient. Transient 605 errors can be caused by the operating system prematurely notifying SQL
Server that an I/O operation has completed; the error message is displayed even though no actual
data corruption exists.
Nontransient 605 errors are often caused by hardware or disk device driver failure.
Action
Execute DBCC CHECKTABLE on the second object specified in the error message. To determine the full
extent of the corruption, execute DBCC CHECKDB as soon as possible. Also check the error log for
other errors, which often accompany a 605 error.
If the 605 error is not transient, the problem is severe and you must run DBCC CHECKDB with one of
the repair clauses. If the error involves an index page, use the REPAIR_REBUILD clause. If the error
involves a data page, it may be necessary to use the REPAIR_ALLOW_DATA_LOSS clause. In the likely
event that you cannot allow the loss of data, you will need to restore from a known clean backup. If
the problem persists, contact your primary support provider. Have the output from DBCC CHECKDB
available for review.
Important If running DBCC CHECKDB with one of the repair clauses does not correct the index
problem, or if you are unsure what effect DBCC CHECKDB with a repair clause has on your data,
contact your primary support provider.
In addition, run hardware diagnostics and correct any problems. You might find it beneficial to
perform a completely new setup on the computer, including reformatting the disk drives and
reinstalling the operating system. This eliminates the possibility that a .dll or .exe program is
corrupted. You can also examine your operating-system error log to see if the error occurred as the
result of hardware failure.
Finally, be sure that your system does not have write caching enabled on the disk controller. If you
suspect this to be the problem, contact your hardware vendor.
Additional Information
DBCC CHECKDB offers the REPAIR_REBUILD and REPAIR_ALLOW_DATA_LOSS clauses. The REPAIR_REBUILD clause
rebuilds corrupt indexes and the REPAIR_ALLOW_DATA_LOSS clause fixes allocation problems. Sometimes,
deleting pages is the only way to fix allocation problems. Typically, these pages contain data that
was already deleted, but the pages may contain valid data. Therefore, deleting pages is a more risky
option than using DBCC CHECKDB with a repair clause. Using DBCC CHECKDB with a repair clause fixes
database corruption when a database backup is not available.
If your database is a data warehouse, you may be able to continue operating without the lost data
for some time before reloading the missing data. In these cases, use DBCC CHECKDB with the
REPAIR_ALLOW_DATA_LOSS clause to fix the damaged database.
You can prevent problems by following these guidelines:
1.. Run SQL Server only on hardware and controllers that are certified for your operating system.
2.. Perform regular backups in conjunction with DBCC CHECKDB statements. DBCC CHECKDB performs all
checks that DBCC NEWALLOC and DBCC CHECKALLOC previously did, but DBCC CHECKDB is faster. This is
the only way to be confident of the state of the database at the time of the backup.
3.. If the data is critical, back up the transaction log frequently. This makes it possible to
reduce your window of vulnerability, even in the event of a catastrophic hardware problem, to an
hour or less.
4.. In the most critical situations, use a standby server and a continually running batch job to
take transaction backups off of the primary computer and continually restore them on the standby
computer.
5.. If you have persistent data corruption problems, try to swap the computer, the controllers,
and the disk device drivers for components of a different type. This makes it easier to determine
whether the problem is specifically platform-related.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"MK" <anonymous@.discussions.microsoft.com> wrote in message
news:36f201c4a54e$c3b508b0$a301280a@.phx.gbl...
> After start SELECT DISTINCT.. FROM TABLE_NAME in Query
> Analyzer server return:
> Server: Msg 605, Level 21, State 1, Line 1
> Attempt to fetch logical page (1:1031984) in
> database 'Database_Name' belongs to object 'syscomments',
> not to object 'Table_Name'.
> Connection Broken
> What does this mean ? What should I do to resolve this
> problem ?
>
begin 666 important.gif
M1TE&.#EA# `+`(#_`,P``,# P"'Y! $```$`+ `````,``L`0 (7C(\9`&H,
3X8F43>E>2]CRZFF1$V9E4 ``.P``
`
end

Attempt to fetch logical page

After start SELECT DISTINCT.. FROM TABLE_NAME in Query
Analyzer server return:
Server: Msg 605, Level 21, State 1, Line 1
Attempt to fetch logical page (1:1031984) in
database 'Database_Name' belongs to object 'syscomments',
not to object 'Table_Name'.
Connection Broken
What does this mean ? What should I do to resolve this
problem ?You have a corruption in your database. First, read below:
http://www.karaszi.com/SQLServer/info_corrupt_suspect_db.asp
Second, if you are on SQL Server 2000, check the specific recommendations for your error. Do this in
the *updated* version of Books Online. Here is the section for 605:
Error 605
Severity Level 21
Message Text
Attempt to fetch logical page %S_PGID in database '%.*ls' belongs to object '%.*ls', not to object
'%.*ls'.
Explanation
This error occurs when Microsoft® SQL ServerT detects database corruption. The second object
specified in the text not to object '%.*ls' is probably corrupt. Because this error can mask the
existence of other errors, execute DBCC CHECKDB to determine the extent of the damage. If DBCC
CHECKDB does not report additional errors, the first object mentioned is not corrupt.
SQL Server detects database corruption when it traverses the pages of an object and finds a page in
the chain whose object ID does not match that of the object being accessed. There is probably a
damaged page chain, a corrupt Index Allocation Map (IAM), or an invalid entry in the sysobjects
system table for that object. A clustered table has one doubly-linked page chain for the table data
as well as one for each index level. A nonclustered index has a page chain for each level of the
index. Pages in a heap are not linked. The IAM is used to find the pages of a heap.
Although error 605 usually displays two object names, other variations can occur:
a.. If instead of an object name the error displays a number greater than 0, it means that an
attempt was made to reference an object ID that does not exist in a system table for that object.
b.. If the error reports the first object ID as 0, an unallocated page was probably encountered.
(There is no object ID equal to 0.)
c.. If the error states that a page belongs to object ALLOCATION, some of the allocation
structures used by the database might be corrupted.
Usually this error occurs after the corruption has been written to the database on disk, but it can
also occur entirely in the cache without the damage ever being written to the disk. This is known as
a transient 605 error and is not associated with data corruption. If error 605 occurs during data
access, but subsequent DBCC CHECKDB statements complete without error, the 605 error was probably
transient. Transient 605 errors can be caused by the operating system prematurely notifying SQL
Server that an I/O operation has completed; the error message is displayed even though no actual
data corruption exists.
Nontransient 605 errors are often caused by hardware or disk device driver failure.
Action
Execute DBCC CHECKTABLE on the second object specified in the error message. To determine the full
extent of the corruption, execute DBCC CHECKDB as soon as possible. Also check the error log for
other errors, which often accompany a 605 error.
If the 605 error is not transient, the problem is severe and you must run DBCC CHECKDB with one of
the repair clauses. If the error involves an index page, use the REPAIR_REBUILD clause. If the error
involves a data page, it may be necessary to use the REPAIR_ALLOW_DATA_LOSS clause. In the likely
event that you cannot allow the loss of data, you will need to restore from a known clean backup. If
the problem persists, contact your primary support provider. Have the output from DBCC CHECKDB
available for review.
Important If running DBCC CHECKDB with one of the repair clauses does not correct the index
problem, or if you are unsure what effect DBCC CHECKDB with a repair clause has on your data,
contact your primary support provider.
In addition, run hardware diagnostics and correct any problems. You might find it beneficial to
perform a completely new setup on the computer, including reformatting the disk drives and
reinstalling the operating system. This eliminates the possibility that a .dll or .exe program is
corrupted. You can also examine your operating-system error log to see if the error occurred as the
result of hardware failure.
Finally, be sure that your system does not have write caching enabled on the disk controller. If you
suspect this to be the problem, contact your hardware vendor.
Additional Information
DBCC CHECKDB offers the REPAIR_REBUILD and REPAIR_ALLOW_DATA_LOSS clauses. The REPAIR_REBUILD clause
rebuilds corrupt indexes and the REPAIR_ALLOW_DATA_LOSS clause fixes allocation problems. Sometimes,
deleting pages is the only way to fix allocation problems. Typically, these pages contain data that
was already deleted, but the pages may contain valid data. Therefore, deleting pages is a more risky
option than using DBCC CHECKDB with a repair clause. Using DBCC CHECKDB with a repair clause fixes
database corruption when a database backup is not available.
If your database is a data warehouse, you may be able to continue operating without the lost data
for some time before reloading the missing data. In these cases, use DBCC CHECKDB with the
REPAIR_ALLOW_DATA_LOSS clause to fix the damaged database.
You can prevent problems by following these guidelines:
1.. Run SQL Server only on hardware and controllers that are certified for your operating system.
2.. Perform regular backups in conjunction with DBCC CHECKDB statements. DBCC CHECKDB performs all
checks that DBCC NEWALLOC and DBCC CHECKALLOC previously did, but DBCC CHECKDB is faster. This is
the only way to be confident of the state of the database at the time of the backup.
3.. If the data is critical, back up the transaction log frequently. This makes it possible to
reduce your window of vulnerability, even in the event of a catastrophic hardware problem, to an
hour or less.
4.. In the most critical situations, use a standby server and a continually running batch job to
take transaction backups off of the primary computer and continually restore them on the standby
computer.
5.. If you have persistent data corruption problems, try to swap the computer, the controllers,
and the disk device drivers for components of a different type. This makes it easier to determine
whether the problem is specifically platform-related.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"MK" <anonymous@.discussions.microsoft.com> wrote in message
news:36f201c4a54e$c3b508b0$a301280a@.phx.gbl...
> After start SELECT DISTINCT.. FROM TABLE_NAME in Query
> Analyzer server return:
> Server: Msg 605, Level 21, State 1, Line 1
> Attempt to fetch logical page (1:1031984) in
> database 'Database_Name' belongs to object 'syscomments',
> not to object 'Table_Name'.
> Connection Broken
> What does this mean ? What should I do to resolve this
> problem ?
>
begin 666 important.gif
M1TE&.#EA# `+`(#_`,P``,# P"'Y! $```$`+ `````,``L`0 (7C(\9`&H,
3X8F43>E>2]CRZFF1$V9E4 ``.P``
`
end

Monday, February 13, 2012

attaching database

HI all,
I 'm trying to attach a database to my local SQL server. Right mouse click
on Database -> all tasks -> Attach Database. I then select the appropriate
mdf file but two red crosses appear over the files I want to import. I can't
even click ok OK.
Someone knows whats going wrong? I 'm using SQL Server 8.0
regardS
Stijn
Probably due to the files being relocated to a different path. I find it
easier to use the sp_attach_db stored procedure for this. You can just list
all the file names at their new locations. See Books Online for the full
syntax.
David Portas
SQL Server MVP
|||Stijn Goris wrote:
> HI all,
> I 'm trying to attach a database to my local SQL server. Right mouse click
> on Database -> all tasks -> Attach Database. I then select the appropriate
> mdf file but two red crosses appear over the files I want to import. I can't
> even click ok OK.
> Someone knows whats going wrong? I 'm using SQL Server 8.0
> regardS
> Stijn
>
or maybe mdf-file is read-only?