Category Archives: How-to

Hyper-V server on USB

Pre-requisites:

Download GImageX

Download the latest Hyper-V ISO

Create VHD

Put in the USB drive

diskpart

select disk 3

clean

create partition primary

select partition 1

active

format quick fs=ntfs

assign letter=z

create vdisk file=z:\hyperv1.vhd maximum=24576 type=fixed

select vdisk file=z:\hyperv1.vhd

attach vdisk

create partition primary

assign letter=r

format quick fs=ntfs label=hyperv1

exit

Apply WIM to primary partition

Use GImageX to apply Install.wim to r:\

dism.exe /apply-imagemediafile:.\Install.wim /index:1 /applydir:r:\

Create BCD store on the UFD

bcdboot r:\Windows /s z:

Disable paging

reg load HKLM\HyperVTemp r:\Windows\System32\config\SYSTEM

reg add “HKLM\HyperVTemp\ControlSet001\Control\Session Manager\Memory Management” /v PagingFiles /t REG_MULTI_SZ /d “” /f

reg delete “HKLM\HyperVTemp\ControlSet001\Control\Session Manager\Memory Management” /v ExistingPageFiles /f

reg unload HKLM\HyperVTemp

Detach the VHD

diskpart

select vdisk file=z:\hyperv1.vhd

detach vdisk

Installing SQL on core

For example ..

setup.exe /q /iacceptsqlserverlicenseterms /action=install /features=sqlengine,replication /instanceid=SQLEXPRESS /instancename=SQLEXPRESS /usemicrosoftupdate

OR you can force enable the UI if (really?) necessary

setup.exe /uimode=EnableUIonServerCore

Don’t forget your firewall allow rules

netsh advfirewall firewall add rule name=”Allow SQL TCP 54321″ protocol=TCP dir=in localport=54321 action=allow

netsh advfirewall firewall add rule name=”Allow SQL UDP 1434″ protocol=UDP dir=in localport=1434 action=allow

And here is the setup help for reference

Microsoft (R) SQL Server 2014 12.00.2000.08
Copyright (c) Microsoft Corporation.  All rights reserved.

Usage:
setup.exe /[option]={value} /[option]={value} …

