Tuesday, March 20, 2012
Change Database Owner
I don't member of DBO owners of my database on sql server
After i've created new table it has my name as an owner
How can i change the owner?
' 03-5611606
' 050-7709399
: roy@.atidsm.co.ilUse sp_changeobjectowner
Markus|||sp_changedbowner
Changes the owner of the current database.
Syntax
sp_changedbowner [ @.loginame = ] 'login'
[ , [ @.map = ] remap_alias_flag ]
Arguments
[@.loginame =] 'login'
Is the login ID of the new owner of the current database. login is sysname,
with no default. login must be Microsoft SQL ServerT login or a Microsoft
Windows NT user that already exists. login cannot become the owner of the
current database if it already has access to the database through an
existing alias or user security account within the database. To avoid this,
drop the alias or user within the current database first.
[@.map =] remap_alias_flag
Is the value true or false, which indicates whether existing aliases to the
old database owner (dbo) are mapped to the new owner of the current database
or dropped. remap_alias_flag is varchar(5), with a default of NULL,
indicating any existing aliases to the old dbo are mapped to the new owner
of the current database. false indicates that existing aliases to the old
database owner are dropped.
Return Code Values
0 (success) or 1 (failure)
"Roy Goldhammer" <roy@.hotmail.com> wrote in message
news:ODXgIbn9FHA.2192@.TK2MSFTNGP14.phx.gbl...
> Hello there
> I don't member of DBO owners of my database on sql server
> After i've created new table it has my name as an owner
> How can i change the owner?
> --
>
>
> ' 03-5611606
> ' 050-7709399
> : roy@.atidsm.co.il
>|||Hi Roy
Do you want to change the owner of the database (as your subject suggests)
or the owner of the tables?
I will assume, based on your message, that you want to change the table
owner, or have the table owner be 'dbo'.
DBO is a user name. It is a member of a role called db_owners. Members of
the db_owners role can do everything that the owner of the database can do,
within the database.
Other users can also be members of the db_owners role, but their user will
be something other than DBO. That sounds like your situation.
Normally, when a user creates a table, the owner of the table is the user
name of whoever creates it. So if DBO creates the table, it is owned by DBO,
if Roy, who might be a member of db_owners role, creates a table, it is
owned by Roy.
Members of the db_owners role do have a special permission that they can
create tables owned by other users:
CREATE TABLE dbo.mytable
(....)
Or, members of db_owners role can change the owner of existing objects.
EXEC sp_changeobjectowner 'roy.mytable', 'dbo'
Please see more details about this command in the Books Online., You might
also want to read up about login names and user names.
HTH
Kalen Delaney, SQL Server MVP
www.solidqualitylearning.com
"Roy Goldhammer" <roy@.hotmail.com> wrote in message
news:ODXgIbn9FHA.2192@.TK2MSFTNGP14.phx.gbl...
> Hello there
> I don't member of DBO owners of my database on sql server
> After i've created new table it has my name as an owner
> How can i change the owner?
> --
>
>
> ' 03-5611606
> ' 050-7709399
> : roy@.atidsm.co.il
>
Sunday, March 11, 2012
Change collation on entire database
I need to change on the entire database all the collations to one collation.
The only way I now it is possible is by:
ALTER TABLE TableName
ALTER COLUMN ColumnName
ColType(ColSize)
and other properties
EXEPT COLLATE newCollateName
That way is very dangures because i must know all the rest properties of the
fields.
Is there a way to change only the collation?To change this, I will use a query that I Adapted from Justin Mallier''s
blog:
(http://mallier.blogspot.com/2005/11.../drsql/blog/cns!80677FB08B3162E4!842.entry
--
----
Louis Davidson - http://spaces.msn.com/members/drsql/
SQL Server MVP
"Arguments are to be avoided: they are always vulgar and often convincing."
(Oscar Wilde)
"Roy Goldhammer" <roy@.hotmail.com> wrote in message
news:%23tbCR3tOGHA.3732@.TK2MSFTNGP10.phx.gbl...
> Hello there
> I need to change on the entire database all the collations to one
> collation.
> The only way I now it is possible is by:
> ALTER TABLE TableName
> ALTER COLUMN ColumnName
> ColType(ColSize)
> and other properties
> EXEPT COLLATE newCollateName
> That way is very dangures because i must know all the rest properties of
> the fields.
> Is there a way to change only the collation?
>
Thursday, March 8, 2012
change @@SERVERNAME 2005 - Urgent please help !!!
Hi There
I have changed the servername of a sql server 2005 instance. Using sp_dropserver and sp_addserver as per BOL.
However, after changing the servername i still see that :
EWX-JDGSQLSRV1\SQLServer2005SQLAgentUser$EWX-JDGSQLSRV1$MSSQLSERVER
EWX-JDGSQLSRV1\SQLServer2005MSSQLUser$EWX-JDGSQLSRV1$MSSQLSERVER
EWX-JDGSQLSRV1\SQLServer2005MSFTEUser$EWX-JDGSQLSRV1$MSSQLSERVER
built in logins still have the old server name.
My big concern is that these will no longer work?
Also i am changing not only servernames but doamins, i cannot find anythign on chaning domains and all that must be done.
Are the built in sql server logins still ok after i change the servername ? Even though they do not reflect the change?
Wjat else must i do before moving the server to a new domain (i will change the servcie accounts to use new domain accounts in the configuration manager?)
Thanx
Dietz:
Did you include the "local" tag when you called the sp_addserver stored procedure?
|||
Dave
Yes i did, i found the prblem though. Has nothing to do with that when i checked the sql log it could not execute sp_startup_agent, becuase agent XP's were not enabled, i could not enable agent XP's because lock pages in memory priviledges were not granted to the new sqlservice account.
So i granted the priviledges and enabled agent XP's and all was well.