Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# OS specific files
.DS_Store
Thumbs.db

# Editor directories and files
.idea/
.vscode/
*.swp
*.swo
*~
.project
.settings/

# Backup files
*.bak
*.backup
*~

# Log files
*.log

# Temporary files
*.tmp
*.temp

# SQL Server specific
*.mdf
*.ldf
*.ndf

# Documentation build files
docs/_build/
docs/.doctrees/

# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
venv/
env/

# Node.js
node_modules/
npm-debug.log*
92 changes: 64 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,72 @@
# Инфо о репозитории
# SQL Server Scripts Repository

Репозиторий содержит полезные скрипты для анализа, разработки и обслуживания информационных систем на Microsoft SQL Server.

| № | Раздел | Описание |
| - | ------ | -------- |
| 1 | [Common-Info](SQL-Server-Common-Info) | Cкрипты общего назначения для просмотра состояния и настроек инстанса и др |
| 2 | [Data-Model-Info](SQL-Server-Data-Model-Info) | Просмотр модели данных и других связанных объектов |
| 3 | [Databases-Info](SQL-Server-Databases-Info) | Информация о базах данных |
| 4 | [Statistics](SQL-Server-Statistics) | Информация об статистиках, вопросах производительности и их анализе |
| 5 | [Indexes](SQL-Server-Indexes) | Информация об индексах, вопросах производительности и их анализе |
| 6 | [File-Groups](SQL-Server-File-Groups) | Информация о файловых группах |
| 7 | [Partitioned-Tables-and-Indexes](SQL-Server-Partitioned-Tables-and-Indexes) | Секционирование таблиц и индексов |
| 8 | [Perfomance](SQL-Server-Perfomance) | Производительность и оптимизация запросов, настроек сервера и поиск узких мест |
| 9 | [Backup-Info](SQL-Server-Backup-Info) | Резервное копирование и восстановление данных |
| 10 | [Maintenance](SQL-Server-Maintenance) | Обслуживание баз данных и сервера |
| 11 | [1С-Extended-Settings](1С-Extended-Database-Settings-Maintenance) | Инструмент для поддержки произвольных индексов, изменение существующих объектов, сжатия таблиц и индексов, файловых групп и прочего для баз 1С:Предприятия |
| 12 | [BCP](SQL-Server-BCP) | Работа с утилитой Bulk Insert Programm (BCP) |
| 13 | [AlwaysOn](SQL-Server-AlwaysOn) | О работе с группами высокой доступности AlwaysOn, настройке WSFC и др. |
| 14 | [Diagnostics](SQL-Server-Diagnostics) | Диагностика работы SQL Server |
| 15 | [FullText-Search](SQL-Server-FullText-Search) | Полнотекстовый поиск и все что с ним связано |

# Полезные ссылки:

