Solved

automate the process of transferring SQL server 2005 login from SQL server 2005 mirror primary site to DR site

Posted on 2014-09-18
11
479 Views
Last Modified: 2016-02-11
Dear all,

Right now just found out that some login in the SQL server 2005 with SP2 mirror DR site do not have the respective login from primary mirror partner.

I can do this to manually transfer sql server login to the DR parnter.

but:

1)  Anyway to automate the whole process?
2)  I recall that the database permission, will goes with the database backup and restore process during the mirror creatino process ? so in this case, we only need to find out only the SQL login transfer script (by http://support.microsoft.com/kb/918992) and apply to the  DR mirror parnter?
3) Can the SQL srever 2012 / 2014 DAG group automate this ? it mirror the MS SQL system database too ?
4) or must use SSIS for that? any step by step guide to implement this kind of SSIS task on SQL server 2005 with SP2?

I find out this: http://www.sqlsoldier.com/wp/sqlserver/transferring-logins-to-a-database-mirror, any one tried that before ? can it copy the database role and permisson of the missing SQL login to the DR server as well ? and it work with SQL server 2005 and all version after?

so usage is dba_CopyLogins <dr server name>;  on primary server?

and it will only copy the MISSING login for that instead of recreate all logins or create all but with error message that the same login already exists on DR server ?

please suggest what is your existing method .
0
Comment
Question by:marrowyung
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
  • 2
11 Comments
 
LVL 1

Author Comment

by:marrowyung
ID: 40332015
so I find a DDL trigger script:

Create Trigger trigger_ApplyLoginsToDestination
On All Server
After Create_Login, Alter_Login, Drop_Login
As
Exec msdb..sp_start_job 'Apply Login Changes from Source to Destination' --change to your own job name
Print 'You have synced your login changes from source to destination server.'

Open in new window


so I change to

Create Trigger trigger_ApplyLoginsToDestination
On All Server
After Create_Login, Alter_Login, Drop_Login
As
Exec dba_CopyLogins <dr server name>; 
Print 'You have synced your login changes from source to destination server.'

Open in new window


?
0
 
LVL 38

Expert Comment

by:Jim P.
ID: 40333414
Have you heard about sp_help_revlogin.

My  last job I had it scheduled to dump to a file every 8 hours. Then that file was replicated to our offsite DR center. So I always had a current copy to use for DR testing or if something really happened..
0
 
LVL 1

Author Comment

by:marrowyung
ID: 40335181
Jim P,

Have you heard about sp_help_revlogin. yes by the MS script, but that one need manual work !

"My  last job I had it scheduled to dump to a file every 8 hours. Then that file was replicated to our offsite DR center. So I always had a current copy to use for DR testing or if something really happened.. "

so you mean get the output from that and store as a file? how ?

so just before you failover to the DR site you apply that file ?
0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
LVL 38

Expert Comment

by:Jim P.
ID: 40335429
Yes, I automated the output using the SQLCMD tool. I don't remember the exact syntax anymore.

Then after the databases were back in place I would run the script.  There are lines that will have to be commented out that the tool puts in, but the is a is a simple search and replace.
0
 
LVL 1

Author Comment

by:marrowyung
ID: 40335974
I can tell you that this:

http://www.sqlsoldier.com/wp/sqlserver/transferring-logins-to-a-database-mirror

can be one of the solution and other solution is to use SSIS package!

but that one is a SP and I don't konw any better solution !

anymore ?
0
 
LVL 38

Accepted Solution

by:
Jim P. earned 500 total points
ID: 40338012
The problem it that the DBs have to pre-exist  at the destiination. Where the script after the script can be run after the DBs have been restored.
0
 
LVL 1

Author Comment

by:marrowyung
ID: 40340829
"The problem it that the DBs have to pre-exist  at the destiination. "

of course ! ok you mean your way is very automated and don't need to know the new server name? DAG right?
0
 
LVL 30

Expert Comment

by:captain
ID: 40369715
marrowyung,

Jim P. sadly passed away on the 23rd of September. If you still require assistance with this, please kindly use the "Request Attention" feature.

capt.
0
 
LVL 1

Author Comment

by:marrowyung
ID: 40369967
R.I.P, you are his/her friend ?

I appreciate everything from him, what happed?
0
 
LVL 30

Expert Comment

by:captain
ID: 40370285
We only met on here. If you follow the link, there is a further link to the obituary. I do not have any more details than this.

I just thought I let you know in case you were waiting for a response.

:(
0
 
LVL 1

Author Comment

by:marrowyung
ID: 40370317
ok, tks a lot. please follow me in this site if you can
0

Featured Post

Comparison of Amazon Drive, Google Drive, OneDrive

What is Best for Backup: Amazon Drive, Google Drive or MS OneDrive? In this free whitepaper we look at their performance, pricing, and platform availability to help you decide which cloud drive is right for your situation. Download and read the results of our testing for free!

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

691 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