Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Xfer Logins

Author  Topic 

tbrothers
Yak Posting Veteran

83 Posts

Posted - 2008-07-17 : 16:36:44
Hi:
Is there a way to automate the process of running a query and saving the result to a file? I've setup log shipping but I'll also need the current SQL Logins in case the production server decides to takes a permanent nap.

I want to run the following script and save the output to a file.

EXEC sp_help_revlogin

Thanks,
Terry

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-07-17 : 16:41:13
quote:
Originally posted by tbrothers

Hi:
Is there a way to automate the process of running a query and saving the result to a file? I've setup log shipping but I'll also need the current SQL Logins in case the production server decides to takes a permanent nap.

I want to run the following script and save the output to a file.

EXEC sp_help_revlogin

Thanks,


Terry



If you backup master database and model database regularly, you don't have to be worried about jobs and logins.
Go to Top of Page

tbrothers
Yak Posting Veteran

83 Posts

Posted - 2008-07-17 : 18:07:15
I perform full backups of all databases every night.

Our production server and our backup server have different names and I'm sure there are slight differences in them. We log ship every 15 minutes. If the prod server fails it's a matter of running a script on each database to take it out of read-only mode.

If I restored the master database to the backup server, different name and maybe slight configuration differences, wouldn't that cause a problem?

Thanks,
Terry
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-07-17 : 18:12:53
I've got a blog on this: http://weblogs.sqlteam.com/tarad/archive/2008/06/24/How-to-transfer-SQL-logins-between-SQL-Server-2005-instances.aspx

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

tbrothers
Yak Posting Veteran

83 Posts

Posted - 2008-07-17 : 18:38:27
Thanks Tara:
Can the script be automated to run nightly or weekly?

Thanks,
Terry
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-07-17 : 18:46:37
Yes. I'd suggest wrapping it into a stored procedure and then just calling the stored procedure from the job step. You could just put my script into the job step, but I prefer to have as little code in jobs for troubleshooting reasons.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -