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
474 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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

Question has a verified solution.

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

My client sends a request to me that they want me to load data, which will be returned by Web Service APIs, and do some transformation before importing to database. In this article, I will provide an approach to load data with Web Service Task and X…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

726 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