Options:
ACTION                       Specifies a Setup work flow, like INSTALL,
UNINSTALL, or UPGRADE. This is a required
parameter.
ADDCURRENTUSERASSQLADMIN     Provision current user as a Database Engine
system administrator for %SQL_PRODUCT_SHORT_NAME%
Express.
AGTDOMAINGROUP               Either domain user name or system account
AGTSVCACCOUNT                Either domain user name or system account
AGTSVCPASSWORD               Password for domain user name. Not required for
system account
AGTSVCSTARTUPTYPE            Startup type for the SQL Server Agent service.
Supported values are Manual, Automatic or
Disabled.
ALLINSTANCES                 Specifies that all instances are to be included
in the Setup operation. This parameter is
supported only when applying a patch.
ALLOWUPGRADEFORSSRSSHAREPOIN
RSInputSettings_AllowUpgradeForSSRSSharePointMode_Description
ASBACKUPDIR                  The location for the Analysis Services backup
files.
ASCOLLATION                  The collation used by Analysis Services.
ASCONFIGDIR                  The location for the Analysis Services
configuration files.
ASDATADIR                    The location for the Analysis Services data
files.
ASLOGDIR                     The location for the Analysis Services log files.
ASPROVIDERMSOLAP             Specifies if the MSOLAP provider can run in
process.
ASSERVERMODE                 Specifies the server mode of the Analysis
Services instance. Valid values are
MULTIDIMENSIONAL and TABULAR. The default value
is MULTIDIMENSIONAL.
ASSVCACCOUNT                 The account used by the Analysis Services
service.
ASSVCPASSWORD                The password for the Analysis Services service
account.
ASSVCSTARTUPTYPE             Controls the service startup type setting for the
service.
ASSYSADMINACCOUNTS           Specifies the list of administrator accounts to
provision.
ASTEMPDIR                    The location for the Analysis Services temporary
files.
BROWSERSVCSTARTUPTYPE        Startup type for Browser Service.
CLTCTLRNAME                  The computer name that the client communicates
with for the Distributed Replay Controller
service.
CLTRESULTDIR                 The result directory for the Distributed Replay
Client service.
CLTSTARTUPTYPE               The startup type for the Distributed Replay
Client service.
CLTSVCACCOUNT                The account used by the Distributed Replay Client
service.
CLTSVCPASSWORD               The password for the Distributed Replay Client
service account.
CLTWORKINGDIR                The working directory for the Distributed Replay
Client service.
CLUSTERPASSIVE               Specifies that SQL Server Setup should not manage
the SQL Server services. This option should be
used only in a non-Microsoft cluster environment.
COMMFABRICENCRYPTION         MATRIXCOMMMESSAGEPROTECTION {0,1}
COMMFABRICNETWORKLEVEL       MATRIXCOMMNETWORKISOLATION {0,1}
COMMFABRICPORT               MATRIXCOMMPORT <port>
CONFIGURATIONFILE            Specifies the configuration file to be used for
Setup.
CONFIRMIPDEPENDENCYCHANGE    Indicates that the change in IP address resource
dependency type for the SQL Server multi-subnet
failover cluster is accepted.
CTLRSTARTUPTYPE              The startup type for the Distributed Replay
Controller service.
CTLRSVCACCOUNT               The account used by the Distributed Replay
Controller service.
CTLRSVCPASSWORD              The password for the Distributed Replay
Controller service account.
CTLRUSERS                    The Windows account(s) used to grant permission
to the Distributed Replay Controller service.
ENABLERANU                   Set to “1” to enable RANU for SQL Server Express.
ENU                          Use the /ENU parameter to install the English
version of SQL Server on your localized Windows
operating system.
ERRORREPORTING               Specify if errors can be reported to Microsoft to
improve future SQL Server releases. Specify 1 or
True to enable and 0 or False to disable this
feature.
FAILOVERCLUSTERDISKS         Specifies a cluster shared disk to associate with
the SQL Server failover cluster instance.
FAILOVERCLUSTERGROUP         Specifies the name of the cluster group for the
SQL Server failover cluster instance.
FAILOVERCLUSTERIPADDRESSES   Specifies an encoded IP address. The encodings
are semicolon-delimited (;), and follow the
format <IP Type>;<address>;<network name>;<subnet
mask>. Supported IP types include DHCP, IPV4, and
IPV6.
FAILOVERCLUSTERNETWORKNAME   Specifies the name of the SQ LServer failover
cluster instance.  This name is the network name
that is used to connect to SQL Server services.
FAILOVERCLUSTERROLLOWNERSHIP Specifies whether the upgraded nodes should take
ownership of the failover instance group or not.
Use 0 to retain ownership in the legacy nodes, 1
to make the upgraded nodes take ownership, or 2
to let SQL Server Setup decide when to move
ownership.
FEATURES                     Specifies features to install, uninstall, or
upgrade. The list of top-level features include
SQL, AS, RS, IS, MDS, and Tools. The SQL feature
will install the Database Engine, Replication,
Full-Text, and Data Quality Services (DQS)
server. The Tools feature will install Management
Tools, Books online components, SQL Server Data
Tools, and other shared components.
FILESTREAMLEVEL              Level to enable FILESTREAM feature at (0, 1, 2 or
3).
FILESTREAMSHARENAME          Name of Windows share to be created for
FILESTREAM File I/O.
FTSVCACCOUNT                 User account for Full-text Filter Daemon Host.
FTSVCPASSWORD                User password for Full-text Filter Daemon Host
account.
FTUPGRADEOPTION              Full-text catalog upgrade option.
HELP                         Displays the command line parameters usage
IACCEPTSQLSERVERLICENSETERMS By specifying this parameter and accepting the
SQL Server license terms, you acknowledge that
you have read and understood the terms of use.
INDICATEPROGRESS             Specifies that the detailed Setup log should be
piped to the console.
INSTALLSHAREDDIR             Specify the root installation directory for
shared components.  This directory remains
unchanged after shared components are already
installed.
INSTALLSHAREDWOWDIR          Specify the root installation directory for the
WOW64 shared components.  This directory remains
unchanged after WOW64 shared components are
already installed.
INSTALLSQLDATADIR            The Database Engine root data directory.
INSTANCEDIR                  Specify the instance root directory.
INSTANCEID                   Specify the Instance ID for the SQL Server
features you have specified. SQL Server directory
structure, registry structure, and service names
will incorporate the instance ID of the SQL
Server instance.
INSTANCENAME                 Specify a default or named instance. MSSQLSERVER
is the default instance for non-Express editions
and SQLExpress for Express editions. This
parameter is required when installing the SQL
Server Database Engine (SQL), Analysis Services
(AS), or Reporting Services (RS).
ISSVCACCOUNT                 Either domain user name or system account.
ISSVCPASSWORD                Password for domain user.
ISSVCSTARTUPTYPE             Automatic, Manual or Disabled.
MATRIXCMBRICKCOMMPORT        MATRIXCMBRICKCOMMPORT portNumber
MATRIXCMSERVERNAME           MATRIXCMSERVERNAME hostName\instanceName
MATRIXNAME                   MATRIXNAME=<name>
NPENABLED                    Specify 0 to disable or 1 to enable the Named
Pipes protocol.
PID                          Specify the SQL Server product key to configure
which edition you would like to use.
QUIET                        Setup will not display any user interface.
QUIETSIMPLE                  Setup will display progress only, without any
user interaction.
ROLE                         Detailed help for command line argument ROLE has
not been defined yet.
RSCATALOGSERVERINSTANCENAME  The SQL Server server for the report server
catalog database.
RSINSTALLMODE                RSInputSettings_RSInstallMode_Description
RSSHPINSTALLMODE             RSInputSettings_RSInstallMode_Description
RSSVCACCOUNT                 Specify the service account of the report server.
This value is required. If you omit this value,
Setup will use the default built-in account for
the current operating system (either
NetworkService or LocalSystem). If you specify a
domain user account, the domain must be under 254
characters and the user name must be under 20
characters. The account name cannot contain the
following characters:
” / \ [ ] : ; | = , + * ? < >
RSSVCPASSWORD                Specify a strong password for the account. A
strong password is at least 8 characters and
includes a combination of upper and lower case
alphanumeric characters and at least one symbol
character. Avoid spelling an actual word or name
that might be listed in a dictionary.
RSSVCSTARTUPTYPE             Specifies the startup mode for the Report Server
service. Valid values include Manual, Automatic,
and Disabled. The default value for StartupType
is Manual, where the server is started when a
request is received.
RSUPGRADEDATABASEACCOUNT     RSInputSettings_RSInstallMode_Description
RSUPGRADEPASSWORD            RSInputSettings_RSInstallMode_Description
RULES                        Specifies the list of rule IDs or rule group IDs
to run.
SAPWD                        Password for SQL Server sa account.
SECURITYMODE                 The default is Windows Authentication. Use “SQL”
for Mixed Mode Authentication.
SQLBACKUPDIR                 Default directory for the Database Engine backup
files.
SQLCOLLATION                 Specifies a Windows collation or an SQL collation
to use for the Database Engine.
SQLSVCACCOUNT                Account for SQL Server service: Domain\User or
system account.
SQLSVCPASSWORD               A SQL Server service password is required only
for a domain account.
SQLSVCSTARTUPTYPE            Startup type for the SQL Server service.
SQLSYSADMINACCOUNTS          Windows account(s) to provision as SQL Server
system administrators.
SQLTEMPDBDIR                 Directory for Database Engine TempDB files.
SQLTEMPDBLOGDIR              Directory for the Database Engine TempDB log
files.
SQLUSERDBDIR                 Default directory for the Database Engine user
databases.
SQLUSERDBLOGDIR              Default directory for the Database Engine user
database logs.
SQMREPORTING                 Specify that SQL Server feature usage data can be
collected and sent to Microsoft. Specify 1 or
True to enable and 0 or False to disable this
feature.
TCPENABLED                   Specify 0 to disable or 1 to enable the TCP/IP
protocol.
UIMODE                       Parameter that controls the user interface
behavior. Valid values are Normal for the full
UI,AutoAdvance for a simplied UI, and
EnableUIOnServerCore for bypassing Server Core
setup GUI block.
UpdateEnabled                Specify whether SQL Server Setup should discover
and include product updates. The valid values are
True and False or 1 and 0. By default SQL Server
Setup will include updates that are found.
UpdateSource                 Specify the location where SQL Server Setup will
obtain product updates. The valid values are “MU”
to search Microsoft Update, a valid folder path,
a relative path such as .\MyUpdates or a UNC
share. By default SQL Server Setup will search
Microsoft Update or a Windows Update service
through the Window Server Update Services.
USEMICROSOFTUPDATE           If this parameter is provided, then this computer
will use Microsoft Update to check for updates.
X86                          Specifies that Setup should install into WOW64.
This command line argument is not supported on an
IA64 or a 32-bit system.