* [MS SQL Server](https://docs.microsoft.com/ru-ru/sql/) - вся оффициальная информация о СУБД MS SQL Server
## Repository Structure

The repository has been restructured to support modular development with clear separation of concerns:

- **[src/](src/)** - All SQL scripts and modules
- **[docs/](docs/)** - High-level documentation, guides, and tutorials
- **[tools/](tools/)** - Helper scripts and utilities

## Available Modules

| № | Module | Description |
| - | ------ | ----------- |
| 1 | [common-info](src/common-info) | Скрипты общего назначения для просмотра состояния и настроек инстанса |
| 2 | [data-model-info](src/data-model-info) | Просмотр модели данных и других связанных объектов |
| 3 | [databases-info](src/databases-info) | Информация о базах данных |
| 4 | [statistics](src/statistics) | Информация об статистиках, вопросах производительности и их анализе |
| 5 | [indexes](src/indexes) | Информация об индексах, вопросах производительности и их анализе |
| 6 | [file-groups](src/file-groups) | Информация о файловых группах |
| 7 | [partitioned-tables-indexes](src/partitioned-tables-indexes) | Секционирование таблиц и индексов |
| 8 | [performance](src/performance) | Производительность и оптимизация запросов, настроек сервера и поиск узких мест |
| 9 | [backup-info](src/backup-info) | Резервное копирование и восстановление данных |
| 10 | [maintenance](src/maintenance) | Обслуживание баз данных и сервера |
| 11 | [oneC-extended-settings](src/oneC-extended-settings) | Инструмент для поддержки произвольных индексов, изменение существующих объектов, сжатия таблиц и индексов для баз 1С:Предприятия |
| 12 | [bcp](src/bcp) | Работа с утилитой Bulk Insert Program (BCP) |
| 13 | [alwayson](src/alwayson) | О работе с группами высокой доступности AlwaysOn, настройке WSFC |
| 14 | [diagnostics](src/diagnostics) | Диагностика работы SQL Server |
| 15 | [fulltext-search](src/fulltext-search) | Полнотекстовый поиск и все что с ним связано |
| 16 | [replication](src/replication) | Репликация данных в SQL Server |

## Getting Started

1. Browse the [src/](src/) directory to find scripts relevant to your needs
2. Check the [docs/](docs/) directory for detailed documentation and guides
3. Use [tools/](tools/) for helper scripts and utilities

## Module Navigation

Each module contains T-SQL scripts for specific SQL Server functionality:

- **common-info** - Server instance information, active connections, and general settings
- **data-model-info** - Schema information, dependencies, tables, views, and stored procedures
- **databases-info** - Database configuration and properties
- **statistics** - Statistics management and analysis
- **indexes** - Index maintenance, fragmentation analysis, and optimization
- **file-groups** - File group management and optimization
- **partitioned-tables-indexes** - Table and index partitioning
- **performance** - Query performance tuning, CPU/IO analysis, and wait statistics
- **backup-info** - Backup history and configuration
- **maintenance** - Database maintenance plans and jobs
- **oneC-extended-settings** - Custom tools for 1C:Enterprise database extensions
- **bcp** - Bulk Copy Program utilities
- **alwayson** - High availability and disaster recovery
- **diagnostics** - Extended Events, Performance Counters, and diagnostics
- **fulltext-search** - Full-text search configuration and maintenance
- **replication** - Replication monitoring and management

# Полезные ссылки

* [MS SQL Server](https://docs.microsoft.com/ru-ru/sql/) - вся официальная информация о СУБД MS SQL Server
* [Tigertoolbox](https://github.com/Microsoft/tigertoolbox) - репозиторий с полезными инструментами от Tiger Team ([MSSQL Tiger Team](https://blogs.msdn.microsoft.com/sql_server_team/))
* [SQL-Server-First-Responder-Kit](https://github.com/BrentOzarULTD/SQL-Server-First-Responder-Kit) - скрипты и другая полезная информация от великого и ужасного (в хорошем смысле!) [Brent Ozar](https://github.com/BrentOzar) и [его команды](https://github.com/BrentOzarULTD)
* [Exploring Your SQL Server Databases with T-SQL](https://www.red-gate.com/simple-talk/sql/database-administration/exploring-your-sql-server-databases-with-t-sql/) - статья о исследование сервера MS SQL Server с помощью T-SQL ([Scott Swanberg](https://www.red-gate.com/simple-talk/author/scott-swanberg/))
* [Утки, Таиланд и T-SQL… или что может подстерегать программистов при работе с SQL Server?](https://habrahabr.ru/post/315142/)
-- все что нужно знать о странностях MS SQL Server ([Sergey Syrovatchenko](https://habrahabr.ru/users/AlanDenton/))
* [Useful links, scripts, tools and best practice for Microsoft SQL Server Database](https://github.com/ktaranov/sqlserver-kit) - полезные материалы из разряда "best practice" для MS SQL Server ([Konstantin
Ktaranov](https://github.com/ktaranov))
* [Статистика ожиданий SQL Server'а или пожалуйста, скажите мне, где болит](https://habrahabr.ru/post/216309/) -- Интересная информация об ожиданиях MS SQL Server ([Алексей Бородин](https://habrahabr.ru/users/minamoto/))
* [Утки, Таиланд и T-SQL… или что может подстерегать программистов при работе с SQL Server?](https://habrahabr.ru/post/315142/) - все что нужно знать о странностях MS SQL Server ([Sergey Syrovatchenko](https://habrahabr.ru/users/AlanDenton/))
* [Useful links, scripts, tools and best practice for Microsoft SQL Server Database](https://github.com/ktaranov/sqlserver-kit) - полезные материалы из разряда "best practice" для MS SQL Server ([Konstantin Ktaranov](https://github.com/ktaranov))
* [Статистика ожиданий SQL Server'а или пожалуйста, скажите мне, где болит](https://habrahabr.ru/post/216309/) - Интересная информация об ожиданиях MS SQL Server ([Алексей Бородин](https://habrahabr.ru/users/minamoto/))
* [Улучшения tempdb в SQL Server 2016](http://sqlcom.ru/dba-tools/tempdb-in-sql-server-2016/) - Информация по оптимизации базы TempDB и мониторинга проблем с ней ([Зайцев Дмитрий](http://sqlcom.ru/author/sqlcom/))
* [Оптимизация временной БД (tempdb)](https://minyurov.com/2016/07/24/mssql-tempdb-opt/) - Дополнительные сведения по оптимизации базы TempDB ([Сергей Минюров](https://minyurov.com/author/minyurov/))
* [Стандарт оформления T-SQL](https://github.com/lestatkim/opensql/blob/master/tsql_standart.md) - Оформление кода T-SQL ([Lestat Kim](https://github.com/lestatkim))
Expand All @@ -44,7 +80,7 @@ Ktaranov](https://github.com/ktaranov))
* [Как разбить базу на файлы и не сойти с ума](https://infostart.ru/public/1039011/) - Описание разбиения базы данных на отдельные файлы с помощью файловых групп и нюансы для баз 1С. ([Permitin Yury](https://github.com/YPermitin))
* [Самый быстрый шринк на Диком Западе](https://infostart.ru/public/1031815/) - о шринке баз данных и связанная полезная информация.

# Информация о производительности:
# Информация о производительности

* [Мониторинг Microsoft SQL Server «на коленке»](https://habrahabr.ru/post/317426/) - пример решения, когда мониторинг SQL Server'а нужно настроить еще вчера. ([IndiraGandhi](https://habrahabr.ru/users/IndiraGandhi/))
* [Высокая нагрузка дисковой подсистемы на сервере СУБД MS SQL Server](https://its.1c.ru/db/metod8dev#content:5813:hdoc)
Expand Down
107 changes: 107 additions & 0 deletions docs/MIGRATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Repository Restructuring - Migration Guide

## Overview

The repository has been restructured to support modular development and clearer separation of concerns. This document describes the changes and provides a migration guide.

## What Changed

### Directory Structure

The repository has been reorganized from a flat structure with prefixed directories to a hierarchical structure under `src/`:

**Before:**
```
SQL-Server-Common-Info/
SQL-Server-Data-Model-Info/
SQL-Server-Databases-Info/
SQL-Server-Statistics/
SQL-Server-Indexes/
SQL-Server-Perfomance/
...
```

**After:**
```
src/
├── common-info/
├── data-model-info/
├── databases-info/
├── statistics/
├── indexes/
├── performance/
└── ...
docs/
tools/
```

### Directory Name Mapping

| Old Name | New Name |
|----------|----------|
| `SQL-Server-Common-Info` | `src/common-info` |
| `SQL-Server-Data-Model-Info` | `src/data-model-info` |
| `SQL-Server-Databases-Info` | `src/databases-info` |
| `SQL-Server-Statistics` | `src/statistics` |
| `SQL-Server-Indexes` | `src/indexes` |
| `SQL-Server-File-Groups` | `src/file-groups` |
| `SQL-Server-Partitioned-Tables-and-Indexes` | `src/partitioned-tables-indexes` |
| `SQL-Server-Perfomance` | `src/performance` (typo fixed) |
| `SQL-Server-Backup-Info` | `src/backup-info` |
| `SQL-Server-Maintenance` | `src/maintenance` |
| `1С-Extended-Database-Settings-Maintenance` | `src/oneC-extended-settings` |
| `SQL-Server-BCP` | `src/bcp` |
| `SQL-Server-AlwaysOn` | `src/alwayson` |
| `SQL-Server-Diagnostics` | `src/diagnostics` |
| `SQL-Server-FullText-Search` | `src/fulltext-search` |
| `SQL-Server-Replication` | `src/replication` |

### New Directories

- **`docs/`** - High-level documentation, guides, and tutorials
- **`tools/`** - Helper scripts and utilities
- **`src/`** - All SQL scripts organized by module

### Files Added

- `.gitignore` - Standard ignore patterns for the repository
- `README.md` files in each module directory for better documentation
- `docs/README.md` - Documentation directory overview
- `tools/README.md` - Tools directory overview

## Benefits

1. **Clearer Organization**: All SQL scripts are now under `src/` with consistent naming
2. **ASCII-only Names**: Directory names no longer contain non-ASCII characters
3. **Modular Structure**: Each module is self-contained with its own documentation
4. **Separation of Concerns**: Code, documentation, and tools are clearly separated
5. **Fixed Typo**: "Perfomance" corrected to "performance"
6. **Better Navigation**: README files at multiple levels help users find what they need

## File History

All files were moved using `git mv` to preserve file history. You can still view the full history of any file using:

```bash
git log --follow -- src/performance/file.sql
```

## Impact on References

- Update any bookmarks or documentation that referenced old paths
- Scripts should continue to work as-is (they contain SQL, not file paths)
- External documentation may need path updates

## Verification

Total files preserved:
- **102 SQL files** - All scripts migrated successfully
- **200+ total files** - Including documentation, images, and other resources
- **25 README files** - Documentation at various levels

## Questions?

If you have questions about the new structure, please refer to:
- [Main README](../README.md) - Overview of the repository
- [Source README](../src/README.md) - Overview of all modules
- Individual module READMEs - Specific module documentation
12 changes: 12 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Documentation

This directory contains high-level documentation for the SQL Server scripts repository.

## Contents

- User guides
- Architecture documentation
- Best practices
- Tutorials

To contribute documentation, please add Markdown files to this directory.
110 changes: 110 additions & 0 deletions docs/STRUCTURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# Repository Structure Reference

## Quick Navigation

This document provides a quick reference to the repository structure and what you'll find in each module.

## Root Directory

```
.
├── .gitignore # Git ignore patterns
├── LICENSE # Repository license
├── README.md # Main documentation
├── docs/ # Documentation directory
│ ├── README.md # Documentation overview
│ ├── MIGRATION.md # Migration guide from old structure
│ └── STRUCTURE.md # This file
├── src/ # All SQL scripts organized by module
│ └── [modules] # See modules section below
└── tools/ # Helper scripts and utilities
└── README.md # Tools overview
```

## Source Modules (`src/`)

### Core Information
- **common-info/** - General server and instance information
- Server configuration, connections, uptime, linked servers

- **databases-info/** - Database-specific information
- Database files, properties, size, configuration

- **data-model-info/** - Data model and schema information
- Tables, columns, dependencies, stored procedures, functions, views

### Statistics & Indexes
- **statistics/** - Statistics management
- Statistics status, incremental statistics, update scripts

- **indexes/** - Index management and optimization
- Fragmentation analysis, missing indexes, unused indexes, maintenance

### Storage Management
- **file-groups/** - File group management
- File group information and operations

- **partitioned-tables-indexes/** - Table and index partitioning
- Partitioning scripts and examples

### Performance & Diagnostics
- **performance/** - Performance tuning and optimization
- Query analysis, CPU/IO monitoring, wait statistics, cache usage

- **diagnostics/** - Diagnostics and troubleshooting
- Extended Events, Performance Counters

### Operations
- **backup-info/** - Backup and restore information
- Backup history, status, verification

- **maintenance/** - Database maintenance
- Maintenance plans, jobs, cleanup scripts

### Advanced Features
- **alwayson/** - High Availability and AlwaysOn
- AlwaysOn configuration, WSFC setup, monitoring

- **replication/** - Replication management
- Replication monitoring and configuration

- **fulltext-search/** - Full-text search
- Full-text configuration and maintenance

### Tools & Utilities
- **bcp/** - Bulk Copy Program (BCP) utilities
- Bulk import/export scripts

- **oneC-extended-settings/** - 1C:Enterprise extensions
- Custom tools for 1C:Enterprise database management
- Custom indexes, compression, file groups

## File Organization

Each module contains:
- **README.md** - Module documentation and overview
- **\*.sql** - SQL scripts (may have Cyrillic names)
- **subdirectories/** - Related sub-modules or examples
- **media/** - Images and diagrams (in some modules)

## Total Assets

- **16 modules** - Organized by functionality
- **102 SQL scripts** - Core T-SQL scripts
- **200+ files** - Including documentation, images, examples
- **25 README files** - Documentation at various levels

## Finding What You Need

1. **Start with the main README.md** - Overview and links to all modules
2. **Browse src/ modules** - Each module focuses on a specific area
3. **Check module READMEs** - Detailed information about each module's contents
4. **Use git log --follow** - View full file history including pre-restructuring

## Contributing

When adding new scripts:
1. Place them in the appropriate module directory
2. Use descriptive filenames (Russian or English)
3. Update the module's README if adding significant functionality
4. Follow existing code style and patterns
Loading