Showing posts with label accessing. Show all posts
Showing posts with label accessing. Show all posts

Thursday, March 29, 2012

Error accessing registry value in report

We store environment specific information in the registry to ease moving from
dev, test and production environments. I'm making a call in the code window
to read from the registry and am getting this error:
Failed to load expression host assembly. Details: Request for the permission
of type System.Security.Permissions.RegistryPermission, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
(rsProcessingError) Get Online Help
Just as a test I've changed all code access security zones to Full Trust but
this hasn't helped.
Please advise.This is what I had to do to get this working, if anyone's interested:
Edit C:\Program Files\Microsoft SQL Server\MSSQL\Reporting
Services\ReportServer\rssrvpolicy.config and modify the entry in the
Report_Expressions_Default_Permissions CodeGroup and change it from Execute
to FullTrust.
"Aaron" wrote:
> We store environment specific information in the registry to ease moving from
> dev, test and production environments. I'm making a call in the code window
> to read from the registry and am getting this error:
> Failed to load expression host assembly. Details: Request for the permission
> of type System.Security.Permissions.RegistryPermission, mscorlib,
> Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
> (rsProcessingError) Get Online Help
> Just as a test I've changed all code access security zones to Full Trust but
> this hasn't helped.
> Please advise.
>|||Giving FullTrust to Report_Expressions_Default_Permissions totally opens
your server for hacker attacks. Now all expressions incliding VB.NET
snippets in Report.Code have fulltrust which allows them to perform any
operations, including formatting drives, reading and writing files etc...
The better way is to create a custom assembly with functions to read
registry and call this assembly from your reports. You will then give only
RegistryPermission to that assembly.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Aaron" <Aaron@.discussions.microsoft.com> wrote in message
news:281FF58C-043F-40DA-AFCF-4C413BFC2A49@.microsoft.com...
> This is what I had to do to get this working, if anyone's interested:
> Edit C:\Program Files\Microsoft SQL Server\MSSQL\Reporting
> Services\ReportServer\rssrvpolicy.config and modify the entry in the
> Report_Expressions_Default_Permissions CodeGroup and change it from
Execute
> to FullTrust.
>
> "Aaron" wrote:
> > We store environment specific information in the registry to ease moving
from
> > dev, test and production environments. I'm making a call in the code
window
> > to read from the registry and am getting this error:
> >
> > Failed to load expression host assembly. Details: Request for the
permission
> > of type System.Security.Permissions.RegistryPermission, mscorlib,
> > Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
failed.
> > (rsProcessingError) Get Online Help
> >
> > Just as a test I've changed all code access security zones to Full Trust
but
> > this hasn't helped.
> >
> > Please advise.
> >|||Aaron I have done similar kind of thing, If your still facing the problem
write to me, I can help you out to fix the issue.
My Email ID:
balajikkrishnan [AT] rediffmail [DOT] com
Thanks
Balaji
--
Message posted via http://www.sqlmonster.comsql

Error accessing database

When I launch a client program that reads the database, I
get the following error message
Error while reading information from database
Error Code Login failed for user 'sa'
Reason Not associated with a trusted SQL Server Connection.
Has anyone got ideas on how to Fix this?
Thanks in advance
DarrinHave a look at the server properties. You should see that the server is set
up to use Windows Authentication only. sa is not a windows account. You
are using sa in a client app. Most people would advise against this.
--
Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org
"Darrin" <darrin.adams@.eei.ericsson.se> wrote in message
news:0a6801c3510d$b546da10$a501280a@.phx.gbl...
> When I launch a client program that reads the database, I
> get the following error message
> Error while reading information from database
> Error Code Login failed for user 'sa'
> Reason Not associated with a trusted SQL Server Connection.
> Has anyone got ideas on how to Fix this?
> Thanks in advance
> Darrin

Wednesday, March 21, 2012

error '80004005' while accessing the ASP pages

