Download as pdf or txt
Download as pdf or txt
You are on page 1of 69

Pro SQL Server 2022 Administration: A

guide for the modern DBA 3rd Edition


Peter A. Carter
Visit to download the full and correct content document:
https://ebookmeta.com/product/pro-sql-server-2022-administration-a-guide-for-the-mo
dern-dba-3rd-edition-peter-a-carter/
More products digital (pdf, epub, mobi) instant
download maybe you interests ...

Pro SQL Server 2019 Administration: A Guide for the


Modern DBA Paperback Second Edition Peter Carter

https://ebookmeta.com/product/pro-sql-server-2019-administration-
a-guide-for-the-modern-dba-paperback-second-edition-peter-carter/

Pro SQL Server 2022 Wait Statistics: A Practical Guide


to Analyzing Performance in SQL Server and Azure SQL
Database, 3rd Edition Thomas Larock

https://ebookmeta.com/product/pro-sql-server-2022-wait-
statistics-a-practical-guide-to-analyzing-performance-in-sql-
server-and-azure-sql-database-3rd-edition-thomas-larock-2/

Pro SQL Server 2022 Wait Statistics: A Practical Guide


to Analyzing Performance in SQL Server and Azure SQL
Database, 3rd Edition Thomas Larock

https://ebookmeta.com/product/pro-sql-server-2022-wait-
statistics-a-practical-guide-to-analyzing-performance-in-sql-
server-and-azure-sql-database-3rd-edition-thomas-larock/

SQL Server 2019 AlwaysOn: Supporting 24x7 Applications


with Continuous Uptime 3rd Edition Peter A. Carter

https://ebookmeta.com/product/sql-server-2019-alwayson-
supporting-24x7-applications-with-continuous-uptime-3rd-edition-
peter-a-carter/
SQL Server 2022 Administration Inside Out 1st Edition
Randolph West

https://ebookmeta.com/product/sql-server-2022-administration-
inside-out-1st-edition-randolph-west/

100 SQL Server Mistakes and How to Avoid Them MEAP V01
Peter A. Carter

https://ebookmeta.com/product/100-sql-server-mistakes-and-how-to-
avoid-them-meap-v01-peter-a-carter/

Pro SQL Server 2019 Wait Statistics: A Practical Guide


to Analyzing Performance in SQL Server - Second Edition
Enrico Van De Laar

https://ebookmeta.com/product/pro-sql-server-2019-wait-
statistics-a-practical-guide-to-analyzing-performance-in-sql-
server-second-edition-enrico-van-de-laar/

Pro Encryption in SQL Server 2022: Provide the Highest


Level of Protection for Your Data 1st Edition Matthew
Mcgiffen

https://ebookmeta.com/product/pro-encryption-in-sql-
server-2022-provide-the-highest-level-of-protection-for-your-
data-1st-edition-matthew-mcgiffen/

Pro T-SQL 2019: Toward Speed, Scalability, and


Standardization for SQL Server Developers 1st Edition
Elizabeth Noble

https://ebookmeta.com/product/pro-t-sql-2019-toward-speed-
scalability-and-standardization-for-sql-server-developers-1st-
edition-elizabeth-noble/
Pro SQL Server 2022
Administration
A Guide for the Modern DBA

Third Edition

Peter A. Carter
Pro SQL Server 2022
Administration
A Guide for the Modern DBA
Third Edition

Peter A. Carter
Pro SQL Server 2022 Administration: A Guide for the Modern DBA
Peter A. Carter
SOUTHAMPTON, UK

ISBN-13 (pbk): 978-1-4842-8863-4 ISBN-13 (electronic): 978-1-4842-8864-1


https://doi.org/10.1007/978-1-4842-8864-1

Copyright © 2023 by Peter A. Carter