Full unattended installation example, showing all required parameters:

setup.exe /Q /IACCEPTSQLSERVERLICENSETERMS /ACTION=install /PID=<validpid> /FEATURES=SQL,AS,RS,IS,Tools
/INSTANCENAME=MSSQLSERVER /SQLSVCACCOUNT=”MyDomain\MyAccount”
/SQLSVCPASSWORD=”************” /SQLSYSADMINACCOUNTS=”MyDomain\MyAccount ”
/AGTSVCACCOUNT=”MyDomain\MyAccount” /AGTSVCPASSWORD=”************”
/ASSVCACCOUNT=”MyDomain\MyAccount” /ASSVCPASSWORD=”************”
/RSSVCACCOUNT=”MyDomain\MyAccount” /RSSVCPASSWORD=”************”
/ISSVCAccount=”MyDomain\MyAccount” /ISSVCPASSWORD=”************”
/ASSYSADMINACCOUNTS=”MyDomain\MyAccount”

Intro to HammerDB

One of my favorite benchmarking tools is HammerDB.  In a nutshell, it allows you to run a well evolved SQL benchmark (TPC-C) against your system to gauge performance.  The scenario to picture is an order/warehouse simulator and your metric is how many new orders per minute (NOPM) the system can crank out.

CPU, memory, disk all matter for SQL and so all make a difference in the achieved NOPM.  Other factors include how many virtual users (you configure) are running against the TPC-C and if you want to get networking into the mix, then you can run the benchmark from a client against a remote SQL server.