hi,
I am having while accessing the asp pages in our the problem is
"Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC SQL Server Driver][Named Pipes]Access denied.
/pressreleases/pressroom.asp, line 90 "
If i restart the system then i am able to connect the database and working
well.. but afterdays again i am getting same error.. so please help me in
this. Thanks in advance
rajavelWhy are you using named pipes? See http://www.aspfaq.com/2126 for optimal
connection strings...
--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
"Rajavelu Dhakshinamurthy" <rajavelu_d@.dev.visualsoft-tech.com> wrote in
message news:#xySVGH7DHA.2404@.TK2MSFTNGP12.phx.gbl...
> hi,
> I am having while accessing the asp pages in our the problem is
> "Microsoft OLE DB Provider for ODBC Drivers error '80004005'
> [Microsoft][ODBC SQL Server Driver][Named Pipes]Access denied.
> /pressreleases/pressroom.asp, line 90 "
>
> If i restart the system then i am able to connect the database and working
> well.. but afterdays again i am getting same error.. so please help me in
> this. Thanks in advance
> rajavel
>
>|||Either you have your database open while you are executing an asp page which
either reads or writes from a datagase or,
You don't have the permission to read/write your database
Click on My Computer icon on your desktop, keep clicking until you find the
folder where your database is. Right click on the database and select
properties and make sure the correct permissions are selected.
regards,
harsh.
"Rajavelu Dhakshinamurthy" <rajavelu_d@.dev.visualsoft-tech.com> wrote in
message news:#xySVGH7DHA.2404@.TK2MSFTNGP12.phx.gbl...
> hi,
> I am having while accessing the asp pages in our the problem is
> "Microsoft OLE DB Provider for ODBC Drivers error '80004005'
> [Microsoft][ODBC SQL Server Driver][Named Pipes]Access denied.
> /pressreleases/pressroom.asp, line 90 "
>
> If i restart the system then i am able to connect the database and working
> well.. but afterdays again i am getting same error.. so please help me in
> this. Thanks in advance
> rajavel
>
>|||In article <uukjTUH7DHA.2760@.TK2MSFTNGP09.phx.gbl>, "harsh" <harshalmistry@.hotmail.com> wrote:
>Either you have your database open while you are executing an asp page which
>either reads or writes from a datagase or,
>You don't have the permission to read/write your database
>Click on My Computer icon on your desktop, keep clicking until you find the
>folder where your database is. Right click on the database and select
>properties and make sure the correct permissions are selected.
>regards,
>harsh.
Huh?
I'm afraid you didn't catch the fact that this is a SQL Server DB.
SQL Server doesn't work like that.
What exactly is the SQL statement that is bombing out doing?
Have you tried running profiler when this occurs?|||Check this general guide how to troubleshoot the 80004005 error as well:
http://support.microsoft.com/default.aspx?scid=kb;en-us;306518.
--
Dejan Sarka, SQL Server MVP
Associate Mentor
Solid Quality Learning
More than just Training
www.SolidQualityLearning.com
"Rajavelu Dhakshinamurthy" <rajavelu_d@.dev.visualsoft-tech.com> wrote in
message news:#xySVGH7DHA.2404@.TK2MSFTNGP12.phx.gbl...
> hi,
> I am having while accessing the asp pages in our the problem is
> "Microsoft OLE DB Provider for ODBC Drivers error '80004005'
> [Microsoft][ODBC SQL Server Driver][Named Pipes]Access denied.
> /pressreleases/pressroom.asp, line 90 "
>
> If i restart the system then i am able to connect the database and working
> well.. but afterdays again i am getting same error.. so please help me in
> this. Thanks in advance
> rajavel
>
>

error '80004005' while accessing the ASP pages

