Unix Technical Forum

script to copy logins and users with all permissions

This is a discussion on script to copy logins and users with all permissions within the SQL Server forums, part of the Microsoft SQL Server category; --> Hello all, I am looking for the script, which I believe exists already.I need to be able to populate ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-01-2008, 12:09 PM
Inna
 
Posts: n/a
Default script to copy logins and users with all permissions

Hello all,
I am looking for the script, which I believe exists already.I need to
be able to populate the script for security of one database and
apply it to another database, even if it is located on another server:
1. All logins which not exist have to be created and which exists
ignored including the NT accounts
2. Users same as the old database + the existing ones stay in database
3. Passwords for the new logins.
4. All permissions/grants on all objects for the users that exists
(usually it's the case) and ignore those that don't.
I have script which does some of it, but it's not perfect, so every
time there are some errors.
Please let me know, if you need me to email script that I have. It's
pretty long so I cannot just post it in here.
Thank you in advance.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 03-01-2008, 12:09 PM
AlterEgo
 
Posts: n/a
Default Re: script to copy logins and users with all permissions

Inna,

If on SQL 2K, use Enterprise Manager.
Right click the database/All Tasks/Generate SQL Script.
Click the Options tab and you can select all of the logins and object
permissions you need.

-- Bill


"Inna" <mednyk@hotmail.com> wrote in message
news:1169753046.376196.16430@v45g2000cwv.googlegro ups.com...
> Hello all,
> I am looking for the script, which I believe exists already.I need to
> be able to populate the script for security of one database and
> apply it to another database, even if it is located on another server:
> 1. All logins which not exist have to be created and which exists
> ignored including the NT accounts
> 2. Users same as the old database + the existing ones stay in database
> 3. Passwords for the new logins.
> 4. All permissions/grants on all objects for the users that exists
> (usually it's the case) and ignore those that don't.
> I have script which does some of it, but it's not perfect, so every
> time there are some errors.
> Please let me know, if you need me to email script that I have. It's
> pretty long so I cannot just post it in here.
> Thank you in advance.
>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-01-2008, 12:11 PM
Inna
 
Posts: n/a
Default Re: script to copy logins and users with all permissions

On Jan 25, 7:04 pm, "AlterEgo" <altereg...@dslextreme.com> wrote:
> Inna,
>
> If on SQL 2K, use Enterprise Manager.
> Right click the database/All Tasks/Generate SQL Script.
> Click the Options tab and you can select all of the logins and object
> permissions you need.
>
> -- Bill
>
> "Inna" <med...@hotmail.com> wrote in message
>
> news:1169753046.376196.16430@v45g2000cwv.googlegro ups.com...
>
>
>
> > Hello all,
> > I am looking for the script, which I believe exists already.I need to
> > be able to populate the script for security of one database and
> > apply it to another database, even if it is located on another server:
> > 1. All logins which not exist have to be created and which exists
> > ignored including the NT accounts
> > 2. Users same as the old database + the existing ones stay in database
> > 3. Passwords for the new logins.
> > 4. All permissions/grants on all objects for the users that exists
> > (usually it's the case) and ignore those that don't.
> > I have script which does some of it, but it's not perfect, so every
> > time there are some errors.
> > Please let me know, if you need me to email script that I have. It's
> > pretty long so I cannot just post it in here.
> > Thank you in advance.- Hide quoted text -

>
> - Show quoted text -


Hello,
I cannot use Enterprise Manager, because every time it has to be done
for different database and this script is a part of another process
and it uses database name and server name as parameter.
Is there way just to populate script for any database, from query
analyzer?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 03-01-2008, 12:12 PM
dunleav1
 
Posts: n/a
Default Re: script to copy logins and users with all permissions

On Jan 30, 3:26 pm, "Inna" <med...@hotmail.com> wrote:
> On Jan 25, 7:04 pm, "AlterEgo" <altereg...@dslextreme.com> wrote:
>
>
>
> > Inna,

>
> > If on SQL 2K, use Enterprise Manager.
> > Right click the database/All Tasks/Generate SQL Script.
> > Click the Options tab and you can select all of the logins and object
> > permissions you need.

>
> > -- Bill

>
> > "Inna" <med...@hotmail.com> wrote in message

>
> >news:1169753046.376196.16430@v45g2000cwv.googlegr oups.com...

>
> > > Hello all,
> > > I am looking for the script, which I believe exists already.I need to
> > > be able to populate the script for security of one database and
> > > apply it to another database, even if it is located on another server:
> > > 1. All logins which not exist have to be created and which exists
> > > ignored including the NT accounts
> > > 2. Users same as the old database + the existing ones stay in database
> > > 3. Passwords for the new logins.
> > > 4. All permissions/grants on all objects for the users that exists
> > > (usually it's the case) and ignore those that don't.
> > > I have script which does some of it, but it's not perfect, so every
> > > time there are some errors.
> > > Please let me know, if you need me to email script that I have. It's
> > > pretty long so I cannot just post it in here.
> > > Thank you in advance.- Hide quoted text -

>
> > - Show quoted text -

>
> Hello,
> I cannot use Enterprise Manager, because every time it has to be done
> for different database and this script is a part of another process
> and it uses database name and server name as parameter.
> Is there way just to populate script for any database, from query
> analyzer?


AlterEgo's point is - let Enterprise manager generate the sql for you.
It will give you a starting point and you can change the code to be
specific for your application.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:17 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com