HammerDB also has nice features such as running in Autopilot mode where you can run, for example, 5 minutes with a single user, then 5 minutes with 2 users, then 4, then 8, then 16, then 32 … and so on.  This mode is my preferred method as I can just setup a benchmark, start it, and just walk away knowing I can just check the logs later for the results.

Another nice capability is the master/slave mode.  Basically, you can coordinate multiple clients to pummel a server simultaneously.  I don’t use it often, but I have used it.

Getting started…

After installing and launching, HammerDB is going to appear like this…

HammerDB1

I’m going to be testing on MSSQL Server, so I will close Oracle and select SQL server instead.  Then I simply pick TPC-C.

HammerDB2

And then confirm.

HammerDB3

Now you will need to create your initial empty TPC-C database.  Simply go into SSMS and create a new database.  I’m calling mine “tpcc”.  You can get fancy and tweak the number of database files and logs, and size them to prevent autogrowth, … etc.  It does help maximize the benchmark numbers.  Remember, you’ll need to be fair and tweak both systems when running a comparison.

HammerDB4  For a first try, just use the model default database.

Now that we have a “tpcc” database on SQL, time to let HammerDB prepare it for testing.  We do this by going to the Schema Build -> Options where we’ll put in the SQL connection string info.

HammerDB5  For your first time, just use the original schema.  Once you start tweaking for higher numbers, building a schema with multiple warehouses will help your cause.  My rule of thumb has been to simply to make the number of warehouses equal to the number of processor cores … 4 processor cores, 4 warehouses.  16 cores, 16 warehouse… etc.  I don’t know if that is ideal, just what I’ve been doing.

Once the schema build options are ready, double-click Build …

HammerDB6

Then click Yes

HammerDB7

It may take a while, just let it build until you see the TPCC SCHEMA COMPLETE.

HammerDB8a  Congrats, you have a database ready to test against.  Click the red traffic light icon (highlighted) to stop the build.

Now let’s configure a test run…

First, we need to again configure the connection string.  This time for the benchmark.  Open Driver Script -> Options.  Your connection string from the schema build should populate here automatically otherwise you can fix it.

HammerDB9a  I prefer using a timed test and highlighted the options in the screenshot.  The reason is that I typically do use the Autopilot test so I can test a number of virtual users for 5 minutes at a time.  Then I can ultimately plot a chart of NOPM against the number of virtual users to get more of a profile.  Some systems scale up virtual users better than others, and you just need more data to see it.  Use Autopilot to perform the data runs for you.

Double-click Load to load those driver options.

Now, lets go to Autopilot -> Options.

HammerDB10  Enable Autopilot, then configure the length of the test and the number of virtual users.

Runtime: Since our driver options specified a 2 minute ramp up, a 5 minute test run, and Autopilot is specifying a 10 minute interval (10-2-5=3), there is going to be a 3 minute cool down where virtual users are disconnected.  If the virtual users cannot all disconnect within that cool down period, HammerDB will wait before starting up the next run.

Users:  For each run, there will be one control user and the rest will be virtual users against the database.  So, basically if you want 4 virtual users, you configure the number 5 in Autopilot.  My screen shot shows 2 3 5 9 17 33 65 129 257 513 1025 … but actually corresponds to a number of working virtual users of 1 2 4 8 16 32 64 128 265 512 1024.

I always check off the option to log the output and to use unique log names.  Occasionally HammerDB crashes and the scrolling log in the GUI will not be retrievable when that happens.  Use the text log files instead.  For this run, on my system, I already know that 1024 users is too ambitious and will crash the system (here is where I might use master/slave to have multiple instances run together to create the 1024 users).

Double-click Autopilot and let it run.  Stop it anytime using the red traffic light.

HammerDB11

A log file output will look something like this …

HammerDB12

Using Excel we can simply generate comparisons like this …

HammerDB13

I’ve used HammerDB to assist with such comparisons as VMware versus Hyper-V versus bare metal … static memory versus memory overcommit versus dynamic memory … local RAID versus SAN … SQL failover cluster versus availability group … and in this blog I plan to be using HammerDB as a tool to benchmark server core.  I’m curious to see the results!