hi,
I am having while accessing the asp pages in our the problem is
"Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC SQL Server Driver][Named Pipes]Access denied.
/pressreleases/pressroom.asp, line 90 "
If i restart the system then i am able to connect the database and working
well.. but afterdays again i am getting same error.. so please help me in
this. Thanks in advance
rajavelWhy are you using named pipes? See http://www.aspfaq.com/2126 for optimal
connection strings...
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
"Rajavelu Dhakshinamurthy" <rajavelu_d@.dev.visualsoft-tech.com> wrote in
message news:#xySVGH7DHA.2404@.TK2MSFTNGP12.phx.gbl...
> hi,
> I am having while accessing the asp pages in our the problem is
> "Microsoft OLE DB Provider for ODBC Drivers error '80004005'
> [Microsoft][ODBC SQL Server Driver][Named Pipes]Access denied.
> /pressreleases/pressroom.asp, line 90 "
>
> If i restart the system then i am able to connect the database and working
> well.. but afterdays again i am getting same error.. so please help me in
> this. Thanks in advance
> rajavel
>
>|||Either you have your database open while you are executing an asp page which
either reads or writes from a datagase or,
You don't have the permission to read/write your database
Click on My Computer icon on your desktop, keep clicking until you find the
folder where your database is. Right click on the database and select
properties and make sure the correct permissions are selected.
regards,
harsh.
"Rajavelu Dhakshinamurthy" <rajavelu_d@.dev.visualsoft-tech.com> wrote in
message news:#xySVGH7DHA.2404@.TK2MSFTNGP12.phx.gbl...
> hi,
> I am having while accessing the asp pages in our the problem is
> "Microsoft OLE DB Provider for ODBC Drivers error '80004005'
> [Microsoft][ODBC SQL Server Driver][Named Pipes]Access denied.
> /pressreleases/pressroom.asp, line 90 "
>
> If i restart the system then i am able to connect the database and working
> well.. but afterdays again i am getting same error.. so please help me in
> this. Thanks in advance
> rajavel
>
>|||In article <uukjTUH7DHA.2760@.TK2MSFTNGP09.phx.gbl>, "harsh" <harshalmistry@.hotmail.com>
wrote:
>Either you have your database open while you are executing an asp page whic
h
>either reads or writes from a datagase or,
>You don't have the permission to read/write your database
>Click on My Computer icon on your desktop, keep clicking until you find the
>folder where your database is. Right click on the database and select
>properties and make sure the correct permissions are selected.
>regards,
>harsh.
Huh?
I'm afraid you didn't catch the fact that this is a SQL Server DB.
SQL Server doesn't work like that.
What exactly is the SQL statement that is bombing out doing?
Have you tried running profiler when this occurs?|||Check this general guide how to troubleshoot the 80004005 error as well:
http://support.microsoft.com/defaul...b;en-us;306518.
Dejan Sarka, SQL Server MVP
Associate Mentor
Solid Quality Learning
More than just Training
www.SolidQualityLearning.com
"Rajavelu Dhakshinamurthy" <rajavelu_d@.dev.visualsoft-tech.com> wrote in
message news:#xySVGH7DHA.2404@.TK2MSFTNGP12.phx.gbl...
> hi,
> I am having while accessing the asp pages in our the problem is
> "Microsoft OLE DB Provider for ODBC Drivers error '80004005'
> [Microsoft][ODBC SQL Server Driver][Named Pipes]Access denied.
> /pressreleases/pressroom.asp, line 90 "
>
> If i restart the system then i am able to connect the database and working
> well.. but afterdays again i am getting same error.. so please help me in
> this. Thanks in advance
> rajavel
>
>

Monday, March 19, 2012

Error 7317 when Accessing Linked Oracle Server

I have a linked server to an Oracle 8i database. When I attempt to query th
e
Oracle tables I get the following error:
Server: Msg 7317, Level 16, State 1, Line 1
OLE DB provider 'MSDAORA' returned an invalid schema definition.
OLE DB error trace [Non-interface error: OLE/DB provider returned an
invalid schema definition.].
The problem is occurring at my customer's site. I have tried duplicating
their environment in my office, but I can not reporduce the problem.
I would appreciate any help you could offer.
Thanks,
Bill Manring
Chief Software Architect
Wavefront Software, Inc.I found an answer to this problem so I thought I should post it in case
anyone else has a similar problem.
If I execute the query using the OPENQUERY function, the query executes
properly. Since OPENQUERY is a peferred way of querying linked srevers
anyway, there really is no problem.
"Bill Manring" wrote:

> I have a linked server to an Oracle 8i database. When I attempt to query
the
> Oracle tables I get the following error:
> Server: Msg 7317, Level 16, State 1, Line 1
> OLE DB provider 'MSDAORA' returned an invalid schema definition.
> OLE DB error trace [Non-interface error: OLE/DB provider returned an
> invalid schema definition.].
> The problem is occurring at my customer's site. I have tried duplicating
> their environment in my office, but I can not reporduce the problem.
> I would appreciate any help you could offer.
>
> --
> Thanks,
> Bill Manring
> Chief Software Architect
> Wavefront Software, Inc.

Error 7317 when Accessing Linked Oracle Server

