?
Solved

How change the existed login name in Sybase?

Posted on 2007-08-02
7
Medium Priority
?
2,931 Views
Last Modified: 2008-01-09
How change the existed login name and it will make no bad effect for system?
Any system procedure to do it? or change system tables? many system tables related to login?
Thanks!
0
Comment
Question by:luyan
  • 3
  • 3
7 Comments
 
LVL 10

Accepted Solution

by:
bret earned 1200 total points
ID: 19618413
All you have to do is update the "name" column in master..syslogins.

1>
2>
3> sp_addlogin "time", "finagle"
4> go

Password correctly set.
Account unlocked.
New login created.
(return status = 0)
1> 2> use master
3> go
1> sp_configure "allow updates", 1
2> go
00:00000:00014:2007/08/02 10:08:26.33 server  Configuration file '/work/releases/1502nb/ASE-15_0/rel1502_bret_sun2.cfg' has been written and the previous version has been renamed to '/work/releases/1502nb/ASE-15_0/rel1502_bret_sun2.038'.
00:00000:00014:2007/08/02 10:08:26.36 server  The configuration option 'allow updates to system tables' has been changed by 'sa' from '0' to '1'.
 Parameter Name                 Default     Memory Used Config Value
         Run Value    Unit                 Type      
 ------------------------------ ----------- ----------- ------------
         ------------ -------------------- ----------
 allow updates to system tables           0           0            1
                    1 switch               dynamic    

(1 row affected)
Configuration option changed. ASE need not be rebooted since the option is
dynamic.
Changing the value of 'allow updates to system tables' does not increase the
amount of memory Adaptive Server uses.
(return status = 0)
1> update syslogins set name = "jime" where name = "time"
2> go
(1 row affected)
1> exit
bret-sun2% isql -Ujime -Pfinagle
go
1> 1>
2> use tempdb
3> go
1>  

0
 
LVL 19

Expert Comment

by:grant300
ID: 19618443
What do you mean "change existed login name"?

There will always be an "sa" login.  Do NOT tamper with that or your database becomes trashed.

Do you have other login names that have been created that you would like to get rid of?

You do not change a login name; you delete the old one and create a new one.  You will have to watch out for object ownership as the system will not let you drop a login that owns objects in a database.  This prevents orphaned objects.  Another alternative is to create the new login and simply disable the old login, but again, NEVER do this to the "sa" login.

Regards,
Bill
0
 

Author Comment

by:luyan
ID: 19619265
For the existed login, the user would be created in many databases in the same name as login. The user could access many databases and could already create some objects. So can not drop it and recreate one in different login name. How should I do, it will make no bad effect?
Thanks!
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 19

Expert Comment

by:grant300
ID: 19619422
The method that Bret outlined should work to change the login name.  The question is why is this necessary.

Most of the time, database objects should be owned by DBO rather than individual logins.  This eliminates the problems you are having now.

You would normally create named logins for users (who may come and go) then ALIAS them to DBO in each of the databases you want them to have authority over.  When the login creates an object in a database, the ownership is DBO which, of course, never goes away.  You can then drop a login and it's aliases will be removed at the same time.  No muss, no fuss.

Regards,
Bill
0
 

Author Comment

by:luyan
ID: 19628026
Yes, I could update the login name in syslogins like Bret suggested and also could update user name in sysusers. Anything else do I need to consider if I modify the name of login in Sybase.
Thanks!
0
 
LVL 19

Assisted Solution

by:grant300
grant300 earned 800 total points
ID: 19628076
There is a small but non-zero possibility that some of the SQL scripts you have laying around for creating database objects may refer explicitly to the owner by name, e.g.
SELECT * FROM MyDB.Somebody.TabName
in which case you will have to patch all of that out.

Again, I would urge you to switch all object ownership to DBO and simply alias the logins to DBO so you never have to go through this again.  There is a reason that, in a mature product like Sybase ASE, there is no way provided to do what you are asking for; it is simply bad practice.  If it weren't, there would be a system stored proc to do it.

Regards,
Bill
0
 

Author Comment

by:luyan
ID: 19663034
Thanks for all your help!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Often times it's very very easy to extend a volume on a Linux instance in AWS, but impossible to shrink it. I wanted to contribute to the experts-exchange community a way of providing a procedure that works on an AWS instance. It can also be used on…
Most folks would know the basics of how Dropbox works, so that’s not the purpose of this article. Security is what it’s all about, so here I’ll share how I choose to secure my Dropbox Account and the Data it contains.
Loops Section Overview
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month13 days, 16 hours left to enroll

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question