USING TIME MACHINE AND MICROSOFT SQL SERVER The following guide is intended as a basic outline for using Time Machine with Microsoft SQL Server for performing date and time based software tests, time-lapsed simulations, or training new application users how to handle the date-triggered events within applications that are tied to a SQL Server database back-end. There are many applications that rely on Microsoft SQL Server to provide a back-end data store. In order to run simulations or test these applications with future or past dates, time zone differences or even simple leap year events it is necessary to use Time Machine to provide virtual clocks to the applications and the SQL Server. If applications are running in a user address space, you will need to provide a virtual clock for the logged in user s account as well as the account for the SQL Server Windows services. This paper shows how to setup and/or verify the SQL Server services are running either with a suitable managed service account or with a username defined by a system administrator. Additionally, the procedures in this paper can be followed as a rough guide for configuring other Windows services that may be part of the application software stack. THIS PROCESS WAS PERFORMED WITH THE FOLLOWING MACHINE PROFILE: Operating System: Windows Server 2012 R2 Database: SQL Server 2014 Click *Start+ then Administrative Tools and select Services. 1) In the right pane of the Service applet locate SQL Server (MSSQLSERVER). 2) Right-click on the entry for SQL Server (MSSQLSERVER) and select Properties.
3) On the Log On tab, if you have a SQL Server managed service account, as in the following screen capture, that will work. Press Cancel. 4) If Local System account is selected, click the This account radio button and enter a user name 5) other than NETWORK or LOCAL SERVICE.
VERIFYING THE CHANGE 1) Verify the change has been accepted by restarting all changed services. To do this just right click the entries for each and select Restart. 2) From a command line, assign a virtual date to the SQL Server account. 3) Verify the virtual date is running for the SQL Server account by listing the running virtual clocks and by executing a SQL Server function to return the current timestamp. tmuser -a -u NT SERVICE\MSSQLSERVER -y 5 or tmuser -a -u SQL -y 5 tmuser -l Listing all virtual clocks: ACCOUNT/pid CLOCK INFORMATION ------------------------------------------------------------------------------------------ (U) NT SERVICE\MSSQLSERVER Sun Sep 29 2019 21:21:37 (UTC-08:00) Pacific Time (US & Canada) Virtual date and time in system's time zone. Clock runs in normal speed. ------------------------------------------------------------------------------------------ C:\Users\Administrator>sqlcmd -d "AdventureWorks2014" -Q "select getdate()" ----------------------- 2019-09-29 21:21:47.970 (1 rows affected)
SETTING UP A SECOND INSTANCE With one instance of SQL Server installed, all users connecting to that instance will see the same virtual clock. It is sometimes useful to have multiple SQL instances so that different users can test concurrently with different virtual clocks or one group of users can see a virtual clock and other group can see the system clock. To set up a second instance for concurrent time testing, install SQL under a different user with a different SID. Remember to change the Log On As in Services for the second instance of SQL under the new SID so that the instances are controlled by difference accounts. Then different virtual clocks can be set against different SID to enable concurrent testing of different virtual clocks.
This document is provided for information purposes only, and the contents hereof are subject to change without notice. This document is not warranted to be error-free, nor subject to any other warranties or conditions, whether expressed orally or implied in law, including implied warranties and conditions of merchantability or fitness for a particular purpose. We specifically disclaim any liability with respect to this document, and no contractual obligations are formed either directly or indirectly by this document. This document may not be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without our prior written permission. Time Machine and Solution-Soft are registered trademarks of SolutionSoft Systems, Inc. All other trademarks are properties of their respective owners. 2015 SolutionSoft Systems, Inc. All rights reserved. SolutionSoft Systems, Inc. 2350 Mission College Blvd. Suite #777 Santa Clara, CA 95054 U.S.A. Worldwide Inquiries: Toll Free: 1.888.884.7337 Phone: 1.408.346.1400 Fax: 1.408.346.1499 www.solution-soft.com