I have a linked server to an Oracle 8i database. When I attempt to query the
Oracle tables I get the following error:
Server: Msg 7317, Level 16, State 1, Line 1
OLE DB provider 'MSDAORA' returned an invalid schema definition.
OLE DB error trace [Non-interface error: OLE/DB provider returned an
invalid schema definition.].
The problem is occurring at my customer's site. I have tried duplicating
their environment in my office, but I can not reporduce the problem.
I would appreciate any help you could offer.
Thanks,
Bill Manring
Chief Software Architect
Wavefront Software, Inc.
I found an answer to this problem so I thought I should post it in case
anyone else has a similar problem.
If I execute the query using the OPENQUERY function, the query executes
properly. Since OPENQUERY is a peferred way of querying linked srevers
anyway, there really is no problem.
"Bill Manring" wrote:

> I have a linked server to an Oracle 8i database. When I attempt to query the
> Oracle tables I get the following error:
> Server: Msg 7317, Level 16, State 1, Line 1
> OLE DB provider 'MSDAORA' returned an invalid schema definition.
> OLE DB error trace [Non-interface error: OLE/DB provider returned an
> invalid schema definition.].
> The problem is occurring at my customer's site. I have tried duplicating
> their environment in my office, but I can not reporduce the problem.
> I would appreciate any help you could offer.
>
> --
> Thanks,
> Bill Manring
> Chief Software Architect
> Wavefront Software, Inc.

Friday, March 9, 2012

error 500 maximum concurent users have reached

We have three Windows 2000 web servers in a WLBS environment accessing a DB server. Though we have only 180,140 and 40 connections respectively on the servers we received ERROR 500 - maximum concurent users have reached.

Please help us to identify the problem.

Best regards

Network BowmansYou may have only 300 users on the website, but the web pages themselves could be opening hordes of connections. Two things to check would be the license for SQL Server (in control panel should be a license applet for SQL Server). Check to see if you have entered 500 CALs. If you have set the server up as per-processor license, or if you have plenty of cals entered on the system, you can check in Enterprise manager to see how many connections are allowed. Right click on the server, then properties, then the connections tab. Make sure the max connections is set to 0 (unlimited). 0 is the default, and I have not had any problems with it, so far. Hope this helps.|||Hmm. After reviewing the post, I seem to have mistaken the error number for a parameter. Looks like my suggestion may not help after all. Are you certain this is a DB error, and not a web error? Check the SQL Error log to be sure.

Wednesday, March 7, 2012

Error 404 Report Manager

It seems that nobody has detailed knowledge on this issue. I've read other
postings and found nothing useful. I had no problem accessing report manager
for a long time, and then all of a sudden I get HTTP 404 error OBject Not
Found. Nothing was changed in IIS, Reports virtual directory, and I'm not
using SSL.
If anyone has any actual experience in successfully fixing this problem
(other than reinstall), please please reply to this. I'm sure lots of other
people will benefit from it.
Any links to related & useful documentation are also welcomed.
Thanks a lot.
A FuI take it you verified that the Virtual Directories are still setup in IIS?
VDir: reports
Path: C:\Program Files\Microsoft SQL Server\MSSQL\Reporting
Services\ReportManager (default)
Default Page: home.aspx
VDir: reportserver
Path: C:\Program Files\Microsoft SQL Server\MSSQL\Reporting
Services\ReportServer (default)
There are some other settings of course, if you need I can save the config
to an xml file so you can compare them or import them.
Michael
"A Fu" <A Fu@.discussions.microsoft.com> wrote in message
news:99899F45-632D-4A16-B600-FAFB9B503BC3@.microsoft.com...
> It seems that nobody has detailed knowledge on this issue. I've read other
> postings and found nothing useful. I had no problem accessing report
> manager
> for a long time, and then all of a sudden I get HTTP 404 error OBject Not
> Found. Nothing was changed in IIS, Reports virtual directory, and I'm not
> using SSL.
> If anyone has any actual experience in successfully fixing this problem
> (other than reinstall), please please reply to this. I'm sure lots of
> other
> people will benefit from it.
> Any links to related & useful documentation are also welcomed.
> Thanks a lot.
> A Fu|||Yes, all the paths are set correctly. It seems that the URL virtual path:
"http://www.somesite.com/reports/Pages/Folder.aspx" is wrong. But I have no
problem accessing "http://www.somesite.com/ReportServer".
Is there any other way to upload reports to the RS server, other than thro'
Report Manager & VS.NET?
If you could give me the xml file, that would be great.
Thanks a lot.
"Michael" wrote:
> I take it you verified that the Virtual Directories are still setup in IIS?
> VDir: reports
> Path: C:\Program Files\Microsoft SQL Server\MSSQL\Reporting
> Services\ReportManager (default)
> Default Page: home.aspx
> VDir: reportserver
> Path: C:\Program Files\Microsoft SQL Server\MSSQL\Reporting
> Services\ReportServer (default)
> There are some other settings of course, if you need I can save the config
> to an xml file so you can compare them or import them.
> Michael
> "A Fu" <A Fu@.discussions.microsoft.com> wrote in message
> news:99899F45-632D-4A16-B600-FAFB9B503BC3@.microsoft.com...
> > It seems that nobody has detailed knowledge on this issue. I've read other
> > postings and found nothing useful. I had no problem accessing report
> > manager
> > for a long time, and then all of a sudden I get HTTP 404 error OBject Not
> > Found. Nothing was changed in IIS, Reports virtual directory, and I'm not
> > using SSL.
> >
> > If anyone has any actual experience in successfully fixing this problem
> > (other than reinstall), please please reply to this. I'm sure lots of
> > other
> > people will benefit from it.
> >
> > Any links to related & useful documentation are also welcomed.
> >
> > Thanks a lot.
> >
> > A Fu
>
>|||Found the solution to the error 404.
There is a rswebapplication.config file in the reportmanager folder of
reporting services
Change the http://servername/reportserver to
http://servername:8080/reportserver
That's it.
"A Fu" wrote:
> It seems that nobody has detailed knowledge on this issue. I've read other
> postings and found nothing useful. I had no problem accessing report manager
> for a long time, and then all of a sudden I get HTTP 404 error OBject Not
> Found. Nothing was changed in IIS, Reports virtual directory, and I'm not
> using SSL.
> If anyone has any actual experience in successfully fixing this problem
> (other than reinstall), please please reply to this. I'm sure lots of other
> people will benefit from it.
> Any links to related & useful documentation are also welcomed.
> Thanks a lot.
> A Fu

