• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 498
  • Last Modified:

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

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
marrowyung
Asked:
marrowyung
  • 6
  • 3
  • 2
1 Solution
 
marrowyungAuthor Commented:
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
 
Jim P.Commented:
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
 
marrowyungAuthor Commented:
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Jim P.Commented:
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
 
marrowyungAuthor Commented:
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
 
Jim P.Commented:
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
 
marrowyungAuthor Commented:
"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
 
captainCommented:
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
 
marrowyungAuthor Commented:
R.I.P, you are his/her friend ?

I appreciate everything from him, what happed?
0
 
captainCommented:
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
 
marrowyungAuthor Commented:
ok, tks a lot. please follow me in this site if you can
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.

  • 6
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now