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
465 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
  • 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
 
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
Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

 
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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Join & Write a Comment

Suggested Solutions

My client has a dictionary table. They're defining a list of standard naming convention. Now, they are requiring my team to provide us a mechanism how to match new incoming data with existing data in their system.
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.

762 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now