This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the
material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation,
broadcasting, reproduction on microfilms or in any other physical way, and transmission or information
storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now
known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with
every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an
editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the
trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not
identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to
proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of publication,
neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or
omissions that may be made. The publisher makes no warranty, express or implied, with respect to the
material contained herein.
Managing Director, Apress Media LLC: Welmoed Spahr
Acquisitions Editor: Jonathan Gennick
Development Editor: Laura Berendson
Coordinating Editor: Jill Balzano
Cover designed by eStudioCalamar
Cover Photo by Anton Maksimov 5642.su on Unsplash
Distributed to the book trade worldwide by Springer Science+Business Media New York, 1 New York Plaza,
Suite 4600, New York, NY 10004-1562, USA. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@
springer-sbm.com, or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole
member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc
is a Delaware corporation.
For information on translations, please e-mail booktranslations@springernature.com; for reprint,
paperback, or audio rights, please e-mail bookpermissions@springernature.com.
Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook versions and
licenses are also available for most titles. For more information, reference our Print and eBook Bulk Sales
web page at http://www.apress.com/bulk-sales.
Any source code or other supplementary material referenced by the author in this book is available to
readers on GitHub (https://github.com/Apress). For more detailed information, please visit http://www.
apress.com/source-code.
Printed on acid-free paper
For Terri. My inspiration, my rock.
Table of Contents
About the Author����������������������������������������������������������������������������������������������������xix

About the Technical Reviewer��������������������������������������������������������������������������������xxi


Acknowledgments������������������������������������������������������������������������������������������������xxiii

Part I: Installation and Configuration������������������������������������������������������������� 1


Chapter 1: Planning the Deployment������������������������������������������������������������������������ 3
Editions and License Models�������������������������������������������������������������������������������������������������������� 3
Hardware Considerations�������������������������������������������������������������������������������������������������������������� 6
Specifying Strategic Minimum Requirements������������������������������������������������������������������������� 7
Storage������������������������������������������������������������������������������������������������������������������������������������ 7
Operating Systems Considerations��������������������������������������������������������������������������������������������� 18
Configuring the Operating System���������������������������������������������������������������������������������������� 19
Selecting Features���������������������������������������������������������������������������������������������������������������������� 24
Instance Features������������������������������������������������������������������������������������������������������������������ 25
Shared Features�������������������������������������������������������������������������������������������������������������������� 27
Summary������������������������������������������������������������������������������������������������������������������������������������ 29

Chapter 2: GUI Installation�������������������������������������������������������������������������������������� 31


Obtaining SQL Server Media������������������������������������������������������������������������������������������������������� 31
Installation Center����������������������������������������������������������������������������������������������������������������������� 32
The Planning Tab������������������������������������������������������������������������������������������������������������������� 33
The Installation Tab���������������������������������������������������������������������������������������������������������������� 34
The Maintenance Tab������������������������������������������������������������������������������������������������������������ 36
The Tools Tab������������������������������������������������������������������������������������������������������������������������� 37
The Resources Tab���������������������������������������������������������������������������������������������������������������� 38
The Advanced Tab������������������������������������������������������������������������������������������������������������������ 39
The Options Tab��������������������������������������������������������������������������������������������������������������������� 41
v
Table of Contents

Installing a Stand-Alone Database Engine Instance������������������������������������������������������������������� 42


Preparation Steps������������������������������������������������������������������������������������������������������������������ 42
The Feature Selection Page��������������������������������������������������������������������������������������������������� 49
The Instance Configuration Page������������������������������������������������������������������������������������������� 50
Selecting Service Accounts��������������������������������������������������������������������������������������������������� 52
Choosing the Collation����������������������������������������������������������������������������������������������������������� 55
Provisioning Instance Security���������������������������������������������������������������������������������������������� 62
Configuring the Instance������������������������������������������������������������������������������������������������������� 64
Configuring SQL Server Extension for Azure������������������������������������������������������������������������� 70
Completing the Installation���������������������������������������������������������������������������������������������������� 71
Summary������������������������������������������������������������������������������������������������������������������������������������ 73

Chapter 3: Server Core Installation������������������������������������������������������������������������ 75


Installing an Instance������������������������������������������������������������������������������������������������������������������ 75
Required Parameters������������������������������������������������������������������������������������������������������������� 76
Role Parameter���������������������������������������������������������������������������������������������������������������������� 79
Basic Installation������������������������������������������������������������������������������������������������������������������� 80
Smoke Tests�������������������������������������������������������������������������������������������������������������������������� 81
Troubleshooting the Installation�������������������������������������������������������������������������������������������� 84
Optional Parameters�������������������������������������������������������������������������������������������������������������� 87
Product Update���������������������������������������������������������������������������������������������������������������������� 91
Using a Config File���������������������������������������������������������������������������������������������������������������������� 93
Automatic Installation Routines�������������������������������������������������������������������������������������������������� 97
Enhancing the Installation Routine���������������������������������������������������������������������������������������� 99
Production Readiness���������������������������������������������������������������������������������������������������������� 100
Summary���������������������������������������������������������������������������������������������������������������������������������� 102

Chapter 4: Installation on Heterogeneous Operating Systems����������������������������� 105


Installing SQL Server on Linux�������������������������������������������������������������������������������������������������� 105
Installing SQL Server Manually�������������������������������������������������������������������������������������������� 106
Configuring SQL Server������������������������������������������������������������������������������������������������������� 109
Unattended Installation������������������������������������������������������������������������������������������������������� 113

vi
Table of Contents

Installing and Managing SQL Server in a Docker Container����������������������������������������������������� 116


Running a Microsoft-Supplied Docker Image���������������������������������������������������������������������� 117
Working with Containers����������������������������������������������������������������������������������������������������� 118
Creating Custom SQL Server Containers���������������������������������������������������������������������������������� 120
Creating a Simple Docker Image for SQL Server����������������������������������������������������������������� 121
Create a Configurable Docker Image for SQL Server����������������������������������������������������������� 126
Summary���������������������������������������������������������������������������������������������������������������������������������� 133

Chapter 5: Configuring the Instance��������������������������������������������������������������������� 135


Instance Configuration�������������������������������������������������������������������������������������������������������������� 135
Using sp_configure�������������������������������������������������������������������������������������������������������������� 135
Processor and Memory Configuration��������������������������������������������������������������������������������� 137
Trace Flags�������������������������������������������������������������������������������������������������������������������������� 150
Ports and Firewalls������������������������������������������������������������������������������������������������������������������� 155
Process of Communication�������������������������������������������������������������������������������������������������� 155
Ports Required by SQL Server��������������������������������������������������������������������������������������������� 156
Configuring the Port That the Instance Will Listen On��������������������������������������������������������� 158
System Databases�������������������������������������������������������������������������������������������������������������������� 161
mssqlsystemresource (Resource)��������������������������������������������������������������������������������������� 161
MSDB����������������������������������������������������������������������������������������������������������������������������������� 161
Master��������������������������������������������������������������������������������������������������������������������������������� 162
Model����������������������������������������������������������������������������������������������������������������������������������� 163
TempDB������������������������������������������������������������������������������������������������������������������������������� 163
Optimizing TempDB������������������������������������������������������������������������������������������������������������� 165
Buffer Pool Extension���������������������������������������������������������������������������������������������������������������� 168
Hybrid Buffer Pool��������������������������������������������������������������������������������������������������������������������� 170
Summary���������������������������������������������������������������������������������������������������������������������������������� 170

vii
Table of Contents

Part II: Database Administration���������������������������������������������������������������� 173


Chapter 6: Database Configuration����������������������������������������������������������������������� 175
Data Storage����������������������������������������������������������������������������������������������������������������������������� 175
Filegroups���������������������������������������������������������������������������������������������������������������������������� 176
FILESTREAM Filegroups������������������������������������������������������������������������������������������������������ 180
Memory-Optimized Filegroups�������������������������������������������������������������������������������������������� 187
Strategies for Structured Filegroups����������������������������������������������������������������������������������� 190
Strategies for Memory-Optimized Filegroups��������������������������������������������������������������������� 193
File and Filegroup Maintenance������������������������������������������������������������������������������������������������ 194
Adding Files������������������������������������������������������������������������������������������������������������������������� 194
Expanding Files������������������������������������������������������������������������������������������������������������������� 197
Shrinking Files��������������������������������������������������������������������������������������������������������������������� 198
Database Scoped Configurations���������������������������������������������������������������������������������������������� 201
Log Maintenance���������������������������������������������������������������������������������������������������������������������� 204
Recovery Model������������������������������������������������������������������������������������������������������������������� 206
Log File Count���������������������������������������������������������������������������������������������������������������������� 207
Shrinking the Log���������������������������������������������������������������������������������������������������������������� 207
Log Fragmentation�������������������������������������������������������������������������������������������������������������� 208
Summary���������������������������������������������������������������������������������������������������������������������������������� 216

Chapter 7: Table Optimizations����������������������������������������������������������������������������� 219


Table Partitioning���������������������������������������������������������������������������������������������������������������������� 219
Partitioning Concepts���������������������������������������������������������������������������������������������������������� 220
Implementing Partitioning��������������������������������������������������������������������������������������������������� 223
Monitoring Partitioned Tables���������������������������������������������������������������������������������������������� 230
Sliding Windows������������������������������������������������������������������������������������������������������������������ 233
Partition Elimination������������������������������������������������������������������������������������������������������������ 236
Table Compression�������������������������������������������������������������������������������������������������������������������� 238
Row Compression���������������������������������������������������������������������������������������������������������������� 239
Page Compression��������������������������������������������������������������������������������������������������������������� 240
Columnstore Compression�������������������������������������������������������������������������������������������������� 242

viii
Table of Contents

XML Compression���������������������������������������������������������������������������������������������������������������� 243


Implementing Compression������������������������������������������������������������������������������������������������� 244
Memory-Optimized Tables�������������������������������������������������������������������������������������������������������� 248
Durability����������������������������������������������������������������������������������������������������������������������������� 249
Creating and Managing Memory-Optimized Tables������������������������������������������������������������� 249
Performance Profile������������������������������������������������������������������������������������������������������������� 252
Table Memory Optimization Advisor������������������������������������������������������������������������������������ 256
Natively Compiled Objects��������������������������������������������������������������������������������������������������� 257
Summary���������������������������������������������������������������������������������������������������������������������������������� 260

Chapter 8: Indexes and Statistics������������������������������������������������������������������������� 263


Clustered Indexes��������������������������������������������������������������������������������������������������������������������� 263
Tables Without a Clustered Index���������������������������������������������������������������������������������������� 264
Tables with a Clustered Index���������������������������������������������������������������������������������������������� 265
Clustering the Primary Key�������������������������������������������������������������������������������������������������� 266
Administering Clustered Indexes����������������������������������������������������������������������������������������� 267
Nonclustered Indexes��������������������������������������������������������������������������������������������������������������� 271
Covering Indexes����������������������������������������������������������������������������������������������������������������� 272
Administering Nonclustered Indexes����������������������������������������������������������������������������������� 273
Filtered Indexes������������������������������������������������������������������������������������������������������������������� 279
Indexes for Specialized Application������������������������������������������������������������������������������������������ 279
Columnstore Indexes����������������������������������������������������������������������������������������������������������� 280
Clustered Columnstore Indexes������������������������������������������������������������������������������������������� 281
Nonclustered Columnstore Indexes������������������������������������������������������������������������������������� 284
In-Memory Indexes�������������������������������������������������������������������������������������������������������������� 285
Maintaining Indexes������������������������������������������������������������������������������������������������������������������ 291
Missing Indexes������������������������������������������������������������������������������������������������������������������� 292
Index Fragmentation������������������������������������������������������������������������������������������������������������ 294
Resumable Index Operations����������������������������������������������������������������������������������������������� 299
Partitioned Indexes�������������������������������������������������������������������������������������������������������������� 302

ix
Table of Contents

Statistics����������������������������������������������������������������������������������������������������������������������������������� 304
Filtered Statistics����������������������������������������������������������������������������������������������������������������� 306
Incremental Statistics���������������������������������������������������������������������������������������������������������� 307
Managing Statistics������������������������������������������������������������������������������������������������������������� 307
Managing Cardinality����������������������������������������������������������������������������������������������������������� 310
Summary���������������������������������������������������������������������������������������������������������������������������������� 312

Chapter 9: Database Consistency������������������������������������������������������������������������� 315


Consistency Errors�������������������������������������������������������������������������������������������������������������������� 315
Understand Consistency Errors������������������������������������������������������������������������������������������� 315
Detecting Consistency Errors���������������������������������������������������������������������������������������������� 317
System Database Corruption����������������������������������������������������������������������������������������������� 327
DBCC CHECKDB������������������������������������������������������������������������������������������������������������������������� 330
Checking for Errors�������������������������������������������������������������������������������������������������������������� 330
Fixing Errors������������������������������������������������������������������������������������������������������������������������ 336
Emergency Mode����������������������������������������������������������������������������������������������������������������� 339
Other DBCC Commands for Corruption�������������������������������������������������������������������������������� 341
Consistency Checks on VLDBs�������������������������������������������������������������������������������������������������� 346
DBCC CHECKDB with PHYSICAL_ONLY�������������������������������������������������������������������������������� 346
Backing Up WITH CHECKSUM and DBCC CHECKALLOC������������������������������������������������������� 347
Splitting the Workload��������������������������������������������������������������������������������������������������������� 347
Offloading to a Secondary Server���������������������������������������������������������������������������������������� 348
Summary���������������������������������������������������������������������������������������������������������������������������������� 348

Part III: Security, Resilience, and Scaling Workloads��������������������������������� 351


Chapter 10: SQL Server Security Model���������������������������������������������������������������� 353
Security Hierarchy��������������������������������������������������������������������������������������������������������������������� 353
Implementing Instance-Level Security�������������������������������������������������������������������������������� 357
Implementing Database-Level Security������������������������������������������������������������������������������������ 368
Database Roles�������������������������������������������������������������������������������������������������������������������� 368
Schemas������������������������������������������������������������������������������������������������������������������������������ 372

x
Table of Contents

Creating and Managing Contained Users���������������������������������������������������������������������������� 375


Implementing Object-Level Security����������������������������������������������������������������������������������������� 379
Summary���������������������������������������������������������������������������������������������������������������������������������� 380

Chapter 11: Auditing and Ledger�������������������������������������������������������������������������� 381


Ledger��������������������������������������������������������������������������������������������������������������������������������������� 381
Append-Only Ledger Tables������������������������������������������������������������������������������������������������� 382
Ledger Database����������������������������������������������������������������������������������������������������������������� 384
Database Ledger and Digest Management������������������������������������������������������������������������� 387
Server Audit������������������������������������������������������������������������������������������������������������������������������ 392
Creating a Server Audit������������������������������������������������������������������������������������������������������� 392
Creating a Server Audit Specification���������������������������������������������������������������������������������� 396
Enabling and Invoking Audits���������������������������������������������������������������������������������������������� 398
Updateable Ledger Tables��������������������������������������������������������������������������������������������������� 399
Database Audit Specifications��������������������������������������������������������������������������������������������� 407
Auditing the Audit���������������������������������������������������������������������������������������������������������������� 412
Summary���������������������������������������������������������������������������������������������������������������������������������� 413

Chapter 12: Encryption����������������������������������������������������������������������������������������� 415


Encryption Hierarchy����������������������������������������������������������������������������������������������������������������� 415
Encryption Concepts������������������������������������������������������������������������������������������������������������ 415
SQL Server Encryption Concepts����������������������������������������������������������������������������������������� 416
Transparent Data Encryption����������������������������������������������������������������������������������������������������� 421
Implementing TDE��������������������������������������������������������������������������������������������������������������� 422
Managing TDE���������������������������������������������������������������������������������������������������������������������� 428
Migrating an Encrypted Database��������������������������������������������������������������������������������������� 429
Managing Cell-Level Encryption����������������������������������������������������������������������������������������������� 430
Accessing Encrypted Data��������������������������������������������������������������������������������������������������� 435
Always Encrypted��������������������������������������������������������������������������������������������������������������������� 437
Implementing Always Encrypted����������������������������������������������������������������������������������������� 439
Administering Keys�������������������������������������������������������������������������������������������������������������� 446
Summary���������������������������������������������������������������������������������������������������������������������������������� 451

xi
Table of Contents

Chapter 13: Backups and Restores���������������������������������������������������������������������� 453


Backup Fundamentals�������������������������������������������������������������������������������������������������������������� 453
Recovery Models����������������������������������������������������������������������������������������������������������������� 453
Changing the Recovery Model��������������������������������������������������������������������������������������������� 456
Backup Types����������������������������������������������������������������������������������������������������������������������� 459
Backup Media���������������������������������������������������������������������������������������������������������������������� 460
Backup Strategies��������������������������������������������������������������������������������������������������������������������� 462
Full Backup Only������������������������������������������������������������������������������������������������������������������ 463
Full and Transaction Log Backups��������������������������������������������������������������������������������������� 463
Full, Differential, and Transaction Log Backups������������������������������������������������������������������� 464
Filegroup Backups��������������������������������������������������������������������������������������������������������������� 464
Partial Backup��������������������������������������������������������������������������������������������������������������������� 465
Backing Up a Database������������������������������������������������������������������������������������������������������������� 465
Backing Up in SQL Server Management Studio������������������������������������������������������������������ 465
Backing Up via T-SQL���������������������������������������������������������������������������������������������������������� 468
Restoring a Database���������������������������������������������������������������������������������������������������������������� 475
Restoring in SQL Server Management Studio��������������������������������������������������������������������� 475
Restoring via T-SQL������������������������������������������������������������������������������������������������������������� 480
Restoring to a Point in Time������������������������������������������������������������������������������������������������������ 486
Restoring Files and Pages�������������������������������������������������������������������������������������������������������� 490
Restoring a File������������������������������������������������������������������������������������������������������������������� 490
Restoring a Page����������������������������������������������������������������������������������������������������������������� 492
Piecemeal Restores������������������������������������������������������������������������������������������������������������������ 495
Accelerated Database Recovery����������������������������������������������������������������������������������������������� 498
Summary���������������������������������������������������������������������������������������������������������������������������������� 501

Chapter 14: High Availability and Disaster Recovery Concepts��������������������������� 505


Availability Concepts����������������������������������������������������������������������������������������������������������������� 506
Level of Availability�������������������������������������������������������������������������������������������������������������� 506
Recovery Point Objective and Recovery Time Objective������������������������������������������������������ 509
Cost of Downtime���������������������������������������������������������������������������������������������������������������� 511
Classification of Standby Servers���������������������������������������������������������������������������������������� 512

xii
Table of Contents

High Availability and Recovery Technologies���������������������������������������������������������������������������� 513


AlwaysOn Failover Clustering���������������������������������������������������������������������������������������������� 513
AlwaysOn Availability Groups���������������������������������������������������������������������������������������������� 520
Log Shipping������������������������������������������������������������������������������������������������������������������������ 526
Combining Technologies������������������������������������������������������������������������������������������������������ 529
Summary���������������������������������������������������������������������������������������������������������������������������������� 532

Chapter 15: Implementing AlwaysOn Availability Groups������������������������������������ 533


Implementing AlwaysOn Availability Groups����������������������������������������������������������������������������� 534
Configuring SQL Server������������������������������������������������������������������������������������������������������� 540
Creating the Availability Group�������������������������������������������������������������������������������������������� 542
Availability Groups On Linux������������������������������������������������������������������������������������������������������ 557
Contained Availability Group����������������������������������������������������������������������������������������������������� 564
Distributed Availability Groups�������������������������������������������������������������������������������������������������� 570
Managing AlwaysOn Availability Groups����������������������������������������������������������������������������������� 573
Failover�������������������������������������������������������������������������������������������������������������������������������� 573
Synchronizing Uncontained Objects������������������������������������������������������������������������������������ 579
Monitoring��������������������������������������������������������������������������������������������������������������������������� 580
Other Administrative Considerations����������������������������������������������������������������������������������� 583
Summary���������������������������������������������������������������������������������������������������������������������������������� 585

Chapter 16: Implementing Log Shipping�������������������������������������������������������������� 587


Implementing Log Shipping for DR������������������������������������������������������������������������������������������� 587
GUI Configuration����������������������������������������������������������������������������������������������������������������� 590
T-SQL Configuration������������������������������������������������������������������������������������������������������������� 601
Log Shipping Maintenance������������������������������������������������������������������������������������������������������� 613
Failing Over Log Shipping���������������������������������������������������������������������������������������������������� 613
Switching Roles������������������������������������������������������������������������������������������������������������������� 614
Monitoring��������������������������������������������������������������������������������������������������������������������������� 620
Summary���������������������������������������������������������������������������������������������������������������������������������� 623

xiii
Table of Contents

Chapter 17: Scaling Workloads���������������������������������������������������������������������������� 625


Database Snapshots����������������������������������������������������������������������������������������������������������������� 625
Implementing Database Snapshots������������������������������������������������������������������������������������� 628
Recovering Data from a Snapshot��������������������������������������������������������������������������������������� 632
Replication�������������������������������������������������������������������������������������������������������������������������������� 633
Replication Concepts����������������������������������������������������������������������������������������������������������� 633
Types of Replication������������������������������������������������������������������������������������������������������������ 635
Implementing Transactional Replication������������������������������������������������������������������������������ 638
AlwaysOn Readable Secondary Replicas���������������������������������������������������������������������������������� 663
Benefits and Considerations������������������������������������������������������������������������������������������������ 663
Implementing Readable Secondaries���������������������������������������������������������������������������������� 664
Summary���������������������������������������������������������������������������������������������������������������������������������� 675

Part IV: Performance and Maintenance������������������������������������������������������ 677


Chapter 18: SQL Server Metadata������������������������������������������������������������������������� 679
Introducing Metadata Objects��������������������������������������������������������������������������������������������������� 679
Server-Level and Instance-Level Metadata������������������������������������������������������������������������������ 683
Exposing Registry Values���������������������������������������������������������������������������������������������������� 683
Exposing Service Details����������������������������������������������������������������������������������������������������� 684
Analyzing Buffer Cache Usage�������������������������������������������������������������������������������������������� 685
Metadata for Capacity Planning������������������������������������������������������������������������������������������������ 687
Exposing File Stats�������������������������������������������������������������������������������������������������������������� 687
Using File Stats for Capacity Analysis��������������������������������������������������������������������������������� 691
Metadata for Troubleshooting and Performance Tuning����������������������������������������������������������� 695
Retrieving Perfmon Counters���������������������������������������������������������������������������������������������� 695
Analyzing Waits������������������������������������������������������������������������������������������������������������������� 700
Database Metadata������������������������������������������������������������������������������������������������������������������� 704
Metadata-Driven Automation���������������������������������������������������������������������������������������������������� 708
Dynamically Cycling Database Snapshots��������������������������������������������������������������������������� 709
Rebuilding Only Fragmented Indexes���������������������������������������������������������������������������������� 712
Summary���������������������������������������������������������������������������������������������������������������������������������� 713

xiv
Table of Contents

Chapter 19: Locking and Blocking������������������������������������������������������������������������ 715


Understanding Locking������������������������������������������������������������������������������������������������������������� 715
Lock Granularity������������������������������������������������������������������������������������������������������������������ 715
Locking Behaviors for Online Maintenance������������������������������������������������������������������������� 717
Lock Compatibility��������������������������������������������������������������������������������������������������������������� 722
Lock Partitioning������������������������������������������������������������������������������������������������������������������ 723
Understanding Deadlocks��������������������������������������������������������������������������������������������������������� 724
How Deadlocks Occur��������������������������������������������������������������������������������������������������������� 724
Minimizing Deadlocks��������������������������������������������������������������������������������������������������������� 726
Understanding Transactions������������������������������������������������������������������������������������������������������ 726
Transactional Properties������������������������������������������������������������������������������������������������������ 727
Transaction with In-Memory OLTP�������������������������������������������������������������������������������������������� 738
Isolation Levels�������������������������������������������������������������������������������������������������������������������� 738
Cross-Container Transactions���������������������������������������������������������������������������������������������� 740
Retry Logic�������������������������������������������������������������������������������������������������������������������������� 742
Observing Transactions, Locks, and Deadlocks������������������������������������������������������������������������ 743
Observing Transactions������������������������������������������������������������������������������������������������������� 743
Observing Locks and Contention����������������������������������������������������������������������������������������� 747
Observing Deadlocks����������������������������������������������������������������������������������������������������������� 752
Summary���������������������������������������������������������������������������������������������������������������������������������� 753

Chapter 20: Extended Events�������������������������������������������������������������������������������� 755


Extended Events Concepts�������������������������������������������������������������������������������������������������������� 755
Packages����������������������������������������������������������������������������������������������������������������������������� 755
Events���������������������������������������������������������������������������������������������������������������������������������� 756
Targets��������������������������������������������������������������������������������������������������������������������������������� 757
Actions��������������������������������������������������������������������������������������������������������������������������������� 757
Predicates���������������������������������������������������������������������������������������������������������������������������� 758
Types and Maps������������������������������������������������������������������������������������������������������������������� 758
Sessions������������������������������������������������������������������������������������������������������������������������������ 760

xv
Table of Contents

Creating an Event Session�������������������������������������������������������������������������������������������������������� 760


Using the New Session Dialog Box�������������������������������������������������������������������������������������� 763
Using T-SQL������������������������������������������������������������������������������������������������������������������������� 770
Viewing the Collected Data������������������������������������������������������������������������������������������������������� 773
Analyzing Data with Data Viewer����������������������������������������������������������������������������������������� 774
Analyzing Data with T-SQL�������������������������������������������������������������������������������������������������� 779
Correlating Extended Events with Operating System Data������������������������������������������������������� 783
Correlating Events with Perfmon Data�������������������������������������������������������������������������������� 783
Integrating Event Sessions with Operating System–Level Events�������������������������������������� 785
Summary���������������������������������������������������������������������������������������������������������������������������������� 792

Chapter 21: Monitoring and Managing a Hybrid Environment����������������������������� 795


Hybrid Management������������������������������������������������������������������������������������������������������������������ 795
Environmental Health and SQL Best Practice Assessment�������������������������������������������������� 797
Microsoft Defender�������������������������������������������������������������������������������������������������������������� 811
Summary���������������������������������������������������������������������������������������������������������������������������������� 820

Chapter 22: Query Store��������������������������������������������������������������������������������������� 823


Enabling and Configuring Query Store�������������������������������������������������������������������������������������� 823
Working with Query Store Data������������������������������������������������������������������������������������������������� 829
Query Store Reports������������������������������������������������������������������������������������������������������������ 831
Query Store T-SQL Objects�������������������������������������������������������������������������������������������������� 836
Resolving Issues with Query Store������������������������������������������������������������������������������������������� 841
Query Store Hints���������������������������������������������������������������������������������������������������������������������� 842
Summary���������������������������������������������������������������������������������������������������������������������������������� 845

Chapter 23: Automating Maintenance Routines��������������������������������������������������� 847


SQL Server Agent���������������������������������������������������������������������������������������������������������������������� 847
SQL Server Agent Concepts������������������������������������������������������������������������������������������������� 848
SQL Server Agent Security�������������������������������������������������������������������������������������������������� 852
Creating SQL Server Agent Jobs������������������������������������������������������������������������������������������ 855
Monitoring and Managing Jobs������������������������������������������������������������������������������������������� 885
Creating Alerts��������������������������������������������������������������������������������������������������������������������� 888

xvi
Table of Contents

Multiserver Jobs����������������������������������������������������������������������������������������������������������������������� 891


Configuring the MSX and TSX Servers�������������������������������������������������������������������������������� 892
Creating Master Jobs���������������������������������������������������������������������������������������������������������� 897
Managing Target Servers����������������������������������������������������������������������������������������������������� 899
Summary���������������������������������������������������������������������������������������������������������������������������������� 903

Chapter 24: Policy-Based Management���������������������������������������������������������������� 905


PBM Concepts��������������������������������������������������������������������������������������������������������������������������� 905
Facets���������������������������������������������������������������������������������������������������������������������������������� 905
Conditions���������������������������������������������������������������������������������������������������������������������������� 906
Targets��������������������������������������������������������������������������������������������������������������������������������� 906
Policies�������������������������������������������������������������������������������������������������������������������������������� 907
Evaluation Modes���������������������������������������������������������������������������������������������������������������� 907
Central Management Servers��������������������������������������������������������������������������������������������������� 909
Creating Policies����������������������������������������������������������������������������������������������������������������������� 916
Creating Simple Policies������������������������������������������������������������������������������������������������������ 916
Creating an Advanced Policy����������������������������������������������������������������������������������������������� 925
Managing Policies��������������������������������������������������������������������������������������������������������������������� 928
Importing and Exporting Policies����������������������������������������������������������������������������������������� 929
Enterprise Management with Policies��������������������������������������������������������������������������������� 930
Evaluating Policies with PowerShell����������������������������������������������������������������������������������� 932
Summary���������������������������������������������������������������������������������������������������������������������������������� 933

Chapter 25: Resource Governor���������������������������������������������������������������������������� 935


Resource Governor Concepts���������������������������������������������������������������������������������������������������� 935
Resource Pool���������������������������������������������������������������������������������������������������������������������� 935
Workload Group������������������������������������������������������������������������������������������������������������������� 937
Classifier Function��������������������������������������������������������������������������������������������������������������� 938
Implementing Resource Governor��������������������������������������������������������������������������������������������� 938
Creating Resource Pools����������������������������������������������������������������������������������������������������� 938
Creating Workload Groups��������������������������������������������������������������������������������������������������� 942
Creating a Classifier Function��������������������������������������������������������������������������������������������� 946
Testing the Classifier Function�������������������������������������������������������������������������������������������� 950
xvii
Table of Contents

Monitoring Resource Governor������������������������������������������������������������������������������������������������� 951


Monitoring with Performance Monitor�������������������������������������������������������������������������������� 951
Monitoring with DMVs��������������������������������������������������������������������������������������������������������� 955
Summary���������������������������������������������������������������������������������������������������������������������������������� 964

Index��������������������������������������������������������������������������������������������������������������������� 965

xviii
About the Author
Peter Carter is a SQL Server expert with over 15 years of
experience in developing, administering, and architecting
SQL Server platforms and data-tier applications. He was
awarded an MCC by Microsoft in 2011 to sit alongside his
array of MCTS, MCITP, MCSA, and MCSE certifications in
SQL Server from version 2005 onward. Peter has written
a number of books across a variety of SQL Server topics,
including security, high availability, and automation.

xix
About the Technical Reviewer
Ian Stirk is a freelance SQL Server consultant based in
London. In addition to his day job, he is an author, creator
of software utilities, and technical reviewer who regularly
writes book reviews for www.i-programmer.info.
He covers every aspect of SQL Server/Azure SQL and has
special interest in performance and scalability. If you require
help with your SQL Server systems, feel free to contact him
at ian_stirk@yahoo.com or www.linkedin.com/in/
ian-stirk-bb9a31.

xxi
Acknowledgments
I want to say a big thank you to Ian Stirk for a great tech review. As always, the quality of
this book is better because of his contribution to the project.
I would also like to thank Jonathan Gennick for the continued support and partnerial
attitude that he has shown through this, and all of the projects that we have worked on
together.
Credit goes to Chris Dent, who has helped me improve some of the PowerShell
scripts within this book.
Finally, I need to thank Terri, without whom this edition of the book would probably
never have been written. She has provided constant motivation and support through
what has been a rather grueling schedule this year.

xxiii
PART I

Installation and
Configuration
CHAPTER 1

Planning the Deployment


Planning a deployment of SQL Server 2022, in order to best support the business’s needs,
can be a complicated task. You should make sure to consider many areas, including
edition, licensing requirements, on-premises vs. cloud hosting, hardware considerations,
software configuration, and even if Windows is the best platform. For example, if your
new instance will be supporting a PHP Web App, hosted on Linux, then maybe your
instance should also be hosted on Linux? And all of this is before you even start to
consider which features of SQL Server you may need to install to support the application.
This chapter will guide you through the key decisions that you should make when
you are planning your deployment. You will also learn how to perform some essential
operating system configurations, should you decide to host your instance on Windows
Server. This chapter will also give you an overview of the top-level features that you can
choose to install and discuss why selecting the appropriate features is important.

Editions and License Models


Choosing the edition of SQL Server 2022 to support your data-tier application may
sound like a simple task, but in fact, you should spend time thinking about this decision
and consulting with both business stakeholders and other IT departments to bring
their opinions into this decision. The first thing to consider is that there are five editions
of SQL Server. These editions not only have different levels of functionality, but they
also have different license considerations. Additionally, from an operational support
perspective, you may find that the TCO (total cost of ownership) of the estate increases
if you allow data-tier applications to be hosted on versions of SQL Server that are not
deployed strategically within your estate.
A full discussion of feature and licensing considerations is beyond the scope of this
book; however, Table 1-1 details the available licensing models for each edition of SQL
Server, whereas Table 1-2 highlights the primary purpose of each edition.

3
© Peter A. Carter 2023
P. A. Carter, Pro SQL Server 2022 Administration, https://doi.org/10.1007/978-1-4842-8864-1_1
Chapter 1 Planning the Deployment

Table 1-1. SQL Server Edition License Models


Edition License Model(s) Comments

Enterprise Per-core –
Standard • Per-core –
• Server + CAL
Web Third-party hosting only –
Developer Free for noncommercial use Not for use in a production environment
Express Free edition of SQL Server Limited functionality and small capacity
limits, such as a 10GB database size, a
1GB limit on RAM, and a CPU limit of one
socket, or four cores

A CAL is a client access license, where a client can refer to either a user or a device.
You can choose whether to purchase user or device licenses based on which will be
cheapest for your environment.
For example, if your organization had a SQL server that was supporting a call center
that had 100 computers, and it ran 24/7 with three eight-hour shifts, then you would
have 100 devices and 300 users, so device CALs would be the most sensible option for
you to choose.
On the flip side, if your organization had a SQL server that was supporting a sales
team of 25 who all connected to the sales application not only via their laptops, but also
via their iPads, then you would have 25 users, but 50 devices, and therefore choosing
user CALs would be the more sensible option.
To summarize, if you have more users than devices, then you should choose device
CALs. If you have more devices than users, on the other hand, you should choose user
CALs. Microsoft also supplies a tool called Microsoft Assessment and Planning (MAP)
Toolkit for SQL Server, which will help you plan your licensing requirements.

4
Chapter 1 Planning the Deployment

Table 1-2. SQL Server Edition Overview


Edition Edition Overview

Enterprise Fully featured edition of SQL Server for Enterprise systems and critical apps
Standard Core database and BI functionality, aimed at departmental-level systems and
noncritical apps
Web Is only available for service providers hosting public websites that use SQL Server
Developer A fully featured edition, to the level of Enterprise edition, but meant for development
use and not allowed for use on production systems
Express A free, entry-level version of SQL Server geared toward small applications with local
data requirements

The version(s) of SQL Server that you choose to support in your Enterprise
applications will vary depending on the project’s requirements, your organization’s
requirements, and the underlying infrastructure. For example, if your organization hosts
its entire SQL Server estate within a private cloud, then you are likely to only support the
Enterprise edition, since you will be licensing the underlying infrastructure.
Alternatively, if your organization is predominantly utilizing physical boxes, then
you most likely need to support a mix of SQL Server versions, such as Enterprise and
Standard editions. This will give projects the flexibility to reduce their costs if they only
require a subset of features and are not expecting high-volume workloads, and hence
can live with the limits that Standard edition imposes on RAM and CPU.
The next thing you should consider before choosing which edition you will use
is whether or not you will use a Windows Server Core installation of SQL Server.
Installations on Server Core can help improve security by reducing the attack surface of
your server. Server Core is a minimal installation, so there is less surface to attack and
fewer security vulnerabilities. It can also improve performance, because you do not have
the overhead of the graphical user interface (GUI) and because many resource-intensive
applications cannot be installed. If you do decide to use Server Core, then it is also
important to understand the impacts of doing so.
From the SQL Server perspective, the following features cannot be used:

• Reporting Services

• SQL Server Data Tools (SSDT)

5
Chapter 1 Planning the Deployment

• Client Tools Backward Compatibility

• Client Tools SDK

• SQL Server Books Online

• Distributed Replay Controller

• Master Data Services (MDS)

• Data Quality Services (DQS)

The following features can be used, but only from a remote server:

• Management Tools

• Distributed Replay Client

From the broader perspective of operational support, you will need to ensure that
all of your operational teams (DBAs, Windows Operations, etc.) are in a position to
support Server Core. For example, if your DBA team relies heavily on a third-party
graphical tool for interrogating execution plans, does this need to be installed locally on
the server? Is there an alternative tool that would meet their needs? From a Windows
operations perspective, does the team have the tools in place for remotely monitoring
and managing the server? Are there any third-party tools they rely on that would need to
be replaced?
You should also consider if your operations team has the skill set to manage systems
using predominantly command-line processes. If it does not, then you should consider
what training or upskilling may be required.

Hardware Considerations
When you are planning the hardware requirements for your server, ideally, you
will implement a full capacity planning exercise so you can estimate the hardware
requirements of the application(s) that the server will support. When conducting this
exercise, make sure you take your company’s standard hardware life cycle into account,
rather than planning just for today. Depending on your organization, this could be
between one and five years, but will generally be three years.
This is important in order to avoid undersizing or oversizing your server. Project
teams will generally want to oversize their servers in order to ensure performance.
Not only is this approach costly when scaled through the enterprise, but in some
6
Chapter 1 Planning the Deployment

environments, it can actually have a detrimental effect on performance. An example


of this would be a private cloud infrastructure with shared resources. In this scenario,
oversizing servers can have a negative impact on the entire environment, including the
oversized server itself.

Specifying Strategic Minimum Requirements


When specifying the minimum hardware requirements for SQL Server within your
environment, you may choose to specify the minimum requirements for installing SQL
Server—4GB RAM and a single 2GHz CPU (based on Enterprise edition). However, you
may be better served to think about operational supportability within your enterprise.
For example, if your environment consists predominantly of a private cloud
infrastructure, then you may wish to specify a minimum of 2 vCores and 4GB RAM +
(number of cores * 1GB) since this may be in line with your enterprise standards.
On the other hand, if you have a highly dispersed enterprise, which has grown
organically, and you wish to help persuade projects to use a shared SQL Server farm,
you may choose to enforce much higher minimum specifications, such as 32GB RAM
and 2 sockets/4 cores. The reasoning here is that any projects without large throughput
requirements would be “forced” to use your shared farm to avoid the heavy costs
associated with an unnecessarily large system.

Storage
Storage is a very important consideration for any SQL Server installation. The following
sections will discuss locally attached storage and SAN storage, as well as considerations
for file placement.

Locally Attached Storage


If your server will use locally attached storage, then you should carefully consider file
layout. By its very nature, SQL Server is often input/output (I/O) bound, and therefore,
configuring the I/O subsystem is one of the critical aspects for performance. You first
need to separate your user databases’ data files and log files onto separate disks or arrays
and also to separate TempDB, which is the most heavily used system database. If all of
these files reside on a single volume, then you are likely to experience disk contention
while SQL Server attempts to write to all of them at the same time.

7
Chapter 1 Planning the Deployment

Typically, locally attached storage will be presented to your server as RAID (redundant
array of inexpensive disks) arrays and various RAID levels are available. There are many
RAID levels available, but the most common are outlined in the following pages.

RAID 0
A RAID 0 volume consists of between two and n spindles, and the data bits are striped
across all of the disks within the array. This provides excellent performance; however, it
provides no fault tolerance. The loss of any disk within the array means that the whole
array will fail. This is illustrated in Figure 1-1.

Tip In the diagrams in this section, the red X denotes a disk failure.

Figure 1-1. The RAID 0 array provides no redundancy

Caution Because RAID 0 provides no redundancy, it should not be used for


production systems.

8
Chapter 1 Planning the Deployment

RAID 1
A RAID 1 volume will consist of two spindles, working together as a mirrored pair. This
provides redundancy in the event of failure of one of the spindles, but it comes at the
expense of write performance, because every write to the volume needs to be made
twice. This method of redundancy is illustrated in Figure 1-2.

Figure 1-2. RAID 1 provides redundancy by mirroring the disk

Note The formula for calculating the total IOPS (input/output per second) against
a RAID 1 array is as follows: IOPS = Reads + (Writes * 2).

RAID 5
A RAID 5 volume will consist of between three and n spindles and provides redundancy
of exactly one disk within the array. Because the blocks of data are striped across
multiple spindles, read performance of the volume will be very good, but again, this is at
the expense of write performance. Write performance is impaired because redundancy
is achieved by distributing parity bits across all spindles in the array. This means that
9
Chapter 1 Planning the Deployment

there is a performance penalty of four writes for every one write to the volume. This is
regardless of the number of disks in the array. The reason for this arbitrary penalty is
because the parity bits are striped in the same way the data is. The controller will read
the original data and the original parity and then write the new data and the new parity,
without needing to read all of the other disks in the array. This method of redundancy is
illustrated in Figure 1-3.
It is worthy of note, however, that should a spindle within the array fail, performance
will be noticeably impaired. It is also worthy of note that rebuilding a disk from the parity
bits contained on its peers can take an extended amount of time, especially for a disk
with a large capacity.

Figure 1-3. RAID 5 provides redundancy through parity bits

10
Chapter 1 Planning the Deployment

Note The formula for calculating total IOPS against a RAID 5 array is as follows:
IOPS = Read + (Writes * 4). To calculate the expected IOPS per spindle, you can
divide this value for IOPS by the number of disks in the array. This can help you
calculate the minimum number of disks that should be in the array to achieve your
performance goals.

RAID 10
A RAID 10 volume will consist of four to n disks, but it will always be an even number. It
provides the best combination of redundancy and performance. It works by creating a
stripe of mirrors. The bits are striped, without parity, across half of the disks within the
array, as they are for RAID 0, but they are then mirrored to the other half of the disks in
the array. It is a combination of RAID 1 and RAID 0.
This is known as a nested, or hybrid RAID level, and it means that half of the disks
within the array can be lost, providing that none of the failed disks are within the same
mirrored pair. This is illustrated in Figure 1-4.

11
Chapter 1 Planning the Deployment

Figure 1-4. RAID 10 provides redundancy by mirroring each disk within the stripe

Note The formula for calculating total IOPS against a RAID 10 array is as follows:
IOPS = Read + (Writes * 2). In the same way as for RAID 5, in order to calculate
the expected IOPS per spindle, you can divide the value for IOPS by the number of
disks in the array. This can help you calculate the minimum number of disks that
should be in the array to achieve your performance goals.

12
Chapter 1 Planning the Deployment

File Placement
It is generally accepted that RAID 0 should not be used for any SQL Server files. I have
known people to suggest that RAID 0 may be acceptable for TempDB files. The rational
here is that a heavily used TempDB often requires very fast performance, and because
it is re-created every time the instance restarts, it does not require redundancy. This
sounds perfectly reasonable, but if you think in terms of uptime, you may realize why I
disagree with this opinion.
Your SQL Server instance requires TempDB in order to function. If you lose TempDB,
then your instance will go down, and if TempDB cannot be re-created, then you will not
be able to bring your instance back up. Therefore, if you host TempDB on a RAID 0 array
and one of the disks within that array fails, you will not be able to bring the instance back
up until you have performed one of the following actions:

1. Wait for the storage team to bring the RAID 0 array back online.

2. Start the instance in “minimal configuration mode” and use


SQLCMD to change the location of TempDB.

By the time either of these steps is complete, you may find that stakeholders are
jumping up and down, so you may find it best to avoid this option. For this reason,
TempDB is generally best placed on a RAID 10 array, whenever possible. This
will provide the best level of performance for the database, and because its size is
significantly smaller than the user database files, you do not have the same level of cost
implication.
In an ideal world, where money is no object, the data files of your user databases
will be stored on RAID 10 arrays, since RAID 10 provides the best combination of
redundancy and performance. In the real world, however, if the applications you are
supporting are not mission critical, this may not be justifiable. If this is the situation,
then RAID 5 can be a good choice, as long as your applications have a fairly high ratio of
reads to writes. I would normally use a ratio of three to one in favor of reads as being a
good baseline, but of course, it can vary in every scenario.
If your databases are only using basic features of SQL Server, then you will likely find
that RAID 1 is a good choice for your log files. RAID 5 is not generally suitable, because of
the write-intensive nature of the transaction log. In some cases, I have even known RAID
1 to perform better than RAID 10 for the transaction log. This is because of the sequential
nature of the write activity.

13
Chapter 1 Planning the Deployment

However, some features of SQL Server can generate substantial read activity from the
transaction log. If this is the case, then you may find that RAID 10 is a requirement for
your transaction log as well as your data files. Features that cause transaction log reads
include the following:

• AlwaysOn availability groups

• Database mirroring

• Snapshot creation

• Backups

• DBCC CHECKDB

• Change data capture

• Log shipping (both backups, and also if restoring logs WITH STANDBY)

Solid-State Drives (SSDs)


One common reason to use locally attached storage, as opposed to a storage area
network (SAN), is to optimize the performance of SQL Server components, which
require extremely fast I/O. These components include TempDB and buffer cache
extensions. It is not uncommon to find that a database’s data and log files are stored on a
SAN, but TempDB and buffer cache extensions are stored on locally attached storage.
In this example, it would make good sense to use SSDs in the locally attached array.
Solid-state drives (SSDs) can offer very high I/O rates, but at a higher cost, compared
to traditional disks. SSDs are also not a “magic bullet.” Although they offer a very high
number of IOPS for random disk access, they can be less efficient for sequential scan
activities, which are common in certain database workload profiles, such as data
warehouses. SSDs are also prone to sudden failure, as opposed to the gradual decline
of a traditional disk. Therefore, having a fault-tolerant RAID level and hot spares in the
array is a very good idea.

Working with a SAN


Storage area network are three words that can strike fear into the heart of a database
administrator (DBA). The modern DBA must embrace concepts such as SAN and
virtualization; however, although they pose fundamental change, they also ease the
overall manageability of the estate and reduce the total cost of ownership (TCO).

14
Chapter 1 Planning the Deployment

The most important thing for a DBA to remember about a SAN is that it changes
the fundamental principles of the I/O subsystem, and DBAs must change their thinking
accordingly. For example, in the world of locally attached storage, the most fundamental
principle is to separate your data files, log files, and TempDB, and to ensure that they are
all hosted on the most appropriate RAID level.
In the world of the SAN, however, you may initially be alarmed to find that your SAN
administrators do not offer a choice of RAID level, and if they do, they may not offer
RAID 10. If you find this to be the case, it is likely because the SAN is, behind the scenes,
actually stripping the data across every disk in the array. This means that although the
RAID level can still have some impact on throughput, the more important consideration
is which storage tier to choose.
Many organizations choose to tier the storage on their SAN, offering three or more
tiers. Tier 1 will be the highest tier and may well consist of a combination of SSDs and
small, highly performing Fiber Channel drives. Tier 2 will normally consist of larger
drives—potentially SATA (serial advanced technology attachment)—and Tier 3 will often
use near-line storage. Near-line storage consists of a large number of inexpensive disks,
such as SATA disks, which are usually stopped. The disks only spin up when there is a
requirement to access the data that they contain. As you have probably guessed, you
will want to ensure that any applications that require good performance will need to be
located on Tier 1 of your SAN. Tier 2 could possibly be an option for small, rarely used
databases with little or no concurrency, and Tier 3 should rarely, if ever, be used to store
SQL Server databases or logs.
Your real throughput will be determined by these factors, but also many others, such
as the number of network paths between your server and the SAN, how many servers are
concurrently accessing the SAN, and so on. Another interesting quirk of a SAN is that you
will often find that your write performance is far superior to your read performance. This
is because some SANs use a battery-backed write cache, but when reading, they need to
retrieve the data from the spindles.
Next, consider that because all of your data may well be striped across all of the
spindles in the array—and even if it isn’t, the likelihood is that all files on a single server
will probably all reside on the same CPG (common provisioning group)—you should not
expect to see an instant performance improvement from separating your data, log, and
TempDB files. Many DBAs, however, still choose to place their data, log, and TempDB
files on separate volumes for logical separation and consistency with other servers that

15
Chapter 1 Planning the Deployment

use locally attached storage. In some cases, however, if you are using SAN snapshots or
SAN replication for redundancy, you may be required to have the data and log files of a
database on the same volume. You should check this with your storage team.

Disk Block Size


Another thing to consider for disk configuration, whether it is locally attached or on a
SAN, is the disk block size. Depending on your storage, it is likely that the default NTFS
(New Technology File System) allocation unit size will be set as 4KB. The issue is that
SQL Server organizes data into eight continuous 8KB pages, known as an extent. To get
optimum performance for SQL Server, the block sizes of the volumes hosting data, logs,
and TempDB should be aligned with this and set to 64KB.
You can check the disk block size by running the Windows PowerShell script in
Listing 1-1, which uses fsutil to gather the NTFS properties of the volume. The script
assumes that f: is the volume whose block size you wish to determine. Be sure to
change this to the drive letter that you wish to check. Also ensure that the script is run as
Administrator.

Listing 1-1. Determine Disk Block Size

# Populate the drive letter you want to check

$drive = "f:"

# Initialize outputarray

$outputarray = new-object PSObject

$outputarray | add-member NoteProperty Drive $drive

# Initialize output

$output = (fsutil fsinfo ntfsinfo $drive)

# Split each line of fsutil into a separate array value

foreach ($line in $output) {

    $info = $line.split(':')

16
Chapter 1 Planning the Deployment

    $outputarray | add-member NoteProperty $info[0].trim().Replace(' ','_')


$info[1].trim()

    $info = $null

# Format and display results

$results = 'Disk Block Size for ' + $drive + ' ' + $outputarray.Bytes_Per_
Cluster/1024 + 'KB'

$results

Cloud Storage
When building IaaS (infrastructure as a service) in a cloud platform, in order to host SQL
Server, careful consideration should be given to the storage requirements of the data-­
tier application. Storage options in cloud are complex and ever changing. They also vary
between cloud providers. Therefore, you should consult with your Cloud architect or
DevOps engineer. However, this section will provide a brief overview of the main points
of consideration.
The first consideration is shared storage. If you are building a stand-alone SQL
Server instance, or indeed an AlwaysOn Availability Group topology, with no shared
storage, then this is not a worry. If you intend to deploy a SQL Server failover clustered
instance, however, then the type of storage you use is important. In AWS, then instead
of using standard EBS (Elastic Block Storage) for your data disks, you will need to use
Amazon FSx file share, which can be shared between multiple EC2 (Elastic Compute
Cloud) instances. In Azure, you will still use Azure managed disks for your VMs, but you
will need to implement S2D (Storage Spaces Direct) and Cluster Shared Volumes, which
can be configured within Windows Server.
You will also need to consider storage performance. There are two separate
components to this. Firstly, you will need to ensure that the storage you choose is fast
enough to meet the requirements of the use case.
In Azure, Microsoft recommends using Premium SSDs, which are no larger than
2048 GiB for the data volume, to optimize cache support. A P40 disk (2048 GiB) provides
7500 maximum nonbursting IOPS (input/output per second) with a maximum 250

17
Chapter 1 Planning the Deployment

MB/s nonbursting throughput. If you step down in size to a P30 disk (1024 GiB), then
the maximum nonbursting IOPS reduces to 5000 with the maximum nonbursting
throughput at 200 MB/s.
If you require higher IOPS, then you would need to consider using Azure ultra disks
instead. These disks can provide submillisecond latency with up to 160,000 IOPS and
4000 Mbps, depending on the size of the disk.
In AWS, the storage options (at the time of writing) are GP2 (General Purpose 2),
GP3 and Provisioned IOPS SSD (io1 and io2). GP2 storage is a predecessor to GP3 and
generally shouldn’t be considered for SQL Server. Its performance is tied to its size,
which means you may end up needing to buy more larger disks than you require. GP3
also has a maximum throughput four times higher than GP2 and is less expensive.
GP3 has a baseline performance of 3000 IOPS and 125 MiB/s throughput. For an
additional fee, however, performance can be increased to a maximum of 16,000 IOPS
and 1000 MiB/s throughput. If additional IOPS are required, then you can move to a
Provisioned IOPS volume. The io2 type is available at the same price point as io1 and has
improved performance, so io1 generally should not be considered for SQL Server. Io2
volumes provide 500 IOPS per GiB, with a maximum of 64,000 IOPS.
In AWS, when considering storage performance, it is important to consider the size
of the EC2 instance, as well as the performance of the disk itself. Different instance types
and sizes have storage throttled at different levels. This means that you need to be careful
that you do not buy fast, expensive storage, but then throttle that performance by using
the wrong instance type. For example, a m4.xlarge instance has an EBS bandwidth of
750 Mbps (715 MiB/s). Therefore, if you have purchased a GP3 volume with 1000 MiB/s
throughput, then you will only actually get 715 MiB/s.

Operating Systems Considerations


SQL Server has support for many operating systems, including many versions of
Windows. It is unlikely, however, that you will want to allow SQL Server to be installed
on any version of any operating system that is supported. For example, within your
Windows estate, it is advisable to align a version of SQL Server with a specific version of
Windows. This gives you two benefits.
First, it drastically reduces the amount of testing that you need to perform to sign
off your build. For example, imagine that you decide you will only allow Enterprise
edition within your environment. In theory, you would still need to gain operational

18
Chapter 1 Planning the Deployment

sign-off on more than a dozen versions of Windows. In contrast, if you allow both SQL
Server Enterprise and Standard editions of SQL Server, but you align both editions with
Windows Server 2022 Standard edition, then you would only require sign-off once for
each of your supported editions of SQL Server.
The second benefit is related to end of life cycle (EOL) for your platforms. If you
allow SQL Server 2019 to be installed on Windows Server 2016, the end of mainstream
support for Windows is January 2022, as opposed to January 2025 for SQL. At best, this
will cause complexity and outage while you upgrade Windows, and at worst, it could
lead to extended support costs that you could have avoided.

Tip It is a good idea to run the latest version of Windows Server and SQL Server,
as they provide the most benefit in terms of features, security, and performance.
If your organization is risk adverse, however, and does not like to run the latest
version of software, in case there are any early life stability issues, then I
recommend trying to adhere to a current version – 1 policy, if possible.

Configuring the Operating System


Do your Windows administration team have a “gold build” for Windows Server 2022?
Even if they do, is it optimized for SQL Server? Unless they have produced a separate
build just for the purposes of hosting SQL Server, then the chances are that it will not
be. The exact customizations that you will need to make are dependent on how the
Windows build is configured, your environmental requirements, and the requirements
of the data-tier application that your server will be hosting. The following sections
highlight some of the changes that are often required.

Note A gold build is a predefined template for the operating system that
can be easily installed on new servers to reduce deployment time and enforce
consistency.

19
Chapter 1 Planning the Deployment

Setting the Power Plan


It is important that you set your server to use the High Performance power plan. This is
because if the balanced power plan is used, then your CPU may be throttled back during
a period of inactivity. When activity on the server kicks in again, you may experience a
performance issue.
You can set the power plan through the Windows GUI by opening the Power Options
console in Control Panel and selecting the High Performance or you can use PowerShell
or the command line. Listing 1-2 illustrates this by passing in the GUID of the High
Performance power plan as a value for the -setactive parameter of the powercfg
executable.

Listing 1-2. Set High Performance Power Plan with PowerShell

powercfg -setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c

Optimizing for Background Services


It is good practice to ensure that your server is configured to prioritize background
services over foreground applications. In practice, this means that Windows will adapt its
context-switching algorithm to allow background services, including those used by SQL
Server, to have more time on the processor than foreground applications have.
To ensure that Optimize for Background Service is turned on, enter the System
console in Control Panel and choose Advanced System Settings. In the System Properties
dialog box, select Settings within the Performance section.
Optimizing for background services can also be set by using PowerShell. Listing 1-3
demonstrates using the set-property command to update the Win32PrioritySeperation
key in the Registry. The script must be run as Administrator.

Listing 1-3. Setting Optimize for Background Services with PowerShell

Set-ItemProperty -path HKLM:\SYSTEM\CurrentControlSet\Control\


PriorityControl -name Win32PrioritySeparation -Type DWORD -Value 24

20
Chapter 1 Planning the Deployment

Assigning User Rights


Depending on the features of SQL Server that you wish to use, you may need to grant
the service account that will be running the SQL Server service user rights assignments.
These assignments allow security principles to perform tasks on a computer. In the case
of the SQL Server service account, they provide the permissions for enabling some SQL
Server functionality where that functionality interacts with the operating system. The
three most common user rights assignments, which are not automatically granted to the
service account during installation, are discussed in the following pages.

Initializing the Instant File


If you have not enabled Instant File Initialization during the installation of the SQL
Server instance, then when you create or expand a file, the file is filled with 0s. This is
a process known as “zeroing out” the file, and it overwrites any data that previously
occupied the same disk space. The issue with this is that it can take some time, especially
for large files.
It is possible to override this behavior, however, so that the files are not zeroed out.
This introduces a very small security risk, in the respect that the data that previously
existed within that disk location could still theoretically be discovered, but this risk is so
small that it is generally thought to be far outweighed by the performance benefits.
In order to use instant file initialization, the Perform Volume Maintenance Tasks
User Rights Assignment must be granted to the service account that is running the SQL
Server Database Engine. Once this has been granted, SQL Server will automatically use
instant file initialization. No other configuration is required.
To grant the assignment through Windows GUI, open the local security policy from
Control Panel ➤ System and Security ➤ Administrative Tools, before drilling through
Local Policies ➤ User Rights Assignment. This will display a full list of assignments.
Scroll down until you find Perform Volume Maintenance Tasks. This is illustrated in
Figure 1-5.

21
Chapter 1 Planning the Deployment

Figure 1-5. Local Security Policy

Right-clicking the assignment and entering its properties will allow you to add your
service account.

Tip Instant File Initialization can also be configured during SQL Server


installation. This will be discussed in Chapter 2.

Locking Pages in Memory


If Windows is experiencing memory pressure, it will attempt to page data from RAM into
virtual memory on disk. This can cause an issue within SQL Server. In order to provide
acceptable performance, SQL Server caches recently used data pages in the buffer cache,
which is an area of memory reserved by the Database Engine. In fact, all data pages

22
Chapter 1 Planning the Deployment

are read from the buffer cache, even if they need to be read from disk first. If Windows
decides to move pages from the buffer cache out to disk, the performance of your
instance will be severely impaired.
In order to avoid this occurrence, it is possible to lock the pages of the buffer cache in
memory, as long as you are using the Enterprise, or Standard, edition of SQL Server 2022.
To do this, you simply need to grant the service account that is running the Database
Engine the Lock Pages In Memory assignment using the same method as for Perform
Volume Maintenance Tasks.

Caution If you are installing SQL Server on a virtual machine, depending on the
configuration of your virtual platform, you may not be able to set Lock Pages In
Memory, because it may interfere with the balloon driver. The balloon driver is used
by the virtualization platform to reclaim memory from the guest operating system.
You should discuss this with your virtual platform administrator.

SQL Audit to the Event Log


If you are planning to use SQL Audit to capture activity within your instance, you will
have the option of saving the generated events to a file, to the security log, or to the
application log. The security log will be the most appropriate location if your enterprise
has high security requirements.
In order to allow generated events to be written to the security log, the service
account that runs the Database Engine must be granted the Generate Security Audits
User Rights Assignment. This can be achieved through the Local Security Policy console.
An additional step, in order for SQL Server to be able to write audit events to
the security log, is to configure the Audit Application Generated setting. This can be
located in the Local Security Policy console, by drilling through Advanced Audit Policy
Configuration ➤ System Audit Policies ➤ Object Access. The properties of the Audit
Application Generated event can then be modified as illustrated in Figure 1-6.

23
Chapter 1 Planning the Deployment

Figure 1-6. Audit Application Generated Properties

Caution You need to ensure that your policies are not overridden by policies
implemented at the GPO level. If this is the case, you should ask your AD (Active
Directory) administrator to move your servers into a separate OU (organizational
unit) with a less restrictive policy.

Selecting Features
When installing SQL Server, it may be tempting to install every feature in case you need
it at some point. For the performance, manageability, and security of your environment,
however, you should always adhere to the YAGNI (you aren't going to need it) principle.
The YAGNI principle derives from extreme programming methodology, but it also holds
true for the platform. The premise is that you do the simplest thing that will work. This
will save you from issues related to complexity. Remember that additional features can
be installed later. The following sections provide an overview of the main features you
can select during an installation of SQL Server 2022 Enterprise edition.

24
Chapter 1 Planning the Deployment

The features are split into two categories, namely, instance features and shared
features. Features within the instance features category can be installed multiple times
on the server, associated to different instances. This is opposed to features within the
shared features category, which can only be installed once on a server and are shared
between all instances. The following sections will discuss the features available within
each of these sections.

Instance Features
The following sections discuss each of the features that can be installed for each SQL
Server instance on the server.

Database Engine Service


The Database Engine is the core service within the SQL Server suite. It contains the
SQLOS, the Storage Engine, and the Relational Engine, as illustrated in Figure 1-7. It is
responsible for securing, processing, and optimizing access to relational data.

Figure 1-7. Database Engine architecture

25
Another random document with
no related content on Scribd:
and in the mornings valleys and low places are completely
enshrouded in it.
As the wind and sun dissipate these rolling vapours, very beautiful
effects are seen, particularly among the valleys and mountains in the
interior. When looking down into a deep valley, the mist is exactly like
a cloud of steam from a locomotive. The “cacimbo” is the best
season for Europeans newly arrived on the coast, but is always
disagreeably felt by those who have lived in the country for some
years, the sudden fall of the thermometer checking the action of the
skin. It has a very depressing effect on old stagers, who are then
more than usually disinclined for any kind of work, bodily or mental.
To new comers, apt to be distressed by heat, the cool season is
delicious, as it enables them to go about freely, carry a gun, work,
&c., without protection from the sun.
The climate of the coast of Africa is everywhere more or less
enervating, and it requires the exercise of a strong will and
determination to overcome its influence, and resist the natural
tendency to produce inactivity of mind and body. This being the case
when in perfect health, it can easily be imagined how much more this
is required when a touch of fever, however slight, still further
enfeebles the system.
I am not competent to speak medically on the subject of the action
of the African climate and fevers on Europeans, which I believe to be
very difficult and obscure, but a few detached facts and observations
I have noted may be interesting. I fancy there must be something in
the action of an atmosphere so completely saturated with moisture,
to account for the sensation of exhaustion and prostration that is felt
in Africa at any bodily exertion, generally accompanied by a clammy
perspiration. I have felt this more especially in the cool or rainless
but misty season, when the air is, I believe, even more saturated
with moisture than in the rainy season with its almost daily storms,
but bright atmosphere, blue sky, and hot sun.
Keys or penknives in use, and kept constantly in the pocket, get
rusty to an extraordinary degree, and steel-springs of every kind
become brittle and break very readily; I never saw a shot-pouch or
powder-flask of which the spring did not very shortly snap in two,
sometimes even before it had become rusty, and when only a thin
line or streak of rust could be seen on it.
For the first few months after arrival, Europeans have enormous
appetites, and all increase in weight;—it is very rarely that fever
attacks those first arriving on the South-West Coast.
Persons of a nervous temperament, of a thin, active, muscular
habit of body, and not above medium height, I have found to be the
most likely to resist the climate.
Previous good health and sobriety are no guarantees against the
probable effects of the climate, and I believe that the best and surest
indication is to be obtained not from the physical, but from the mental
constitution of the individual. Those of a light-hearted and happy
disposition, naturally disposed to make the best of circumstances,
and whom no inconveniences or annoyances can rob for long of
their good humour, are almost certain to enjoy their health on the
South-West Coast, whilst those difficult to please, who worry
themselves about every little unpleasantness, and who are irritable
and unhappy under difficulties, are soon attacked by fever and ague,
although apparently just as strong and healthy as the former.
I have always observed that an educated man has a great
advantage over one who is without education, in resisting disease on
the coast; this shows very strongly the preservative action of the
healthy and active mind.
Amongst uneducated men, I have found that Portuguese,
Spaniards, and Italians enjoy better health than Englishmen or
Germans, and have vastly more endurance and pluck in sickness
than the latter. A Portuguese working man, soldier, or convict, will roll
himself up and shiver and groan under a strong attack of fever or
ague, and as soon as it is over will quickly go about his occupation
without making any fuss or complaint, whereas the English miners,
strong and powerful as navvies when well, were, as I have said
before, pitiable sights under even a slight attack.
The reason for the greater immunity enjoyed by the natives of
southern over those of northern Europe from attacks of fever and
ague, may be due not only to the fact of that race inhabiting a hot
climate, but also to their mode of living and greater sobriety.
Their cookery is infinitely better adapted to a climate like that of
Africa than ours; their soups, stews, and made dishes more or less
highly seasoned, or condimented, give less trouble to the stomach
naturally debilitated by the action of the climate, and present the food
in a better condition for easy digestion, than the solid ill-cooked
masses of roast or boiled meat preferred by the English—always
freshly killed, and rarely of good quality or in proper condition, from
the impossibility of hanging it long enough to allow it to get tender
without being tainted. The natives of south Europe also make great
use of two vegetable products, which I consider to be of great benefit
in preserving health—the common tomato and garlic. The former,
apart from what I believe to be its valuable medicinal properties,
gives a delicious zest to every kind of cooked food from its slightly
acid taste, often transforming an uninviting dish of cold meat, fowl, or
fish, into a savoury mess, the very smell of which is sufficient to
make one’s mouth water, and raise the enfeebled appetite.
A common and very delicious dish on the coast is called
“muqueca,” and is thus prepared: the bottom of a frying-pan is
covered with sliced tomatoes, on these a layer of small fish is put, or
pieces of larger fish, and some salt; a little salad-oil is poured over
the whole, and lastly the fish is covered with thin slices of bread. No
water is added, the tomatoes and fish supplying quite enough liquid
to cook the whole, which is allowed to stew slowly till done. It should
be made hot to taste with green chilies, cut up and added with the
salt. Cold fried-fish is equally good for making a “muqueca,” which is
always served at table in the frying-pan, or, better still, flat earthen
pan in which it has been cooked. A plate or close cover over the pan
whilst cooking the “muqueca” is desirable, as it keeps in the moisture
better, and the bread becomes nice and soft in the rich gravy. The
proportion of tomato to fish is soon ascertained by practice, but it is
never a fault to have too much of the former.
Garlic I consider a most valuable article of food in a hot climate,
especially eaten raw. I never travelled without a supply of garlic, and
I found its beneficial effects on the stomach and system most
marked. When very hungry and fatigued I have found nothing to
equal a few pieces of raw garlic, eaten with a crust of bread or a
biscuit, for producing a few minutes after a delightful sensation of
repose, and that feeling of the stomach being ready to receive food,
generally absent when excessive emptiness or exhaustion is the
case.
The Portuguese in Angola as a rule rarely drink anything stronger
than Lisbon red wine. Many undoubtedly drink a great deal more
cold water than is necessary or good for them, as constantly
drenching the stomach with water must weaken it greatly.
The English and other foreigners on the coast, on the contrary,
make use of too much brandy and spirits, which is a principal cause
of the sickness amongst them; but I am happy to say that
drunkenness has very greatly decreased of late years. It would not
be easy to see now such scenes as I have witnessed at Quissembo
and Cabinda only a few years ago.
I was at the former place when an Englishman died from the
effects of intemperance a few hours after his arrival from Cabinda,
where a three days’ orgie had been held to bid him good-bye
previous to his return to England.
His body was laid on a table, candles were lit all round it, and a
kind of wake held nearly all night, during which time two casks of
bottled ale and several cases of spirits were consumed amongst not
more than a dozen people. In the morning a hole was dug in the
sand, and the body, in a wooden coffin, lowered into it, whilst the few
English in the place stood around, most of them crying, and held by
their black servants to prevent them from falling into the grave, the
effects of the wake not allowing them to be sufficiently steady to
stand without assistance. An American, since dead, poor fellow! tried
to read the burial service, but he was obliged to give up the task, his
utterance being most amusingly choked with sobs and hiccups.
I have known an Englishman to invite the rest of his countrymen to
dinner on Christmas-day, and only a very small number make their
appearance, the rest having been overpowered by drink at breakfast
and during the day.
At Cabinda, on one occasion, a poor fellow who was dying was
taken out of his bed, seated on a chair at the head of the table, and
his head held up to make him drink to his own health, whilst the rest
sang, “For he is a jolly good fellow!” Next morning he was found
dead and stiff on his bed.
The reason for this disgraceful state of things must not be laid
entirely to the fault of the men or the climate, but greatly to the false
economy of the stupid and bad system of inducing a certain class of
young men to go out at a nominal salary for several years, under the
pretence of learning the African trade.
It is rather too much to expect a young man to devote his entire
time and to work hard on the coast of Africa, away from his family
and every amusement and relaxation, placed very often in a
responsible situation, and knowing that his employers are making
large profits, whilst he is earning the munificent sum of 20l., 30l., and
40l., for the first, second, and third year of his engagement, and that
also liable to various deductions, and with a very remote chance of
ever becoming a head agent.
I am certain that the popular idea against the use of brandy or
wine in African travel is erroneous and very mischievous, and may
be the cause of the loss of valuable lives in future exploration if not
refuted. To the traveller in perfect health, spirits of any kind are no
doubt unnecessary, and should not be made use of at all under
ordinary circumstances, but I am decidedly of opinion that wine and
water (in equal parts) is almost a necessity, and should be taken at
meals as long as it can be procured. Lisbon red wine, which has
more body but is not stronger than claret, is unquestionably the best
for this purpose.
When chilled with wet, exhausted by fatigue, or when the stomach
and bowels are deranged by the heat, or bad food and water, brandy
is worth its weight in gold, and is better and more efficacious than
any medicine. It is all very well for strong, healthy people in Europe
to cry down brandy because its use is abused, and because any
fatigue they may undergo, in a comfortable manner, is easily
dispelled at a good fire, with a cup of nice tea, buttered toast, and
warm slippers; but let them travel in Africa, perhaps drenched by
rain, with clothes and food all soaked, or weak with profuse
perspiration and bad food, stomach, &c., out of order, and gasping
for breath under the hot sun, and they will confess to the wonderfully
reviving effect of a drop of good brandy! It is almost as suicidal to
travel in tropical Africa without brandy as without quinine. Both
should of course only be used on occasions when necessary. During
eight months of the rainy season, when I was exploring the province
of Cambambe, I only suffered from one fit of ague, lasting half an
hour, and an attack of simple intermittent fever for about four hours,
and my consumption of spirits for the whole time was about a litre
bottle full of brandy, but I am positive that it saved me from illness on
several occasions. The risk from the climate to Europeans in tropical
Africa is quite sufficient, without increasing it by withholding such a
valuable protection as brandy from our explorers, simply from fear of
its abuse, or in deference to popular claptrap.
A very important rule to be observed (and invariably adopted by
the Portuguese) is to take a cup of coffee or tea immediately on
rising at daybreak. I made my miners at Benguella take a mugful of
hot coffee and a biscuit every morning before going to work, with
great benefit to them.
My whole experience on the coast has taught me no lesson more
strongly than that of immediately attending to the slightest indication
of illness or fever, and I believe that the great secret or means of
enjoying health depends almost entirely on this. It is very rarely that
a fever or ague comes on without some premonitory indisposition,
very often so slight as to be disregarded—a dryness of the mouth, or
thirst, or a nervous exhilaration, being often the forerunner of an
attack of fever.
If rest be taken (a slight aperient if necessary), and attention paid
to not exposing the body to the sun, the attack is generally slight, or
does not come on at all. If it does, cooling drinks must be plentifully
made use of, and means adopted to cause copious perspiration as it
passes off, and care taken to avoid any chill or cold.
A most important measure is to take the sulphate of quinine
immediately the pulse is reduced to its natural beat, but not before:
three to five grains are to be taken every half hour, until fifteen to
twenty-five grains have been swallowed, either in solution or made
into pills with a little camphor, and one grain of opium to twenty of
sulphate of quinine.
Any kind of cooling drink most palatable to the patient may be
made use of liberally, and only chicken or other broth as food.
This treatment in the majority of cases will suffice to stop the fever
or ague. Ten or twelve grains of quinine (in small doses) should be
given a few hours before the completion of the twenty-four hours
after the commencement of the attack, when its recurrence takes
place if the amount of quinine first given has not been sufficient to
arrest it. Should the attack come on a second time, the same
treatment must be adopted, with an increased amount of quinine.
For a couple of days or so nothing but fowl-soup, or other light
nutritious food, should be given, increasing it only as the appetite
becomes fully developed, and when it is certain that the attack has
been successfully combated. A very strong but false appetite is often
developed immediately after a fever, which it is necessary to be very
careful not to satisfy with strong food, as this would be quite
sufficient to cause indigestion, and with certainty produce a worse
attack of fever, often complicated with dangerous bilious
derangement, vomiting, &c. Bilious fevers of a bad type are
comparatively rare in Angola; and if the foregoing all-important
precaution is taken, of attending carefully to a fever at first, there is
but little fear of the dangerous type.
A great deal of the sickness on the coast is entirely owing to the
want of this precaution. People get into a careless habit of going
about with a little fever on them every day, and it is only when they
become very reduced in strength, or unwell, that they call the doctor
or place themselves under proper treatment or regimen.
It is perfectly impossible to account for the origin of fevers in
Africa. They do not always depend upon the proximity of marshes or
stagnant water. They were very frequent at Bembe, where I believe
the thick forest around had something to do with their occurrence, as
it became healthier as these were gradually cleared away. Fever is
sometimes common in places near the sea, where there are neither
marshes nor forests for considerable distances.
Again, the banks of rivers may be comparatively free from fevers,
whilst at the same time places apparently least likely are suffering
from them. In any case, even in the dangerous type, there is never
any long convalescence or recovery, as happens with the agues and
fevers of the marshy places in Europe. A few days suffice to restore
people to health after an attack of African fever and ague, and in a
short time flesh and strength are picked up.
There is no effectual substitute for quinine as yet known; its use by
subcutaneous injection has not yet been adopted in Angola. Many
Portuguese have a prejudice against quinine, and in its stead make
use of a common plant called “Fedegozo” (Cassia occidentalis).
The root, which is excessively bitter, is made into decoction. The
seeds also are roasted and ground, and their infusion taken either
alone, or generally mixed with coffee.
The natives suffer but little from fever and ague, and then it is
generally the result of a chill, on the change from the hot to the cold
season. Their treatment almost always consists in lying quiet until
nature works her own cure, but they also make use of a strong
infusion of the leaves of the “Malulo,” an excessively bitter plant
(Vernonia (Elephantopus) Senegalensis).
This is a handsome, herbaceous shrub, and is curious from its
habit of being (like the nettle with us) the first to take possession of
and grow luxuriantly on all bare open places where habitations or
plantations have existed. The infusion of this plant is also universally
employed by the natives in bowel complaints. A common method
they have of curing fever is to induce strong perspiration by squatting
over an earthen pot (just removed from the fire) sunk in a hole in the
ground, in which “Herva Santa Maria” (Chenopodium ambrosioides)
and “Sangue-sangue” have been boiled. The patient is well covered
over, and the aromatic vapour-bath soon produces its desired effect.
I have seen blacks cured of severe attacks of fever with one or two
applications of this simple remedy. “Sangue-sangue” is the name
given to the large seed-heads of a strong, tall grass (a species of
Cymbopogon), which exhales a very powerful aromatic odour when
crushed.
The “Herva Santa Maria” grows very abundantly everywhere in
Angola, and, as in other warm countries where it is found, its
medicinal properties are held in great repute. It is a small annual
plant, generally about a foot and a half high, very green and bushy,
and every part of it is hotly and strongly aromatic.
In almost every complaint the natives first apply this plant as a
remedy. For internal pains of every kind it is taken as decoction, or
the crushed plant rubbed over the seat of the pain; for blows,
swellings, and bruises, a poultice of the fresh plant is employed.
When the back aches from carrying a heavy load, &c., fresh leaves
are rubbed on the spine, and a handful of the crushed plant is placed
between the skin and the waistcloth. In cases of headache, the
crushed plant is rubbed over the head, and plugs of the leaves
inserted in the capacious nostrils; for this pain they also paint the
forehead with the milky juice of the mandioca-plant, and place one or
more white dots on the temples of “pemba” or white clay. A shrub
growing near streams, called “Entuchi” (the botanical name of which
I know not), the leaves and young shoots of which, when freshly
crushed, exhale a delicious smell of bitter almonds, is also used to
plug the nostrils in cases of headache.
There is remarkably little diarrhœa or dysentery in Angola, either
amongst the natives or whites. The treatment for it adopted by the
natives consists exclusively in taking decoctions of various astringent
and aromatic plants.
The principal are “Empebi,” the aromatic seeds of the Anona
muricata; “Mucozo,” the thick, fleshy, rose-coloured bark of a large,
handsome fig-tree, and very strongly astringent; the “Jindungo
N’Congo” (Congo-pepper), the carpels of the Xylopia æthiopica, with
a disagreeable, resinous taste; “Ensacu-sacu,” the small, knobby
roots of a plant growing in marshy places, and with a strong smell of
turpentine, and the roots and stems of the Hydnora already
described.
A singular disease of a dysenteric character, and peculiar to the
blacks, is called “maculo,” and is quickly fatal if not attended to
promptly, when it is easily cured. It commences with strong
diarrhœa, but its chief characteristic is the production in the anal
orifice, both internally and externally, of little ulcers containing
maggots. The native method of treatment is quickly efficacious, and
consists in plugging the orifice with a wad of crushed “Herva Santa
Maria” dipped in strong rum and ground gunpowder, and any kind of
astringent medicine is given at the same time. This disease was very
prevalent in the slave barracoons; and I was told that at the French
depot at Banana, when they shipped some thousands of blacks
some years ago under the name of “free emigrants,” the slaves were
dying at the rate of fifty and sixty each day from this disease, whilst
under the care of the French surgeons; but that when these left from
ill health, and the slaves were entrusted to the care of black
medicine-men skilled in the treatment of “maculo,” the deaths
decreased immediately to a very small number.
This disease is due to overcrowding and improper food; but
change of place will also produce it. Slaves from the interior mostly
have it on coming into possession of the white man, when it is
probably induced by the change from their usual poor food to the
very much better sustenance given them by their new masters.
Sores and ulcers on the feet and legs are extremely common, and
are troublesome to heal, whether in natives or Europeans. The
blacks use a variety of remedies, and are sometimes very successful
in the cure of stubborn cases.
I had a boy at Bembe called “Brilhante” (Brilliant), about fourteen
years of age, a fine, sharp little fellow, the son of a “capata” or head-
man of a number of carriers from the town of Musserra. A fetid ulcer
appeared on his leg, and I put him in the military hospital under the
doctor’s care, where he remained for three months without the least
improvement, although every care was taken of him, and every
remedy employed that could be thought of. At last, his father said he
would take him to the coast, and see whether the native treatment
could cure him. Two months after, he returned to Bembe, bringing
me little Brilhante perfectly cured. Our doctor was astounded, but
although I offered the boy’s father a large reward if he would obtain
for me the plants, &c., employed by the medicine-man, he never did.
Their principal remedy, however, is powdered malachite, with or
without lime-juice. Lime-juice is also used by itself, or with powdered
“mubafo” or gum elemi, which is very abundant in the Mushicongo
country. Poultices and decoctions made of crushed “Herva Santa
Maria,” and of various other plants, are also applied to the sores,
which are protected from dust and flies by a piece of rag, or very
often by a light shield made from a piece of dry gourd. Ointments are
never made use of by the natives in the treatment of ulcers, and they
are not much in favour with the Portuguese.
From the sudden fall of the high temperature of the hot season to
the “cacimbo” the natives, as might be expected, suffer most from
diseases of the respiratory organs. No provision whatever is made
by the bulk of the natives against this great change, and the quick
transition from the clear warm nights of the hot season to the cold
wet ones of the “cacimbo,” when the ground is covered with a heavy
mist, tells on their nearly naked and unprotected bodies with terribly
fatal effect. In fact, by far the greater part of the blacks die from this
cause; and so true is this, that it is rare to see a white-headed native
in Angola.
There is no doubt that this is a wise provision of nature for keeping
down the otherwise excessive numbers of the human animal in that
country, and it is certainly more natural and merciful than the
supplementary measures adopted by themselves, of poisoning by
“casca” or otherwise killing one another for “fetish” or witchcraft, or in
times of famine. Should the negro race ever be civilized, they must
be taught to be more industrious, or else means must be adopted to
enable the teeming millions to seek work and food in other countries;
subjects, I am afraid but too little regarded by philanthropists in their
present anxious solicitude for the welfare of these lazy, happy
brutes.
It is a wonderful scene when travelling with a caravan in the
“cacimbo” season, to see perhaps two or three hundred blacks wake
up in the cold misty mornings, and crouch in circles of ten or a dozen
together round a fire, shivering and chattering their teeth. It is then
that they enjoy smoking the “diamba” (Cannabis sativa), which is the
name they give to the wild-hemp, the flowering tops of which are
collected and dried for this purpose. It is burnt in a straight clay-pipe
bowl inserted in the closed end of a long gourd, in which is contained
a small quantity of water, and through which the smoke is forced and
washed when the open end of the gourd is put to the mouth and
suction applied. (Plate XIV.) Four or six long deep inspirations from
the gourd are as much as a man can bear of the disagreeable acrid
smoke, which makes them cough and expectorate as if their lungs
were coming out of their mouths. The gourd is rapidly passed from
one to another in each circle, and the mighty chorus of violent
coughing and hawking lasts for about ten minutes or a quarter of an
hour. The effects of the wild hemp (from which the “hasheesh” of
other countries is prepared) are curious, and appear to be different
from those described as attending its use in other parts of the world.
There is no intoxicating effect produced, but, on the contrary, the
blacks affirm that it wakes them up and warms their bodies, so that
they are ready to start up with alacrity, take up their loads, and trot
off quickly.
Natives who smoke “diamba” immoderately, and make themselves
slaves to the habit, have their brains affected in time, and become
stupid and listless. When they arrive at this stage, they are “fetished”
like drunkards. The Portuguese prohibit their slaves from indulging in
this habit. The plant is cultivated round the huts everywhere in
Angola, but except in the cold season diamba-smoking is not very
general.
The natives have no efficient remedies or treatment for bronchitis,
pleurisy, and pneumonia, from which they suffer so much and so
fatally in the cold season. They chew the stem of a kind of rush
growing in streams and marshy places, the juice of which has an
agreeable taste of acetic acid, and make a few emulcent drinks from
the leafless parasite Cassytha, a large mallow, and the seed-heads
of the sangue-sangue; these, and rubbing the chest with “tacula”
mixed with a pulp of the bruised leaves of “Herva Santa Maria,”
“Ensuso-ensuso,” “Brucutu,” and other plants, are their only
applications. With slaves or other blacks under the care of
Europeans, only the most energetic medical treatment will save their
lives when attacked by these complaints, so dangerous and rapid is
the effect on their constitutions.
Ophthalmia, or any affection of the eyes, is extremely rare in
Angola, either amongst natives or Europeans, which is singular,
considering that the littoral region is so white and sandy in many
places.
A kind of itch called “sarna” is very common among the blacks: it
appears as little watery pustules on the hands and feet, and, in
severe cases, on the elbows and knees, and on the arms and legs.
These pustules break into sores, which become covered with matter
and scales, and are accompanied by a little swelling and pain, but
not much itching. It does not appear to be contagious, and I was
unable to find acari in several cases that I examined under the
microscope.
I believe it is principally the result of dirt and filth, but is not always
so, as the Cabindas and the cleaner tribes have it, although not to
such an extent as tribes like the Mushicongos, who are so much
dirtier in their habits. Europeans are almost sure to have it after
some years’ residence in the country, and I have known this to be
the case with some who were scrupulously clean in their persons
and habits. It readily gives way to sulphur ointment, and the blacks
have no native remedy so efficacious as this, which is therefore often
asked for by them.
I remember, on my first arrival in Africa, witnessing a little episode
that produced some impression on my then inexperienced mind. I
saw one morning, from my window at Bembe, a black woman and a
little girl go out into the enclosure at the back of my neighbour’s
house, both carrying kitchen pots and pans, plates, and cups and
saucers, which they placed ready for washing up on the usual
“tarimba,” a kind of table or framework of sticks on four uprights, to
be seen in every yard for this purpose. Before going on with her
work, however, the woman stripped the child naked, and proceeded
with both hands to rub her little body all over with sulphur ointment,
she being covered from head to foot with this “sarna.” When she had
thoroughly rubbed in the ointment to her satisfaction, she
deliberately, without even so much as wiping her hands on a rag,
poured some water into a frying-pan and cleaned it with her hands;
she did the same with the rest of the pans and crockery, and left
them to drain on the “tarimba” ready for preparing her master’s
breakfast!
I afterwards, in the course of time, had any little squeamishness or
prejudices that I had brought with me from England rubbed off by
other instances of similar insignificant negligences on the part of the
black cooks in Africa. I once found a fine cutting of a big-toe nail on a
beefsteak; another time, a round head with a beak and large eyes,
and a body of an indistinct and cloudy nature, in a rice-pudding, from
a half-hatched egg having been stirred into it in its manufacture; and
in a roast fowl I was disappointed in cutting open what I fondly
thought was its stuffed breast, to find that it was the poor hen’s crop,
full of indian-corn, cockroaches, and a fine centipede. I also, as I
have said before, once saw my cook at Ambriz making some
forcemeat-balls quite round and smooth by rolling them with the
palm of his hand on his naked stomach!
Another skin disease, principally attacking children, and said to be
very contagious, appears in the form of little bladders filled with
water. The treatment for this disease is to touch the vesicles with
caustic, when they soon heal; but the natives adopt a barbarous and
painful process, which is to rub them off with a rough indian-corn cob
and sand and water, and then cover the raw places with powdered
malachite and lime-juice. When at Bembe, my wife was horrified at
finding two or three women busily engaged in the cure of this
complaint on a child near a very pretty pool of water, to which we
had gone to collect butterflies; but instead of using a corn cob, they
were actually scraping the poor, yelling little unfortunate’s sores with
a piece of sharp potsherd! It is, however, satisfactory to know that
the treatment, although cruel, is efficacious.
The purgatives made use of by the negroes are the castor-oil
seeds ground and mixed with a little water, and the juice of the plant
bearing the physic-nut (Jatropha curcas). This is collected on a leaf
from a cut made in the stem of the plant, and at once swallowed;—
from five to ten drops appear to be a dose.
Epsom-salts are a very favourite medicine of the blacks living with
the white men near the coast, and I have seen them take a great
mugful of a strong solution of this salt without making a wry face.
They are also very fond of being cupped for any pain, and it is rare to
see a man or woman whose back or shoulders do not bear signs of
this operation.
Bleeding seems to suit the negro constitution admirably, and the
Bunda-speaking natives are very skilful in the use of the lancet, often
with dreadfully blunt instruments.
One of the natives in my service at Cambambe was a capital hand
at bleeding, but his lancet was in such shocking condition, that I took
some pains to sharpen it properly on a hone: the first time he used it
afterwards, he nearly killed the man he operated upon, for,
accustomed to find considerable resistance to its blunt point, he
applied the same force to it when sharpened. He told me
confidentially that he was much obliged to me for “fetishing” the
lancet, as he was sure I had not made it so sharp by merely grinding
on a stone, and he also told me that no blood-letter would be able to
compete with him.
For swellings in the feet, &c., they are fond of making a number of
little incisions in the skin with a razor or common knife, and I have
often lent them my sharp penknife for this purpose.
For inflammation of the bowels, colic, or other violent pains, great
use is made of the fresh leaves of the tobacco plant, applied as
gathered to the abdomen, or better still, after dipping in boiling water.
They are also chopped up and made into a poultice with castor-oil. I
have heard such wonderful accounts of the efficacy of this remedy in
those cases, both from the natives and Portuguese who have used
it, that I hope some of my medical readers may be induced to give it
a trial, which could easily be done even here, where tobacco is now
so generally grown out of doors as an ornamental plant in our
gardens.
The leaves of the castor-oil plant are also employed in the same
manner, but are said not to be so efficacious.
A short, broad-leaved grass covered with hairs, exuding a sticky
gum, and with a resinous smell, grows in the interior, and when very
tired the natives drink an infusion of it, which they say acts with great
benefit.
There are a variety of other plants employed by the natives in the
cure of various complaints, but of their positive efficacy I can only
speak in two cases. One is a shrub with a very peculiar leaf, but
which unfortunately I did not observe in flower, and therefore did not
collect a specimen, so that I cannot ascertain its botanical name.
About Benguella its name is “Mboi.” The root is sliced, and the
decoction employed to rinse the mouth in scurvy.
A Portuguese trader at Novo Redondo first told me of this plant,
and that it had quickly cured him of a dreadfully ulcerated mouth
from scurvy, after every other remedy he had had from the druggists
at Loanda had failed. On arriving at Egito I found my friend the
“chefe” there also suffering from a very bad mouth. I went into the
bush in search of this plant, and obtained a bundle of the roots for
him; a few days after, I had the satisfaction of receiving a letter telling
me it had cured him perfectly.
Another remedy for stomach and liver complaints, from which I
have seen great benefit derived by the Portuguese who have used it,
is the root of a creeper bearing very pretty small white flowers
(Boerhaavia sp.), and growing most abundantly everywhere in
Angola.
A clerk of mine at Ambriz, who complained of pain in his stomach,
and who was in ill health for several months, notwithstanding the
doctor’s care, was quite cured in a short time by the use of the
decoction of this root. I gave it to him, having seen its good results in
several cases at Benguella.
Singularly enough, there is very little rheumatism amongst the
natives of Angola. Europeans also suffer but little from this
complaint; but a few years ago an epidemic of a kind of rheumatic
fever attacked the natives and nearly every white at Loanda and its
neighbourhood. It was like a simple fever, but accompanied with
sudden pain in every joint, rendering the slightest movement almost
impossible. This lasted only a few days, and the patients gradually
got well. If I remember right, there was no fatal termination to any
case among the Europeans. This disease is known in Angola by the
name of “Católo-tólo,” and nearly forty years had elapsed since its
previous appearance at Loanda.
Leeches are extremely abundant in the fresh-water lagoons of
Angola, and are much used by the Portuguese.
In former days, when there was more intercourse between Angola
and the Brazils, leeches were an important article of export, as they
fetched a high price in the latter country. I have often bought a large
clay-pot full of fine leeches for a few fathoms of cotton cloth.
The acrid, milky juice of the euphorbias is very dangerous to the
eyes if it should drop into them, no uncommon circumstance in
clearing away bush, &c. As a remedy the natives employ the juice of
the Sanseviera Angolensis, Welw. I imagine that any good effect of
this plant in such cases is more mechanical than otherwise, as it is
so full of watery juice that, by simply twisting the rod-like leaves,
abundance of it immediately squirts out.
CHAPTER X.
CUSTOMS—BURIAL—WHITE ANT—WASPS—
FRUITS—SCENTS—SPITTING-SNAKE—
SCARABÆUS—LEMUR.

There are several peculiar habits and customs, common to the


natives of Angola, that I have not mentioned in the preceding
chapters. One of the most striking and pleasing is their regard for
their parents and old people. These are always consulted before
they undertake a journey, or hire themselves as carriers or for other
service, and they always bid them good-bye, and leave them some
little present of beads or rum. On returning to their towns they
immediately see their fathers and mothers and the old people, and
squat down and “beat hands” to them, and give an account of their
doings. A little food is then eaten together, and they consider that
they have done their duty. Neither the men nor women will smoke
whilst speaking to their old people, but always take their pipes out of
their mouths, or, if their hands are engaged, hold the pipe-stem
across their teeth. Other marks of respect always practised to their
old men, to their kings, and to white men, are, when passing
between or close to them, to bend their bodies slightly and snap their
fingers: if they meet them on the road, they will stand aside without
moving, till they have passed, and if carrying a load on the head,
always remove it to the shoulder, or lift it above the head on both
hands. A gun is never carried on the shoulder in similar cases, but
always in the hand, horizontally at the side.
Smoking is universal, but although they are very fond of the habit,
and the plant grows luxuriantly and without any trouble, tobacco is
comparatively dear in all parts of Angola. It is a very usual thing to
see a native put a great piece of lighted charcoal in his empty pipe-
bowl, and puff away, as he says, to warm himself. They generally
carry the bits of plaited tobacco behind the ear. Tobacco is always
smoked pure. Only amongst the Mushicongos have I seen them put
small chips of a sweet-smelling root (probably a species of orris) in
their pipes with the tobacco, to give a flavour to the smoke. This root
they call “Ncombo” or “goat,” its beautiful scent being compared by
the natives to that of a billy-goat!
Snuff-taking is also very general, the Mushicongos and the natives
of the Zombo country beyond, who bring down the ivory to the coast,
being the tribes most addicted to the habit. The tobacco leaf is well
dried over a fire, and ground on a stone, when it is ready for use, but
the above-mentioned tribes are not satisfied with it in its pure
condition, and, to make it stronger, mix it with a white ash obtained
by burning the twigs of a bush which appears to be very alkaline.
This even is not sufficiently strong for many of their delicate noses,
and dried ground Chili (cayenne) pepper is also added to obtain the
degree of strength desired.
Their snuff-box is generally a length of cane between two knots,
the open end being closed by a small wooden stopper, secured to
the snuff-box by a bit of string passing through a hole in the centre.
Snuff-boxes are also carved out of wood, and variously ornamented.
The ordinary way of taking a pinch of snuff, between the forefinger
and thumb, is unknown to the blacks, and would be considered a
very unsatisfactory method. They pour about a teaspoonful of snuff
into the palm of the hand, and burying their wide and capacious
nostrils in the peppery mixture, snort it up loudly, aided by a rotary
motion of the half closed hand.
Many allow a scrubby, woolly moustache to grow for the sole
purpose of plastering it thickly with snuff, so that when on a journey
and carrying a load, they can take it by simply curling up the upper
lip and sniffing strongly, without stopping or laying down the load to
open the box and take it in the ordinary way.
Neither infanticide nor abortion are practised in Angola; on the
contrary, it is considered a misfortune not to have children, and their
marriages may be dissolved if they prove barren.
The Mundombes have a curious custom in connection with this
desire for children. A banana-tree is planted on the day of their
marriage, and if on its producing its first bunch of fruit, which is
generally in nine or ten months after, a child should not have been
born, the contract is considered void, and they may marry again.
The common way amongst blacks to assert the truth of a
statement, is to go on their knees and rub the forefinger of each
hand on the ground, and then touch their tongues and forehead with
the dusty tips; this is equivalent to an oath. About Loanda they make
the sign of the cross on the ground with a finger, for the same
purpose, and this is evidently derived from some old custom
introduced by the former missionaries.
Some of the actions of the blacks are exactly the same as those
performed by monkeys. In using their hands and fingers to clean or
polish a piece of brass work, for instance, the feeble and nerveless
manner of holding the bit of oiled rag, and the whole action of the
hand and arm, is strikingly like that of a monkey when it rubs its
hands on the ground when they are sticky or dirty. Their manner of
sliding their hands up and down on the edge of a door or on a door-
post, or along the edges of a table whilst waiting or speaking, is very
monkey-like, and no black—man, woman, or child—ever goes along
a corridor or narrow passage without rubbing both hands on the
walls.
Blacks, especially women, have a singular way of carrying any
object in the hand, which always appeared to me to be very
uncomfortable. A plate or glass, for instance, is invariably carried as
in Plate XIV., the hand being thrown back and the object taken on
the flat, extended palm. The greater flexibility of the joints in the
negro race may have something to do with this, as also with the fact
of their squatting on their heels, but with their knees not touching the
ground, for a considerable length of time, and then getting up
apparently without the slightest stiffness from what would be to most
of us a very uncomfortable position.
Blacks have an odd habit, when they feel cold, of placing their
hands on their shoulders, not with their arms crossed, as would be

You might also like