Friday, February 17, 2012

Error 21776 when accessing sa account

I get the 21776 error when I try to view the sa account under
security/logins. I can click past it and still view and change account
details, but how do I get rid of the error. I have read about
out-of-sync users problem and have tried the suggested script:
USE MyDatabase
EXEC sp_addlogin 'TempOwner'
EXEC sp_changedbowner 'TempOwner'
EXEC sp_changedbowner 'sa'
EXEC sp_droplogin 'TempOwner'
GO
However I don't know what to use for MyDatabase. Since I'm changing sa
account details I thought that I should point to master. You can't
change the owner of master. I'm a noob. What am I missing. I'm using
msde2000.
Tom
Error 21776: [SQL-DMO]The name 'dbo' was not found in the Users
Collection. If the name is a qualified name, use [] to seperate various
parts of the name, and try again.The error means that the owner of one or more of your user databases is
out-of-sync, probably due to a restore or attach.
You need to run sp_changedbowner in the context of your user database.
sp_changedbowner was corrected in SP3 so you don't need to temporarily
change ownership to a non-conflicting login.
The script below will change ownership for all user databases to 'sa':
DECLARE @.ChangeDBOwner nvarchar(4000)
DECLARE ChangeDBOwner CURSOR
LOCAL FAST_FORWARD READ_ONLY FOR
SELECT N'USE ' + CATALOG_NAME + N'
EXEC sp_changedbowner ''sa'''
FROM INFORMATION_SCHEMA.SCHEMATA
WHERE CATALOG_NAME NOT IN
(
'master',
'model',
'msdb',
'tempdb',
'distribution'
)
OPEN ChangeDBOwner
WHILE 1 = 1
BEGIN
FETCH NEXT FROM ChangeDBOwner INTO @.ChangeDBOwner
IF @.@.FETCH_STATUS = -1 BREAK
EXEC(@.ChangeDBOwner)
END
CLOSE ChangeDBOwner
DEALLOCATE ChangeDBOwner
GO
--
Hope this helps.
Dan Guzman
SQL Server MVP
--
SQL FAQ links (courtesy Neil Pike):
http://www.ntfaq.com/Articles/Index.cfm?DepartmentID=800
http://www.sqlserverfaq.com
http://www.mssqlserver.com/faq
--
"Tom Wells" <noemail@.nowhere.none> wrote in message
news:%23kHB4HWeDHA.3160@.tk2msftngp13.phx.gbl...
> I get the 21776 error when I try to view the sa account under
> security/logins. I can click past it and still view and change account
> details, but how do I get rid of the error. I have read about
> out-of-sync users problem and have tried the suggested script:
> USE MyDatabase
> EXEC sp_addlogin 'TempOwner'
> EXEC sp_changedbowner 'TempOwner'
> EXEC sp_changedbowner 'sa'
> EXEC sp_droplogin 'TempOwner'
> GO
> However I don't know what to use for MyDatabase. Since I'm changing sa
> account details I thought that I should point to master. You can't
> change the owner of master. I'm a noob. What am I missing. I'm using
> msde2000.
> Tom
> Error 21776: [SQL-DMO]The name 'dbo' was not found in the Users
> Collection. If the name is a qualified name, use [] to seperate
various
> parts of the name, and try again.
>|||I wish I understood better what I was doing but it worked. I used the
Query Analyzer and ran the script against each of my user databases.
After running the script the sa user showed up as the dbo of the database.
Thanks
Tom
Dan Guzman wrote:
> The error means that the owner of one or more of your user databases is
> out-of-sync, probably due to a restore or attach.
> You need to run sp_changedbowner in the context of your user database.
> sp_changedbowner was corrected in SP3 so you don't need to temporarily
> change ownership to a non-conflicting login.
> The script below will change ownership for all user databases to 'sa':
> DECLARE @.ChangeDBOwner nvarchar(4000)
> DECLARE ChangeDBOwner CURSOR
> LOCAL FAST_FORWARD READ_ONLY FOR
> SELECT N'USE ' + CATALOG_NAME + N'
> EXEC sp_changedbowner ''sa'''
> FROM INFORMATION_SCHEMA.SCHEMATA
> WHERE CATALOG_NAME NOT IN
> (
> 'master',
> 'model',
> 'msdb',
> 'tempdb',
> 'distribution'
> )
> OPEN ChangeDBOwner
> WHILE 1 = 1
> BEGIN
> FETCH NEXT FROM ChangeDBOwner INTO @.ChangeDBOwner
> IF @.@.FETCH_STATUS = -1 BREAK
> EXEC(@.ChangeDBOwner)
> END
> CLOSE ChangeDBOwner
> DEALLOCATE ChangeDBOwner
> GO
>|||The database owner SID is stored in 2 separate places - sysdatabases
(master database) and the 'dbo' row in the sysusers (user database).
The GUI tools misbehave when these get out of sync due to a restore or
attach. The sp_changedbowner script corrected the mismatch.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Tom Wells" <noemail@.nowhere.none> wrote in message
news:euuMXy5eDHA.1056@.TK2MSFTNGP10.phx.gbl...
> I wish I understood better what I was doing but it worked. I used the
> Query Analyzer and ran the script against each of my user databases.
> After running the script the sa user showed up as the dbo of the
database.
> Thanks
> Tom
> Dan Guzman wrote:
> > The error means that the owner of one or more of your user databases
is
> > out-of-sync, probably due to a restore or attach.
> >
> > You need to run sp_changedbowner in the context of your user
database.
> > sp_changedbowner was corrected in SP3 so you don't need to
temporarily
> > change ownership to a non-conflicting login.
> >
> > The script below will change ownership for all user databases to
'sa':
> >
> > DECLARE @.ChangeDBOwner nvarchar(4000)
> > DECLARE ChangeDBOwner CURSOR
> > LOCAL FAST_FORWARD READ_ONLY FOR
> > SELECT N'USE ' + CATALOG_NAME + N'
> > EXEC sp_changedbowner ''sa'''
> > FROM INFORMATION_SCHEMA.SCHEMATA
> > WHERE CATALOG_NAME NOT IN
> > (
> > 'master',
> > 'model',
> > 'msdb',
> > 'tempdb',
> > 'distribution'
> > )
> > OPEN ChangeDBOwner
> > WHILE 1 = 1
> > BEGIN
> > FETCH NEXT FROM ChangeDBOwner INTO @.ChangeDBOwner
> > IF @.@.FETCH_STATUS = -1 BREAK
> > EXEC(@.ChangeDBOwner)
> > END
> > CLOSE ChangeDBOwner
> > DEALLOCATE ChangeDBOwner
> > GO
> >
>