Thursday, March 22, 2012
Change dbowner on database
administrator to boaadmin. And now we need to change dbo owner for a
database becauase the dbase is still using the name administrator for
the dbo.
I ran the process :
sp_changedbowner boaadmin
but it gives the following error. Am I doing something wrong, since I'm
a bit new to SQL...
Server: Msg 15007, Level 16, State 1, Procedure sp_changedbowner, Line
33 The login 'boaaladmin' does not exist.
When I ran the process in Query Analyzer I'm using the id boaadmin to
login...
I finally managed to execute the command without errors I had to add
the machine domain in front of the it servername\boaadmin.
After executing the command it returned "aliases were mapped to the new
database owner. database owner changed".
But when I look inside the dbase user's the dbo doesn't have a login
name associated with it. Previously it was servername\administrator and
now its just blank.
I've ran the sp_changedbowner twice and it still doesn't allocate the
id servername\boaadmin to dbo.
I even tried recreating the database using boaadmin, but find that the
dbowner is still the servername\administrator account.
Can'tr figure out why....Hi
If you renamed the account then the SID has not changed, the probably means
that sysxlogins has not be changed. You may want to try calling sp_grantlogi
n
for boaadmin and sp_revokelogin for administrator.
What does sp_change_users_login 'report' give on the database?
I also noticed that the error message for sp_changedbowner refers to
'boaaladmin'
John
"Zeno" wrote:
> We recently renamed the local administrator account on our server from
> administrator to boaadmin. And now we need to change dbo owner for a
> database becauase the dbase is still using the name administrator for
> the dbo.
>
> I ran the process :
> sp_changedbowner boaadmin
>
> but it gives the following error. Am I doing something wrong, since I'm
> a bit new to SQL...
>
> Server: Msg 15007, Level 16, State 1, Procedure sp_changedbowner, Line
> 33 The login 'boaaladmin' does not exist.
>
> When I ran the process in Query Analyzer I'm using the id boaadmin to
> login...
> I finally managed to execute the command without errors I had to add
> the machine domain in front of the it servername\boaadmin.
>
> After executing the command it returned "aliases were mapped to the new
> database owner. database owner changed".
>
> But when I look inside the dbase user's the dbo doesn't have a login
> name associated with it. Previously it was servername\administrator and
> now its just blank.
>
> I've ran the sp_changedbowner twice and it still doesn't allocate the
> id servername\boaadmin to dbo.
>
> I even tried recreating the database using boaadmin, but find that the
> dbowner is still the servername\administrator account.
> Can'tr figure out why....
>|||Zeno,
Does 'machinename\boaaladmin' have a login in SQL Server? Create the login
and try again. I see no reason why it shouldn't work.
Mark Allison, SQL Server MVP
http://www.markallison.co.uk
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602m.html
"Zeno" wrote:
> We recently renamed the local administrator account on our server from
> administrator to boaadmin. And now we need to change dbo owner for a
> database becauase the dbase is still using the name administrator for
> the dbo.
>
> I ran the process :
> sp_changedbowner boaadmin
>
> but it gives the following error. Am I doing something wrong, since I'm
> a bit new to SQL...
>
> Server: Msg 15007, Level 16, State 1, Procedure sp_changedbowner, Line
> 33 The login 'boaaladmin' does not exist.
>
> When I ran the process in Query Analyzer I'm using the id boaadmin to
> login...
> I finally managed to execute the command without errors I had to add
> the machine domain in front of the it servername\boaadmin.
>
> After executing the command it returned "aliases were mapped to the new
> database owner. database owner changed".
>
> But when I look inside the dbase user's the dbo doesn't have a login
> name associated with it. Previously it was servername\administrator and
> now its just blank.
>
> I've ran the sp_changedbowner twice and it still doesn't allocate the
> id servername\boaadmin to dbo.
>
> I even tried recreating the database using boaadmin, but find that the
> dbowner is still the servername\administrator account.
> Can'tr figure out why....
>|||Zeno
Is there a speciffic reason why you don't want your database and objects
owned by SA. With any other owner you will find some utilities and commands
will not run as you expect. I have in the past inherited databases not owned
by sa and they can be a right pain.
You need to limit access to sa, but generally your life will be much easier.
Regards
John
"Mark Allison" wrote:
[vbcol=seagreen]
> Zeno,
> Does 'machinename\boaaladmin' have a login in SQL Server? Create the login
> and try again. I see no reason why it shouldn't work.
> --
> Mark Allison, SQL Server MVP
> http://www.markallison.co.uk
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602m.html
>
> "Zeno" wrote:
>
Change dbowner on database
administrator to boaadmin. And now we need to change dbo owner for a
database becauase the dbase is still using the name administrator for
the dbo.
I ran the process :
sp_changedbowner boaadmin
but it gives the following error. Am I doing something wrong, since I'm
a bit new to SQL...
Server: Msg 15007, Level 16, State 1, Procedure sp_changedbowner, Line
33 The login 'boaaladmin' does not exist.
When I ran the process in Query Analyzer I'm using the id boaadmin to
login...
I finally managed to execute the command without errors I had to add
the machine domain in front of the it servername\boaadmin.
After executing the command it returned "aliases were mapped to the new
database owner. database owner changed".
But when I look inside the dbase user's the dbo doesn't have a login
name associated with it. Previously it was servername\administrator and
now its just blank.
I've ran the sp_changedbowner twice and it still doesn't allocate the
id servername\boaadmin to dbo.
I even tried recreating the database using boaadmin, but find that the
dbowner is still the servername\administrator account.
Can'tr figure out why....
Hi
If you renamed the account then the SID has not changed, the probably means
that sysxlogins has not be changed. You may want to try calling sp_grantlogin
for boaadmin and sp_revokelogin for administrator.
What does sp_change_users_login 'report' give on the database?
I also noticed that the error message for sp_changedbowner refers to
'boaaladmin'
John
"Zeno" wrote:
> We recently renamed the local administrator account on our server from
> administrator to boaadmin. And now we need to change dbo owner for a
> database becauase the dbase is still using the name administrator for
> the dbo.
>
> I ran the process :
> sp_changedbowner boaadmin
>
> but it gives the following error. Am I doing something wrong, since I'm
> a bit new to SQL...
>
> Server: Msg 15007, Level 16, State 1, Procedure sp_changedbowner, Line
> 33 The login 'boaaladmin' does not exist.
>
> When I ran the process in Query Analyzer I'm using the id boaadmin to
> login...
> I finally managed to execute the command without errors I had to add
> the machine domain in front of the it servername\boaadmin.
>
> After executing the command it returned "aliases were mapped to the new
> database owner. database owner changed".
>
> But when I look inside the dbase user's the dbo doesn't have a login
> name associated with it. Previously it was servername\administrator and
> now its just blank.
>
> I've ran the sp_changedbowner twice and it still doesn't allocate the
> id servername\boaadmin to dbo.
>
> I even tried recreating the database using boaadmin, but find that the
> dbowner is still the servername\administrator account.
> Can'tr figure out why....
>
|||Zeno,
Does 'machinename\boaaladmin' have a login in SQL Server? Create the login
and try again. I see no reason why it shouldn't work.
Mark Allison, SQL Server MVP
http://www.markallison.co.uk
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602m.html
"Zeno" wrote:
> We recently renamed the local administrator account on our server from
> administrator to boaadmin. And now we need to change dbo owner for a
> database becauase the dbase is still using the name administrator for
> the dbo.
>
> I ran the process :
> sp_changedbowner boaadmin
>
> but it gives the following error. Am I doing something wrong, since I'm
> a bit new to SQL...
>
> Server: Msg 15007, Level 16, State 1, Procedure sp_changedbowner, Line
> 33 The login 'boaaladmin' does not exist.
>
> When I ran the process in Query Analyzer I'm using the id boaadmin to
> login...
> I finally managed to execute the command without errors I had to add
> the machine domain in front of the it servername\boaadmin.
>
> After executing the command it returned "aliases were mapped to the new
> database owner. database owner changed".
>
> But when I look inside the dbase user's the dbo doesn't have a login
> name associated with it. Previously it was servername\administrator and
> now its just blank.
>
> I've ran the sp_changedbowner twice and it still doesn't allocate the
> id servername\boaadmin to dbo.
>
> I even tried recreating the database using boaadmin, but find that the
> dbowner is still the servername\administrator account.
> Can'tr figure out why....
>
|||Zeno
Is there a speciffic reason why you don't want your database and objects
owned by SA. With any other owner you will find some utilities and commands
will not run as you expect. I have in the past inherited databases not owned
by sa and they can be a right pain.
You need to limit access to sa, but generally your life will be much easier.
Regards
John
"Mark Allison" wrote:
[vbcol=seagreen]
> Zeno,
> Does 'machinename\boaaladmin' have a login in SQL Server? Create the login
> and try again. I see no reason why it shouldn't work.
> --
> Mark Allison, SQL Server MVP
> http://www.markallison.co.uk
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602m.html
>
> "Zeno" wrote:
Change dbowner on database
administrator to boaadmin. And now we need to change dbo owner for a
database becauase the dbase is still using the name administrator for
the dbo.
I ran the process :
sp_changedbowner boaadmin
but it gives the following error. Am I doing something wrong, since I'm
a bit new to SQL...
Server: Msg 15007, Level 16, State 1, Procedure sp_changedbowner, Line
33 The login 'boaaladmin' does not exist.
When I ran the process in Query Analyzer I'm using the id boaadmin to
login...
I finally managed to execute the command without errors I had to add
the machine domain in front of the it servername\boaadmin.
After executing the command it returned "aliases were mapped to the new
database owner. database owner changed".
But when I look inside the dbase user's the dbo doesn't have a login
name associated with it. Previously it was servername\administrator and
now its just blank.
I've ran the sp_changedbowner twice and it still doesn't allocate the
id servername\boaadmin to dbo.
I even tried recreating the database using boaadmin, but find that the
dbowner is still the servername\administrator account.
Can'tr figure out why....Hi
If you renamed the account then the SID has not changed, the probably means
that sysxlogins has not be changed. You may want to try calling sp_grantlogin
for boaadmin and sp_revokelogin for administrator.
What does sp_change_users_login 'report' give on the database?
I also noticed that the error message for sp_changedbowner refers to
'boaaladmin'
John
"Zeno" wrote:
> We recently renamed the local administrator account on our server from
> administrator to boaadmin. And now we need to change dbo owner for a
> database becauase the dbase is still using the name administrator for
> the dbo.
>
> I ran the process :
> sp_changedbowner boaadmin
>
> but it gives the following error. Am I doing something wrong, since I'm
> a bit new to SQL...
>
> Server: Msg 15007, Level 16, State 1, Procedure sp_changedbowner, Line
> 33 The login 'boaaladmin' does not exist.
>
> When I ran the process in Query Analyzer I'm using the id boaadmin to
> login...
> I finally managed to execute the command without errors I had to add
> the machine domain in front of the it servername\boaadmin.
>
> After executing the command it returned "aliases were mapped to the new
> database owner. database owner changed".
>
> But when I look inside the dbase user's the dbo doesn't have a login
> name associated with it. Previously it was servername\administrator and
> now its just blank.
>
> I've ran the sp_changedbowner twice and it still doesn't allocate the
> id servername\boaadmin to dbo.
>
> I even tried recreating the database using boaadmin, but find that the
> dbowner is still the servername\administrator account.
> Can'tr figure out why....
>|||Zeno,
Does 'machinename\boaaladmin' have a login in SQL Server? Create the login
and try again. I see no reason why it shouldn't work.
--
Mark Allison, SQL Server MVP
http://www.markallison.co.uk
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602m.html
"Zeno" wrote:
> We recently renamed the local administrator account on our server from
> administrator to boaadmin. And now we need to change dbo owner for a
> database becauase the dbase is still using the name administrator for
> the dbo.
>
> I ran the process :
> sp_changedbowner boaadmin
>
> but it gives the following error. Am I doing something wrong, since I'm
> a bit new to SQL...
>
> Server: Msg 15007, Level 16, State 1, Procedure sp_changedbowner, Line
> 33 The login 'boaaladmin' does not exist.
>
> When I ran the process in Query Analyzer I'm using the id boaadmin to
> login...
> I finally managed to execute the command without errors I had to add
> the machine domain in front of the it servername\boaadmin.
>
> After executing the command it returned "aliases were mapped to the new
> database owner. database owner changed".
>
> But when I look inside the dbase user's the dbo doesn't have a login
> name associated with it. Previously it was servername\administrator and
> now its just blank.
>
> I've ran the sp_changedbowner twice and it still doesn't allocate the
> id servername\boaadmin to dbo.
>
> I even tried recreating the database using boaadmin, but find that the
> dbowner is still the servername\administrator account.
> Can'tr figure out why....
>|||Zeno
Is there a speciffic reason why you don't want your database and objects
owned by SA. With any other owner you will find some utilities and commands
will not run as you expect. I have in the past inherited databases not owned
by sa and they can be a right pain.
You need to limit access to sa, but generally your life will be much easier.
Regards
John
"Mark Allison" wrote:
> Zeno,
> Does 'machinename\boaaladmin' have a login in SQL Server? Create the login
> and try again. I see no reason why it shouldn't work.
> --
> Mark Allison, SQL Server MVP
> http://www.markallison.co.uk
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602m.html
>
> "Zeno" wrote:
> > We recently renamed the local administrator account on our server from
> > administrator to boaadmin. And now we need to change dbo owner for a
> > database becauase the dbase is still using the name administrator for
> > the dbo.
> >
> >
> > I ran the process :
> > sp_changedbowner boaadmin
> >
> >
> > but it gives the following error. Am I doing something wrong, since I'm
> > a bit new to SQL...
> >
> >
> > Server: Msg 15007, Level 16, State 1, Procedure sp_changedbowner, Line
> > 33 The login 'boaaladmin' does not exist.
> >
> >
> > When I ran the process in Query Analyzer I'm using the id boaadmin to
> > login...
> >
> > I finally managed to execute the command without errors I had to add
> > the machine domain in front of the it servername\boaadmin.
> >
> >
> > After executing the command it returned "aliases were mapped to the new
> > database owner. database owner changed".
> >
> >
> > But when I look inside the dbase user's the dbo doesn't have a login
> > name associated with it. Previously it was servername\administrator and
> > now its just blank.
> >
> >
> > I've ran the sp_changedbowner twice and it still doesn't allocate the
> > id servername\boaadmin to dbo.
> >
> >
> > I even tried recreating the database using boaadmin, but find that the
> > dbowner is still the servername\administrator account.
> >
> > Can'tr figure out why....
> >
Sunday, March 11, 2012
Change connected user to avoid owner prefix in queries
I've five instances of SQL Server 2000 with the SAME database with a
DIFFERENT owner in each server. I, as the administrator, have a lot of
queries that I have to execute in some or all servers. The problem is
that I have to connect to all servers with MY user, not each of the db
owners...
So I have queries this way:
select * from mike.table1 t1 join mike.table2 t2 on...
And when I connect to another server I have to change mike for jeremy
in all the SQLs...
And when I connect to another server I have to change jeremy for nina
in all the SQLs...
I know that there was an old, v7, deprecated way to change the
"schema", something like
change current user to kimberly
go
select * from table1 t1 join table2 t2 on...
This way, I'll change ONLY once the connected user. I could even do at
the beginning of the script an IF, to change the connected user
depending on @.@.SERVERNAME !!!
Can someone remember this instruction?
Thanks in advance for your help !!!Found it !!!
setuser 'q01'
-- quien importo una orden de transporte
select USERNAME, SYDATE, SYTIME, CLIENT
from TPLOG
where CMDSTRING like '%D02K909789%
Quote:
Originally Posted by
>From BOL:
SETUSER
Allows a member of the sysadmin fixed server role or db_owner fixed
database role to impersonate another user.
Important SETUSER is included in Microsoft? SQL Server? 2000 only for
backward compatibility, and its usage is not recommended. SETUSER may
not be supported in a future release of SQL Server.
Syntax
SETUSER [ 'username' [ WITH NORESET ] ]
Arguments
'username'
Is the name of a SQL Server or Microsoft Windows NT? user in the
current database that is impersonated. When username is not specified,
the original identity of the system administrator or database owner
impersonating the user is reestablished.
WITH NORESET
Specifies that subsequent SETUSER statements (with no specified
username) do not reset to the system administrator or database owner.